/* =========================================
   1. VARIABLES Y TEMA
   ========================================= */
:root {
    --bg-body: #1a1a1a;
    --bg-container: #222;
    --bg-aux: #333;
    --bg-nav: #252525;
    --bg-card: #2a2a2a;
    --text-main: #eee;
    --text-muted: #aaa;
    --text-on-corp: #ffffff; /* Texto blanco para fondos oscuros */
    --border-color: #444;
    --gradient-info: linear-gradient(180deg, #222 0%, #111 100%);
    --link-color: #3498db;
    --bg-modal: rgba(0,0,0,0.9);
}


[data-theme="light"] {
    --bg-body: #c6c6c6;
    --bg-container: #fff;
    --bg-aux: #9f2b68;      /* Color de tu cliente */
    --bg-nav: #9f2b68;      /* Color de tu cliente */
    --bg-card: #fff;
    --bg-playlistside: #ffffff;
    --text-main: #1c1e21;
    --text-muted: #65676b;
    --text-on-corp: #ffffff; /* Texto blanco sobre el púrpura del cliente */
    --border-color: #ddd;
    --gradient-info: linear-gradient(180deg, #ffffff 0%, #dcdde1 100%);
    --link-color: #9f2b68;  /* El enlace ahora es del color corporativo */
    --bg-modal: rgba(255,255,255,0.9);
}

/* =========================================
   1.1 HIPERVÍNCULOS Y ESTADOS AUXILIARES (Versión Definitiva)
   ========================================= */
a {
    transition: color 0.3s ease;
}

/* Hover general para el resto de la web */
a:hover {
    color: var(--link-color);
}

/* REGLAS PARA ZONAS CORPORATIVAS (Aux-bar y Nav-bar) */

/* 1. Forzamos blanco para textos y links */
#aux-bar, #aux-bar a, #aux-bar i,
#nav-bar-content, #nav-bar-content a, #nav-bar-content i {
    color: var(--text-on-corp) !important;
}

/* EXCEPCIÓN REFORZADA: La lupa y el icono de borrar del buscador */
#nav-bar-content .search-box i, 
#nav-bar-content .clear-search {
    color: var(--text-muted) !important;
    opacity: 1 !important;
}

/* 2. Opacidad para elementos no seleccionados (idiomas y menú) */
#aux-bar .lang-selector a,
.nav-item {
    opacity: 0.6;
    text-decoration: none !important;
}

/* 3. Estado ACTIVO (Idiomas y Menú Videos/Playlists) */
#aux-bar .lang-selector a.active,
.nav-item.active {
    opacity: 1 !important;
    font-weight: bold;
    text-decoration: none !important;
}

/* Especial para el idioma activo con subrayado */
#aux-bar .lang-selector a.active {
    text-decoration: underline !important; 
}

/* 4. HOVER PROTEGIDO: Evita que el texto se vuelva púrpura al tocarlo */
#aux-bar a:hover, 
#nav-bar-content a:hover,
.btn-login-submit:hover {
    color: var(--text-on-corp) !important;
    opacity: 1 !important;
    filter: brightness(0.9);
}


/* =========================================
   2. ESTILOS GENERALES
   ========================================= */
body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: 'Segoe UI', sans-serif;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Mejora: Añadido 'background' a la transición para el degradado suave */
    transition: background-color 0.3s, color 0.3s, background 0.3s;
}

/* =========================================
   3. MODALES (Splash y Login)
   ========================================= */
#splash-overlay, #login-overlay {
    position: fixed; top:0; left:0; width:100%; height:100%;
    background: var(--bg-modal);
    z-index: 10000;
    display: none;
    align-items: center; justify-content: center;
    backdrop-filter: blur(5px);
}

#splash-content {
    background: var(--bg-container);
    width: 90%; max-width: 500px;
    padding: 40px; border-radius: 15px;
    border: 2px solid var(--link-color);
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.splash-text { font-size: 18px; line-height: 1.6; margin-bottom: 30px; }
.btn-splash-close {
    background: var(--link-color); color: #fff; border: none;
    padding: 12px 40px; border-radius: 30px; cursor: pointer;
    font-weight: bold; font-size: 16px; transition: 0.3s;
}

#login-content {
    background: var(--bg-card);
    width: 90%; max-width: 350px;
    padding: 30px; border-radius: 10px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    position: relative; text-align: center;
}

#login-content h2 { 
    margin-top: 0; 
    margin-bottom: 20px; 
    font-size: 22px; 
    color: var(--text-main); 
}

.login-field {
    width: 100%; padding: 12px; margin: 8px 0;
    background: var(--bg-body); 
    border: 1px solid var(--border-color);
    color: var(--text-main); 
    border-radius: 5px; 
    box-sizing: border-box; 
    outline: none;
}
.login-field:focus { border-color: var(--link-color); }

.btn-login-submit {
    width: 100%; padding: 12px;
    background: var(--link-color); 
    color: var(--text-on-corp); /* Cambiado de #fff a variable para asegurar visibilidad */
    border: none; border-radius: 5px; cursor: pointer;
    font-weight: bold; font-size: 16px; margin-top: 15px; transition: 0.2s;
}
.btn-login-submit:hover { opacity: 0.9; }

.close-login-btn {
    position: absolute; top: 10px; right: 15px;
    font-size: 24px; cursor: pointer; 
    color: var(--text-muted);
}
.close-login-btn:hover { color: var(--text-main); }

/* =========================================
   4. ESTRUCTURA PRINCIPAL (Header & Layout)
   ========================================= */
#main-container {
    width: 1280px; min-height: 100vh;
    background-color: var(--bg-container);
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    display: flex; flex-direction: column;
}

header img { width: 1280px; height: 80px; object-fit: cover; }

#aux-bar {
    height: 35px; background-color: var(--bg-aux);
    color: var(--text-on-corp); /* Forzamos que el texto general sea blanco */
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 20px; font-size: 13px; border-bottom: 1px solid var(--border-color);
}

/* Forzamos que los enlaces ES | CA también sean blancos */
#aux-bar a {
    color: var(--text-on-corp);
    text-decoration: none;
}

.theme-switch { display: flex; align-items: center; gap: 15px; }
.theme-switch i { cursor: pointer; font-size: 16px; opacity: 0.8; transition: 0.3s; }

/* El icono del sol/luna ahora también será blanco sobre el púrpura */
.theme-switch i:not(.logout-icon) { color: var(--text-on-corp); }
.theme-switch i:hover { opacity: 1; filter: brightness(1.2); }

.logout-icon { color: #ff4d4d !important; opacity: 1 !important; }

.login-trigger {
    margin-right: 5px; 
    color: var(--text-on-corp); /* Antes era text-muted, ahora blanco */
    text-decoration: none;
    font-weight: 600; font-size: 13px; display: flex; align-items: center;
    gap: 6px; cursor: pointer; transition: 0.3s;
}
.login-trigger:hover { filter: brightness(0.8); }

/* =========================================
   5. REPRODUCTOR Y VIDEO INFO
   ========================================= */
#player-section {
    width: 1280px; 
    max-width: 100%;
    background-color: #000; 
    aspect-ratio: 16/9;
    display: flex; 
    align-items: center; 
    justify-content: center;
    overflow: hidden; 
    position: relative;
    margin: 0 auto;
}

/* Ajuste fino para Video.js: centrado automático si el video no es 16:9 */
.video-js .vjs-tech {
    object-fit: contain; /* Mantiene la proporción sin deformar */
}

.preroll-overlay {
    position: absolute; top: 20px; left: 20px;
    background: rgba(0, 0, 0, 0.7); color: white;
    padding: 8px 15px; border-radius: 5px;
    font-size: 13px; font-weight: 600; z-index: 10;
    pointer-events: none; display: flex; align-items: center;
    gap: 10px; border-left: 3px solid var(--link-color);
    backdrop-filter: blur(4px);
}

#video-info { padding: 15px 30px; background: var(--gradient-info); border-bottom: 2px solid var(--border-color); }
#video-info h1 { margin: 0; font-size: 26px; color: var(--text-main); display: flex; align-items: center; }
.meta-info { color: var(--text-muted); font-size: 14px; margin-top: 8px; display: flex; gap: 20px; align-items: center; }

.btn-share {
    background: none; border: none; color: var(--link-color);
    cursor: pointer; font-size: 14px; display: flex; align-items: center;
    gap: 5px; padding: 5px 10px; border-radius: 5px; transition: 0.2s;
}
.btn-share:hover { background: rgba(52, 152, 219, 0.1); }

.description { margin-top: 12px; line-height: 1.6; color: var(--text-main); font-size: 15px; max-width: 1000px; }
.description a { color: var(--link-color); text-decoration: none; font-weight: 600; transition: 0.2s; }
.description a:hover { text-decoration: underline; opacity: 0.8; }

/* =========================================
   6. BARRA DE NAVEGACIÓN (Sin subrayados)
   ========================================= */
#nav-bar-content {
    height: 50px; background-color: var(--bg-nav);
    display: flex; align-items: center; padding: 0 25px;
    border-bottom: 1px solid var(--border-color);
}

.nav-item {
    display: flex; align-items: center; gap: 8px; margin-right: 30px;
    color: var(--text-on-corp); 
    text-decoration: none !important; /* Adiós subrayados */
    font-weight: 500; /* Un poco menos grueso por defecto */
    opacity: 0.6; /* Los no seleccionados se ven más discretos */
    transition: 0.3s;
}

/* El item activo brilla al 100% y se pone en negrita */
.nav-item.active { 
    color: var(--text-on-corp) !important; 
    opacity: 1;
    font-weight: 700; /* Más negrita para que destaque */
    text-decoration: none !important; 
}

/* Al pasar el ratón, también brilla al 100% */
.nav-item:hover { 
    opacity: 1;
    text-decoration: none !important;
}

/* Mantengo el buscador y selector intactos como pediste */
.search-box {
    margin-left: auto; display: flex; align-items: center;
    background: var(--bg-body); border: 1px solid var(--border-color);
    border-radius: 20px; padding: 5px 15px; gap: 8px;
}
.search-box input { background: transparent; border: none; color: var(--text-main); padding: 5px; outline: none; width: 180px; }
.clear-search { cursor: pointer; color: var(--text-muted); margin-left: 10px; font-size: 14px; text-decoration: none; }

#cat-select {
    margin-left: 63px; padding: 5px; border-radius: 8px;
    background: var(--bg-body); color: var(--text-main);
    border: 1px solid var(--border-color);
}

/* =========================================
   7. GRID Y CARDS (Unificado)
   ========================================= */
#grid-container {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 20px; padding: 25px; flex-grow: 1; align-content: start;
}

.card {
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border-color);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    top: 0;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 6px 6px rgba(0,0,0,0.5);
    border-color: var(--link-color);
}

.card img {
    width: 100%; height: 165px; object-fit: cover;
    transition: transform 0.6s ease, filter 0.3s ease;
    filter: brightness(0.9);
}

.card:hover img { transform: scale(1.05); filter: brightness(1.1); }
.card-body { padding: 15px; }

.card-title {
    font-weight: bold; margin-bottom: 5px;
    min-height: 2.8em; line-height: 1.4em;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}

.card:hover .card-title { color: var(--link-color); transition: color 0.3s ease; }

.card-meta {
    font-size: 12px; color: var(--text-muted);
    display: flex; justify-content: space-between;
    align-items: center; margin-top: 10px;
}

.card::after {
    content: ""; position: absolute; top: 162px; left: 0;
    width: 0%; height: 3px; background: var(--link-color);
    transition: width 0.4s ease; z-index: 2;
}
.card:hover::after { width: 100%; }

/* =========================================
   8. PAGINADOR Y FOOTER
   ========================================= */
.paginator { 
    display: flex; 
    justify-content: center; 
    gap: 10px; 
    padding: 20px 0 40px 0; 
}

.pag-btn {
    padding: 8px 16px; 
    border-radius: 5px;
    background: var(--bg-card); 
    /* 2. Usamos el púrpura para el texto en lugar de negro/gris */
    color: var(--link-color); 
    text-decoration: none !important; 
    /* 1. Borde púrpura para que se perciba claramente */
    border: 2px solid var(--link-color); 
    font-weight: bold; 
    transition: all 0.3s ease;
}

/* EFECTO HOVER: Invertimos colores para que resalte */
.pag-btn:hover {
    background: var(--link-color); 
    color: var(--text-on-corp) !important;
    border-color: var(--link-color);
    transform: translateY(-2px);
    text-decoration: none !important;
}

/* BOTÓN ACTIVO: Relleno sólido */
.pag-btn.active {
    background: var(--link-color); 
    color: var(--text-on-corp) !important;
    border-color: var(--link-color); 
    pointer-events: none;
    text-decoration: none !important;
}

/* --- FOOTER UNIFICADO --- */
footer {
    height: 40px; 
    background-color: var(--bg-nav) !important;
    border-top: 1px solid var(--border-color);
    display: flex; 
    justify-content: space-between;
    align-items: center; 
    padding: 0 25px;
    font-size: 13px; 
    color: var(--text-on-corp) !important; 
}

footer a, .footer-left a {
    color: var(--text-on-corp) !important;
    text-decoration: none !important;
    margin-left: 15px;
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

.footer-left a:first-child {
    margin-left: 0;
}

footer a:hover, .footer-left a:hover {
    opacity: 1 !important;
    text-decoration: none !important;
}

/* =========================================
   9. VISTA ESPECÍFICA: PLAYLIST INTERNA
   ========================================= */
#playlist-layout {
    display: flex; 
    background: var(--bg-body);
    flex-grow: 1; 
    min-height: 0;
}

#playlist-sidebar {
    width: 320px; 
    background: var(--bg-nav); 
    border-right: 1px solid var(--border-color);
    padding: 25px; 
    text-align: center;
    flex-shrink: 0; 
    display: flex; 
    flex-direction: column;
    /* Aseguramos que los textos del sidebar se adapten al fondo */
    color: var(--text-main);
}

/* En modo LIGHT, el sidebar es blanco, así que el texto debe ser oscuro */
[data-theme="light"] #playlist-sidebar {
    background: var(--bg-playlistside) !important;
    color: var(--text-main);
}

.pl-poster {
    width: 100%; border-radius: 8px;
    margin-bottom: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* BOTÓN VOLVER: Estilo similar a tu nuevo paginador */
.btn-back-playlist {
    text-decoration: none !important; 
    color: var(--link-color);
    font-size: 14px; 
    font-weight: 600; 
    padding: 10px;
    border: 2px solid var(--link-color); 
    border-radius: 5px;
    transition: 0.3s; 
    background: transparent; /* Fondo transparente para que respire */
}

.btn-back-playlist:hover { 
    background: var(--link-color); 
    color: var(--text-on-corp) !important; 
}

#playlist-items {
    flex-grow: 1; 
    background: var(--bg-container);
    display: flex; 
    flex-direction: column; 
    overflow-y: auto;
}

.video-row {
    display: flex; 
    align-items: center; 
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none !important; 
    color: var(--text-main);
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative; 
    border-left: 0px solid transparent;
}

/* HOVER DE FILA: Cuidado con el púrpura aquí */
.video-row:hover {
    /* En Light, usamos un gris muy suave para que el texto negro siga leyéndose */
    background: var(--bg-body); 
    padding-left: 30px;
    border-left: 6px solid var(--link-color);
}

/* FILA ACTIVA: Aquí sí podemos usar el púrpura porque forzamos texto blanco */
.video-row.active { 
    background: var(--link-color) !important; 
    border-left: 6px solid var(--link-color); 
    pointer-events: none; 
}

.video-row.active .v-title,
.video-row.active .v-dur { 
    color: var(--text-on-corp) !important; 
}

.v-thumb {
    width: 120px; height: 68px; object-fit: cover;
    border-radius: 4px; margin-right: 20px;
    transition: transform 0.4s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.v-info { display: flex; flex-direction: column; gap: 4px; }
.v-title { font-weight: 600; font-size: 15px; transition: color 0.3s ease; }
.v-dur { font-size: 12px; color: var(--text-muted); }

/* Al hacer hover, el título se vuelve púrpura (solo si la fila no es la activa) */
.video-row:not(.active):hover .v-title { 
    color: var(--link-color); 
}

/* =========================================
   10. AJUSTES PARA SMARTPHONE (RESPONSIVE)
   ========================================= */

@media (max-width: 1280px) {
    /* 1. Contenedores fluidos */
    #main-container, header img, #player-section {
        width: 100% !important;
        height: auto;
    }

    /* 2. Navegación en una línea con scroll horizontal */
    #nav-bar-content {
        height: 60px;
        display: flex;
        flex-direction: row; /* Forzamos una sola línea */
        overflow-x: auto;    /* Scroll horizontal si no cabe */
        white-space: nowrap; /* Evita que los textos salten de línea */
        padding: 0 15px;
        gap: 20px;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch; /* Suavidad en iOS */
    }

    #nav-bar-content::-webkit-scrollbar { display: none; } /* Ocultamos barra de scroll */

    .nav-item {
        margin-right: 0;
        flex-shrink: 0; /* No se encogen, mantienen su tamaño */
        opacity: 1;
    }

    /* Ajuste de buscador y select para que no rompan la línea */
    #cat-select, .search-box {
        margin-left: 0;
        flex-shrink: 0;
    }

    /* 3. Grid de 2 columnas con cards un 25% más altas */
    #grid-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 15px;
    }

    .card img {
        height: 210px; /* Aumentado para dar ese aspecto más vertical/grande */
    }

    .card-body {
        padding: 18px; /* Un poco más de cuerpo */
    }

    .card-title {
        font-size: 1.1em; /* Título un poco más legible */
    }
}
