@charset "utf-8";

/* ==========================================================================
   VARIABLES GLOBALES (Tema Foxiz / SmartMag Premium)
   ========================================================================== */
:root {
    --bg-dark: #000000;
    --accent-red: #ff0000;
    --border-color: #2E2E2E;
    --text-main: #ffffff;
    --text-muted: #b3b3b3;
    --font-heading: 'Franklin Gothic', sans-serif;
    --font-body: 'Roboto', sans-serif;
}

/* ==========================================================================
   ESTRUCTURA GENERAL
   ========================================================================== */
.playlist-interna {
    background-color: var(--bg-dark);
    margin: 0;
    padding: 0;
}

.main-container {
    display: flex;
    max-width: 100%;
    margin: 0 auto;
    background-color: var(--bg-dark);
}

.video-and-content {
    flex: 2.2;
    background-color: var(--bg-dark);
    padding: 2px;
}

/* ==========================================================================
   REPRODUCTOR DE VIDEO (Elimina brincos y parpadeos)
   ========================================================================== */
.video-wrapper {
    position: relative;
    width: 100%;
    background-color: #000000; 
    aspect-ratio: 16 / 9;      /* Reserva el espacio exacto del video */
    overflow: hidden;
}

.video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: contain;       /* Adapta el video sin estirarlo */
    background-color: #000000; 
    display: block;
}

/* ==========================================================================
   BOTÓN DE AUDIO GLOBAL PERMANENTE (Sincronizado)
   ========================================================================== */
.global-audio-btn {
    position: absolute;
    top: 15px;
    right: 15px;               /* Esquina superior derecha (Lejos de los anuncios) */
    z-index: 15;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.global-audio-btn:hover {
    background: rgba(255, 0, 0, 0.9); 
    transform: scale(1.05);
}

/* Lógica de intercambio de iconos mediante clases CSS */
.global-audio-btn.muted .audio-icon-up {
    display: none; 
}

.global-audio-btn.muted .audio-icon-mute {
    display: block; 
}

.global-audio-btn.unmuted .audio-icon-mute {
    display: none; 
}

.global-audio-btn.unmuted .audio-icon-up {
    display: block; 
    color: #00ffcc;            /* Verde/azul brillante para audio activo */
}

/* ==========================================================================
   TEXTOS DEL VIDEO (Títulos y Descripciones)
   ========================================================================== */
#video-title {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: -0.5px;
    line-height: 1.2;
    font-family: var(--font-heading);
    color: var(--text-main);
    padding: 15px 20px 10px 20px;
    margin: 0;
    text-align: left;
}

.text-content {
    font-family: var(--font-heading);
    color: var(--text-main);
}

.text-content p {
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--text-muted);
    padding: 0 20px 15px 20px;
    margin: 0;
}

/* ==========================================================================
   CONTENEDOR DE LA PLAYLIST (Scroll)
   ========================================================================== */
.playlist-drawer {
    flex: 1.2;
    background-color: var(--bg-dark);
    overflow-y: auto;
    max-height: 492px;
}

.playlist-thumbnails {
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   MINIATURAS BLINDADAS (Consistencia Matemática Total)
   ========================================================================== */
.thumbnail-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;             /* Aumentamos un poco el espacio entre imagen y texto */
    cursor: pointer;
    padding: 12px 15px;    /* Más espacio interno para que respire el diseño */
    min-height: 89px;      /* CAMBIO CLAVE: Altura mínima flexible en lugar de fija */
    box-sizing: border-box;
    transition: background-color 0.2s;
    font-family: var(--font-body);
    color: var(--text-main);
    font-size: 0.9rem;
}

.thumbnail-item::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 5%;
    right: 5%;
    height: 1px;
    background-color: var(--border-color);
}

.thumbnail-item:hover {
    background-color: #141414;
}

.thumbnail-item.active {
    background-color: #0d0d0d;
}



.thumbnail-item img {
    width: 160px;          /* Aumentamos el ancho a 120px */
    aspect-ratio: 16 / 9;  /* El navegador calcula automáticamente el alto (67.5px) */
    object-fit: cover;     /* Mantiene el corte perfecto sin deformar */
    border-radius: 4px;
    flex-shrink: 0;        /* Evita que la imagen se encoja */
}




.thumbnail-item p {
    margin: 0;
    padding: 0;
    line-height: 1.25;     /* Un poquito más de espacio entre renglones para mejor lectura */
    display: -webkit-box;
    -webkit-line-clamp: 3; /* CAMBIO CLAVE: Ahora permite hasta 3 renglones de título */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* SOLUCIÓN AL ERROR: Oculto por defecto, solo se activa en la miniatura activa */
.now-playing-overlay {
    position: absolute;
    background: var(--accent-red);
    color: white;
    padding: 2px 6px;
    font-size: 0.85rem;
    font-weight: normal;
    top: 4px;
    left: 4px;
    border-radius: 2px;
    z-index: 2;
    display: none;             /* Oculto para todas las miniaturas */
}

/* Muestra el aviso "VIENDO" única y exclusivamente en el video activo */
.thumbnail-item.active .now-playing-overlay {
    display: block;            
}

/* ==========================================================================
   CONTROLES DE ANUNCIOS (Esquina Inferior Derecha)
   ========================================================================== */
.ad-controls-overlay {
    position: absolute;
    bottom: 15px;
    right: 15px;               /* Esquina inferior derecha */
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 4px;
    color: white;
    display: none;             /* Controlado dinámicamente por JS */
    align-items: center;
    gap: 10px;
    z-index: 10;
    font-family: var(--font-body);
}

.ad-countdown {
    font-size: 0.85rem;
}

.ad-btn, .skip-ad-btn {
    color: white;
    border: 1px solid white;
    padding: 4px 10px;
    cursor: pointer;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.8rem;
    background-color: #2F2F2F;
    display: none;             /* Controlado dinámicamente por JS */
    transition: background 0.2s;
}

.skip-ad-btn {
    background-color: #007bff;
}

.ad-btn:hover { background-color: #218838; }
.skip-ad-btn:hover { background-color: #0056b3; }

/* ==========================================================================
   CONSULTAS DE MEDIOS (Diseño Responsive)
   ========================================================================== */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    /* LÍNEA DIVISORIA EN MÓVILES: Separa el video/textos de las miniaturas inferiores */
    .video-and-content {
        border-bottom: 3px solid var(--border-color);
        padding-bottom: 10px;
    }

    #video-title {
        font-size: 1.2rem;
        padding: 12px 15px 6px 15px;
    }

    .text-content p {
        padding: 0 15px 10px 15px;
        font-size: 0.88rem;
    }

    .playlist-drawer {
        max-height: 350px;
    }

    .global-audio-btn {
        top: 10px;
        right: 10px;
        width: 38px;
        height: 38px;
        font-size: 14px;
    }

    .ad-controls-overlay {
        bottom: 10px;
        right: 10px;
        padding: 4px 8px;
        gap: 6px;
    }
    
    .ad-countdown { font-size: 0.75rem; }
    .ad-btn, .skip-ad-btn { font-size: 0.75rem; padding: 3px 6px; }
}
