/* === Group Chat App — Admin Panel Styles === */

/* Toolbar button */
.sb-groupchat-btn {
    cursor: pointer;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: #566069;
    padding: 0 10px;
    height: 40px;
}

.sb-groupchat-btn:hover {
    color: #333;
}

.sb-groupchat-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* Participant panel (appears above editor) */
#sb-groupchat-panel {
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    padding: 10px 16px;
    font-size: 13px;
    color: #333;
    position: relative;
}

#sb-groupchat-panel.hidden {
    display: none;
}

#sb-groupchat-panel h4 {
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sb-groupchat-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    min-height: 28px;
}

.sb-groupchat-participant {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: white;
    border: 1px solid #d0d7de;
    border-radius: 16px;
    padding: 3px 10px 3px 6px;
    font-size: 12px;
    color: #333;
    white-space: nowrap;
}

.sb-groupchat-participant img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
}

.sb-groupchat-participant .sb-gc-avatar-placeholder {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0069ff;
    color: white;
    font-size: 9px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sb-groupchat-participant .sb-gc-remove {
    cursor: pointer;
    color: #999;
    font-size: 14px;
    line-height: 1;
    margin-left: 2px;
    transition: color 0.15s;
}

.sb-groupchat-participant .sb-gc-remove:hover {
    color: #e00;
}

/* Add agent dropdown */
.sb-groupchat-add-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.sb-groupchat-add-row select {
    flex: 1;
    min-width: 150px;
    max-width: 260px;
    padding: 4px 8px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-size: 12px;
    color: #333;
    background: white;
    height: 30px;
}

.sb-groupchat-add-row button {
    padding: 4px 12px;
    background: #0069ff;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    height: 30px;
    font-weight: 500;
    transition: background 0.15s;
    white-space: nowrap;
}

.sb-groupchat-add-row button:hover {
    background: #0058d6;
}

.sb-groupchat-add-row button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Group video call button */
.sb-groupchat-video-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    background: linear-gradient(135deg, #00c853 0%, #00b0ff 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    height: 30px;
    font-weight: 500;
    transition: filter 0.15s;
    white-space: nowrap;
}

.sb-groupchat-video-btn:hover {
    filter: brightness(1.1);
}

.sb-groupchat-video-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

/* No participants hint */
.sb-groupchat-empty {
    color: #999;
    font-size: 12px;
    font-style: italic;
}

/* === Group Video UI (shared with video app pattern) === */
#sb-groupchat-video {
    position: relative;
    width: 100%;
    background: #111;
    margin-bottom: 0;
    border-radius: 0;
    overflow: hidden;
    min-height: 200px;
}

#sb-groupchat-video.full-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    z-index: 99999;
    border-radius: 0;
    margin: 0;
}

.sb-gc-video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 4px;
    padding: 4px;
    min-height: 200px;
}

.sb-gc-video-tile {
    position: relative;
    background: #1a1a1a;
    aspect-ratio: 16/9;
    border-radius: 6px;
    overflow: hidden;
    min-height: 120px;
}

.sb-gc-video-tile .sb-gc-tile-label {
    position: absolute;
    bottom: 6px;
    left: 8px;
    color: white;
    font-size: 11px;
    background: rgba(0,0,0,0.5);
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 5;
}

.sb-gc-video-tile .sb-gc-tile-video {
    width: 100%;
    height: 100%;
}

.video-btn-screen {
    background: rgba(255, 255, 255, 0.2);
}

.video-btn-screen.active {
    background: #00c853;
}

.video-btn-screen.active:hover {
    background: #00a843;
}

.sb-gc-video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
    z-index: 20;
    opacity: 0;
    transition: opacity 0.3s;
}

#sb-groupchat-video:hover .sb-gc-video-controls {
    opacity: 1;
}

.sb-gc-video-loading {
    position: absolute;
    inset: 0;
    background: #111;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 13px;
    gap: 12px;
    z-index: 100;
}

.sb-gc-video-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top: 3px solid #00c853;
    border-radius: 50%;
    animation: sb-gc-spin 1s linear infinite;
}

@keyframes sb-gc-spin {
    to { transform: rotate(360deg); }
}

/* When the group panel is open, SB's typing/replying indicator floats over it
   (it uses position:absolute; top:-45px; z-index:95 relative to .sb-editor).
   Reset it to flow normally so it doesn't overlap our panel. */
#sb-groupchat-panel:not(.hidden) ~ .sb-editor .sb-labels {
    position: static !important;
    top: auto !important;
    left: auto !important;
    padding: 4px 15px 2px;
}

/* Invitation toast animations */
@keyframes sb-gc-toast-in {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes sb-gc-toast-out {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(8px) scale(0.97); }
}
