/* ==========================================================================
   TV CHANNEL WEB - ESTILOS DEL REPRODUCTOR DE TELEVISIÓN
   Diseño de transmisión profesional sin logos ni controles de YouTube
   ========================================================================== */

:root {
    --tv-bg: #000000;
    --tv-accent: #ef4444; /* Rojo transmisión en vivo */
    --tv-accent-glow: rgba(239, 68, 68, 0.4);
    --tv-primary: #6366f1;
    --tv-primary-glow: rgba(99, 102, 241, 0.35);
    
    --tv-glass-bg: rgba(10, 14, 26, 0.75);
    --tv-glass-border: rgba(255, 255, 255, 0.12);
    --tv-glass-blur: blur(20px);
    
    --tv-text: #ffffff;
    --tv-text-dim: #94a3b8;
    
    --transition-smooth: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--tv-bg);
    color: var(--tv-text);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: relative;
}

/* --------------------------------------------------------------------------
   TV SCREEN & IFRAME WRAPPER (Recorte total de branding de YouTube)
   -------------------------------------------------------------------------- */
.tv-viewport {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

/* Contenedor del video con escala 106% para ocultar bordes, títulos y marcas de agua de YouTube */
.tv-video-container {
    position: absolute;
    top: -3.5%;
    left: -3.5%;
    width: 107%;
    height: 107%;
    pointer-events: none;
    overflow: hidden;
    background: #000;
}

.tv-video-container iframe,
.tv-video-container #ytPlayer {
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none;
}

/* Escudo protector invisible para capturar clics e impedir interacción nativa con YouTube */
.tv-interaction-shield {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    cursor: default;
    background: transparent;
}

/* --------------------------------------------------------------------------
   ESTÁTICA / RUIDO ANALÓGICO DE CAMBIO DE CANAL
   -------------------------------------------------------------------------- */
.tv-static-noise {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    pointer-events: none;
    opacity: 0;
    background-image: repeating-radial-gradient(circle at 17% 32%, white, black 0.00085px);
    background-size: 200px 200px;
    transition: opacity 0.08s ease;
}

.tv-static-noise.active {
    opacity: 0.95;
    animation: staticFlicker 0.15s steps(4) infinite;
}

@keyframes staticFlicker {
    0% { background-position: 0 0; }
    25% { background-position: -50px 30px; }
    50% { background-position: 40px -40px; }
    75% { background-position: -20px -20px; }
    100% { background-position: 10px 50px; }
}

/* --------------------------------------------------------------------------
   STATION BUG / MARCA DE AGUA DEL CANAL (Superior Izquierda / Derecha)
   -------------------------------------------------------------------------- */
.tv-station-bug {
    position: absolute;
    top: 28px;
    right: 36px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(10, 14, 26, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 999px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    transition: var(--transition-smooth);
}

.tv-station-logo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1e1b4b;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
}

.tv-station-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tv-station-info {
    display: flex;
    flex-direction: column;
}

.tv-station-name {
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #ffffff;
    text-transform: uppercase;
}

.tv-station-badge-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: var(--tv-accent);
}

.live-indicator .pulse-dot {
    width: 6px;
    height: 6px;
    background-color: var(--tv-accent);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--tv-accent);
    animation: livePulse 1.4s infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

.tv-channel-number {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    color: #94a3b8;
    font-weight: 700;
}

.tv-station-clock {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #cbd5e1;
    font-weight: 600;
    margin-left: 4px;
    padding-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
}

/* --------------------------------------------------------------------------
   TV CHANNEL OSD (On-Screen Display - Banner Superior de Programa)
   -------------------------------------------------------------------------- */
.tv-osd-banner {
    position: absolute;
    top: 28px;
    left: 36px;
    z-index: 12;
    background: var(--tv-glass-bg);
    backdrop-filter: var(--tv-glass-blur);
    -webkit-backdrop-filter: var(--tv-glass-blur);
    border: 1px solid var(--tv-glass-border);
    border-radius: 16px;
    padding: 16px 24px;
    max-width: 540px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    transform: translateY(0);
    opacity: 1;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}

.tv-osd-banner.hidden {
    transform: translateY(-80px);
    opacity: 0;
    pointer-events: none;
}

.tv-osd-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.tv-osd-ch-badge {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.05em;
}

.tv-osd-status {
    font-size: 0.74rem;
    color: #94a3b8;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.06em;
}

.tv-osd-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.tv-osd-progress-wrap {
    margin-top: 10px;
}

.tv-osd-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    overflow: hidden;
}

.tv-osd-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ef4444, #f59e0b);
    border-radius: 2px;
    transition: width 1s linear;
}

.tv-osd-time-row {
    display: flex;
    justify-content: space-between;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 4px;
}

.tv-osd-next {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.78rem;
    color: #cbd5e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tv-osd-next span {
    color: #ef4444;
    font-weight: 700;
}

/* --------------------------------------------------------------------------
   TV CONTROLS DECK (Barra de Control Inferior - Estilo Broadcast TV)
   -------------------------------------------------------------------------- */
.tv-controls-deck {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    z-index: 15;
    background: var(--tv-glass-bg);
    backdrop-filter: var(--tv-glass-blur);
    -webkit-backdrop-filter: var(--tv-glass-blur);
    border: 1px solid var(--tv-glass-border);
    border-radius: 20px;
    padding: 10px 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7), 0 0 1px 1px rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 1;
    pointer-events: auto;
    max-width: 90vw;
}

.tv-controls-deck.idle-hidden {
    transform: translateX(-50%) translateY(90px);
    opacity: 0;
    pointer-events: none;
}

/* Botones de Control */
.tv-ctrl-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    flex-shrink: 0;
}

.tv-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.tv-ctrl-btn:active {
    transform: translateY(0);
}

.tv-ctrl-btn.active {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--tv-accent);
    color: var(--tv-accent);
}

.tv-ctrl-btn.btn-play-pause {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    box-shadow: 0 4px 15px var(--tv-accent-glow);
}

.tv-ctrl-btn.btn-play-pause:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 6px 20px var(--tv-accent-glow);
}

/* Grupo de Volumen */
.tv-vol-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tv-vol-slider {
    width: 80px;
    height: 6px;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    transition: width 0.2s ease;
}

.tv-vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #ffffff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s ease;
}

.tv-vol-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Equalizador de audio simulado */
.tv-audio-visualizer {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 16px;
    padding: 0 4px;
}

.tv-audio-bar {
    width: 3px;
    background: #10b981;
    border-radius: 1px;
    height: 4px;
    transition: height 0.1s ease;
}

body.playing .tv-audio-bar:nth-child(1) { animation: eqBar 0.6s infinite ease-in-out alternate; }
body.playing .tv-audio-bar:nth-child(2) { animation: eqBar 0.8s 0.1s infinite ease-in-out alternate; }
body.playing .tv-audio-bar:nth-child(3) { animation: eqBar 0.5s 0.2s infinite ease-in-out alternate; }
body.playing .tv-audio-bar:nth-child(4) { animation: eqBar 0.7s 0.15s infinite ease-in-out alternate; }

@keyframes eqBar {
    0% { height: 3px; }
    100% { height: 16px; }
}

/* Separadores de grupo */
.tv-deck-separator {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.15);
}

/* Botón con texto */
.tv-ctrl-btn-text {
    width: auto;
    padding: 0 14px;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 700;
}

/* --------------------------------------------------------------------------
   CINTILLO DE NOTICIAS / MARQUEE TICKER (Inferior)
   -------------------------------------------------------------------------- */
.tv-news-ticker {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 34px;
    background: linear-gradient(90deg, #b91c1c 0%, #1e1b4b 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    z-index: 10;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.ticker-label {
    background: #ef4444;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 0 14px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    z-index: 2;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.4);
}

.ticker-content {
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    flex: 1;
}

.ticker-text {
    display: inline-block;
    padding-left: 100%;
    animation: marqueeScroll 35s linear infinite;
    font-size: 0.82rem;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.02em;
}

@keyframes marqueeScroll {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-100%, 0, 0); }
}

/* Si el ticker está activo, subir ligeramente los controles */
body.ticker-active .tv-controls-deck {
    bottom: 46px;
}

/* --------------------------------------------------------------------------
   PANTALLA DE SINTONIZACIÓN INICIAL (Unmute Overlay)
   -------------------------------------------------------------------------- */
.tv-unmute-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.tv-unmute-overlay.dismissed {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.unmute-card {
    background: var(--tv-glass-bg);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    padding: 36px 48px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 30px var(--tv-accent-glow);
    animation: floatCard 3s ease-in-out infinite;
    max-width: 90vw;
}

@keyframes floatCard {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.unmute-icon-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.15);
    border: 2px solid var(--tv-accent);
    box-shadow: 0 0 30px var(--tv-accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: var(--tv-accent);
}

.unmute-card h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.unmute-card p {
    font-size: 0.95rem;
    color: var(--tv-text-dim);
    margin-bottom: 24px;
}

.btn-tune-in {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: #ffffff;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    padding: 14px 32px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 20px var(--tv-accent-glow);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition-smooth);
}

.btn-tune-in:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 30px var(--tv-accent-glow);
}

/* --------------------------------------------------------------------------
   GUÍA ELECTRÓNICA DE PROGRAMAS (EPG - Drawer Lateral)
   -------------------------------------------------------------------------- */
.tv-epg-drawer {
    position: absolute;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 90vw;
    height: 100%;
    background: rgba(10, 14, 26, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-left: 1px solid var(--tv-glass-border);
    z-index: 30;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.7);
}

.tv-epg-drawer.open {
    transform: translateX(0);
}

.epg-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.epg-header-title h3 {
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
}

.btn-close-epg {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: #94a3b8;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.btn-close-epg:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.epg-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.epg-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.epg-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(-4px);
}

.epg-item.current-playing {
    background: rgba(239, 68, 68, 0.12);
    border-color: var(--tv-accent);
}

.epg-item-thumb {
    width: 80px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    background: #000;
    flex-shrink: 0;
}

.epg-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.epg-item-playing-badge {
    position: absolute;
    top: 2px;
    left: 2px;
    background: #ef4444;
    color: #fff;
    font-size: 0.58rem;
    font-weight: 800;
    padding: 1px 4px;
    border-radius: 3px;
    text-transform: uppercase;
}

.epg-item-info {
    flex: 1;
    min-width: 0;
}

.epg-item-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.epg-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
    font-size: 0.72rem;
    color: #94a3b8;
    font-family: 'JetBrains Mono', monospace;
}

/* --------------------------------------------------------------------------
   RESPONSIVIDAD
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .tv-station-bug {
        top: 14px;
        right: 14px;
        padding: 6px 12px;
    }
    .tv-station-name {
        font-size: 0.75rem;
    }
    .tv-station-clock {
        display: none;
    }
    .tv-osd-banner {
        top: 14px;
        left: 14px;
        right: 14px;
        max-width: none;
        padding: 12px 16px;
    }
    .tv-osd-title {
        font-size: 0.95rem;
    }
    .tv-controls-deck {
        bottom: 16px;
        padding: 8px 14px;
        gap: 10px;
    }
    .tv-vol-slider {
        width: 50px;
    }
    .tv-ctrl-btn-text span {
        display: none;
    }
    .tv-ctrl-btn {
        width: 38px;
        height: 38px;
    }
}
