@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body { 
    background-color: #f0f2f5; 
    color: #1f2937; 
    font-family: 'Roboto', sans-serif; 
    height: 100vh; 
    height: 100dvh; 
    overflow: hidden; 
    display: flex; 
    flex-direction: column; 
    margin: 0;
}

/* LAYOUT GRID */
.main-layout { 
    display: grid; 
    grid-template-columns: 64px 1fr 260px; 
    height: 100%; 
    width: 100%; 
}

/* 1. SIDE NAV */
.side-nav { 
    background: linear-gradient(180deg, #27ae60 0%, #219150 100%); 
    border-right: 1px solid #1e8449; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    padding: 16px 0; 
    gap: 16px; 
    z-index: 30; 
}

/* 2. CONTENT AREA */
.content-area { 
    display: flex; 
    flex-direction: column; 
    background: #ffffff; 
    border-right: 1px solid #d1d5db; 
    position: relative; 
    overflow: hidden; 
    min-width: 0; 
}

/* Stage Cam */
.stage-container { 
    height: 170px; 
    background: #e2e8f0; 
    border-bottom: 1px solid #cbd5e0; 
    display: flex; 
    padding: 10px; 
    gap: 10px; 
    overflow-x: auto; 
    flex-shrink: 0; 
    scrollbar-width: none; 
}

.cam-slot { 
    width: 210px; 
    height: 100%; 
    background: #000; 
    border: 2px solid #94a3b8; 
    border-radius: 6px; 
    flex-shrink: 0; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    position: relative; 
    overflow: hidden; 
}
.cam-slot.active { border: 3px solid #2ecc71; }

/* Chat Area */
.chat-container { 
    flex-grow: 1; 
    display: flex; 
    flex-direction: column; 
    background: #ffffff; 
    overflow: hidden; 
    position: relative; 
}

.message-list { 
    flex-grow: 1; 
    overflow-y: auto; 
    padding: 12px; 
    display: flex; 
    flex-direction: column; 
    gap: 4px; 
    font-size: 14px; 
}

.input-bar { 
    background: #f1f5f9; 
    padding: 10px; 
    border-top: 1px solid #e2e8f0; 
    display: flex; 
    gap: 10px; 
    align-items: center; 
    flex-shrink: 0; 
    padding-bottom: env(safe-area-inset-bottom, 10px); 
}

/* 3. USER LIST */
.user-sidebar { 
    background: #f8fafc; 
    border-left: 1px solid #e2e8f0; 
    display: flex; 
    flex-direction: column; 
    width: 260px; 
}

.user-header { 
    background: linear-gradient(to bottom, #27ae60, #219150); 
    color: white; 
    padding: 10px; 
    font-size: 13px; 
    font-weight: bold; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
    text-align: center; 
    border-bottom: 1px solid #1e8449; 
}

.user-item { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    padding: 8px 12px; 
    font-size: 14px; 
    cursor: pointer; 
    border-bottom: 1px solid #f1f5f9; 
    color: #334155; 
}
.user-item:hover { background: #e2e8f0; }

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
    .main-layout { grid-template-columns: 1fr; grid-template-rows: 1fr 56px; }
    .side-nav { grid-row: 2; flex-direction: row; width: 100%; border-right: none; border-top: 1px solid #1e8449; padding: 0; justify-content: space-around; background: #1a202c; }
    .side-nav .logo-block { display: none; }
    .content-area { grid-row: 1; border-right: none; }
    .stage-container { height: 140px; padding: 8px; gap: 8px; }
    .cam-slot { width: 140px; }
    .user-sidebar { position: fixed; top: 0; right: 0; bottom: 0; width: 85%; max-width: 320px; transform: translateX(100%); transition: transform 0.3s; z-index: 50; box-shadow: -5px 0 25px rgba(0,0,0,0.3); }
    .user-sidebar.open { transform: translateX(0); }
    .input-bar { padding: 8px 12px; }
    #mobile-user-toggle { display: flex !important; }
    #user-count-desktop { display: none; }
    #btn-send span { display: none; } #btn-send svg { display: block; }
}

/* OVERLAYS & UTILS */
#user-overlay-bg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 40; }
#user-overlay-bg.show { display: block; }
#auth-overlay, #mic-type-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 100; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
#bypass-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 110; display: none; align-items: center; justify-content: center; padding: 20px; }
#mobile-user-toggle { display: none; }
#connection-status { position: fixed; top: 0; left: 0; right: 0; padding: 3px; text-align: center; font-size: 11px; font-weight: bold; z-index: 200; pointer-events: none; }

.viz-bar { width: 4px; background: #2ecc71; animation: sound-wave 0.5s infinite ease-in-out; }
@keyframes sound-wave { 0%, 100% { height: 10%; } 50% { height: 100%; } }
.viz-playing .viz-bar:nth-child(1) { animation-duration: 0.4s; }
.viz-playing .viz-bar:nth-child(2) { animation-duration: 0.5s; }
.viz-playing .viz-bar:nth-child(3) { animation-duration: 0.3s; }