/* ==========================================================================
   TV PARAGUAY (tvv.lat) — SMART TV DESIGN SYSTEM (10-FOOT UI)
   ========================================================================== */

:root {
    --bg-main: #07080D;
    --bg-surface: #10121A;
    --bg-card: #151824;
    --bg-card-hover: #1C2030;
    
    --accent-primary: #00F2FE;
    --accent-secondary: #4FACFE;
    --accent-live: #FF2A55;
    
    --text-primary: #FFFFFF;
    --text-secondary: #9AA0B4;
    --text-muted: #5C6275;
    
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-focus: #00F2FE;
    
    --glow-focus: 0 0 30px rgba(0, 242, 254, 0.5);
    --transition-fast: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

/* RESET */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    line-height: 1.4;
    overflow-x: hidden;
    user-select: none;
    -webkit-font-smoothing: antialiased;
}

/* FONDOS AMBIENTALES DECORATIVOS */
.glow-orb {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(140px);
    opacity: 0.18;
}

.glow-top-left {
    top: -200px;
    left: -200px;
    background: radial-gradient(circle, var(--accent-primary) 0%, transparent 70%);
}

.glow-bottom-right {
    bottom: -200px;
    right: -200px;
    background: radial-gradient(circle, var(--accent-secondary) 0%, transparent 70%);
}

/* CONTENEDOR PRINCIPAL */
.app-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0 4vw 4vh 4vw;
}

/* HEADER SUPERIOR */
.tv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0 16px 0;
    border-bottom: 1px solid var(--border-subtle);
}

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

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 26px;
    letter-spacing: 0.5px;
}

.logo-icon {
    font-size: 30px;
}

.accent-dot {
    color: var(--accent-primary);
    font-weight: 900;
}

.live-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 42, 85, 0.15);
    border: 1px solid rgba(255, 42, 85, 0.4);
    color: var(--accent-live);
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.8px;
}

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

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

/* GUÍA DE CONTROL REMOTO */
.remote-legend {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.04);
    padding: 6px 16px;
    border-radius: 24px;
    border: 1px solid var(--border-subtle);
    font-size: 13px;
}

.key-badge {
    background: rgba(255, 255, 255, 0.12);
    color: var(--accent-primary);
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 11px;
}

.legend-text {
    color: var(--text-secondary);
}

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

.channel-counter {
    font-size: 13px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 12px;
    border-radius: 12px;
}

.clock-display {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 22px;
    color: var(--text-primary);
}

/* BARRA DE CATEGORÍAS */
.categories-bar {
    display: flex;
    gap: 12px;
    padding: 20px 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.categories-bar::-webkit-scrollbar {
    display: none;
}

.cat-pill {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    padding: 10px 22px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition-fast);
}

.cat-pill:hover,
.cat-pill.active {
    background: rgba(0, 242, 254, 0.12);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* CONTENIDO Y SECCIÓN DE CANALES */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 20px;
}

.section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.quick-instructions {
    font-size: 14px;
    color: var(--text-muted);
}

.quick-instructions b {
    color: var(--accent-primary);
}

/* GRID DE CANALES */
.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 18px;
    padding-bottom: 40px;
}

/* TARJETA DE CANAL (10-FOOT UI) */
.channel-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 18px;
    cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 140px;
}

.channel-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.2);
}

/* ESTADO DE FOCO SMART TV (CRUCETA D-PAD) */
.focusable:focus,
.channel-card.focused,
.cat-pill.focused,
.hud-control-btn.focused,
.hud-btn-back.focused,
.btn-primary.focused,
.btn-secondary.focused {
    outline: none;
    border-color: var(--border-focus) !important;
    box-shadow: var(--glow-focus) !important;
    transform: scale(1.05) !important;
    z-index: 10;
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.channel-number {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 16px;
    color: var(--accent-primary);
    background: rgba(0, 242, 254, 0.1);
    padding: 3px 8px;
    border-radius: 6px;
}

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

.card-middle {
    margin: 12px 0 8px 0;
}

.channel-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: var(--text-primary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.channel-category-tag {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.fav-btn-icon {
    font-size: 16px;
    opacity: 0.3;
    transition: opacity 0.2s, transform 0.2s;
}

.fav-btn-icon.is-favorite {
    opacity: 1;
    color: #FFD700;
}

/* OVERLAY NUMÉRICO (Cuando el usuario presiona 1, 2, 3... en el control) */
.numeric-overlay {
    position: fixed;
    top: 40px;
    right: 40px;
    background: rgba(7, 8, 13, 0.9);
    border: 2px solid var(--accent-primary);
    box-shadow: var(--glow-focus);
    padding: 16px 28px;
    border-radius: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    backdrop-filter: blur(12px);
    transition: opacity 0.2s, transform 0.2s;
}

.numeric-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-20px);
}

.numeric-title {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 1px;
}

.numeric-digits {
    font-family: 'Outfit', sans-serif;
    font-size: 42px;
    font-weight: 900;
    color: var(--accent-primary);
    line-height: 1;
    margin-top: 4px;
}

/* REPRODUCTOR A PANTALLA COMPLETA */
.player-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000000;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-modal.hidden {
    display: none;
}

.player-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* SPINNER DE CARGA */
.player-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    z-index: 920;
    pointer-events: none;
    transition: opacity 0.3s;
}

.player-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loader-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* OVERLAY HUD INFORMATIVO */
.player-hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 36px 4vw;
    background: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, transparent 35%, transparent 65%, rgba(0,0,0,0.92) 100%);
    z-index: 910;
    pointer-events: auto;
    transition: opacity 0.35s ease;
}

.player-hud.autohidden {
    opacity: 0;
    pointer-events: none;
}

.hud-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hud-btn-back {
    background: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: var(--transition-fast);
}

.hud-btn-back:hover {
    background: rgba(0, 242, 254, 0.2);
    border-color: var(--accent-primary);
}

.hud-live-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 42, 85, 0.25);
    border: 1px solid var(--accent-live);
    color: #FFF;
    font-size: 13px;
    font-weight: 800;
    padding: 6px 14px;
    border-radius: 20px;
    letter-spacing: 1px;
}

.hud-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
}

.hud-channel-info {
    max-width: 60%;
}

.hud-channel-num {
    display: inline-block;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 18px;
    color: var(--accent-primary);
    background: rgba(0, 242, 254, 0.15);
    padding: 3px 10px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.hud-channel-name {
    font-family: 'Outfit', sans-serif;
    font-size: 34px;
    font-weight: 800;
    color: #FFFFFF;
    line-height: 1.15;
    margin-bottom: 6px;
}

.hud-channel-cat {
    font-size: 15px;
    color: var(--text-secondary);
}

.hud-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.hud-control-btn {
    background: rgba(255, 255, 255, 0.12);
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(12px);
    transition: var(--transition-fast);
}

.hud-control-btn:hover {
    background: rgba(0, 242, 254, 0.25);
    border-color: var(--accent-primary);
}

/* ERROR EN REPRODUCTOR */
.player-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(16, 18, 26, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 36px 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    z-index: 930;
    backdrop-filter: blur(16px);
}

.player-error.hidden {
    display: none;
}

.error-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.player-error h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    margin-bottom: 8px;
}

.player-error p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.error-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-primary {
    background: var(--accent-primary);
    color: #07080D;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #FFF;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

/* BARRA INFERIOR MÓVIL (OCULTA EN PC Y SMART TV) */
.mobile-bottom-nav {
    display: none;
}

/* ==========================================================================
   DISEÑO ESPECÍFICO PARA CELULAR Y TABLET (PANTALLAS TÁCTILES)
   ========================================================================== */
@media (max-width: 768px) {
    /* Ocultar elementos de TV */
    .remote-legend,
    .channel-counter,
    .clock-display,
    .quick-instructions,
    .numeric-overlay {
        display: none !important;
    }

    /* Padding de página adaptado a celular */
    .app-container {
        padding: 0 16px 85px 16px;
    }

    /* Header móvil compacto */
    .tv-header {
        padding: 14px 0 10px 0;
    }

    .brand-logo {
        font-size: 20px;
    }

    .logo-icon {
        font-size: 22px;
    }

    .live-pill {
        font-size: 10px;
        padding: 2px 8px;
    }

    /* Barra de categorías en móvil */
    .categories-bar {
        padding: 10px 0 14px 0;
        gap: 8px;
    }

    .cat-pill {
        padding: 7px 14px;
        font-size: 13px;
        border-radius: 20px;
    }

    .section-title {
        font-size: 18px;
        margin-bottom: 12px;
    }

    /* Grilla de canales compacta en 2 columnas */
    .channels-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding-bottom: 20px;
    }

    .channel-card {
        min-height: 100px;
        padding: 12px;
        border-radius: 14px;
        border: 1px solid rgba(255, 255, 255, 0.07);
    }

    .channel-card:active {
        transform: scale(0.96) !important;
    }

    .channel-number {
        font-size: 12px;
        padding: 2px 6px;
    }

    .channel-title {
        font-size: 14px;
        margin: 6px 0 4px 0;
        font-weight: 600;
    }

    .channel-category-tag {
        font-size: 11px;
    }

    /* REPRODUCTOR MÓVIL STICKY ESTILO YOUTUBE */
    body.mobile-playing {
        overflow-x: hidden;
    }

    body.mobile-playing .tv-header {
        display: none;
    }

    body.mobile-playing .app-container {
        padding-top: 0;
    }

    body.mobile-playing #player-modal {
        position: sticky;
        top: 0;
        left: 0;
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
        z-index: 1000;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.8);
        display: flex;
        border-bottom: 2px solid rgba(0, 242, 254, 0.3);
    }

    body.mobile-playing #player-modal:fullscreen,
    body.mobile-playing #player-modal.is-fullscreen {
        position: fixed;
        width: 100vw;
        height: 100vh;
        aspect-ratio: unset;
        z-index: 9999;
    }

    /* HUD en móvil */
    .player-hud {
        padding: 14px 16px;
    }

    .hud-btn-back {
        padding: 8px 14px;
        font-size: 12px;
    }

    .hud-channel-name {
        font-size: 18px;
    }

    .hud-channel-num {
        font-size: 13px;
        padding: 2px 6px;
    }

    .hud-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .hud-controls {
        width: 100%;
        display: flex;
        justify-content: space-between;
        gap: 6px;
    }

    .hud-control-btn {
        padding: 8px 10px;
        font-size: 11px;
        flex: 1;
        text-align: center;
        border-radius: 8px;
    }

    /* BARRA DE NAVEGACIÓN INFERIOR (PULGAR) */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 62px;
        background: rgba(13, 15, 23, 0.96);
        backdrop-filter: blur(20px);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        z-index: 800;
        justify-content: space-around;
        align-items: center;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .mobile-nav-btn {
        background: transparent;
        border: none;
        color: var(--text-muted);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        font-size: 10px;
        font-weight: 600;
        cursor: pointer;
        padding: 6px 12px;
        transition: var(--transition-fast);
        border-radius: 8px;
    }

    .mobile-nav-btn:active {
        transform: scale(0.92);
    }

    .mobile-nav-btn.active {
        color: var(--accent-primary);
    }

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