/* ==========================================================================
   Watch Party - Design System & Styles (Person A: Media/UI)
   Theme: Deep Slate / Cyber Cinema with Glassmorphism & Vibrant Accents
   ========================================================================== */

:root {
    --bg-main: #090d16;
    --bg-surface: #121826;
    --bg-surface-elevated: #1b2336;
    --bg-overlay: rgba(9, 13, 22, 0.85);

    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-bright: rgba(255, 255, 255, 0.18);

    --accent-primary: #38bdf8;
    --accent-primary-hover: #0ea5e9;
    --accent-glow: rgba(56, 189, 248, 0.35);

    --accent-violet: #818cf8;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #ef4444;

    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;

    --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 0 1px 1px rgba(255, 255, 255, 0.06);
    --shadow-glow: 0 0 24px -2px var(--accent-glow);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-sans);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
}

#app-root {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    position: relative;
    background: radial-gradient(circle at 50% 0%, #151d30 0%, #090d16 80%);
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   Header / Top Bar
   ========================================================================== */

#top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 20px;
    background: rgba(18, 24, 38, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 100;
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-violet));
    color: #040810;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 14px var(--accent-glow);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 1.2px;
    background: linear-gradient(90deg, #fff, var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-sub {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.center-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    transition: all 0.25s ease;
}

.status-pill.connected {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.35);
    color: #34d399;
}

.status-pill.connecting {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.35);
    color: #fbbf24;
}

.status-pill.failed, .status-pill.disconnected {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
    color: #f87171;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    box-shadow: 0 0 8px currentColor;
}

.sync-pill {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-family: var(--font-mono);
    font-size: 11px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.sync-pill.corrected {
    background: rgba(56, 189, 248, 0.2);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: scale(1.06);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--border-bright);
}

.cam-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-dim);
    transition: all 0.2s ease;
}

.cam-dot.active {
    background: var(--accent-emerald);
    box-shadow: 0 0 8px var(--accent-emerald);
}

.ready-btn {
    border-color: rgba(129, 140, 248, 0.3);
}

.ready-btn.ready-active {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--accent-emerald);
    color: #6ee7b7;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
}

.connect-btn {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-violet));
    color: #050b14;
    font-weight: 600;
    border: none;
    box-shadow: 0 0 14px var(--accent-glow);
}

.connect-btn:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

/* ==========================================================================
   Movie Info Bar
   ========================================================================== */

#movie-meta-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 24px;
    background: rgba(15, 20, 32, 0.6);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 12px;
}

.meta-section {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 40%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.meta-label {
    color: var(--text-dim);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.meta-value {
    color: var(--text-main);
    font-weight: 500;
}

.match-badge {
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
}

.match-ok {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.match-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.match-neutral {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

/* ==========================================================================
   Main Stage & Theater
   ========================================================================== */

#main-stage {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.dropzone {
    width: 80%;
    max-width: 680px;
    padding: 50px 30px;
    border: 2px dashed var(--border-bright);
    border-radius: var(--radius-lg);
    background: rgba(18, 24, 38, 0.5);
    backdrop-filter: blur(16px);
    text-align: center;
    transition: all 0.25s ease;
}

.dropzone.drag-active {
    border-color: var(--accent-primary);
    background: rgba(56, 189, 248, 0.08);
    transform: scale(1.02);
}

.dropzone-icon {
    margin-bottom: 20px;
    color: var(--accent-primary);
}

.dropzone h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
}

.dropzone p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.5;
}

.dropzone-hint {
    display: block;
    margin-top: 14px;
    font-size: 12px;
    color: var(--text-dim);
}

.theater {
    width: 100%;
    height: 100%;
    position: relative;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-loading-overlay, .video-error-overlay {
    position: absolute;
    inset: 0;
    background: rgba(9, 13, 22, 0.88);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 50;
}

.video-error-overlay {
    color: var(--accent-rose);
}

.video-error-overlay span {
    color: var(--text-main);
    font-size: 15px;
    font-weight: 500;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(56, 189, 248, 0.2);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

#video-element {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* ==========================================================================
   Custom Video Controls Overlay
   ========================================================================== */

.controls-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 24px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.4) 60%, transparent 100%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.theater:hover .controls-overlay,
.controls-overlay:focus-within {
    opacity: 1;
}

.timeline-container {
    position: relative;
    width: 100%;
    height: 14px;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.timeline-track {
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    position: relative;
    overflow: hidden;
}

.timeline-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-violet));
    border-radius: var(--radius-full);
}

#timeline-scrubber {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    margin: 0;
}

.controls-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.controls-left, .controls-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ctrl-icon-btn {
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.ctrl-icon-btn:hover {
    color: var(--accent-primary);
    transform: scale(1.1);
}

.time-display {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-muted);
}

.time-sep {
    margin: 0 4px;
    color: var(--text-dim);
}

.volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

#volume-slider {
    width: 75px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

/* ==========================================================================
   Countdown Overlay
   ========================================================================== */

.countdown-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.countdown-text {
    font-size: 140px;
    font-weight: 800;
    color: var(--accent-primary);
    text-shadow: 0 0 50px var(--accent-glow), 0 0 100px var(--accent-glow);
    font-family: var(--font-sans);
}

.countdown-pulse {
    animation: countdownPulse 0.9s cubic-bezier(0.1, 0.9, 0.2, 1);
}

.countdown-zoom {
    animation: countdownZoom 0.7s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
}

@keyframes countdownPulse {
    0% { transform: scale(0.6); opacity: 0; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 0.9; }
}

@keyframes countdownZoom {
    0% { transform: scale(0.8); opacity: 0; }
    40% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1.3); opacity: 0; }
}

/* ==========================================================================
   Reaction Snapshot Popup Card
   ========================================================================== */

.reaction-card {
    position: absolute;
    bottom: 80px;
    right: 24px;
    width: 260px;
    background: rgba(18, 24, 38, 0.92);
    backdrop-filter: blur(16px);
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7), 0 0 20px var(--accent-glow);
    overflow: hidden;
    z-index: 150;
    transition: all 0.3s ease;
}

.popup-in {
    animation: slideUpFade 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.popup-out {
    animation: slideDownFade 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUpFade {
    from { transform: translateY(30px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes slideDownFade {
    from { transform: translateY(0) scale(1); opacity: 1; }
    to { transform: translateY(30px) scale(0.95); opacity: 0; }
}

.reaction-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid var(--border-subtle);
}

.reaction-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-primary);
}

.live-dot {
    width: 6px;
    height: 6px;
    background: var(--accent-rose);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--accent-rose);
}

.btn-close-sm {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
}

.btn-close-sm:hover {
    color: #fff;
}

.reaction-body {
    width: 100%;
    height: 180px;
    background: #000;
}

.reaction-body img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.reaction-caption {
    padding: 6px 10px;
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    background: rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   Signaling Modal / Drawer
   ========================================================================== */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 14, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.modal-card {
    width: 90%;
    max-width: 640px;
    max-height: 90vh;
    background: var(--bg-surface);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.btn-close:hover {
    color: #fff;
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.2);
}

.tab-btn {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
    background: rgba(56, 189, 248, 0.05);
}

.tab-section {
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.step-card {
    display: flex;
    gap: 16px;
    padding: 16px;
    border-radius: var(--radius-md);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
}

.step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: #040810;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.step-content h3 {
    font-size: 14px;
    font-weight: 600;
}

.step-content p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

textarea {
    width: 100%;
    height: 75px;
    background: #090d16;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 8px 10px;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}

textarea:focus {
    border-color: var(--accent-primary);
}

.btn-primary {
    align-self: flex-start;
    padding: 9px 18px;
    background: var(--accent-primary);
    color: #040810;
    font-weight: 600;
    font-size: 12px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--accent-primary-hover);
    box-shadow: 0 0 12px var(--accent-glow);
}

.btn-secondary {
    align-self: flex-start;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    font-size: 12px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.14);
}

.status-msg {
    font-size: 12px;
    color: var(--accent-primary);
    font-weight: 500;
    text-align: center;
    min-height: 18px;
}

/* ==========================================================================
   Toasts
   ========================================================================== */

.toasts {
    position: fixed;
    bottom: 24px;
    left: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 400;
    pointer-events: none;
}

.toast {
    padding: 10px 16px;
    border-radius: var(--radius-md);
    background: rgba(18, 24, 38, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-bright);
    color: var(--text-main);
    font-size: 13px;
    box-shadow: var(--shadow-card);
    transform: translateY(16px);
    opacity: 0;
    transition: all 0.25s ease;
}

.toast-show {
    transform: translateY(0);
    opacity: 1;
}

.toast-success {
    border-color: rgba(16, 185, 129, 0.5);
    color: #6ee7b7;
}

.toast-warning {
    border-color: rgba(245, 158, 11, 0.5);
    color: #fbbf24;
}

.toast-error {
    border-color: rgba(239, 68, 68, 0.5);
    color: #f87171;
}

.toast-info {
    border-color: rgba(56, 189, 248, 0.5);
    color: #7dd3fc;
}

/* ==========================================================================
   Fullscreen Styles
   ========================================================================== */
.theater:fullscreen {
    width: 100vw;
    height: 100vh;
    background: #000;
}

.theater:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    background: #000;
}

/* Web-specific badge */
.web-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-sm, 6px);
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent-primary, #38bdf8);
    border: 1px solid rgba(56, 189, 248, 0.3);
    margin-left: 8px;
    letter-spacing: 0.5px;
}

