@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

:root {
    --c-primary: #ff6d48; 
    --c-primary-glow: rgba(255, 109, 72, 0.3);
    --c-bg: #09090b;
    --c-surface: #18181b;
    --c-surface-light: #27272a;
    --c-text: #fafafa; 
    --c-text-muted: #a1a1aa; 
    --c-error: #ef4444;
    --c-success: #22c55e;
    --c-border: rgba(255, 255, 255, 0.08); 
    --c-glass: rgba(255, 255, 255, 0.04);
    --c-glass-hover: rgba(255, 255, 255, 0.08);
    --c-glass-border: rgba(255, 255, 255, 0.1);
    --header-height: 56px;
    --controls-height: 72px;
    --font-main: 'Outfit', sans-serif;
    --panel-width: 280px;
    
    --shadow-heavy: rgba(0, 0, 0, 0.5);
    --shadow-medium: rgba(0, 0, 0, 0.3);
}

/* Light Mode  */
body.light-theme {
    --c-bg: #f3f4f6;
    --c-surface: #f3f4f6;
    --c-surface-light: #e5e7eb;
    --c-text: #1f2937;
    --c-border: rgba(31, 41, 55, 0.1);
    --c-glass: rgba(31, 41, 55, 0.04);
    --c-glass-hover: rgba(31, 41, 55, 0.08);
    --c-glass-border: rgba(31, 41, 55, 0.12);
    
    --shadow-heavy: rgba(0, 0, 0, 0.08);
    --shadow-medium: rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

header, .controls-bar, .participants-panel, #conference-stage, #participants-tray, .participant-node, .participant-card, .reactions-picker {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

html, body {
    font-family: var(--font-main);
    background-color: var(--c-bg);
    color: var(--c-text);
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    width: 100vw;
    overflow: hidden;
}

/*CONFERENCE VIEW WRAPPER*/
#conference-view {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    width: 100vw;
    overflow: hidden;
}

/*LOBBY*/
#lobby {
    position: fixed;
    inset: 0;
    background: var(--c-bg);
    z-index: 900;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
}

.bg-slideshow {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.bg-slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
    z-index: 1;
}

.bg-slide.active {
    opacity: 1;
}

.bg-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.15);
    z-index: 2;
}

.lobby-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
    max-width: 900px;
    z-index: 10;
    position: relative;
    animation: lobbyEntrance 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    margin: auto;
}

.lobby-branding {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.lobby-main-logo {
    height: 44px;
    width: auto;
}

.lobby-content-box {
    width: 100%;
    background: var(--c-glass);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid var(--c-glass-border);
    border-radius: 32px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: 
        0 30px 100px rgba(0, 0, 0, 0.4),
        inset 0 0 0 1px var(--c-glass-border);
}

.lobby-cards-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

@media (min-width: 1024px) {
    #lobby {
        padding: 0;
        justify-content: center;
    }
    
    .lobby-wrapper {
        margin: auto;
    }

    .lobby-content-box {
        padding: 2rem;
        border-radius: 32px;
    }

    .lobby-cards-container {
        flex-direction: row;
        gap: 1.5rem;
        align-items: stretch;
    }
    
    .lobby-controls-card {
        padding: 1.5rem;
        gap: 1.25rem;
        flex: 1 1 0;
        width: 0;
    }

    .lobby-event-title {
        font-size: 2rem;
    }

    .lobby-meta-info {
        gap: 0.6rem;
    }
    
    .lobby-right-column {
        flex: 1.4 1 0;
        width: 0;
        gap: 1.25rem;
    }
    
    .lobby-preview-card {
        flex: 1 1 0;
        height: auto;
        min-height: 220px;
    }
}

.lobby-right-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

/* Preview Card */
.lobby-preview-card {
    background: var(--c-surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--c-glass-border);
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 25px 50px -12px var(--shadow-heavy);
    aspect-ratio: 16 / 9;
    min-height: 200px;
    width: 100%;
}

.lobby-preview-card video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    z-index: 2;
}

.lobby-avatar-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    z-index: 1;
}

.lobby-avatar-circle {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--c-primary), #ff8a6c);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    box-shadow: 0 12px 32px rgba(255, 109, 72, 0.4);
}

.lobby-cam-label {
    color: var(--c-text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px 12px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

/* Controls Card */
.lobby-controls-card {
    background: var(--c-surface);
    backdrop-filter: blur(20px);
    border: 1px solid var(--c-glass-border);
    border-radius: 24px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 25px 50px -12px var(--shadow-heavy);
    color: var(--c-text);
}

.lobby-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 109, 72, 0.15);
    border: 1px solid rgba(255, 109, 72, 0.4);
    color: #ff6d48;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    width: fit-content;
}

.lobby-event-title {
    font-size: 1.75rem;
    font-weight: 900;
    color: var(--c-text);
    line-height: 1.1;
    margin: 0;
}

.lobby-meta-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lobby-meta-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 0.95rem;
    color: var(--c-text-muted);
}

.lobby-meta-row svg {
    width: 16px;
    height: 16px;
    color: var(--c-text-muted);
}

.lobby-meta-row strong {
    color: var(--c-text);
    font-weight: 700;
}


/* Participant avatars row */
.lobby-participants-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

.lobby-avatars {
    display: flex;
}

.lobby-avatars .lobby-mini-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
    margin-left: -6px;
    border: 2px solid var(--c-surface);
}

.lobby-avatars .lobby-mini-avatar:first-child {
    margin-left: 0;
}

.lobby-in-call-text {
    font-size: 0.75rem;
    color: var(--c-text-muted);
}

/* Name row */
.lobby-name-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: var(--c-surface-light);
    border-radius: 10px;
    border: 1px solid var(--c-border);
}

.lobby-name-row svg {
    width: 16px;
    height: 16px;
    color: var(--c-text-muted);
    flex-shrink: 0;
}

.selector-label {
    display: block;
    margin-bottom: 0.8rem;
    font-size: 0.85rem;
    color: var(--c-text-muted);
    font-weight: 500;
}

/* Virtual Background Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: var(--c-surface);
    border: 1px solid var(--c-glass-border);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    padding: 2rem;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.modal-header h2 {
    font-size: 1.25rem;
    margin: 0;
}

.modal-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--c-text);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.vb-modal-content {
    max-width: 900px;
    width: 95%;
}

.vb-modal-body {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.vb-modal-left {
    flex: 1 1 0;
    width: 100%;
}

#vb-modal-preview-zone .participant-node {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    min-height: 250px;
    border-radius: 24px;
    background: var(--c-surface);
    box-shadow: 0 25px 50px -12px var(--shadow-heavy);
    border: 1px solid var(--c-glass-border);
}

.vb-modal-right {
    flex: 1 1 0;
    width: 100%;
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .vb-modal-body {
        flex-direction: row;
    }
}



.lobby-name-field {
    font-size: 0.85rem;
    color: var(--c-text);
    font-weight: 500;
}

/* Toggle rows */
.lobby-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0;
}

.lobby-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: var(--c-text);
}

.lobby-toggle-label svg {
    width: 16px;
    height: 16px;
    color: var(--c-text-muted);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--c-surface-light);
    border: 1px solid var(--c-border);
    border-radius: 24px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--c-primary);
    border-color: var(--c-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* Join Button */
.lobby-join-btn {
    width: 100%;
    padding: 0.85rem 1.5rem;
    background: var(--c-primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 6px 20px var(--c-primary-glow);
    margin-top: 0.25rem;
}

.lobby-join-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px var(--c-primary-glow);
}

.lobby-join-btn:active {
    transform: translateY(0);
}

/*HEADER*/
header {
    height: var(--header-height);
    background: var(--c-bg);
    border-top: 3px solid #5a1ec0; 
    border-bottom: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 100;
}

.header-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding-left: 1rem; 
}

#header-conf-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--c-text);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#header-conf-time {
    font-size: 0.75rem;
    color: #64748b;
    margin: 0;
    margin-top: 1px;
}

.header-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 0 1rem;
    min-width: 200px; 
}

/* Avatar Stack */
.header-avatars {
    display: flex;
    align-items: center;
}

.avatar-stack {
    display: flex;
    align-items: center;
}

.avatar-stack-item {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--c-bg);
    margin-left: -10px;
    background: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
    overflow: hidden;
}

.avatar-stack-item:first-child {
    margin-left: 0;
}

.avatar-stack-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-stack-more {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--c-glass);
    border: 2px solid var(--c-bg);
    margin-left: -10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
}

/* Meeting ID Pill */
.meeting-id-pill {
    background: var(--c-glass);
    padding: 5px 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--c-glass-border);
}

.meeting-id-pill svg {
    width: 14px;
    height: 14px;
    color: #94a3b8;
}

.pill-divider {
    width: 1px;
    height: 14px;
    background: var(--c-glass-border);
}

#header-meeting-id {
    font-family: inherit;
    font-size: 0.8rem;
    color: #cbd5e1;
    letter-spacing: 0.02em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

/* User Card */
.user-profile-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--c-glass);
    padding: 3px 12px 3px 3px;
    border-radius: 20px;
    border: 1px solid var(--c-glass-border);
}

.user-avatar-small {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--c-primary), #ff8a6c);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    overflow: hidden;
}

.user-avatar-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info-small {
    display: flex;
    flex-direction: column;
}

.user-name-small {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--c-text);
    line-height: 1.2;
}

.user-role-small {
    font-size: 0.6rem;
    color: #64748b;
}

.header-icon-btn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.header-icon-btn:hover {
    background: var(--c-glass-hover);
    color: var(--c-text);
}

.header-icon-btn svg {
    width: 18px;
    height: 18px;
}

.header-icon-btn {
    position: relative;
}

.chat-unread-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--c-primary);
    color: white;
    font-size: 0.6rem;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    pointer-events: none;
    animation: badgePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 2px 6px rgba(255, 109, 72, 0.4);
}

@keyframes badgePop {
    0% { transform: scale(0); }
    80% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@media (max-width: 768px) {
    #header-conf-time {
        display: none;
    }
    
    .header-center {
        display: none;
    }
    
    .user-info-small {
        display: none; 
    }
    
    .user-profile-card {
        padding: 3px;
    }
    
    header {
        padding: 0 1rem;
    }
    
    #header-conf-title {
        font-size: 0.95rem;
        white-space: normal;
    }
}

/*MAIN BODY*/
.conference-body {
    flex: 1;
    display: flex;
    min-height: 0;             
    overflow: hidden;
}

#conference-stage {
    flex: 1;
    min-width: 0;
    padding: 0; /* we'll use inset for positioning */
    display: block;
    position: relative;
    overflow: hidden;
}

#video-stage {
    position: absolute;
    inset: 1.5rem 280px; /* leaves exactly 280px from edges */
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 0;
    border-radius: 16px;
    overflow: hidden;
    transition: inset 0.3s ease;
}

#video-stage .participant-node {
    width: 100%;
    height: 100%;
    border-radius: 16px;
    background: var(--c-surface);
    box-shadow: 0 12px 40px var(--shadow-medium);
    border: 1px solid var(--c-border);
}

#participants-tray {
    position: absolute;
    inset: 1.5rem;
    width: auto;
    height: auto;
    z-index: 10;
    pointer-events: none;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}

#participants-tray::-webkit-scrollbar {
    display: none;
}

#tray-inner {
    display: grid;
    grid-template-columns: 240px 240px; /* 2 columns exactly card width */
    justify-content: space-between;
    align-content: start;
    gap: 1rem;
    width: 100%;
    min-height: 100%;
    pointer-events: none;
}

#tray-inner .participant-node {
    pointer-events: auto;
    width: 240px;
    height: 160px;
    flex-shrink: 0;
    border-radius: 12px;
    background: var(--c-surface);
    box-shadow: 0 10px 30px var(--shadow-medium);
    border: 1px solid var(--c-glass-border);
    cursor: grab;
}

#tray-inner .participant-node:active {
    cursor: grabbing;
    box-shadow: 0 15px 40px var(--shadow-heavy);
}

.audio-status-indicator {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 28px;
    height: 28px;
    background: rgba(34, 197, 94, 0.15);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--c-success);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 15;
    pointer-events: none; /* Let the card handle the grab */
}

.audio-status-indicator.muted {
    background: rgba(239, 68, 68, 0.2);
    color: var(--c-error);
    border-color: rgba(239, 68, 68, 0.4);
}

.audio-status-indicator svg {
    width: 14px;
    height: 14px;
}

.participant-node {
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    border: 2px solid transparent;
    min-height: 0;
}

.participant-node.speaking {
    border-color: var(--c-primary);
    box-shadow: 0 0 16px var(--c-primary-glow);
}

.video-wrapper {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.avatar-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, var(--c-surface-light), var(--c-bg));
    z-index: 1;
}

.avatar-initials {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--c-primary), #ff8a6c);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 700;
    box-shadow: 0 6px 20px rgba(255, 109, 72, 0.25);
}

.avatar-img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--c-glass-border);
}

.video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
    position: relative;
}

.participant-node.is-sharing-screen .video-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.participant-node.is-sharing-screen .video-wrapper .screen-share-video {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    z-index: 3;
    background: #000;
}

.participant-node.is-sharing-screen .video-wrapper .camera-video,
.participant-node.is-sharing-screen .video-wrapper .avatar-placeholder {
    display: none !important;
}

.participant-label {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(9, 9, 11, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid var(--c-glass-border);
    color: white;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 10;
}

.host-badge {
    background: var(--c-primary);
    font-size: 0.55rem;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 3px;
}

/* Participant Grid Dropdown Options */
.participant-options-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(9, 9, 11, 0.4);
    backdrop-filter: blur(8px);
    border: 1px solid var(--c-glass-border);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 15;
    transition: all 0.2s ease;
}

.participant-options-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.participant-options-btn svg {
    width: 16px;
    height: 16px;
}

.participant-options-menu {
    position: absolute;
    top: 45px;
    right: 8px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid var(--c-glass-border);
    border-radius: 12px;
    padding: 6px;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 20;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.dropdown-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.dropdown-option:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.dropdown-option svg {
    width: 14px;
    height: 14px;
    color: #cbd5e1;
}

/*PARTICIPANTS SIDEBAR*/
.participants-panel {
    width: 0;
    min-width: 0;
    overflow: hidden;
    background: var(--c-surface);
    border-left: 1px solid var(--c-border);
    transition: width 0.3s ease, min-width 0.3s ease;
    display: flex;
    flex-direction: column;
}

.participants-panel.open {
    width: var(--panel-width);
    min-width: var(--panel-width);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1rem 0.75rem;
    border-bottom: 1px solid var(--c-border);
}

.panel-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
}

.panel-close-btn {
    background: none;
    border: none;
    color: var(--c-text-muted);
    cursor: pointer;
    display: flex;
    padding: 2px;
}

.panel-close-btn svg {
    width: 16px;
    height: 16px;
}

.participants-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.participants-list::-webkit-scrollbar {
    width: 4px;
}
.participants-list::-webkit-scrollbar-thumb {
    background: var(--c-glass-border);
    border-radius: 10px;
}

.participant-card {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.5rem;
    border-radius: 8px;
    transition: background 0.2s;
}

.participant-card:hover {
    background: var(--c-glass);
}

.participant-card.speaking {
    background: rgba(90, 30, 192, 0.15); 
    border: 1px solid rgba(90, 30, 192, 0.3);
}

.participant-card-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--c-primary), #ff8a6c);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.participant-card-info {
    flex: 1;
    min-width: 0;
}

.participant-card-name {
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.participant-card-role {
    font-size: 0.65rem;
    color: var(--c-text-muted);
}

.participant-card-status {
    display: flex;
    gap: 4px;
}

.status-icon {
    width: 16px;
    height: 16px;
    color: var(--c-text-muted);
}

.status-icon.active {
    color: var(--c-success);
}

.status-icon.muted {
    color: var(--c-error);
}

/* CHAT PANEL STYLES */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: var(--c-glass-border);
    border-radius: 10px;
}

.chat-message {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    align-items: flex-start;
}

.chat-message.self {
    align-items: flex-end;
}

.chat-message-sender {
    font-size: 0.7rem;
    color: var(--c-text-muted);
    padding: 0 0.2rem;
}

.chat-message-text {
    background: var(--c-glass);
    padding: 0.5rem 0.8rem;
    border-radius: 12px;
    font-size: 0.85rem;
    max-width: 90%;
    word-break: break-word;
    border: 1px solid var(--c-glass-border);
    color: var(--c-text);
}

.chat-message.self .chat-message-text {
    background: var(--c-primary);
    color: white;
    border-color: var(--c-primary);
}

.chat-input-area {
    padding: 1rem;
    border-top: 1px solid var(--c-border);
    display: flex;
    gap: 0.5rem;
    background: var(--c-surface);
}

.chat-input-area input {
    flex: 1;
    background: var(--c-glass);
    border: 1px solid var(--c-border);
    color: var(--c-text);
    padding: 0.5rem 0.8rem;
    border-radius: 20px;
    outline: none;
    font-size: 0.85rem;
    transition: border-color 0.2s;
}

.chat-input-area input:focus {
    border-color: var(--c-primary);
}

.chat-input-area button {
    background: var(--c-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-input-area button:hover {
    filter: brightness(1.2);
    transform: scale(1.05);
}

.chat-input-area button svg {
    width: 16px;
    height: 16px;
}

/*CONTROLS BAR*/
.controls-bar {
    height: var(--controls-height);
    min-height: var(--controls-height);
    background: var(--c-bg);
    opacity: 0.98;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0 1.5rem;
    border-top: 1px solid var(--c-border);
    z-index: 100;
}

.controls-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.controls-divider {
    width: 1px;
    height: 24px;
    background: var(--c-border);
    margin: 0 0.25rem;
}

.control-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid var(--c-border);
    background: var(--c-glass);
    color: var(--c-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}

.control-btn:hover {
    background: var(--c-glass-hover);
    color: var(--c-text);
}

.control-btn.active {
    background: var(--c-primary);
    color: white;
    border-color: var(--c-primary);
    box-shadow: 0 4px 12px var(--c-primary-glow);
}

.control-btn.danger {
    width: auto;
    padding: 0 1.1rem;
    gap: 0.4rem;
    border-radius: 24px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--c-error);
    border-color: rgba(239, 68, 68, 0.2);
}

.control-btn.danger:hover {
    background: var(--c-error);
    color: white;
    border-color: var(--c-error);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.25);
}

.control-btn svg {
    width: 18px;
    height: 18px;
}

.btn-label {
    font-size: 0.75rem;
    font-weight: 600;
}

.reaction-icon, .hand-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.reactions-wrapper {
    position: relative;
}

.reactions-picker {
    display: none;
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--c-surface);
    border: 1px solid var(--c-glass-border);
    border-radius: 16px;
    padding: 8px;
    gap: 4px;
    grid-template-columns: repeat(4, 1fr);
    z-index: 200;
    backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    animation: pickerFadeIn 0.2s ease;
}

.reactions-picker.open {
    display: grid;
}

@keyframes pickerFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.reaction-option {
    width: 44px;
    height: 44px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.reaction-option:hover {
    background: var(--c-glass-hover);
    transform: scale(1.25);
}

.reaction-option:active {
    transform: scale(0.95);
}

.control-btn.hand-raised {
    background: #f59e0b;
    color: #000;
    border-color: #f59e0b;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.control-btn.hand-raised:hover {
    background: #d97706;
    border-color: #d97706;
}

.reactions-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
}

.floating-reaction {
    position: absolute;
    font-size: 3rem;
    z-index: 1001;
    pointer-events: none;
    animation: floatUp 3s ease-out forwards;
    text-shadow: 0 4px 12px rgba(0,0,0,0.5);
    line-height: 1;
}

@keyframes floatUp {
    0%   { opacity: 0; transform: translate(-50%, 0) scale(0.5); }
    10%  { opacity: 1; transform: translate(-50%, -20px) scale(1.2); }
    30%  { opacity: 1; transform: translate(-50%, -60px) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -180px) scale(0.8); }
}

.hand-raise-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(245, 158, 11, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    z-index: 15;
    animation: handPulse 1.5s ease-in-out infinite;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

@keyframes handPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.15); }
}

.participant-card .hand-indicator {
    font-size: 1rem;
    animation: handPulse 1.5s ease-in-out infinite;
}

#loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--c-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 109, 72, 0.1);
    border-top-color: var(--c-primary);
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    margin-bottom: 1.5rem;
}

#loading-status {
    font-weight: 500;
    color: var(--c-text-muted);
    font-size: 0.9rem;
}

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

.overlay-btn {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.6rem 1.4rem;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-family: var(--font-main);
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.25s ease;
}

.overlay-btn.primary-btn {
    background: var(--c-primary);
    color: white;
    box-shadow: 0 4px 12px var(--c-primary-glow);
}

.overlay-btn.primary-btn:hover {
    transform: translateY(-2px);
}

.overlay-btn.secondary-btn {
    background: var(--c-surface-light);
    color: var(--c-text);
    border: 1px solid var(--c-border);
}

.end-screen {
    position: fixed;
    inset: 0;
    background: var(--c-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    gap: 0.75rem;
}

.end-screen h1 {
    font-size: 1.3rem;
    font-weight: 600;
}

.end-screen p {
    color: var(--c-text-muted);
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .participants-panel.open {
        position: fixed;
        right: 0;
        top: var(--header-height);
        bottom: var(--controls-height);
        z-index: 200;
        width: 260px;
        min-width: 260px;
    }
    .controls-bar {
        gap: 0.5rem;
        padding: 0 0.75rem;
    }
    .control-btn {
        width: 40px;
        height: 40px;
    }
    .btn-label {
        display: none;
    }
    #conference-stage {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-auto-rows: min-content !important;
        padding: 8px !important;
        gap: 8px !important;
        overflow-y: auto !important;
        flex-direction: initial !important;
    }
    #video-stage, #participants-tray, #tray-inner {
        display: contents !important;
    }
    .participant-node {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 1/1 !important;
        border-radius: 8px !important;
    }
    #video-stage .participant-node.on-stage {
        grid-column: 1 / -1 !important;
        aspect-ratio: 16/9 !important;
    }
    .video-wrapper {
        border-radius: 8px !important;
    }
}

.lobby-bg-selector {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--c-border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.selector-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--c-text);
}

.bg-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.bg-opt {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 2px solid transparent;
    background-color: var(--c-surface-light);
    background-size: cover;
    background-position: center;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-text-muted);
    transition: all 0.2s ease;
    padding: 0;
}

.bg-opt:hover {
    border-color: var(--c-text-muted);
}

.bg-opt.active {
    border-color: var(--c-primary);
    color: var(--c-primary);
}

.bg-opt svg {
    width: 18px;
    height: 18px;
}

.bg-opt.upload-btn {
    background: var(--c-glass);
    border: 2px dashed var(--c-glass-border);
}

.bg-opt.upload-btn:hover {
    background: var(--c-glass-hover);
    border-style: solid;
}

.background-wrapper {
    position: relative;
}

.bg-panel {
    display: none;
    position: absolute;
    bottom: calc(100% + 12px);
    right: 0;
    width: 220px;
    background: var(--c-surface);
    border: 1px solid var(--c-glass-border);
    border-radius: 16px;
    padding: 12px;
    z-index: 200;
    backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    animation: pickerFadeIn 0.2s ease;
}

.bg-panel.open {
    display: block;
}

#lobby-canvas-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 20px;
    transform: scaleX(-1);
}
