/* ==========================================================================
   Nebula Stream - Design System & Custom Stylesheet
   ========================================================================== */

/* ==========================================================================
   PALETA DE COLORES GLOBAL
   Modifica estas variables para cambiar el esquema de color del sitio.
   ========================================================================== */
:root {
    /* ── Fondos Obsidian / Charcoal ───────────────────────────────────────── */
    --bg-dark-base: #08090d;
    /* Fondo principal de la app — Deep Obsidian */
    --bg-dark-surface: #0f1219;
    /* Tarjetas, paneles, sidebars */
    --bg-dark-elevated: #161b26;
    /* Elementos elevados (inputs, dropdowns) */
    --bg-dark-highlight: #212838;
    /* Hover sutil, selección */

    /* ── Color primario (Cyber Indigo / Electric Violet) ─────────────────── */
    --primary: #6366f1;
    /* Indigo eléctrico */
    --primary-hover: #818cf8;
    /* Versión más luminosa al hover */
    --primary-glow: rgba(99, 102, 241, 0.35);
    /* Sombra/glow del primario */
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);

    /* ── Texto ───────────────────────────────────────────────────────────── */
    --text-main: #f1f5f9;
    /* Blanco humo de alta legibilidad */
    --text-muted: #94a3b8;
    /* Gris pizarra para subtítulos */
    --text-dark: #090c10;
    /* Texto sobre fondo claro */

    /* ── Colores de acento / estado ──────────────────────────────────────── */
    --accent-red: #ff2d55;
    /* Signal Neon Red — Live badge y peligro */
    --accent-red-glow: rgba(255, 45, 85, 0.4);
    --accent-green: #10b981;
    /* Emerald — Online, verificado, éxito */
    --accent-green-glow: rgba(16, 185, 129, 0.25);
    --accent-yellow: #f59e0b;
    /* Solar Amber — Advertencias, destacado */
    --accent-cyan: #06b6d4;
    /* Cyber Cyan — Métricas y badges técnicos */

    /* ── Bordes & Luces ─────────────────────────────────────────────────── */
    --border-light: rgba(255, 255, 255, 0.065);
    /* Borde sutil general */
    --border-focus: rgba(99, 102, 241, 0.6);
    /* Borde al enfocar input */
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.05);

    /* ── Radios de borde ─────────────────────────────────────────────────── */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-round: 50%;

    /* ── Tipografía Distintiva ────────────────────────────────────────────── */
    --font-heading: 'Bricolage Grotesque', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* ── Transiciones ────────────────────────────────────────────────────── */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* SVG Custom Icon Helper */
.svg-icon {
    display: inline-block;
    width: 1.1em;
    height: 1.1em;
    vertical-align: middle;
    margin-right: 0.35em;
    flex-shrink: 0;
}

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

body {
    background-color: var(--bg-dark-base);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark-base);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-dark-highlight);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Main Container Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar Styling */
.sidebar {
    width: 240px;
    background-color: var(--bg-dark-surface);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
}

.brand {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    border-bottom: 1px solid var(--border-light);
}

.brand-logo {
    width: 32px;
    height: 32px;
    background: url('/uploads/default-logo.png?v=2') no-repeat center center/contain;
    border-radius: var(--radius-md);
    box-shadow: 0 0 12px var(--primary-glow);
    position: relative;
}


.brand-name {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 22px;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #fff, var(--primary-hover));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    padding: 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: var(--transition-fast);
    gap: 12px;
}

.nav-item:hover {
    background-color: var(--bg-dark-elevated);
    color: var(--text-main);
}

.nav-item.active {
    background-color: rgba(14, 165, 233, 0.15);
    color: var(--primary-hover);
    border-left: 3px solid var(--primary);
    border-top-left-radius: 2px;
    border-bottom-left-radius: 2px;
}

.nav-item .icon {
    font-size: 18px;
}

.recommended-channels {
    padding: 20px 16px;
    flex-grow: 1;
    border-top: 1px solid var(--border-light);
}

.recommended-channels h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.channel-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rec-channel {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.rec-channel:hover {
    background-color: var(--bg-dark-elevated);
}

.rec-channel .avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-round);
    background-color: var(--bg-dark-highlight);
    position: relative;
}

.rec-channel .avatar.online::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 8px;
    height: 8px;
    border-radius: var(--radius-round);
    background-color: var(--accent-green);
    border: 2px solid var(--bg-dark-surface);
}

.rec-channel .stream-thumb {
    width: 56px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background-color: var(--bg-dark-highlight);
}

.rec-channel .channel-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
}

.rec-channel .channel-info .name {
    font-weight: 600;
    color: var(--text-main);
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.rec-channel .channel-info .category {
    font-size: 11px;
    color: var(--text-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.rec-channel .live-dot {
    color: var(--accent-red);
    font-size: 10px;
    animation: pulse 1.5s infinite;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background-color: var(--bg-dark-base);
}

/* Header */
.main-header {
    height: 64px;
    background-color: var(--bg-dark-surface);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
}

.page-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 20px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.codec-compatibility {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: var(--bg-dark-elevated);
    border: 1px solid var(--border-light);
}

.codec-compatibility.success {
    border-color: rgba(0, 240, 118, 0.4);
    background-color: rgba(0, 240, 118, 0.05);
}

.codec-compatibility.warning {
    border-color: rgba(255, 208, 0, 0.4);
    background-color: rgba(255, 208, 0, 0.05);
}

.support-dot {
    width: 6px;
    height: 6px;
    border-radius: var(--radius-round);
}

.support-dot.green {
    background-color: var(--accent-green);
}

.support-dot.red {
    background-color: var(--accent-red);
}

.server-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    background: var(--bg-dark-elevated);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-round);
}

.status-indicator.green {
    background-color: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green-glow);
}

.status-indicator.red {
    background-color: var(--accent-red);
    box-shadow: 0 0 8px var(--accent-red-glow);
}

.status-indicator.yellow {
    background-color: var(--accent-yellow);
}

/* Grid Layout */
.dashboard-grid {
    display: flex;
    flex-grow: 1;
    height: calc(100vh - 64px);
    overflow: hidden;
}

/* Column Left: Stream, Owner, OBS details */
.stream-column {
    flex-grow: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    min-height: 0;
}

/* Video Card & Custom Player */
.video-card {
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-light);
    aspect-ratio: 16/9;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
    /* Prevents video container from shrinking */
}

.video-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-element {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(14, 14, 16, 0.9);
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.overlay-content {
    text-align: center;
    padding: 20px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(14, 165, 233, 0.1);
    border-top: 4px solid var(--primary);
    border-radius: var(--radius-round);
    margin: 0 auto 16px;
    animation: spin 1s linear infinite;
}

#overlayMessage {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-muted);
}

/* Custom Video Controls */
.custom-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 6;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.video-card:hover .custom-controls,
.video-card.show-controls .custom-controls {
    opacity: 1;
}

/* Unmute Overlay Pill */
.unmute-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(22, 26, 34, 0.95);
    border: 1px solid rgba(65, 117, 252, 0.4);
    border-radius: 30px;
    padding: 10px 18px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    z-index: 12;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    transition: opacity 0.25s ease, transform 0.25s ease;
    opacity: 0;
    pointer-events: auto;
}

.unmute-overlay:hover {
    background: #161a22;
    border-color: rgba(65, 117, 252, 0.8);
    transform: translateY(-1px);
}

.unmute-overlay:active {
    transform: translateY(1px);
}

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

.control-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.control-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.volume-slider {
    width: 70px;
    height: 4px;
    accent-color: var(--primary-hover);
    cursor: pointer;
}

.live-badge {
    background-color: var(--accent-red);
    color: #fff;
    font-weight: 700;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    letter-spacing: 0.5px;
    box-shadow: 0 0 8px var(--accent-red-glow);
    animation: pulse 1.5s infinite;
}

/* Stream Metadata card */
.stream-info-card {
    background-color: var(--bg-dark-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    flex-shrink: 0;
    /* Prevents metadata card from shrinking */
}

.streamer-profile {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.streamer-avatar-large {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-round);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    object-fit: cover;
    flex-shrink: 0;
}

.streamer-meta {
    flex-grow: 1;
}

.stream-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 4px;
    line-height: 1.3;
}

.streamer-name {
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.verified-icon {
    color: var(--primary-hover);
    font-weight: bold;
}

.tags {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.tag {
    background-color: var(--bg-dark-elevated);
    color: var(--text-muted);
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
}

.stream-badges-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.viewer-count-container {
    background-color: rgba(235, 4, 0, 0.1);
    border: 1px solid rgba(235, 4, 0, 0.2);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    color: var(--accent-red);
    font-weight: 700;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Stats overlay */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    border-top: 1px solid var(--border-light);
    padding-top: 16px;
}

.stat-box {
    background-color: var(--bg-dark-elevated);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
}

/* OBS Details Card */
.obs-config-card {
    background-color: var(--bg-dark-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    flex-shrink: 0;
    /* Prevents config card from shrinking */
}

.obs-config-card .card-header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background-color: var(--bg-dark-elevated);
    transition: background var(--transition-fast);
}

.obs-config-card .card-header:hover {
    background-color: var(--bg-dark-highlight);
}

.obs-config-card h3 {
    font-size: 14px;
    font-weight: 600;
}

.toggle-arrow {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform var(--transition-normal);
}

.card-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-normal);
}

.card-body.expanded {
    max-height: 800px;
    min-height: 380px;
    /* Ensures a larger minimum height when expanded */
    border-top: 1px solid var(--border-light);
}

.config-instructions {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-group label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.input-copy-wrapper {
    display: flex;
    gap: 8px;
}

.input-copy-wrapper input {
    flex-grow: 1;
    background-color: var(--bg-dark-elevated);
    border: 1px solid var(--border-light);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: monospace;
    font-size: 13px;
    outline: none;
}

.input-copy-wrapper input:focus {
    border-color: var(--primary);
}

.copy-btn {
    background-color: var(--primary);
    border: none;
    color: #fff;
    padding: 0 16px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.copy-btn:hover {
    background-color: var(--primary-hover);
}

.copy-btn.copied {
    background-color: var(--accent-green);
    color: var(--text-dark);
}

.toggle-visibility-btn {
    background-color: var(--bg-dark-elevated);
    border: 1px solid var(--border-light);
    color: var(--text-main);
    padding: 0 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-visibility-btn:hover {
    background-color: var(--bg-dark-highlight);
    border-color: var(--primary);
}

.obs-settings-tips {
    background-color: var(--bg-dark-elevated);
    padding: 16px;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary);
}

.obs-settings-tips h4 {
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 12px;
}

.obs-settings-tips ul {
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.obs-settings-tips li {
    font-size: 12px;
    color: var(--text-muted);
}

.obs-settings-tips li strong {
    color: var(--text-main);
}

/* Column Right: Live Chat */
.chat-column {
    width: 340px;
    background-color: var(--bg-dark-surface);
    border-left: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.chat-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.users-online {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.chat-messages {
    flex-grow: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    font-size: 13px;
    line-height: 1.4;
    word-break: break-word;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-message.self {
    background-color: rgba(14, 165, 233, 0.05);
    padding: 6px 10px;
    border-radius: var(--radius-md);
    border-left: 2px solid var(--primary);
}

.chat-time {
    font-size: 10px;
    color: var(--text-muted);
}

.chat-user {
    font-weight: 700;
    margin-right: 6px;
}

.chat-text {
    color: var(--text-main);
}

.chat-input-area {
    padding: 16px;
    border-top: 1px solid var(--border-light);
    background-color: var(--bg-dark-elevated);
}

.chat-input-area form {
    display: flex;
    gap: 8px;
}

.chat-input-area input {
    flex-grow: 1;
    background-color: var(--bg-dark-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--text-main);
    font-size: 13px;
    outline: none;
}

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

.chat-input-area button {
    background-color: var(--primary);
    border: none;
    color: #fff;
    padding: 0 16px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.chat-input-area button:hover {
    background-color: var(--primary-hover);
}

/* Animations */
@keyframes pulse {
    0% {
        opacity: 0.4;
        box-shadow: 0 0 0 0 rgba(235, 4, 0, 0.7);
    }

    70% {
        opacity: 1;
        box-shadow: 0 0 0 6px rgba(235, 4, 0, 0);
    }

    100% {
        opacity: 0.4;
        box-shadow: 0 0 0 0 rgba(235, 4, 0, 0);
    }
}

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

/* Responsive Rules */
@media (max-width: 1024px) {
    .dashboard-grid {
        flex-direction: column;
        overflow: visible;
        height: auto;
    }

    .chat-column {
        width: 100%;
        height: 400px;
        border-left: none;
        border-top: 1px solid var(--border-light);
    }

    .stream-column {
        overflow-y: visible;
        padding: 16px;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        height: auto;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-light);
    }

    .brand {
        height: 56px;
    }

    .nav-links {
        flex-direction: row;
        padding: 8px;
    }

    .nav-item {
        padding: 8px 12px;
        font-size: 12px;
    }

    .recommended-channels {
        display: none;
    }

    .main-header {
        padding: 0 16px;
        height: 56px;
    }

    .dashboard-grid {
        height: auto;
    }

    .volume-slider {
        display: none !important;
    }

    /* Spectator view: move badges below tags on mobile */
    .streamer-profile {
        flex-wrap: wrap;
    }

    .streamer-meta {
        order: 1;
        width: 100%;
        flex-grow: 1;
        min-width: 0;
    }

    .stream-badges-row {
        order: 2;
        width: 100%;
        margin-top: 10px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .streamer-avatar-large {
        order: 0;
    }

    /* Fix spectator page: allow vertical scroll so chat is reachable */
    body {
        overflow-y: auto;
        height: auto;
    }

    .main-content {
        overflow-y: auto;
        height: auto;
    }

    #channelView.dashboard-grid {
        display: block;
        height: auto;
        overflow: visible;
    }

    #channelView .stream-column {
        display: flex;
        flex-direction: column;
        gap: 0;
        overflow-y: visible;
        height: auto;
        padding: 16px;
    }

    /* Chat injected by JS before #recordedStreamsCard on mobile */
    #channelView .stream-column .chat-column {
        width: 100% !important;
        height: 460px;
        flex-shrink: 0;
        border-left: none;
        border-top: 1px solid var(--border-light);
        margin: 16px 0;
    }

    #channelView .stream-column .chat-card {
        height: 100%;
        display: flex;
        flex-direction: column;
    }
}

/* Spectator View Layout on Desktop: restore original flex-row with sticky chat sidebar */
@media (min-width: 1025px) {
    #channelView.dashboard-grid {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        height: calc(100vh - 64px);
        overflow: hidden;
        padding: 0;
    }

    #channelView .stream-column {
        flex: 1 1 0;
        min-width: 0;
        overflow-y: auto;
        height: 100%;
        padding: 24px;
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    /* On desktop the chat-column is a direct child of #channelView */
    #channelView > .chat-column {
        width: 340px;
        flex-shrink: 0;
        height: 100%;
        border-left: 1px solid var(--border-light);
        display: flex;
        flex-direction: column;
    }

    #channelView > .chat-column .chat-card {
        height: 100%;
        display: flex;
        flex-direction: column;
    }
}

/* ==========================================================================
   Nebula Stream - New Multi-User & Lobby Stylesheet
   ========================================================================== */

/* Lobby grid style */
.lobby-container {
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 64px);
    box-sizing: border-box;
    flex-grow: 1;
}

.lobby-header {
    margin-bottom: 30px;
    text-align: center;
}

.lobby-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.channel-card {
    background-color: var(--bg-dark-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.channel-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 10px 20px rgba(14, 165, 233, 0.15);
}

/* Canal en vivo: borde rojo con pulso */
.channel-card--live {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 1px var(--accent-red), 0 0 16px var(--accent-red-glow);
    animation: live-pulse 2.5s ease-in-out infinite;
}

@keyframes live-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 1px var(--accent-red), 0 0 12px var(--accent-red-glow);
    }

    50% {
        box-shadow: 0 0 0 1px var(--accent-red), 0 0 24px rgba(244, 63, 94, 0.5);
    }
}

.channel-card--live:hover {
    border-color: var(--accent-red);
    box-shadow: 0 8px 24px rgba(244, 63, 94, 0.4);
    animation: none;
}

/* Private Channel Card */
.channel-card--private {
    border-color: rgba(75, 85, 99, 0.4);
    box-shadow: 0 0 0 1px rgba(75, 85, 99, 0.3), 0 0 10px rgba(0, 0, 0, 0.25);
}

.channel-card--private:hover {
    border-color: rgba(75, 85, 99, 0.65);
    box-shadow: 0 8px 24px rgba(75, 85, 99, 0.2);
}

.private-badge {
    background: rgba(45, 55, 72, 0.85);
    border: 1px solid rgba(75, 85, 99, 0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-heading);
    padding: 4px 8px;
    border-radius: 6px;
    letter-spacing: 0.03em;
    position: absolute;
    top: 12px;
    right: 12px;
    left: auto;
    z-index: 2;
}

.channel-card-banner {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.channel-card-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
    transition: scale 0.3s ease;
}

.channel-card:hover .channel-card-banner img {
    scale: 1.05;
}

.channel-card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
}

.channel-card-badge-stack {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
}

.channel-card-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 54px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(17, 24, 39, 0.78);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    text-transform: uppercase;
}

.channel-card-pill--hevc {
    background: rgba(220, 38, 38, 0.86);
}

.channel-card-pill--resolution {
    background: rgba(15, 118, 110, 0.86);
}

.channel-card-pill--fps {
    background: rgba(37, 99, 235, 0.86);
}

.channel-card-info {
    padding: 16px;
    display: flex;
    gap: 12px;
}

.channel-card-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-round);
    object-fit: cover;
    border: 2px solid var(--border-light);
}

.channel-card-meta {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.channel-card-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-main);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    margin-bottom: 4px;
}

.channel-card-author {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    display: block;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

/* Social Share and QR */
.social-share-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.share-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background-color: var(--bg-dark-elevated);
    border: 1px solid var(--border-light);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: 16px;
}

.btn-social:hover {
    transform: translateY(-2px);
    color: white;
}

.btn-social.x-btn:hover {
    background-color: #000000;
    border-color: #333333;
}

.btn-social.wa-btn:hover {
    background-color: #25D366;
    border-color: #25D366;
}

.btn-social.fb-btn:hover {
    background-color: #1877F2;
    border-color: #1877F2;
}

.btn-social.tg-btn:hover {
    background-color: #26A5E4;
    border-color: #26A5E4;
}

.btn-social.ig-btn:hover {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    border-color: transparent;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: #141324;
    border: 1px solid var(--border-light);
    border-radius: 24px;
    width: 90%;
    max-width: 440px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    position: relative;
}

.modal.open .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: white;
}

.qr-canvas {
    background: white;
    padding: 12px;
    border-radius: 12px;
    margin: 20px auto;
    display: block;
}

/* Club listing styles */
.club-section {
    padding: 20px 16px;
    border-top: 1px solid var(--border-light);
}

.club-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.club-members-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.club-member {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    text-decoration: none;
    color: inherit;
}

.club-member:hover {
    background-color: var(--bg-dark-elevated);
}

.club-member img {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-round);
    object-fit: cover;
}

.club-member-meta {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-grow: 1;
}

.club-member-name {
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.club-member-status {
    font-size: 10px;
    color: var(--text-muted);
}

/* Demo Chat Mode Alert */
.demo-chat-banner {
    background: linear-gradient(90deg, rgba(124, 77, 255, 0.2), rgba(255, 123, 114, 0.2));
    border-bottom: 1px solid var(--border-light);
    padding: 8px 16px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #38bdf8;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Description collapse arrow styling */
.description-body {
    max-height: 80px;
    overflow: hidden;
    transition: max-height 0.3s ease;
    position: relative;
}

.description-body.expanded {
    max-height: 2000px;
}

.description-toggle-btn {
    background: none;
    border: none;
    color: var(--primary-hover);
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 4px;
    outline: none;
    margin-top: 8px;
}

.description-toggle-btn:hover {
    text-decoration: underline;
}

/* Helper hidden class */
.hidden {
    display: none !important;
}

.btn-creator-header:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px var(--primary-glow);
    filter: brightness(1.1);
}

/* Hide reconnect button in fullscreen */
.video-card:fullscreen #btnReload {
    display: none !important;
}

.video-card:-webkit-full-screen #btnReload {
    display: none !important;
}

/* Active stream resolution/codec badge */
.stream-info-badge {
    background-color: rgba(14, 165, 233, 0.1);
    border: 1px solid rgba(14, 165, 233, 0.25);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    color: var(--primary-hover);
    font-weight: 700;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-body);
}

/* ==========================================================================
   Estilos del Footer (Pie de Página)
   ========================================================================== */
.global-footer-container {
    width: 100%;
    padding: 0 30px;
    box-sizing: border-box;
    margin-top: 24px;
}

.site-footer {
    padding: 16px 0;
    border-top: 2px solid var(--accent-green);
    background-color: transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--text-muted);
    box-sizing: border-box;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.footer-brand {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text-main);
}

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition-fast);
}

.footer-link:hover {
    color: var(--primary-hover);
}

@media (max-width: 600px) {
    .site-footer {
        flex-direction: column;
        justify-content: center;
        gap: 8px;
        padding: 16px 0;
    }
}

/* Web Stream Audio Mixer & Fixed Responsive Preview Box */
.web-stream-preview-wrapper {
    position: relative;
    width: 100%;
    max-width: 560px;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px auto;
    border: 1px solid var(--panel-border, rgba(255, 255, 255, 0.1));
    box-sizing: border-box;
}

.web-stream-preview-video {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    background: #000;
    display: block;
}

.btn-web-stream-preview {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border, rgba(255, 255, 255, 0.15));
    border-radius: 12px;
    color: var(--text-primary, #fff);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    font-family: var(--font-heading);
    transition: all 0.3s ease;
}

.btn-web-stream-preview:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.btn-web-stream-start {
    padding: 10px 22px;
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    font-family: var(--font-heading);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-web-stream-start:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.btn-web-stream-start:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-web-stream-stop {
    padding: 10px 22px;
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    font-family: var(--font-heading);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-web-stream-stop:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.audio-mixer-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 15px;
}

.audio-mixer-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary, #94a3b8);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.audio-channel-row {
    display: grid;
    grid-template-columns: 140px 1fr 100px 36px;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.25);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

@media (max-width: 640px) {
    .audio-channel-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

.audio-channel-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary, #e2e8f0);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.vu-meter-track {
    width: 100%;
    height: 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.vu-meter-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #10b981 0%, #10b981 70%, #f59e0b 85%, #ef4444 100%);
    border-radius: 5px;
    transition: width 0.05s ease-out;
}

.audio-vol-slider {
    width: 100%;
    accent-color: #0ea5e9;
    cursor: pointer;
}

/* ==========================================================================
   Channel Past Recorded Streams Grid (Responsive 4x2 / 3x2 / 2x2 / 1x3)
   ========================================================================== */
.channel-videos-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    width: 100%;
}

@media (max-width: 1320px) {
    .channel-videos-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 14px;
    }
}

@media (max-width: 860px) {
    .channel-videos-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
}

@media (max-width: 540px) {
    .channel-videos-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* ==========================================================================
   Video Player Keyboard & Touch Gesture Feedback HUD
   ========================================================================== */
.video-gesture-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    overflow: hidden;
}

.gesture-hud-badge {
    position: absolute;
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid rgba(56, 189, 248, 0.45);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7), 0 0 18px rgba(56, 189, 248, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #ffffff;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 15px;
    padding: 10px 20px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    user-select: none;
    z-index: 52;
}

.gesture-hud-badge.show {
    opacity: 1;
    transform: scale(1);
}

.gesture-hud-badge.hud-left {
    left: 12%;
}

.gesture-hud-badge.hud-right {
    right: 12%;
}

.gesture-hud-badge.hud-center {
    top: 15%;
}

/* Feathered semicircular ripple pulse */
.gesture-ripple {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 51;
}

.gesture-ripple.ripple-left {
    left: 0;
    border-radius: 0 100% 100% 0 / 0 50% 50% 0;
    background: radial-gradient(ellipse at 35% 50%, rgba(56, 189, 248, 0.22) 0%, rgba(56, 189, 248, 0.08) 45%, rgba(56, 189, 248, 0) 80%);
    mask-image: radial-gradient(ellipse at left center, black 40%, transparent 95%);
    -webkit-mask-image: radial-gradient(ellipse at left center, black 40%, transparent 95%);
}

.gesture-ripple.ripple-right {
    right: 0;
    border-radius: 100% 0 0 100% / 50% 0 0 50%;
    background: radial-gradient(ellipse at 65% 50%, rgba(56, 189, 248, 0.22) 0%, rgba(56, 189, 248, 0.08) 45%, rgba(56, 189, 248, 0) 80%);
    mask-image: radial-gradient(ellipse at right center, black 40%, transparent 95%);
    -webkit-mask-image: radial-gradient(ellipse at right center, black 40%, transparent 95%);
}

.gesture-ripple.show {
    opacity: 1;
    transform: scale(1);
}


/* ==========================================================================
   Top-Right Video Status & Buffering Indicator
   ========================================================================== */
.video-top-indicators {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    z-index: 60 !important;
    pointer-events: none !important;
    user-select: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.video-buffering-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #38bdf8;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.9), 0 0 3px #ffffff;
    display: none;
    pointer-events: none;
}

.video-buffering-dot.active {
    display: block !important;
    animation: bufferDotBlink 0.8s ease-in-out infinite;
}

@keyframes bufferDotBlink {
    0%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
        box-shadow: 0 0 4px rgba(56, 189, 248, 0.4);
    }
    50% {
        opacity: 1;
        transform: scale(1.3);
        box-shadow: 0 0 12px rgba(56, 189, 248, 0.95), 0 0 5px #ffffff;
    }
}

.video-play-pause-badge {
    display: none;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 16px;
    color: #ffffff;
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

.video-play-pause-badge.show {
    display: inline-flex !important;
    animation: fadeInPlay 0.2s ease-out;
}

@keyframes fadeInPlay {
    from { opacity: 0; transform: translateY(-3px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.video-play-pause-badge .badge-icon {
    font-size: 9px;
    color: #38bdf8;
}

/* ==========================================================================
   Responsive Video Player Modal (Mobile Vertical & Desktop Layouts)
   ========================================================================== */
.video-player-modal-content {
    width: 98vw;
    max-width: 98vw;
    height: 94vh;
    max-height: 96vh;
    padding: 14px 18px;
    background: #0b1324;
    border: 1px solid var(--border-light, rgba(255, 255, 255, 0.1));
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85);
    overflow: hidden;
}

.video-player-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    flex-shrink: 0;
    position: relative;
}

.video-player-modal-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 40px;
}

.video-player-modal-body {
    display: flex;
    gap: 14px;
    flex: 1;
    min-height: 0;
    align-items: stretch;
    height: 100%;
    overflow: hidden;
}

.modal-video-col {
    flex: 1;
    min-width: 0;
    height: 100%;
    position: relative;
    background: #000000;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: block; /* Block layout prevents flex sibling displacement */
    user-select: none;
    touch-action: manipulation;
}

/* Fullscreen mode on video wrapper */
.modal-video-col:fullscreen,
.modal-video-col:-webkit-full-screen,
.modal-video-col:-moz-full-screen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
    background: #000000 !important;
}

.modal-video-col:fullscreen video,
.modal-video-col:-webkit-full-screen video,
.modal-video-col:-moz-full-screen video {
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    object-fit: contain !important;
}

.modal-video-col:fullscreen .video-top-indicators,
.modal-video-col:-webkit-full-screen .video-top-indicators {
    top: 24px !important;
    right: 24px !important;
    z-index: 2147483647 !important;
}

.modal-video-col:fullscreen .video-gesture-overlay,
.modal-video-col:-webkit-full-screen .video-gesture-overlay {
    z-index: 2147483646 !important;
}

.modal-video-col video {
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    position: absolute;
    inset: 0;
}

.modal-chat-col {
    flex: 0 0 320px;
    width: 320px;
    max-width: 340px;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #111b2e;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
    min-height: 0;
}

/* Mobile Vertical (Portrait) & Small Screens */
@media (max-width: 860px), (max-width: 1024px) and (orientation: portrait) {
    #videoPlayerModal.modal {
        padding: 0 !important;
        align-items: stretch !important;
        justify-content: stretch !important;
    }

    .video-player-modal-content {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100% !important;
        max-height: 100% !important;
        min-height: 100% !important;
        border-radius: 0 !important;
        border: none !important;
        padding: 10px 10px 14px 10px !important;
        background: #070d19 !important;
    }

    .video-player-modal-header {
        margin-bottom: 8px !important;
        padding: 0 4px;
    }

    .video-player-modal-title {
        font-size: 15px !important;
    }

    .video-player-modal-body {
        flex-direction: column !important;
        gap: 10px !important;
        height: calc(100% - 35px) !important;
    }

    .modal-video-col {
        flex: none !important;
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 16 / 9 !important;
        max-height: 40vh !important;
        border-radius: 10px !important;
    }

    .modal-chat-col {
        flex: 1 1 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: auto !important;
        min-height: 0 !important;
        border-radius: 10px !important;
    }
}

/* ==========================================================================
   Nebula Bulletproof Player Error & Diagnostic Overlay
   ========================================================================== */
.nebula-player-error-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.96), rgba(2, 6, 23, 0.98));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    color: #f8fafc;
    text-align: center;
    border-radius: inherit;
    animation: nebulaFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes nebulaFadeIn {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

.nebula-error-card {
    max-width: 520px;
    width: 100%;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(239, 68, 68, 0.3);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6), 0 0 25px rgba(239, 68, 68, 0.15);
    border-radius: 16px;
    padding: 24px 26px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.nebula-error-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
}

.nebula-error-title {
    font-size: 17px;
    font-weight: 700;
    color: #f8fafc;
    margin: 0;
}

.nebula-error-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.nebula-error-desc {
    font-size: 13px;
    line-height: 1.55;
    color: #cbd5e1;
    margin: 0;
    text-align: center;
}

.nebula-error-tip {
    font-size: 12px;
    color: #94a3b8;
    background: rgba(15, 23, 42, 0.6);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 14px;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    line-height: 1.45;
}

.nebula-error-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
    margin-top: 6px;
}

.nebula-btn-retry {
    background: #3b82f6;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.nebula-btn-retry:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.nebula-btn-mute-fallback {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.nebula-btn-mute-fallback:hover {
    background: rgba(16, 185, 129, 0.25);
    transform: translateY(-1px);
}

.nebula-btn-diag {
    background: rgba(255, 255, 255, 0.06);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.nebula-btn-diag:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.diag-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 13px;
}
.diag-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.diag-pill-ok {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}
.diag-pill-warn {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}
.diag-pill-bad {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

