/* ── Theater Page — Optimized Multi-POV Layout ─────────────── */

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0d0d0d; }
::-webkit-scrollbar-thumb { background: #1a1a1a; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #C9A96E; }

/* ── Body: viewport-locked when streams active ─────────────── */
body.theater-active { height: 100dvh; overflow: hidden; }

/* ── Header: auto-shrink ───────────────────────────────────── */
#site-header {
    height: 80px;
    transition: height 0.3s ease;
}
body.theater-active #site-header {
    height: 40px;
}
body.theater-active #site-header:hover {
    height: 80px;
}
body.theater-active #site-header .header-full { opacity: 0; pointer-events: none; height: 0; overflow: hidden; }
body.theater-active #site-header:hover .header-full { opacity: 1; pointer-events: auto; height: auto; }
body.theater-active #site-header .header-slim { opacity: 1; pointer-events: auto; }
body.theater-active #site-header:hover .header-slim { opacity: 0; pointer-events: none; position: absolute; }

.header-slim {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    transition: opacity 0.2s ease;
}
.header-full {
    transition: opacity 0.2s ease;
}

/* ── Controls strip: collapsible ───────────────────────────── */
#controls-bar {
    height: 36px;
    overflow: hidden;
    transition: height 0.3s ease;
    flex-shrink: 0;
}
#controls-bar:hover,
#controls-bar.expanded {
    height: auto;
    min-height: 36px;
}
#controls-row-main {
    height: 36px;
    display: flex;
    align-items: center;
}
#controls-row-extra {
    display: none;
    padding-bottom: 8px;
}
#controls-bar:hover #controls-row-extra,
#controls-bar.expanded #controls-row-extra {
    display: flex;
}

/* ── Left drawer ───────────────────────────────────────────── */
#drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 45;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
#drawer-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

#left-drawer {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 300px;
    background: #141414;
    border-right: 1px solid rgba(255,255,255,0.08);
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}
#left-drawer.open {
    transform: translateX(0);
}

#drawer-tab {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 40;
    width: 22px;
    height: 64px;
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.1);
    border-left: none;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
}
#drawer-tab:hover {
    background: #242424;
    border-color: rgba(201,169,110,0.4);
}
#drawer-tab .tab-icon {
    font-size: 14px;
    color: #9ca3af;
    transition: color 0.2s;
}
#drawer-tab:hover .tab-icon {
    color: #C9A96E;
}

/* Drawer internals */
#drawer-header {
    padding: 20px 16px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
#drawer-server-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 16px 8px;
    flex-shrink: 0;
}
.server-tab {
    flex: 1;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.08);
    background: transparent;
    color: #9ca3af;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}
.server-tab:hover { color: #fff; border-color: rgba(255,255,255,0.2); }
.server-tab.active {
    background: rgba(201,169,110,0.15);
    border-color: rgba(201,169,110,0.4);
    color: #C9A96E;
}
#drawer-members {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Stream toggle buttons inside drawer */
.stream-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.03);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}
.stream-toggle-btn:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
}
.stream-toggle-btn.selected {
    background: rgba(201,169,110,0.12);
    border-color: rgba(201,169,110,0.4);
    box-shadow: 0 0 12px rgba(201,169,110,0.15);
}

/* Live dot */
.live-dot-wrap { position: relative; flex-shrink: 0; width: 8px; height: 8px; }
.live-dot-ping {
    position: absolute; inset: 0;
    border-radius: 50%;
    background: #ef4444;
    animation: ping 1.5s cubic-bezier(0,0,0.2,1) infinite;
    opacity: 0.75;
}
.live-dot {
    position: relative;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #ef4444;
}
@keyframes ping {
    75%, 100% { transform: scale(2); opacity: 0; }
}

.platform-badge {
    font-size: 9px;
    opacity: 0.5;
    font-weight: 900;
    text-transform: uppercase;
    margin-left: auto;
    flex-shrink: 0;
}

/* ── Stream grid ───────────────────────────────────────────── */
#stream-grid {
    display: grid;
    gap: 3px;
    width: 100%;
    height: 100%;
}
.stream-cell {
    background: #1a1a1a;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}
.stream-cell iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* ── Floating chat overlay ─────────────────────────────────── */
#floating-chat {
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 340px;
    height: 500px;
    z-index: 55;
    display: none;
    flex-direction: column;
    background: rgba(13,13,13,0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    overflow: hidden;
    resize: both;
}
#floating-chat.visible { display: flex; }
#floating-chat.minimized { height: 40px !important; resize: none; }

#chat-drag-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    height: 40px;
    flex-shrink: 0;
    cursor: grab;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    user-select: none;
}
#chat-drag-bar:active { cursor: grabbing; }

#chat-drag-bar .grip-icon { color: #555; font-size: 16px; }
#chat-drag-bar .chat-label {
    font-size: 10px; font-weight: 900;
    text-transform: uppercase; letter-spacing: 0.15em;
    color: #fff;
}
.chat-header-btns {
    margin-left: auto;
    display: flex;
    gap: 4px;
}
.chat-header-btns button {
    width: 28px; height: 28px;
    border-radius: 6px;
    border: none;
    background: rgba(255,255,255,0.06);
    color: #9ca3af;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    font-size: 16px;
}
.chat-header-btns button:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

#chat-source-bar {
    display: flex;
    gap: 4px;
    padding: 6px 12px;
    overflow-x: auto;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.chat-src-btn {
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.08);
    background: transparent;
    color: #9ca3af;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.chat-src-btn:hover { color: #fff; }
.chat-src-btn.active {
    background: rgba(201,169,110,0.15);
    border-color: rgba(201,169,110,0.4);
    color: #C9A96E;
}

#chat-iframe {
    flex: 1;
    width: 100%;
    border: none;
}

/* Chat toggle button (right edge) */
#chat-toggle-tab {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 40;
    width: 22px;
    height: 64px;
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.1);
    border-right: none;
    border-radius: 6px 0 0 6px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
}
#chat-toggle-tab:hover {
    background: #242424;
    border-color: rgba(201,169,110,0.4);
}
#chat-toggle-tab .tab-icon {
    font-size: 14px;
    color: #9ca3af;
    transition: color 0.2s;
}
#chat-toggle-tab:hover .tab-icon {
    color: #C9A96E;
}

/* ── Footer hidden ─────────────────────────────────────────── */
footer { display: none !important; }

/* ── Empty state ───────────────────────────────────────────── */
#empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    text-align: center;
    height: 100%;
    grid-column: 1 / -1;
}

/* ── Fullscreen ────────────────────────────────────────────── */
#theater-layout:-webkit-full-screen { background: #0d0d0d; }
#theater-layout:-moz-full-screen { background: #0d0d0d; }
#theater-layout:fullscreen { background: #0d0d0d; }

/* ── Mobile menu ───────────────────────────────────────────── */
#mobile-menu {
    transform: translateX(100%);
    transition: transform 0.3s ease;
}
#mobile-menu.open { transform: translateX(0); }

/* ── Mobile responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
    #floating-chat {
        width: calc(100vw - 32px) !important;
        height: 350px !important;
        bottom: 8px;
        right: 8px;
        left: 8px;
    }
    #left-drawer { width: 260px; }
    #drawer-tab {
        width: 32px;
        height: 48px;
    }
    #chat-toggle-tab {
        top: auto;
        bottom: 16px;
        right: 16px;
        border-radius: 6px;
        border: 1px solid rgba(255,255,255,0.1);
        width: 40px;
        height: 40px;
    }
}
