:root {
    --bg-window: #13121A;      /* Fondo exterior más oscuro */
    --bg-main: #1C1A24;        /* Fondo del contenedor principal */
    --bg-card: #252233;        /* Fondo de tarjetas */
    --border-color: rgba(255, 255, 255, 0.04);
    
    /* Sapphire UI Accents */
    --accent-purple: #9D74FF;
    --accent-pink: #F87171;
    --accent-blue: #38BDF8;
    
    --text-main: #FFFFFF;
    --text-muted: #94A3B8;
}

/* =========================================
   SISTEMA DE AUTENTICACIÓN — ESTILOS BASE
   ========================================= */

/* Overlay con transición de opacidad (NO display toggle) */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,9,20,0.92);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
    /* Invisible por defecto */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.auth-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

/* Animación de entrada de la card del modal */
@keyframes authCardIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.auth-modal-card {
    animation: authCardIn 0.4s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
}

/* Spinner inline para botones de submit */
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.btn-auth-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

.spin {
    animation: spin 1s linear infinite;
}

/* Toast de notificación no bloqueante */
.auth-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-80px);
    background: #1e1c2e;
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    padding: 14px 22px;
    border-radius: 14px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    z-index: 99999;
    transition: transform 0.4s cubic-bezier(0.34, 1.2, 0.64, 1), opacity 0.3s;
    opacity: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 420px;
    white-space: nowrap;
}

.auth-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.auth-toast.warning { border-color: rgba(251,191,36,0.4); }
.auth-toast.error   { border-color: rgba(248,113,113,0.4); }
.auth-toast.success { border-color: rgba(52,211,153,0.4); }

body {
    margin: 0; padding: 0; 
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-window); 
    color: var(--text-main); 
    height: 100%; 
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Efectos de luz traseros estilo Sapphire UI */
body::before {
    content: ""; position: absolute; top: -100px; left: 20%; width: 400px; height: 400px;
    background: radial-gradient(circle, var(--accent-purple) 0%, transparent 70%);
    filter: blur(120px); opacity: 0.15; z-index: -1; pointer-events: none;
}
body::after {
    content: ""; position: absolute; bottom: -100px; right: 20%; width: 500px; height: 500px;
    background: radial-gradient(circle, var(--accent-blue) 0%, transparent 70%);
    filter: blur(150px); opacity: 0.1; z-index: -1; pointer-events: none;
}

.app-container { 
    display: flex; 
    width: 100vw; 
    height: 100%; 
    background-color: transparent;
    overflow: hidden;
}

/* SIDEBAR Sapphire Style (Integrada pero visualmente separada) */
.sidebar { 
    width: 250px; padding: 30px 20px; 
    display: flex; flex-direction: column; z-index: 10;
    overflow-y: auto;
    min-height: 0;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.05); border-radius: 10px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.1); }

.logo { 
    margin-bottom: 50px; padding-left: 10px; display: flex; align-items: center; gap: 12px;
}
.logo .dot { 
    width: 28px; height: 28px; 
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue)); 
    border-radius: 8px; box-shadow: 0 0 20px rgba(157, 116, 255, 0.4);
}
.logo h2 { margin: 0; font-size: 1.2rem; font-weight: 700; letter-spacing: 0.5px;}

.section-label { 
    font-size: 0.7rem; color: #475569; font-weight: 800; letter-spacing: 1px; 
    padding-left: 15px; margin-bottom: 15px; text-transform: uppercase;
}

.menu { margin-bottom: 30px; }
.menu a { 
    display: flex; align-items: center; padding: 12px 15px; color: var(--text-muted); 
    text-decoration: none; border-radius: 12px; margin-bottom: 4px; transition: all 0.2s ease; font-weight: 500; font-size: 0.95rem;
}
.menu a:hover { color: white; background: rgba(255,255,255,0.03); }
.menu a.active { 
    background: rgba(255,255,255,0.06); color: white; 
}
.menu a.active .icon { color: var(--accent-purple); }

.menu .icon { margin-right: 14px; font-size: 1.1rem; opacity: 0.9; }

/* CONTENIDO PRINCIPAL (La gran tarjeta flotante) */
.main-content { 
    flex: 1;
    padding: 10px;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-main);
    border-radius: 30px; 
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    margin: 10px;
    height: calc(100% - 20px);
    box-sizing: border-box;
    min-height: 0;
}

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; flex-shrink: 0; }
.topbar .greeting { font-size: 0.8rem; color: var(--text-muted); margin: 0 0 1px 0;}
.topbar h1 { font-size: 1.2rem; font-weight: 700; margin: 0; letter-spacing: -0.5px; }


/* Search & Profile */
.topbar-right { display: flex; align-items: center; gap: 20px; }
.search-bar { background: var(--bg-card); padding: 10px 20px; border-radius: 20px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--border-color);}
.search-bar input { background: transparent; border: none; color: white; outline: none; font-family: 'Outfit';}

/* VISTAS — Llenan el espacio restante de main-content (flex column) */
.view-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
    padding-right: 5px;
}

/* Estilo para el scrollbar dentro de las vistas */
.view-section::-webkit-scrollbar { width: 6px; }
.view-section::-webkit-scrollbar-track { background: transparent; }
.view-section::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.05); border-radius: 10px; }
.view-section::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.1); }

/* GRID Y TARJETAS */
.dashboard-grid { display: grid; grid-template-columns: 1.6fr 1.1fr; gap: 25px; }
.player-split-grid { 
    display: grid; 
    grid-template-columns: 2.5fr 1fr; 
    gap: 20px; 
    width: 100%; 
    box-sizing: border-box; 
    min-height: 0;
}
.player-split-grid > div { min-width: 0; }

.card { 
    background: var(--bg-card); border-radius: 24px; padding: 30px; 
    border: 1px solid rgba(255, 255, 255, 0.02);
    position: relative; overflow: hidden;
}

.card.ai-featured {
    padding: 0;
    background: linear-gradient(145deg, #241e3d, #14131d);
    border: 1px solid rgba(157, 116, 255, 0.2);
}
.ai-featured-content { padding: 40px; position:relative; z-index: 2; }
.ai-featured h2 { margin: 0 0 10px 0; font-size: 2rem; background: linear-gradient(90deg, #fff, var(--accent-blue)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;}
.ai-featured-glow {
    position: absolute; right: -50px; bottom: -50px; width: 300px; height: 300px;
    background: radial-gradient(circle, var(--accent-pink) 0%, var(--accent-purple) 40%, transparent 70%);
    filter: blur(40px); opacity: 0.3; z-index: 1;
}

.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;}
.card-header h3 { margin: 0; font-size: 1.1rem; font-weight: 600; display:flex; align-items:center; gap:8px;}

/* Estilos de tabla / listas */
.status-row { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 18px 0; border-bottom: 1px solid var(--border-color); font-size: 0.95rem;
}
.status-row:last-child { border-bottom: none; }
.status-row .label { display: flex; align-items: center; gap: 15px; font-weight: 500;}
.status-row .icon-box { width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,0.03); display: flex; justify-content: center; align-items: center;}

.pill { padding: 5px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.5px;}
.pill.pending { background: rgba(245, 158, 11, 0.1); color: #FCD34D;}
.pill.ok { background: rgba(16, 185, 129, 0.1); color: #34D399;}

/* Dropzone Premium */
.drop-zone { 
    margin-top: 20px; border: 2px dashed rgba(157, 116, 255, 0.3); border-radius: 16px; 
    padding: 50px 20px; text-align: center; background: rgba(157, 116, 255, 0.02); 
    transition: all 0.3s ease; cursor: pointer;
}
.drop-zone:hover { background: rgba(157, 116, 255, 0.08); border-color: var(--accent-purple); }

.upload-icon { font-size: 3rem; margin-bottom: 15px; filter: hue-rotate(45deg); opacity: 0.8;}
.drop-zone h4 { margin: 0 0 5px 0; font-size: 1.2rem; font-weight: 600; color: white;}
.drop-zone p { margin: 0; color: var(--text-muted); font-size: 0.9rem;}

.btn-upload {
    background: rgba(255,255,255,0.05); color: white; border: 1px solid var(--border-color);
    padding: 8px 16px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.2s; font-family: 'Outfit';
}
.btn-upload:hover { background: var(--accent-purple); border-color: var(--accent-purple); color: black;}

/* --- BIBLIOTECA DE AULAS (AULAS VIEW) --- */
.view-section h1 {
    font-size: 2.2rem;
    margin-bottom: 30px;
}

#aulas-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-top: 20px;
}

.curso-section {
    background: rgba(255, 255, 255, 0.01);
    border-radius: 24px;
    border: 1px solid var(--border-color);
    padding: 25px;
}

.curso-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.trimestre-card {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 18px;
    margin-bottom: 15px;
    overflow: hidden;
}

.trimestre-header {
    padding: 18px 25px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.01);
    transition: 0.3s;
}

.trimestre-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.trimestre-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--accent-purple);
}

.asignatura-group {
    padding: 10px 25px 25px 25px;
}

.asignatura-title {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin: 20px 0 15px 0;
    border-left: 2px solid var(--accent-blue);
    padding-left: 10px;
}

/* TARJETA DE CLASE PREMIUM */
.class-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.class-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 16px 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.class-card:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(157, 116, 255, 0.2);
}

.class-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.class-badge {
    width: 32px;
    height: 32px;
    background: rgba(157, 116, 255, 0.1);
    color: var(--accent-purple);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.75rem;
}

.class-card h4 {
    margin: 0;
    font-weight: 500;
    font-size: 1rem;
    color: #f1f5f9;
}

/* ACCIONES DE LA CLASE (MULTIMEDIA) */
.class-actions {
    display: flex;
    gap: 10px;
}

.media-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: white;
    cursor: pointer;
    transition: 0.2s;
    font-size: 1.1rem;
    position: relative;
}

.media-btn:hover {
    background: var(--accent-purple);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(157, 116, 255, 0.3);
}

.media-btn.disabled {
    opacity: 0.15;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(1);
}

/* Tooltips básicos */
.media-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: 0.2s;
}

.media-btn:hover::after {
    opacity: 1;
}

/* --- COLA DE SUBIDA MULTIPLE --- */
#upload-queue {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 28vh; /* Ajuste adaptativo para evitar recortes en laptops */
    overflow-y: auto;
    padding-right: 10px;
}

#upload-queue::-webkit-scrollbar { width: 4px; }
#upload-queue::-webkit-scrollbar-track { background: transparent; }
#upload-queue::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
#upload-queue::-webkit-scrollbar-thumb:hover { background: var(--accent-purple); }

.upload-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    text-align: left;
    flex-shrink: 0; /* EVITAR QUE SE ENCOJAN AL HABER MUCHOS */
}

.upload-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
    position: relative;
    z-index: 2;
}

.upload-name {
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.upload-status {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.upload-progress-track {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    z-index: 2;
}

.upload-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-blue));
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Identificadores de estado dinámicos */
.upload-item.en-cola .upload-progress-fill { background: rgba(255, 255, 255, 0.1); }
.upload-item.procesando .upload-progress-fill { background: linear-gradient(90deg, var(--accent-pink), var(--accent-purple)); }
.upload-item.conversion .upload-progress-fill { background: linear-gradient(90deg, var(--accent-blue), #10B981); }
.upload-item.completado { border-color: rgba(16, 185, 129, 0.3); background: rgba(16, 185, 129, 0.05); }
.upload-item.error .upload-progress-fill { background: #EF4444; }

/* DETALLES DE CONTROL Y PESO */
.upload-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-size {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    padding: 2px 6px;
    border-radius: 4px;
}

.btn-cancel {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(248, 113, 113, 0.1);
    color: #F87171;
    border: 1px solid rgba(248, 113, 113, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 900;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: #EF4444;
    color: white;
    border-color: #EF4444;
    transform: scale(1.1);
}

.upload-item.completado .btn-cancel,
.upload-item.error .btn-cancel {
    display: none; /* Ocultar al terminar */
}

/* ========================================= */
/* NETFLIX UI - PORTADAS Y LISTADOS INMERSIVOS */
/* ========================================= */

.netflix-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 25px;
    margin-top: 20px;
    padding: 10px; /* Espacio interno para que el escalado no se corte */
}

.netflix-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s;
    aspect-ratio: 2/3;
    background: #111119; /* Placeholder oscuro */
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.netflix-card:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 30px rgba(0,0,0,0.5);
    z-index: 10;
}

.netflix-card img.cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.netflix-card:hover img.cover {
    opacity: 0.4;
}

.netflix-card .card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    display: flex;
    flex-direction: column;
}

.netflix-card .card-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: white;
    margin-bottom: 5px;
}

.netflix-card .card-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.btn-edit-cover {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    z-index: 20;
}

.netflix-card:hover .btn-edit-cover {
    opacity: 1;
}

.btn-edit-cover:hover {
    background: var(--accent-pink);
    transform: scale(1.1);
}

/* Tipos Teórico / Práctico (Minimalista) */
.type-tabs {
    display: flex;
    gap: 30px;
    margin-bottom: 25px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.type-tab {
    padding: 15px 0;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.type-tab.active, .type-tab:hover {
    color: white;
    border-bottom-color: var(--accent-pink);
}

/* Lista de Clases (Netflix Style) */
.episode-list {
    display: flex;
    flex-direction: column;
}

.episode-row {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    border-radius: 16px;
    margin-bottom: 4px;
    background: transparent;
    border: 1px solid transparent;
}

.episode-row:hover {
    background: linear-gradient(90deg, rgba(255,255,255,0.01) 0%, rgba(255,255,255,0.03) 100%);
    border-color: rgba(255,255,255,0.05);
    transform: scale(1.01);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.episode-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: transparent;
    -webkit-text-stroke: 1px rgba(255,255,255,0.15);
    background: transparent;
    width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    flex-shrink: 0;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.episode-row:hover .episode-number {
    color: white;
    -webkit-text-stroke: 0px transparent;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

.episode-title {
    flex: 1;
    font-size: 1.15rem;
    font-weight: 400;
    color: #94A3B8;
    letter-spacing: 0.5px;
    transition: all 0.3s;
}

.episode-row:hover .episode-title {
    color: #ffffff;
    font-weight: 600;
}

.episode-meta {
    display: flex;
    gap: 15px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.episode-icons {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-left: 20px;
}

.epi-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    color: white;
    opacity: 0.2;
    transition: all 0.4s;
}

.episode-row:hover .epi-icon.video { background: var(--accent-purple); color: white; opacity: 1; box-shadow: 0 4px 15px rgba(157, 116, 255, 0.4); }
.episode-row:hover .epi-icon.pdf { background: #F87171; color: white; opacity: 1; box-shadow: 0 4px 15px rgba(248, 113, 113, 0.4); }
.episode-row:hover .epi-icon.audio { background: #34D399; color: white; opacity: 1; box-shadow: 0 4px 15px rgba(52, 211, 153, 0.4); }
.epi-icon.video { color: var(--text-muted); }
.epi-icon.pdf { color: var(--text-muted); }
.epi-icon.audio { color: var(--text-muted); }

/* Indicador de recurso ya visto/reproducido */
.epi-icon.visto {
    background: rgba(255,255,255,0.1) !important;
    border-color: rgba(255,255,255,0.4) !important;
    opacity: 0.5;
}

/* Scroll Estético para las Listas */
.episode-list::-webkit-scrollbar {
    width: 6px;
}
.episode-list::-webkit-scrollbar-track {
    background: transparent;
}
.episode-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
.episode-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent-pink);
}

/* REPRODUCTOR SUPERPUESTO (TEATRO MODO) */
.player-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(10, 10, 12, 0.98);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s;
}

.player-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.player-header {
    padding: 25px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
}

.btn-close-player {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-close-player:hover {
    background: #EF4444;
    transform: rotate(90deg);
}

.player-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 0 40px 40px 40px;
    display: flex;
    flex-direction: column;
}

.player-tabs {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.player-tab {
    padding: 12px 25px;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.player-tab.active {
    background: rgba(255,255,255,0.1);
    color: white;
    border-color: rgba(255,255,255,0.2);
}

.player-frame-container {
    width: 100%;
    aspect-ratio: 16/9;
    background: black;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
}

.player-frame-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Carrusel de "Siguientes episodios" */
.up-next-section {
    margin-top: 40px;
}

.up-next-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    margin-bottom: 15px;
}

.up-next-carousel {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.up-next-item {
    min-width: 280px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.up-next-item:hover {
    background: rgba(255,255,255,0.08);
}

.up-next-num {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.up-next-name {
    font-size: 1rem;
    font-weight: 600;
    color: white;
}

/* ========================================= */
/* MODAL SELECTOR DE PORTADAS (GALLERY)      */
/* ========================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 9, 20, 0.95);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(15px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.visible {
    display: flex;
    opacity: 1;
}

.cover-selector-card {
    background: #1e1c2e;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0,0,0,0.8);
    animation: authCardIn 0.4s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.modal-header {
    padding: 25px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.modal-close {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}

.modal-close:hover {
    background: rgba(248, 113, 113, 0.2);
    color: #F87171;
}

.modal-body {
    padding: 20px 30px;
    overflow-y: auto;
    flex: 1;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.gallery-item {
    aspect-ratio: 16/9;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: 0.2s;
    position: relative;
    background: #14131d;
}

.gallery-item:hover {
    transform: scale(1.05);
    border-color: var(--accent-purple);
    z-index: 5;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
    transition: 0.2s;
}

.gallery-item:hover img {
    opacity: 1;
}

.gallery-item.selected {
    border-color: var(--accent-pink);
    box-shadow: 0 0 15px rgba(248, 113, 113, 0.4);
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* DASHBOARD GRID SYSTEM (Desktop default) */
.stats-kpi-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}
.stats-courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}
.auth-grid-two-col {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
}

/* Ocultar elementos móviles por defecto */
.nav-toggle-btn {
    display: none;
}
.mobile-sidebar-overlay {
    display: none;
}

/* Forzar bloqueo de scroll en landing */
body.landing-active, 
body.landing-active html {
    overflow: hidden !important;
    height: 100vh !important;
    position: fixed;
    width: 100%;
}

/* =========================================
   RESPONSIVIDAD Y OPTIMIZACIÓN MÓVIL
   ========================================= */

@media (max-width: 1024px) {
    html {
        overflow: hidden !important;
        height: 100% !important;
    }
    body { 
        overflow-x: hidden !important; 
        overflow-y: auto !important; 
        height: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block !important; 
        -webkit-overflow-scrolling: touch;
    }
    
    .app-container {
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        min-height: 100% !important;
        padding-bottom: 70px !important; 
        margin: 0 !important;
        overflow: hidden !important;
    }

   /* Mobile Drawer - Hidden by default */
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -320px !important; 
        bottom: 0 !important;
        width: 280px !important;
        height: 100vh !important;
        background: #161521 !important; 
        backdrop-filter: blur(25px) !important;
        flex-direction: column !important;
        padding: 30px 20px !important;
        margin: 0 !important;
        justify-content: flex-start !important;
        align-items: stretch !important;
        border-right: 1px solid rgba(255,255,255,0.08) !important;
        border-top: none !important;
        z-index: 100000 !important; 
        box-shadow: none !important; 
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
        overflow-y: auto !important;
    }

    .sidebar.open {
        transform: translateX(320px) !important;
        box-shadow: 20px 0 50px rgba(0,0,0,0.5) !important;
    }

    .mobile-sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    .mobile-sidebar-overlay.visible {
        opacity: 1;
        pointer-events: all;
    }

    .nav-toggle-btn {
        display: flex !important;
    }

    .sidebar-logo, .section-label, #admin-group { display: block !important; }
    .sidebar-logo { margin-bottom: 30px !important; }
    
    .menu {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        height: auto !important;
        margin-bottom: 20px !important;
    }

    .menu a {
        flex-direction: row !important;
        gap: 12px !important;
        padding: 14px 18px !important;
        font-size: 0.95rem !important;
        text-transform: none !important;
        letter-spacing: normal !important;
        margin-bottom: 6px !important;
        background: rgba(255,255,255,0.02) !important;
        flex: none !important;
        text-align: left !important;
        justify-content: flex-start !important;
        border-radius: 12px !important;
    }
    
     /* Auth & Modals */
    .auth-overlay { overflow-y: auto !important; align-items: flex-start !important; padding: 20px 0 !important; }
    .auth-modal-card { 
        width: calc(100% - 30px) !important; 
        max-width: 420px !important;
        margin: 20px auto !important; 
        padding: 25px 15px !important; /* Reducir padding en móvil */
    }

    /* Panel de Notificaciones Adaptable */
    .notifications-dropdown {
        position: fixed !important;
        top: 80px !important;
        left: 15px !important;
        right: 15px !important;
        width: auto !important;
        max-width: none !important;
        z-index: 100000 !important;
    }

    /* Dropdown de Cuenta Adaptable */
    #account-dropdown {
        right: -10px !important;
        min-width: 220px !important;
    }

    .menu a .icon { width: 18px !important; height: 18px !important; }
    .menu a.active { background: rgba(157, 116, 255, 0.1) !important; border: 1px solid rgba(157, 116, 255, 0.2) !important; }

    /* Contenedor Principal */
    .main-content {
        margin: 0 !important;
        border-radius: 0 !important;
        border: none !important;
        padding: 15px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        min-height: 100vh !important;
        box-shadow: none !important;
        overflow-x: hidden !important;
        background-color: var(--bg-window) !important;
    }

    .topbar { 
        width: 100% !important; 
        flex-direction: row !important; 
        align-items: center !important; 
        justify-content: space-between !important;
        gap: 10px !important; 
        box-sizing: border-box !important; 
        margin-bottom: 20px !important;
        padding-bottom: 15px !important;
    }
    .topbar .greeting { display: none; } /* Ocultar saludo largo en móvil */
    .topbar-right { width: auto !important; gap: 10px !important; }
    .search-bar { display: none !important; } /* Ocultar buscador en móvil para ahorrar espacio */

    .view-section { 
        width: 100% !important; 
        overflow-x: hidden !important; 
        overflow-y: visible !important; 
        -webkit-overflow-scrolling: touch;
    }

    /* DASHBOARD RESPONSIVE */
    .stats-kpi-strip {
        display: flex !important;
        overflow-x: auto !important;
        gap: 15px !important;
        padding: 5px 2px 20px 2px !important;
        scroll-snap-type: x mandatory !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
        grid-template-columns: none !important;
    }
    .stats-kpi-strip::-webkit-scrollbar { display: none !important; }
    
    .stats-kpi-card {
        flex: 0 0 240px !important;
        scroll-snap-align: center !important;
        padding: 18px !important;
    }
    
    .stats-courses-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    .stats-course-card {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 15px !important;
    }

    /* Convertir la tarjeta en Grid Estricto (minmax previene estallidos por texto largo) */
    #store-step-content > .checkout-summary-container > div,
    #store-step-content > div[style*="580px"] > div {
        display: grid !important;
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) !important;
        grid-template-rows: auto auto auto !important;
        gap: 5px 15px !important;
        padding: 10px !important;
    }

    #store-step-content > .checkout-summary-container h3,
    #store-step-content > div[style*="580px"] h3 {
        grid-column: 1 / 3 !important;
        margin-bottom: 0 !important;
        font-size: 1.1rem !important;
    }

    /* Historial */
    #store-step-content > .checkout-summary-container > div > div:nth-of-type(1),
    #store-step-content > div[style*="580px"] > div > div:nth-of-type(1) {
        grid-column: 1 / 2 !important;
        grid-row: 2 / 4 !important;
        padding: 4px !important;
    }

    /* Obligamos al historial a envolver el texto si es muy largo */
    #store-step-content > .checkout-summary-container > div > div:nth-of-type(1) > div,
    #store-step-content > div[style*="580px"] > div > div:nth-of-type(1) > div {
        flex-wrap: wrap !important;
        padding-bottom: 2px !important;
        gap: 2px !important;
    }

    /* Calculadora / Totales */
    #store-step-content > .checkout-summary-container > div > div:nth-of-type(2),
    #store-step-content > div[style*="580px"] > div > div:nth-of-type(2) {
        grid-column: 2 / 3 !important;
        grid-row: 2 / 3 !important;
        margin-top: 0 !important;
        border-top: none !important;
        padding-top: 0 !important;
        gap: 4px !important;
    }

    /* Reducir bestialmente el texto de 500€ para ganar espacio vertical */
    #store-step-content > .checkout-summary-container > div > div:nth-of-type(2) > div:last-child,
    #store-step-content > div[style*="580px"] > div > div:nth-of-type(2) > div:last-child {
        padding: 5px 10px !important;
    }

    #store-step-content > .checkout-summary-container > div > div:nth-of-type(2) > div:last-child span[style*="font-size:2.4rem"],
    #store-step-content > div[style*="580px"] > div > div:nth-of-type(2) > div:last-child span[style*="font-size:2.4rem"] {
        font-size: 1.4rem !important; 
    }

    /* Botón / Checkbox Wrapper */
    #store-step-content > .checkout-summary-container > div > div:nth-of-type(3),
    #store-step-content > div[style*="580px"] > div > div:nth-of-type(3) {
        grid-column: 1 / 3 !important;
        grid-row: 4 !important;
        margin-top: 15px !important;
    }

    #store-step-content > .checkout-summary-container button,
    #store-step-content > div[style*="580px"] button {
        grid-column: 1 / 3 !important;
    }

    /* Contenido / Level 5 Grid */
    .player-split-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .player-frame-container {
        aspect-ratio: 16/9 !important;
        height: auto !important;
    }
    
    .episode-list {
        max-height: 400px !important;
    }
    
    .stats-course-card > div:first-child {
        flex-direction: column !important;
        gap: 20px !important;
        padding-bottom: 15px !important;
    }

    .stats-course-card .course-progress-ring-container {
        width: 100% !important;
        justify-content: center !important;
    }

    .stats-course-card .course-details-main {
        text-align: center !important;
    }

    .stats-course-card .course-subjects-mini-list {
        margin-top: 15px !important;
        border-top: 1px solid rgba(255,255,255,0.05) !important;
        padding-top: 15px !important;
    }
    
    .netflix-grid {
        display: grid !important;
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
        gap: 15px !important;
        padding: 10px 0 !important;
        overflow-x: visible !important;
        overflow-y: visible !important;
    }
    
    .netflix-card {
        flex: none !important;
        width: 100% !important;
        aspect-ratio: 16/9 !important;
        height: auto !important;
    }

    .netflix-card .card-info {
        padding: 12px !important;
    }

    .netflix-card .card-title { 
        font-size: 0.9rem !important; 
        line-height: 1.25 !important;
        font-weight: 700 !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        white-space: normal !important;
        word-wrap: break-word !important;
    }

    .netflix-card .card-subtitle {
        font-size: 0.65rem !important;
        line-height: 1.2 !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 1 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        white-space: normal !important;
        margin-bottom: 4px !important;
    }

    /* STORE RESPONSIVE */
    .store-horizontal-layout {
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        gap: 15px !important;
        padding: 20px 5px !important;
        scroll-snap-type: x mandatory !important;
        scrollbar-width: none !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .store-horizontal-layout::-webkit-scrollbar { display: none !important; }

    .store-option-card {
        flex: 0 0 260px !important;
        scroll-snap-align: center !important;
    }

    /* Stacked Cards (Ciclos) Mobile */
    .stats-kpi-strip .netflix-card.protected-card,
    .store-horizontal-layout .netflix-card.protected-card {
        height: 38vh !important;
        max-height: 280px !important;
        width: calc(38vh * 0.7) !important;
        min-width: 180px !important;
    }

    .stacked-covers-container {
        height: 80% !important;
    }

    .stacked-cover.back-card {
        left: 20% !important;
        transform: rotate(8deg) !important;
    }

    .stacked-cover.front-card {
        left: 5% !important;
        transform: rotate(-5deg) !important;
    }

    .netflix-card.protected-card .card-title {
        font-size: 1.2rem !important;
    }

    .netflix-card.protected-card .card-subtitle {
        font-size: 0.8rem !important;
    }

    /* Notifications Dropdown Mobile */
    .notifications-dropdown {
        position: fixed !important;
        top: 60px !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        max-height: calc(100vh - 120px) !important;
        transform: none !important;
    }


    .main-content {
        margin: 0 !important;
        border-radius: 0 !important;
        border: none !important;
        padding: 15px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        min-height: 100vh !important;
        box-shadow: none !important;
        overflow-x: hidden !important;
        background-color: var(--bg-window) !important;
    }

    .hide-mobile { display: none !important; }
    .show-mobile { display: block !important; }
    .flex-mobile { display: flex !important; }


    #mobile-sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 15000;
        opacity: 0;
        transition: opacity 0.4s ease;
    }

    #mobile-sidebar-overlay.visible {
        display: block;
        opacity: 1;
    }

    /* Estilos de Clases y Media (Vistas Profundas) */
    .breadcrumb-nav {
        font-size: 0.9rem !important;
        padding: 0 5px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .episode-row {
        padding: 12px 10px !important;
        gap: 10px !important;
        border-radius: 12px !important;
        margin-bottom: 8px !important;
        background: rgba(255,255,255,0.02) !important;
    }

    .episode-number { 
        font-size: 1.4rem !important; 
        width: 35px !important; 
        margin-right: 5px !important;
    }

    .episode-title { 
        font-size: 0.9rem !important; 
        line-height: 1.3 !important;
    }

    .episode-icons {
        gap: 8px !important;
        margin-left: 10px !important;
    }

    .epi-icon {
        width: 38px !important; /* Más grandes para touch */
        height: 38px !important;
        opacity: 0.4 !important; /* Más visibles en móvil por defecto */
    }
    
    .episode-row:hover .epi-icon {
        opacity: 1 !important;
    }

    /* Podcast Player */
    #podcast-player { padding: 15px !important; }

    .iti__dropdown-content {
        width: calc(100vw - 60px) !important;
        max-width: 300px !important;
    }

    .auth-grid-two-col {
        grid-template-columns: 1fr !important;
    }

    .type-tabs {
        gap: 15px !important;
        margin-bottom: 15px !important;
        justify-content: center !important;
    }

    .type-tab {
        font-size: 0.9rem !important;
        padding: 10px 0 !important;
    }
}

/* =========================================
   SISTEMA DE RESPONSIVIDAD PROFESIONAL (CRASH v2.6)
   ========================================= */

/* DISPOSITIVOS MÓVILES Y TABLETS (Cualquier tamaño < 1024px) */
@media screen and (max-width: 1024px) {
    html, body {
        overflow-x: hidden;
        overflow-y: auto;
        height: auto;
        min-height: 100%;
        position: relative;
        display: block;
    }

    body {
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        background-color: var(--bg-window) !important;
        -webkit-overflow-scrolling: touch;
    }

    .app-container {
        width: 100%;
        max-width: 100%;
        height: auto;
        min-height: 100%;
        display: flex;
        flex-direction: column;
        margin: 0;
        padding: 0;
    }

    /* MODO HORIZONTAL / LANDSCAPE OPTIMIZADO */
    @media (orientation: landscape) and (max-height: 600px) {
        .app-container { min-height: 100vh !important; }
        .main-content { 
            min-height: 100vh !important; 
            padding: 5px 10px 40px 10px !important; 
        }
        .topbar { 
            padding: 2px 10px !important; 
            margin-bottom: 5px !important;
        }
        .logo h2 { display: none; }
        .breadcrumb-nav { padding: 2px 5px !important; font-size: 0.8rem !important; }
        h1, .view-section h1 { font-size: 1rem !important; }
    }

    /* SIDEBAR -> DRAWER MÓVIL */
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 280px !important;
        height: 100% !important;
        background: #1c1a24 !important;
        box-shadow: 20px 0 50px rgba(0,0,0,0.8) !important;
        transform: translateX(-110%) !important;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 10001 !important;
        padding: 30px 20px !important;
        overflow-y: auto !important;
    }

    .sidebar.open {
        transform: translateX(0) !important;
    }

    .mobile-sidebar-overlay {
        position: fixed !important;
        inset: 0 !important;
        background: rgba(0,0,0,0.7) !important;
        backdrop-filter: blur(4px) !important;
        z-index: 10000 !important;
        opacity: 0 !important;
        pointer-events: none !important;
        transition: opacity 0.3s ease !important;
    }

    .mobile-sidebar-overlay.visible {
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    #mobile-menu-toggle { display: flex !important; }

    .main-content {
        margin: 0 !important;
        border-radius: 0 !important;
        width: 100% !important;
        border: none !important;
        min-height: 100vh !important;
        padding: 10px 10px 20px 10px !important;
        box-shadow: none !important;
        overflow: visible !important;
        display: block !important;
    }

    /* NAVEGACIÓN HORIZONTAL SCROLLABLE */
    .breadcrumb-nav, #store-breadcrumb-container {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        padding: 8px 5px !important;
        gap: 12px !important;
        -webkit-overflow-scrolling: touch;
        width: 100% !important;
        scrollbar-width: none;
        box-sizing: border-box !important;
    }
    .breadcrumb-nav::-webkit-scrollbar { display: none; }
    .breadcrumb-nav span, .breadcrumb-nav a, #store-breadcrumb-container > * {
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }

    /* TIPOGRAFÍA ADAPTATIVA */
    .topbar h1, .view-section h1 {
        font-size: clamp(1rem, 5vw, 1.3rem) !important;
        line-height: 1.1 !important;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    h2 { font-size: clamp(0.9rem, 4vw, 1.2rem) !important; }
    h1, h2, h3 { line-height: 1.2 !important; }

    .view-section {
        overflow: visible !important;
        height: auto !important;
        flex: none !important;
    }

    /* OPTIMIZACIÓN DE REPRODUCTOR PLYR PARA MÓVIL (Timeline Visible y Largo) */
    .plyr__controls {
        display: flex !important;
        flex-wrap: wrap !important;
        padding: 10px 15px !important;
        justify-content: space-between !important;
        align-items: center !important;
    }
    
    .plyr__progress {
        flex: 1 1 100% !important;
        order: -1 !important;
        padding: 10px 0 !important;
        display: block !important;
    }

    .plyr__time { font-size: 11px !important; flex: none !important; margin: 0 5px !important; }
    .plyr__volume { max-width: 60px !important; }

    @media (max-width: 400px) { .plyr__volume { display: none !important; } }

    /* GRIDS & CARDS */
    .stats-kpi-strip, .stats-courses-grid, .dashboard-grid {
        grid-template-columns: 1fr !important;
        display: grid !important;
        gap: 12px !important;
        width: 100% !important;
    }
    .card { padding: 15px !important; border-radius: 12px !important; }
}

/* TABLETS & LAPTOPS */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .stats-kpi-strip { grid-template-columns: 1fr 1fr 1fr !important; }
}

@media screen and (min-width: 1025px) and (max-width: 1366px) {
    .app-container { width: 99vw; height: 98vh; }
    .sidebar { width: 220px; }
    .main-content { margin: 5px 5px 5px 0; border-radius: 20px; }
}

/* UTILIDADES */
.nav-toggle-btn { display: none; }
@media (max-width: 1024px) { .nav-toggle-btn { display: flex !important; } }

.show-mobile, .flex-mobile { display: none; }
@media (max-width: 1024px) {
    .show-mobile { display: block !important; }
    .flex-mobile { display: flex !important; }
}

/* --- MEJORA: TÍTULO DE CLASE FULL-WIDTH EN MÓVIL --- */
@media (max-width: 768px) {
    .player-controls-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
        margin-bottom: 8px !important;
    }
    .player-controls-header h2 {
        font-size: 1.1rem !important;
        width: 100% !important;
        line-height: 1.3 !important;
        text-align: left !important;
    }
    .player-controls-header > div {
        width: 100% !important;
        justify-content: flex-start !important;
    }
}


/* --- OPTIMIZACIÓN LANDSCAPE MÓVIL (MAXIMIZACIÓN VERTICAL v3.1 - FINAL) --- */
@media screen and (max-height: 500px) and (orientation: landscape) {
    /* Forzar ocultación de elementos que roban altura */
    .topbar {
        padding: 5px 15px !important;
        margin-bottom: 0 !important; /* Eliminamos margen extra */
        border-bottom: 1px solid rgba(255,255,255,0.05) !important;
        min-height: 40px !important;
        height: 40px !important;
    }
    .greeting { font-size: 1rem !important; }
    .topbar-right { display: none !important; }

    .breadcrumb-nav { display: none !important; }

    /* Forzar eliminación de paddings inline de los contenedores por ID */
    #view-contenido.active, 
    #aulas-container {
        padding: 0 !important;
        margin: 0 !important;
        gap: 0 !important;
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .app-container {
        padding-bottom: 0 !important; /* Quitar los 70px de móvil vertical */
        height: auto !important;
        min-height: 100% !important;
        overflow: visible !important;
    }

    .main-content, .view-section, #view-store, #view-store.active, #store-active-step-container {
        padding: 0 5px !important; 
        margin: 0 !important;
        height: auto !important;
        min-height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: visible !important;
    }

    .player-split-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 5px !important;
        height: auto !important;
        padding-top: 5px !important;
    }

    /* Ocultar elementos secundarios del reproductor */
    .view-section button[onclick*="goBack"] { margin-bottom: 2px !important; font-size: 0.6rem !important; }
    .player-split-grid h2,
    .player-split-grid > div:last-child {
        display: none !important;
    }

    .player-frame-container {
        aspect-ratio: 16 / 9 !important;
        width: 100% !important;
        max-width: 610px !important; /* Maximizado casi al 100% del ancho del iPhone SE */
        margin: 0 auto !important;
        height: auto !important;
        background: #000 !important;
        border-radius: 8px !important;
    }

    .player-tab {
        padding: 3px 10px !important;
        font-size: 0.65rem !important;
    }

    .plyr {
        width: 100% !important;
        height: auto !important;
    }

    /* FIX: EVITAR QUE EL PODCAST SE CORTE Y ELIMINAR DOBLE MARCO NEGRO */
    .player-frame-container:has(#inline-player-frame.audio-active) {
        aspect-ratio: auto !important;
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
    }
    #inline-player-frame.audio-active {
        height: 320px !important; /* Altura fija sellada en portrait */
        min-height: 320px !important;
        max-height: 320px !important;
        overflow: hidden !important;
    }
}

/* =========================================
   ADAPTACIÓN RESPONSIVA FINAL (v3.2)
   Blindaje Desktop > 1440px
   ========================================= */

@media screen and (min-width: 1200px) and (max-width: 1440px) {
    .app-container { width: 100vw; height: 100%; gap: 5px; }
    .sidebar { width: 220px; padding: 20px 15px; }
    .player-split-grid { grid-template-columns: 2fr 1fr !important; gap: 15px !important; }
    .main-content { padding: 15px !important; margin: 5px; height: calc(100% - 10px); }
}

/* TABLETS (PORTRAIT & LANDSCAPE) */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    .player-split-grid {
        grid-template-columns: 1fr !important;
        display: flex !important;
        flex-direction: column !important;
    }
    .plyr-container-box {
        max-width: min(100%, calc(((100% - 180px) / 9) * 16)) !important;
    }
    .episode-list {
        max-height: 500px !important;
    }
}

/* MÓVILES PORTRAIT */
@media screen and (max-width: 767px) {
    .plyr-container-box {
        max-width: 100% !important;
        aspect-ratio: 16/9 !important;
        border-radius: 8px !important;
    }
    .player-split-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
    }
    .episode-list {
        max-height: none !important;
        overflow: visible !important;
    }
    .player-controls-header h2 {
        font-size: 1rem !important;
    }
}

/* OPTIMIZACIÓN LANDSCAPE MÓVIL (TEATRO MODO v3.2) */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .topbar { 
        height: 35px !important; 
        padding: 0 10px !important;
        margin-bottom: 5px !important;
    }
    .main-content { padding: 5px !important; }
    
    .player-split-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
    }

    /* Mostrar sidebar en landscape pero debajo del video para que sea navegable */
    .player-split-grid > div:last-child {
        display: flex !important;
        height: auto !important;
        max-height: none !important;
        margin-top: 10px !important;
    }

    .player-frame-container {
        width: 100% !important;
        max-width: none !important;
        margin: 0 auto !important;
        background: transparent !important; /* Quitar fondo negro exterior */
    }

    .plyr-container-box {
        max-width: min(100%, calc(((100% - 50px) / 9) * 16)) !important;
        width: 100% !important;
        height: auto !important;
        margin: 0 auto !important;
        box-shadow: 0 0 40px rgba(0,0,0,0.8) !important;
    }

    .plyr__video-wrapper {
        aspect-ratio: 16/9 !important;
    }
}

/* =========================================
   REFINAMIENTOS RESPONSIVOS v4.0
   EPISODE MENU & NEXT ACTION PILL
   ========================================= */

/* Next Action Pill (Siguiente Clase) */
.next-action-pill {
    position: absolute;
    bottom: 70px;
    right: 20px;
    z-index: 9999;
    animation: fadeInUp 0.4s ease;
    pointer-events: auto;
}

.next-action-btn {
    background: rgba(20, 18, 30, 0.92);
    backdrop-filter: blur(12px);
    color: white;
    border: 1px solid rgba(157, 116, 255, 0.6);
    padding: 12px 22px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    transition: all 0.2s;
}

.next-action-btn:hover {
    background: rgba(157, 116, 255, 0.25);
    border-color: rgba(157, 116, 255, 1);
}

.next-action-btn i[data-lucide] {
    width: 16px;
}

.next-action-btn i:last-child {
    width: 14px;
    opacity: 0.7;
}

/* Episode List & Rows */
.episode-list {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 10px;
    scrollbar-width: thin;
}

.episode-row {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.episode-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.episode-row.active {
    background: rgba(255, 255, 255, 0.08);
    border-left: 4px solid var(--accent-pink);
}

.episode-number {
    font-size: 1.4rem;
    font-family: 'Bebas Neue', sans-serif;
    color: var(--text-muted);
    min-width: 30px;
}

.episode-number.active {
    color: white;
    opacity: 1;
    padding-left: 5px;
}

.episode-title {
    font-size: 0.95rem;
    color: var(--text-light);
    line-height: 1.4;
}

.sidebar-prog-pct {
    font-size: 0.65rem;
    color: var(--accent-purple);
    font-weight: 800;
    margin-left: auto;
}

/* RESPONSIVE REFINEMENTS v4.0 */

/* Tablets & Mobile adjustments for new classes */
@media screen and (max-width: 1024px) {
    .next-action-pill {
        bottom: 60px;
        right: 15px;
    }
    .next-action-btn {
        padding: 10px 18px;
        font-size: 0.85rem;
    }
    
    .episode-list {
        max-height: 450px;
    }
    .episode-row {
        padding: 12px;
    }
}

@media screen and (max-width: 767px) {
    .next-action-pill {
        bottom: 50px;
        right: 10px;
    }
    .next-action-btn {
        padding: 8px 15px;
        font-size: 0.8rem;
    }
    .episode-list {
        max-height: none;
        overflow: visible;
    }
}

/* Landscape optimization for video-first experience */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .next-action-pill {
        bottom: 20px;
        right: 20px;
    }
    .episode-row {
        padding: 10px 15px;
    }
    .episode-title {
        font-size: 0.85rem;
    }
}

/* FINAL DOUBLE SCROLL ERADICATION (v4.1) - Modificado para permitir chat flexible */
@media screen and (max-width: 1024px) {
    html { overflow: hidden; height: 100%; }
    body { overflow-y: auto; height: 100%; -webkit-overflow-scrolling: touch; }
    
    /* Solo aplicamos height:auto si NO es el chat */
    .app-container, .main-content {
        overflow-y: visible;
        height: auto;
        min-height: 100%;
    }
    
    .view-section:not(#view-professor-ia) {
        overflow-y: visible;
        height: auto;
    }

    /* Restore aspect-ratio for mobile/tablet consistency */
    .plyr-container-box, .plyr, .plyr__video-wrapper {
        aspect-ratio: 16 / 9 !important;
    }
    .plyr video {
        object-fit: cover !important;
        height: 100% !important;
    }
}

/* =======================================================
   PODCAST PLAYER DEFINITIVO - NO TOCAR PC (>1024px)
   ======================================================= */

/* BASE (PC >1024px) - Estilos propios del player, no se tocan */
.podcast-player-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* CENTRADO COMPACTO */
    background: linear-gradient(160deg, #100f1c, #1a1728);
    padding: 30px 40px;
    box-sizing: border-box;
    gap: 15px;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid rgba(157,116,255,0.15);
    width: 100%;
    height: 100%;
}

.podcast-visualizer-area {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 160px;
    flex-shrink: 0;
    position: relative;
}

.podcast-mic-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(157,116,255,0.2), rgba(248,113,113,0.2));
    border: 2px solid rgba(157,116,255,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;  /* NUNCA absolute */
    z-index: 1;
    box-shadow: 0 0 40px rgba(157,116,255,0.12);
}

.podcast-mic-circle i { color: #C49DFF; width: 48px; height: 48px; }

.podcast-interaction-block {
    width: 95%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2;
}

/* Progress bar base */
.podcast-timeline-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.5);
}

#podcast-current, #podcast-duration {
    min-width: 40px;
    flex-shrink: 0;
    white-space: nowrap;
}

#podcast-track {
    flex: 1;
    position: relative;
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    cursor: pointer;
}

#podcast-fill {
    position: absolute;
    left: 0; top: 0; height: 100%; width: 0%;
    background: linear-gradient(90deg, #9D74FF, #F87171);
    border-radius: 4px;
    pointer-events: none;
}

.podcast-seek-handle {
    position: absolute;
    right: -6px; top: -4px;
    width: 14px; height: 14px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(157,116,255,0.8);
}

.podcast-controls-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 20px;
    gap: 10px;
}

.podcast-speed-box, .podcast-volume-box { width: 140px; }

.podcast-speed-rel {
    position: relative;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    overflow: hidden;
}

#podcast-speed {
    background: transparent;
    color: #C49DFF;
    font-weight: 700;
    padding: 8px 30px 8px 12px;
    font-size: 0.8rem;
    border: none;
    outline: none;
    appearance: none;
    cursor: pointer;
    width: 100%;
}

.podcast-speed-chevron {
    position: absolute;
    right: 8px; top: 50%;
    transform: translateY(-50%);
    width: 16px;
    color: rgba(255,255,255,0.5);
    pointer-events: none;
}

.podcast-main-btns {
    display: flex;
    align-items: center;
    gap: 25px;
}

#podcast-play {
    background: linear-gradient(135deg, #9D74FF, #6B45CC);
    color: white; border: none;
    width: 76px; height: 76px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 35px rgba(157,116,255,0.5);
    cursor: pointer;
    flex-shrink: 0;
}

#podcast-play i { width: 34px; height: 34px; margin-left: 4px; }

#podcast-rewind, #podcast-forward {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    width: 50px; height: 50px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.podcast-volume-box {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

#podcast-vol { width: 85px; accent-color: #9D74FF; cursor: pointer; }

/* -------------------------------------------------------
   MOVIL PORTRAIT < 1024px: Baseline PC reducida, controles en fila
   ------------------------------------------------------- */
@media screen and (max-width: 1024px) {
    .podcast-player-container {
        /* SE MANTIENE COLUMN DE PC */
        margin-top: auto !important;
        padding: 15px 12px 10px 12px !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        justify-content: center !important;
        width: 100% !important;
    }

    .podcast-visualizer-area {
        flex: none !important;
        min-height: 84px !important;
        flex-shrink: 0 !important;
        margin-bottom: 5px !important;
    }

    /* Icono Central (Micrófono): Reduce un 30% (base 120px -> 84px) */
    .podcast-mic-circle {
        width: 84px !important;
        height: 84px !important;
        flex-shrink: 0 !important;
        aspect-ratio: 1 / 1 !important;
    }

    .podcast-mic-circle i { width: 34px !important; height: 34px !important; }

    .podcast-interaction-block {
        width: 100% !important;
        max-width: 100% !important;
        gap: 12px !important;
    }

    .podcast-timeline-row {
        gap: 10px !important;
        font-size: 0.78rem !important;
    }

    #podcast-current, #podcast-duration {
        min-width: 35px !important;
    }

    /* Controles: UNA ÚNICA FILA HORIZONTAL perfectamente centrada */
    .podcast-controls-panel {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 10px !important;
        padding-bottom: 5px !important;
    }

    /* Subtítulos arriba en portrait: entre el micro y el timeline */
    .podcast-captions-overlay {
        margin-bottom: 5px !important;
        height: 60px !important;
    }

    /* Mostrar el contenedor de volumen pero solo para el botón CC */
    .podcast-volume-box { 
        display: flex !important; 
        order: 3 !important; 
        width: auto !important;
        background: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        gap: 0 !important;
        box-shadow: none !important;
    }
    .podcast-volume-box > i, .podcast-volume-box > input { display: none !important; }

    .podcast-main-btns { order: 2 !important; gap: 15px !important; }
    
    .podcast-speed-box {
        order: 1 !important;
        width: auto !important;
        display: flex !important;
        justify-content: center !important;
    }

    .podcast-speed-rel { width: auto !important; }
    #podcast-speed { padding: 6px 10px !important; font-size: 0.8rem !important; width: 65px !important; text-align: center; }
    .podcast-speed-chevron { display: none !important; }

    /* Reducir tamaño botones de Play para no tocar bordes */
    #podcast-play { width: 50px !important; height: 50px !important; box-shadow: none !important; }
    #podcast-play i { width: 24px !important; height: 24px !important; margin-left:2px !important; }
    #podcast-rewind, #podcast-forward { width: 38px !important; height: 38px !important; }
    #podcast-rewind i, #podcast-forward i { width: 20px !important; }

    .next-action-pill { display: none !important; }
}

/* -------------------------------------------------------
   LANDSCAPE MOVIL: MODO REPRODUCTOR HORIZONTAL SELLADO
   ------------------------------------------------------- */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .podcast-player-container {
        /* HORIZONTAL */
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 10px 20px !important;
        gap: 20px !important; 
        margin: 0 auto !important;
        height: auto !important;
        min-height: 200px !important;
        max-height: 100% !important; /* Limita la altura para que no desborde */
        overflow: hidden !important;
    }

    /* Columna 1: Micrófono a la izquierda */
    .podcast-visualizer-area {
        flex: none !important;
        min-height: 0 !important;
        width: 100px !important;
        height: 100px !important;
        flex-shrink: 0 !important;
        margin-bottom: 0 !important;
    }

    .podcast-mic-circle {
        width: 100px !important;
        height: 100px !important;
        flex-shrink: 0 !important;
        aspect-ratio: 1 / 1 !important;
        box-shadow: none !important;
    }

    .podcast-mic-circle i { width: 36px !important; height: 36px !important; }
    
    /* La onda ahora es visible en landscape gracias al lienzo dinámico y su ajuste automático */
    #podcast-waveform { display: block !important; }

    /* Columna 2: Línea de tiempo y Controles (Igual a la PC pero achicado) */
    .podcast-interaction-block {
        flex: 1 !important;
        width: auto !important;
        max-width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        gap: 12px !important;
    }

    .podcast-timeline-row {
        padding: 0 !important;
        font-size: 0.70rem !important;
        gap: 8px !important;
        width: 100% !important;
    }

    #podcast-current, #podcast-duration { min-width: 30px !important; }
    #podcast-track { flex: 1 !important; }

    /* Los controles vuelven al diseño original de PC (Space-Between) pero compactos */
    .podcast-controls-panel {
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding-bottom: 0 !important;
        gap: 15px !important;
        width: 100% !important;
    }

    .podcast-volume-box { display: flex !important; }

    .podcast-speed-box, .podcast-volume-box { width: auto !important; }
    
    .podcast-main-btns { gap: 15px !important; }

    #podcast-play {
        width: 44px !important;
        height: 44px !important;
        box-shadow: none !important;
    }
    #podcast-play i { width: 22px !important; height: 22px !important; margin-left: 2px !important; }

    #podcast-rewind, #podcast-forward { width: 34px !important; height: 34px !important; }

    .podcast-speed-rel { width: auto !important; }
    #podcast-speed { font-size: 0.7rem !important; padding: 4px 8px !important; width: 60px !important; text-align: center; }
    .podcast-speed-chevron { display: none !important; }
    
    #podcast-vol { width: 60px !important; }
    
    .next-action-pill { display: none !important; }
}

/* =======================================================
   ADAPTACIÓN RESPONSIVA: TIENDA / MÁSTERS (SENIOR ARCHITECT)
   Este bloque asegura compatibilidad total en móviles, tablets 
   y portátiles con resoluciones intermedias (1280px-1440px).
   ======================================================= */

/* 1. BLINDAJE Y AJUSTES PARA PORTÁTILES (1280px a 1440px) */
@media screen and (min-width: 1025px) and (max-width: 1440px) {
    #view-store {
        padding: 20px 30px !important;
    }
    #view-store > div {
        max-width: 1100px !important;
    }
    .store-option-card {
        padding: 30px 20px !important;
        flex: 1 1 220px !important; /* Más compacto */
    }
    #store-step-title {
        font-size: 1.3rem !important;
    }
}

/* 2. TABLETS Y MÓVILES (WIDTH < 1024px) */
@media screen and (max-width: 1024px) {
    #store-header {
        flex-direction: column !important;
        gap: 15px !important;
        text-align: center !important;
        padding-bottom: 20px !important;
    }
    
    #store-header > div {
        flex: none !important;
        width: 100% !important;
        justify-content: center !important;
    }

    #store-price-container {
        order: 3;
    }
    
    #store-price-container > div {
        align-items: center !important;
        margin: 0 auto !important;
        width: fit-content !important;
    }

    /* Mejora del Breadcrumb en tablets */
    #store-breadcrumb-container {
        padding: 10px 5px !important;
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    #store-breadcrumb-container::-webkit-scrollbar { display: none; }

    /* Layout de selección de módulos (Step 2C_num) */
    #store-step-content > div[style*="display:flex"] {
        flex-direction: column !important;
        align-items: center !important;
        gap: 30px !important;
    }

    /* Ocultamos los espaciadores inútiles en móvil */
    #store-step-content > div > div[style*="flex:1"] {
        display: none !important;
    }

    /* El botón de continuar módulos se centra */
    #store-step-content > div > div:last-child {
        display: flex !important;
        justify-content: center !important;
        padding-left: 0 !important;
        width: 100% !important;
    }

    #btn-continue-modules {
        width: 100% !important;
        max-width: 320px !important;
        padding: 15px 25px !important;
    }
}

/* 3. OPTIMIZACIÓN ESPECÍFICA MÓVIL (Portrait) */
@media screen and (max-width: 768px) {
    #view-store {
        padding: 15px 10px 0 10px !important;
    }

    #view-store h1 {
        font-size: 1.6rem !important;
        margin-bottom: 2px !important;
    }

    #store-step-title {
        font-size: 1rem !important;
        letter-spacing: 0.5px !important;
        padding: 0 10px !important;
    }

    /* Forzamos que las tarjetas de opción sean legibles */
    .store-option-card {
        padding: 20px 15px !important;
        min-height: 180px !important;
    }

    .store-option-card i {
        width: 32px !important;
        height: 32px !important;
        margin-bottom: 10px !important;
    }

    /* Netflix Cards en la tienda */
    .netflix-card.protected-card {
        height: 35vh !important;
        min-height: 240px !important;
        width: auto !important;
        aspect-ratio: 2/3 !important;
        max-width: 220px !important;
    }

    /* Reglas anteriores de la tablet (aquí no hay checkout grid) */
}

/* 4. MODO HORIZONTAL / LANDSCAPE (Blindaje contra recortes) */
@media screen and (max-height: 600px) and (orientation: landscape) {

    /* Bloqueo Nivel Sistema Operativo para la Tienda */
    html:has(#view-store.active),
    body:has(#view-store.active) {
        overflow: hidden !important;
        position: fixed !important;
        width: 100vw !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body:has(#view-store.active) .app-container {
        padding-bottom: 0 !important;
        height: 100% !important;
        overflow: hidden !important;
        width: 100vw !important;
        margin: 0 !important;
    }

    body:has(#view-store.active) .main-content {
        height: calc(100% - 35px) !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        border-radius: 0 !important;
        overflow: hidden !important;
    }

    /* Reducir topbar para dar más espacio neto */
    body:has(#view-store.active) .topbar {
        padding: 2px 10px !important;
        margin-bottom: 0 !important;
        min-height: 35px !important;
        height: 35px !important;
    }

    #view-store.active {
        overflow: hidden !important; /* Prohibido cualquier scroll */
        display: flex !important;
        flex-direction: column !important;
        flex: 1 !important; 
        height: auto !important;
        min-height: 0 !important;
        padding: 5px 10px 0 10px !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    #view-store.active > div {
        height: auto !important; 
        flex: 1 !important;
        min-height: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #store-active-step-container {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto !important;
        height: 100% !important; 
        justify-content: flex-start !important; 
        align-items: center !important;
        overflow: hidden !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }

    #store-active-step-container > div {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto !important;
        height: 100% !important;
        justify-content: flex-start !important; 
        align-items: center !important;
        width: 100% !important;
        overflow: hidden !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* Garantizar que la caja de CheckouT NO toque el borde: 10px de margen por cada lado */
    #store-step-content > .checkout-summary-container,
    #store-step-content > div[style*="580px"] {
        max-width: calc(100% - 20px) !important;
        width: 100% !important;
        margin: 0 10px !important;
        box-sizing: border-box !important;
    }

    #store-breadcrumb-container {
        margin-bottom: 2px !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        padding-bottom: 0 !important;
        -webkit-overflow-scrolling: touch;
    }

    #store-breadcrumb-container > div {
        white-space: nowrap !important; /* Prohibido que ocupen 2 líneas de alto */
        padding: 4px 8px !important;
    }
    
    #store-breadcrumb-container span {
        font-size: 0.65rem !important; /* Tipografía enana para los breadcrumbs */
    }

    #store-step-title {
        margin-top: 0 !important;
        margin-bottom: 5px !important;
        font-size: 0.95rem !important; /* Título aún más pequeño */
    }

    #store-step-content {
        padding: 5px 0 !important; 
        flex: 1 1 auto !important; height: auto !important; min-height: min-content !important;
        display: flex !important;
        align-items: center !important;
    }



    /* Eliminamos scroll lateral y ajustamos tarjetas para que quepan todas */
    .store-horizontal-layout {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: hidden !important; /* Forzar que no haya scroll lateral */
        justify-content: center !important;
        padding: 5px !important;
        gap: 12px !important;
        width: 100% !important;
    }

    .store-option-card {
        flex: 1 1 0px !important; 
        max-width: 250px !important;
        min-width: 80px !important; /* Permitir encogimiento extremo */
        height: auto !important;
        min-height: 80px !important; /* Ya no está forzado a 100px */
        padding: 8px 5px !important; 
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
    }

    .store-option-card i {
        width: 24px !important; 
        height: 24px !important;
        margin-bottom: 5px !important;
    }

    .store-option-card h3 {
        font-size: 0.85rem !important; /* Letra un poco más pequeña */
        margin-bottom: 2px !important;
    }

    .store-option-card p {
        font-size: 0.7rem !important;
    }

    /* Redimensionado Ajustado para las Tarjetas (Más elásticas) */
    .netflix-card.protected-card, #store-step-content .netflix-card {
        height: 220px !important;
        max-height: 55dvh !important;
        min-height: 80px !important; 
        min-width: 0 !important; /* CRÍTICO: Matar herencia de min-width: 180px de tablets */
        width: auto !important;
        max-width: 180px !important;
        aspect-ratio: 2/3 !important;
        margin: 0 !important;
    }

    /* Las tarjetas de módulos puros no necesitan ser tan altas, mejor cuadradas para espacio de texto */
    .netflix-card.module-multi-card {
        aspect-ratio: 4/5 !important;
        max-height: 48dvh !important;
        max-width: 200px !important;
        min-width: 0 !important;
    }

    .netflix-card .card-title {
        font-size: 0.95rem !important; /* Texto legible */
        line-height: 1.1 !important;
        word-break: normal !important;
    }

    /* FIX: Gravedad desde arriba para no invadir los breadcrumbs y EVITAR EL CORTE DEL FLEX CENTER */
    #store-active-step-container {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 0% !important;
        min-height: 0 !important;
        height: 100% !important; 
        justify-content: flex-start !important; 
        align-items: flex-start !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    #store-active-step-container > div {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto !important;
        min-height: min-content !important;
        height: auto !important;
        justify-content: flex-start !important; 
        align-items: center !important;
        width: 100% !important;
        overflow: visible !important;
    }
    #store-step-content > div[style*="display:flex"] {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 15px !important;
        width: 100% !important;
        justify-content: center !important;
        align-items: flex-start !important; /* Ya no crecen hacia arriba, solo hacia abajo */
    }

    #store-step-content > div > div[style*="gap:20px"] {
        gap: 10px !important;
        flex-wrap: nowrap !important;
        flex: none !important; /* El centro mide lo justo */
    }

    #store-step-content > div > div[style*="flex:1"]:first-child {
        display: flex !important; /* Restauramos espaciador izquierdo */
        flex: 1 !important;
    }

    #store-step-content > div > div:last-child {
        display: flex !important;
        flex: 1 !important; /* Botón a la derecha equilibrado */
        width: auto !important;
        padding-left: 10px !important;
        justify-content: flex-start !important;
    }

    #btn-continue-modules {
        padding: 10px 15px !important;
        justify-content: center !important;
        gap: 4px !important;
        width: auto !important;
    }

    #btn-continue-modules span {
        font-size: 0.9rem !important;
    }

    /* FIX MÁGICO: Ocultar el div espaciador inyectado en JS que rompía el nowrap */
    .store-horizontal-layout > div[style*="width:100%"] {
        display: none !important;
    }


    /* Ajuste de cabecera en landscape */
    #store-header {
        flex-direction: row !important;
        justify-content: space-between !important;
        padding-bottom: 10px !important;
    }

    #store-header h1 { font-size: 1.2rem !important; }
    #store-header p { display: none !important; } /* Ocultar para ahorrar espacio */
    
    #store-price-container {
        width: auto !important;
        flex: none !important;
    }
    
    #store-price-container > div {
        padding: 4px 10px !important;
    }
    
    #store-price-container span:last-child {
        font-size: 1rem !important;
    }
}

/* --- BLOQUE DE SEGURIDAD PARA EVITAR SOLAPAMIENTO DE VISTAS EN MÓVIL --- */
/* Cuando el main-content pasa a ser 'display: block' en móviles/tablets, las vistas
   podrían apilarse si la lógica JS no las oculta correctamente o si hay delays.
   Forzamos que solo la sección con clase .active sea visible. */
@media screen and (max-width: 1024px) {
    .view-section:not(.active) {
        display: none !important;
    }
}

/* =======================================================
   SUBTITLE OVERRIDES (PLYR Y PODCAST RESPONSIVE)
   ======================================================= */
/* Plyr Fluid Captions */
.plyr__captions {
    font-size: clamp(14px, 3.5vw, 24px) !important;
    line-height: 1.4 !important;
}
.plyr__captions .plyr__caption {
    background: rgba(0, 0, 0, 0.75) !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    text-shadow: 1px 1px 2px black, 0 0 10px black !important;
}

/* Custom Podcast Captions */
.podcast-captions-overlay {
    position: absolute;
    bottom: 0px;
    width: 100%;
    text-align: center;
    pointer-events: none;
    z-index: 10;
    padding: 0 15px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    transition: opacity 0.3s ease;
    opacity: 0;
}
.podcast-captions-overlay.active {
    opacity: 1;
}
.podcast-captions-text {
    background: rgba(0, 0, 0, 0.75);
    color: white;
    font-size: clamp(14px, 3.5vw, 24px);
    line-height: 1.4;
    padding: 4px 10px;
    border-radius: 6px;
    text-shadow: 1px 1px 2px black, 0 0 10px black;
    font-family: inherit;
    /* Evitar que toque el borde abajo en móvil */
    margin-bottom: 25px; 
    max-width: 90%;
    word-wrap: break-word; 
    overflow-wrap: break-word; 
}

/* Tooltip and Active CC Button effect */
#podcast-cc-btn {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    width: 44px; height: 44px; 
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}
#podcast-cc-btn.active-cc {
    background: rgba(157,116,255,0.25);
    color: white;
    border-color: #9D74FF;
    box-shadow: 0 0 15px rgba(157,116,255,0.4);
}
#podcast-cc-btn:hover {
    background: rgba(255,255,255,0.09);
}

/* Modificaciones Responsivas para el CC del podcast */
@media screen and (max-width: 1024px) {
    #podcast-cc-btn {
        width: 38px; height: 38px;
    }
    #podcast-cc-btn i { width: 20px; height: 20px; }
}
@media screen and (max-height: 500px) and (orientation: landscape) {
    #podcast-cc-btn {
        width: 34px; height: 34px;
    }
    #podcast-cc-btn i { width: 18px; height: 18px; }
}




/* --- FIX MOBILE SCROLL NATIVO (COMO EN EL BACKUP) --- */
@media (max-width: 768px) {
    html, body {
        position: relative !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        height: auto !important;
        min-height: 100vh !important;
        padding-bottom: 80px !important;
    }
    #app-content, .app-container {
        height: auto !important;
        min-height: 100vh !important;
        overflow: visible !important;
    }
    .main-content {
        margin: 0 !important;
        border-radius: 0 !important;
        border: none !important;
        height: auto !important;
        min-height: 100vh !important;
        width: 100% !important;
        overflow: visible !important;
        box-shadow: none !important;
    }
    .view-section, #view-store, #store-active-step-container {
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
        flex: none !important;
    }
}

/* --- FIX PLYR MOBILE OVERLAP --- */
@media (max-width: 600px) {
    /* En móviles el volumen se controla por botones físicos. Ocultarlo ahorra mucho espacio y evita solapamientos */
    [data-plyr="mute"], .plyr__volume, [data-plyr="pip"] {
        display: none !important;
    }
    .plyr__controls {
        gap: 5px !important;
    }
    /* Asegurar que el tiempo tenga espacio */
    .plyr__time {
        font-size: 12px !important;
        margin-right: 5px !important;
    }
    /* Si sigue faltando espacio, forzar márgenes más pequeños en los controles */
    .plyr__controls > button {
        padding: 5px !important;
    }
    .plyr__menu__container {
        right: 0 !important;
        bottom: 100% !important;
    }
}

    /* Asegurar que los controles hagan wrap en móviles muy estrechos */
    .plyr__controls {
        flex-wrap: wrap !important;
    }
    /* Mover la barra de progreso arriba para dar espacio a los botones abajo */
    .plyr__controls .plyr__progress {
        order: -1 !important;
        width: 100% !important;
        flex: 1 1 100% !important;
        margin-bottom: 5px !important;
    }\n    /* Asegurarndow: #13121A;      /* Fondo exterior más oscuro */
    --bg-main: #1C1A24;        /* Fondo del contenedor principal */
    --bg-card: #252233;        /* Fondo de tarjetas */
    --border-color: rgba(255, 255, 255, 0.04);
    
    /* Sapphire UI Accents */
    --accent-purple: #9D74FF;
    --accent-pink: #F87171;
    --accent-blue: #38BDF8;
    
    --text-main: #FFFFFF;
    --text-muted: #94A3B8;
}

/* =========================================
   SISTEMA DE AUTENTICACIÓN — ESTILOS BASE
   ========================================= */

/* Overlay con transición de opacidad (NO display toggle) */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,9,20,0.92);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
    /* Invisible por defecto */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.auth-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

/* Animación de entrada de la card del modal */
@keyframes authCardIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.auth-modal-card {
    animation: authCardIn 0.4s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
}

/* Spinner inline para botones de submit */
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.btn-auth-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

.spin {
    animation: spin 1s linear infinite;
}

/* Toast de notificación no bloqueante */
.auth-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-80px);
    background: #1e1c2e;
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    padding: 14px 22px;
    border-radius: 14px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    z-index: 99999;
    transition: transform 0.4s cubic-bezier(0.34, 1.2, 0.64, 1), opacity 0.3s;
    opacity: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 420px;
    white-space: nowrap;
}

.auth-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.auth-toast.warning { border-color: rgba(251,191,36,0.4); }
.auth-toast.error   { border-color: rgba(248,113,113,0.4); }
.auth-toast.success { border-color: rgba(52,211,153,0.4); }

body {
    margin: 0; padding: 0; 
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-window); 
    color: var(--text-main); 
    height: 100%; 
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Efectos de luz traseros estilo Sapphire UI */
body::before {
    content: ""; position: absolute; top: -100px; left: 20%; width: 400px; height: 400px;
    background: radial-gradient(circle, var(--accent-purple) 0%, transparent 70%);
    filter: blur(120px); opacity: 0.15; z-index: -1; pointer-events: none;
}
body::after {
    content: ""; position: absolute; bottom: -100px; right: 20%; width: 500px; height: 500px;
    background: radial-gradient(circle, var(--accent-blue) 0%, transparent 70%);
    filter: blur(150px); opacity: 0.1; z-index: -1; pointer-events: none;
}

.app-container { 
    display: flex; 
    width: 100vw; 
    height: 100%; 
    background-color: transparent;
    overflow: hidden;
}

/* SIDEBAR Sapphire Style (Integrada pero visualmente separada) */
.sidebar { 
    width: 250px; padding: 30px 20px; 
    display: flex; flex-direction: column; z-index: 10;
    overflow-y: auto;
    min-height: 0;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.05); border-radius: 10px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.1); }

.logo { 
    margin-bottom: 50px; padding-left: 10px; display: flex; align-items: center; gap: 12px;
}
.logo .dot { 
    width: 28px; height: 28px; 
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue)); 
    border-radius: 8px; box-shadow: 0 0 20px rgba(157, 116, 255, 0.4);
}
.logo h2 { margin: 0; font-size: 1.2rem; font-weight: 700; letter-spacing: 0.5px;}

.section-label { 
    font-size: 0.7rem; color: #475569; font-weight: 800; letter-spacing: 1px; 
    padding-left: 15px; margin-bottom: 15px; text-transform: uppercase;
}

.menu { margin-bottom: 30px; }
.menu a { 
    display: flex; align-items: center; padding: 12px 15px; color: var(--text-muted); 
    text-decoration: none; border-radius: 12px; margin-bottom: 4px; transition: all 0.2s ease; font-weight: 500; font-size: 0.95rem;
}
.menu a:hover { color: white; background: rgba(255,255,255,0.03); }
.menu a.active { 
    background: rgba(255,255,255,0.06); color: white; 
}
.menu a.active .icon { color: var(--accent-purple); }

.menu .icon { margin-right: 14px; font-size: 1.1rem; opacity: 0.9; }

/* CONTENIDO PRINCIPAL (La gran tarjeta flotante) */
.main-content { 
    flex: 1;
    padding: 10px;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-main);
    border-radius: 30px; 
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    margin: 10px;
    height: calc(100% - 20px);
    box-sizing: border-box;
    min-height: 0;
}

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; flex-shrink: 0; }
.topbar .greeting { font-size: 0.8rem; color: var(--text-muted); margin: 0 0 1px 0;}
.topbar h1 { font-size: 1.2rem; font-weight: 700; margin: 0; letter-spacing: -0.5px; }


/* Search & Profile */
.topbar-right { display: flex; align-items: center; gap: 20px; }
.search-bar { background: var(--bg-card); padding: 10px 20px; border-radius: 20px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--border-color);}
.search-bar input { background: transparent; border: none; color: white; outline: none; font-family: 'Outfit';}

/* VISTAS — Llenan el espacio restante de main-content (flex column) */
.view-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
    padding-right: 5px;
}

/* Estilo para el scrollbar dentro de las vistas */
.view-section::-webkit-scrollbar { width: 6px; }
.view-section::-webkit-scrollbar-track { background: transparent; }
.view-section::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.05); border-radius: 10px; }
.view-section::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.1); }

/* GRID Y TARJETAS */
.dashboard-grid { display: grid; grid-template-columns: 1.6fr 1.1fr; gap: 25px; }
.player-split-grid { 
    display: grid; 
    grid-template-columns: 2.5fr 1fr; 
    gap: 20px; 
    width: 100%; 
    box-sizing: border-box; 
    min-height: 0;
}
.player-split-grid > div { min-width: 0; }

.card { 
    background: var(--bg-card); border-radius: 24px; padding: 30px; 
    border: 1px solid rgba(255, 255, 255, 0.02);
    position: relative; overflow: hidden;
}

.card.ai-featured {
    padding: 0;
    background: linear-gradient(145deg, #241e3d, #14131d);
    border: 1px solid rgba(157, 116, 255, 0.2);
}
.ai-featured-content { padding: 40px; position:relative; z-index: 2; }
.ai-featured h2 { margin: 0 0 10px 0; font-size: 2rem; background: linear-gradient(90deg, #fff, var(--accent-blue)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;}
.ai-featured-glow {
    position: absolute; right: -50px; bottom: -50px; width: 300px; height: 300px;
    background: radial-gradient(circle, var(--accent-pink) 0%, var(--accent-purple) 40%, transparent 70%);
    filter: blur(40px); opacity: 0.3; z-index: 1;
}

.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;}
.card-header h3 { margin: 0; font-size: 1.1rem; font-weight: 600; display:flex; align-items:center; gap:8px;}

/* Estilos de tabla / listas */
.status-row { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 18px 0; border-bottom: 1px solid var(--border-color); font-size: 0.95rem;
}
.status-row:last-child { border-bottom: none; }
.status-row .label { display: flex; align-items: center; gap: 15px; font-weight: 500;}
.status-row .icon-box { width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,0.03); display: flex; justify-content: center; align-items: center;}

.pill { padding: 5px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.5px;}
.pill.pending { background: rgba(245, 158, 11, 0.1); color: #FCD34D;}
.pill.ok { background: rgba(16, 185, 129, 0.1); color: #34D399;}

/* Dropzone Premium */
.drop-zone { 
    margin-top: 20px; border: 2px dashed rgba(157, 116, 255, 0.3); border-radius: 16px; 
    padding: 50px 20px; text-align: center; background: rgba(157, 116, 255, 0.02); 
    transition: all 0.3s ease; cursor: pointer;
}
.drop-zone:hover { background: rgba(157, 116, 255, 0.08); border-color: var(--accent-purple); }

.upload-icon { font-size: 3rem; margin-bottom: 15px; filter: hue-rotate(45deg); opacity: 0.8;}
.drop-zone h4 { margin: 0 0 5px 0; font-size: 1.2rem; font-weight: 600; color: white;}
.drop-zone p { margin: 0; color: var(--text-muted); font-size: 0.9rem;}

.btn-upload {
    background: rgba(255,255,255,0.05); color: white; border: 1px solid var(--border-color);
    padding: 8px 16px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.2s; font-family: 'Outfit';
}
.btn-upload:hover { background: var(--accent-purple); border-color: var(--accent-purple); color: black;}

/* --- BIBLIOTECA DE AULAS (AULAS VIEW) --- */
.view-section h1 {
    font-size: 2.2rem;
    margin-bottom: 30px;
}

#aulas-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-top: 20px;
}

.curso-section {
    background: rgba(255, 255, 255, 0.01);
    border-radius: 24px;
    border: 1px solid var(--border-color);
    padding: 25px;
}

.curso-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.trimestre-card {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 18px;
    margin-bottom: 15px;
    overflow: hidden;
}

.trimestre-header {
    padding: 18px 25px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.01);
    transition: 0.3s;
}

.trimestre-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.trimestre-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--accent-purple);
}

.asignatura-group {
    padding: 10px 25px 25px 25px;
}

.asignatura-title {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin: 20px 0 15px 0;
    border-left: 2px solid var(--accent-blue);
    padding-left: 10px;
}

/* TARJETA DE CLASE PREMIUM */
.class-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.class-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 16px 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.class-card:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(157, 116, 255, 0.2);
}

.class-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.class-badge {
    width: 32px;
    height: 32px;
    background: rgba(157, 116, 255, 0.1);
    color: var(--accent-purple);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.75rem;
}

.class-card h4 {
    margin: 0;
    font-weight: 500;
    font-size: 1rem;
    color: #f1f5f9;
}

/* ACCIONES DE LA CLASE (MULTIMEDIA) */
.class-actions {
    display: flex;
    gap: 10px;
}

.media-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: white;
    cursor: pointer;
    transition: 0.2s;
    font-size: 1.1rem;
    position: relative;
}

.media-btn:hover {
    background: var(--accent-purple);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(157, 116, 255, 0.3);
}

.media-btn.disabled {
    opacity: 0.15;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(1);
}

/* Tooltips básicos */
.media-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: 0.2s;
}

.media-btn:hover::after {
    opacity: 1;
}

/* --- COLA DE SUBIDA MULTIPLE --- */
#upload-queue {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 28vh; /* Ajuste adaptativo para evitar recortes en laptops */
    overflow-y: auto;
    padding-right: 10px;
}

#upload-queue::-webkit-scrollbar { width: 4px; }
#upload-queue::-webkit-scrollbar-track { background: transparent; }
#upload-queue::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
#upload-queue::-webkit-scrollbar-thumb:hover { background: var(--accent-purple); }

.upload-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    text-align: left;
    flex-shrink: 0; /* EVITAR QUE SE ENCOJAN AL HABER MUCHOS */
}

.upload-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
    position: relative;
    z-index: 2;
}

.upload-name {
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.upload-status {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.upload-progress-track {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    z-index: 2;
}

.upload-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-blue));
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Identificadores de estado dinámicos */
.upload-item.en-cola .upload-progress-fill { background: rgba(255, 255, 255, 0.1); }
.upload-item.procesando .upload-progress-fill { background: linear-gradient(90deg, var(--accent-pink), var(--accent-purple)); }
.upload-item.conversion .upload-progress-fill { background: linear-gradient(90deg, var(--accent-blue), #10B981); }
.upload-item.completado { border-color: rgba(16, 185, 129, 0.3); background: rgba(16, 185, 129, 0.05); }
.upload-item.error .upload-progress-fill { background: #EF4444; }

/* DETALLES DE CONTROL Y PESO */
.upload-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-size {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    padding: 2px 6px;
    border-radius: 4px;
}

.btn-cancel {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(248, 113, 113, 0.1);
    color: #F87171;
    border: 1px solid rgba(248, 113, 113, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 900;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: #EF4444;
    color: white;
    border-color: #EF4444;
    transform: scale(1.1);
}

.upload-item.completado .btn-cancel,
.upload-item.error .btn-cancel {
    display: none; /* Ocultar al terminar */
}

/* ========================================= */
/* NETFLIX UI - PORTADAS Y LISTADOS INMERSIVOS */
/* ========================================= */

.netflix-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 25px;
    margin-top: 20px;
    padding: 10px; /* Espacio interno para que el escalado no se corte */
}

.netflix-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s;
    aspect-ratio: 2/3;
    background: #111119; /* Placeholder oscuro */
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.netflix-card:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 30px rgba(0,0,0,0.5);
    z-index: 10;
}

.netflix-card img.cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.netflix-card:hover img.cover {
    opacity: 0.4;
}

.netflix-card .card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    display: flex;
    flex-direction: column;
}

.netflix-card .card-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: white;
    margin-bottom: 5px;
}

.netflix-card .card-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.btn-edit-cover {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    z-index: 20;
}

.netflix-card:hover .btn-edit-cover {
    opacity: 1;
}

.btn-edit-cover:hover {
    background: var(--accent-pink);
    transform: scale(1.1);
}

/* Tipos Teórico / Práctico (Minimalista) */
.type-tabs {
    display: flex;
    gap: 30px;
    margin-bottom: 25px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.type-tab {
    padding: 15px 0;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.type-tab.active, .type-tab:hover {
    color: white;
    border-bottom-color: var(--accent-pink);
}

/* Lista de Clases (Netflix Style) */
.episode-list {
    display: flex;
    flex-direction: column;
}

.episode-row {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    border-radius: 16px;
    margin-bottom: 4px;
    background: transparent;
    border: 1px solid transparent;
}

.episode-row:hover {
    background: linear-gradient(90deg, rgba(255,255,255,0.01) 0%, rgba(255,255,255,0.03) 100%);
    border-color: rgba(255,255,255,0.05);
    transform: scale(1.01);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.episode-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: transparent;
    -webkit-text-stroke: 1px rgba(255,255,255,0.15);
    background: transparent;
    width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    flex-shrink: 0;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.episode-row:hover .episode-number {
    color: white;
    -webkit-text-stroke: 0px transparent;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

.episode-title {
    flex: 1;
    font-size: 1.15rem;
    font-weight: 400;
    color: #94A3B8;
    letter-spacing: 0.5px;
    transition: all 0.3s;
}

.episode-row:hover .episode-title {
    color: #ffffff;
    font-weight: 600;
}

.episode-meta {
    display: flex;
    gap: 15px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.episode-icons {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-left: 20px;
}

.epi-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    color: white;
    opacity: 0.2;
    transition: all 0.4s;
}

.episode-row:hover .epi-icon.video { background: var(--accent-purple); color: white; opacity: 1; box-shadow: 0 4px 15px rgba(157, 116, 255, 0.4); }
.episode-row:hover .epi-icon.pdf { background: #F87171; color: white; opacity: 1; box-shadow: 0 4px 15px rgba(248, 113, 113, 0.4); }
.episode-row:hover .epi-icon.audio { background: #34D399; color: white; opacity: 1; box-shadow: 0 4px 15px rgba(52, 211, 153, 0.4); }
.epi-icon.video { color: var(--text-muted); }
.epi-icon.pdf { color: var(--text-muted); }
.epi-icon.audio { color: var(--text-muted); }

/* Indicador de recurso ya visto/reproducido */
.epi-icon.visto {
    background: rgba(255,255,255,0.1) !important;
    border-color: rgba(255,255,255,0.4) !important;
    opacity: 0.5;
}

/* Scroll Estético para las Listas */
.episode-list::-webkit-scrollbar {
    width: 6px;
}
.episode-list::-webkit-scrollbar-track {
    background: transparent;
}
.episode-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
.episode-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent-pink);
}

/* REPRODUCTOR SUPERPUESTO (TEATRO MODO) */
.player-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(10, 10, 12, 0.98);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s;
}

.player-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.player-header {
    padding: 25px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
}

.btn-close-player {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-close-player:hover {
    background: #EF4444;
    transform: rotate(90deg);
}

.player-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 0 40px 40px 40px;
    display: flex;
    flex-direction: column;
}

.player-tabs {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.player-tab {
    padding: 12px 25px;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.player-tab.active {
    background: rgba(255,255,255,0.1);
    color: white;
    border-color: rgba(255,255,255,0.2);
}

.player-frame-container {
    width: 100%;
    aspect-ratio: 16/9;
    background: black;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
}

.player-frame-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Carrusel de "Siguientes episodios" */
.up-next-section {
    margin-top: 40px;
}

.up-next-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    margin-bottom: 15px;
}

.up-next-carousel {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.up-next-item {
    min-width: 280px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.up-next-item:hover {
    background: rgba(255,255,255,0.08);
}

.up-next-num {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.up-next-name {
    font-size: 1rem;
    font-weight: 600;
    color: white;
}

/* ========================================= */
/* MODAL SELECTOR DE PORTADAS (GALLERY)      */
/* ========================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 9, 20, 0.95);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(15px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.visible {
    display: flex;
    opacity: 1;
}

.cover-selector-card {
    background: #1e1c2e;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0,0,0,0.8);
    animation: authCardIn 0.4s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.modal-header {
    padding: 25px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.modal-close {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}

.modal-close:hover {
    background: rgba(248, 113, 113, 0.2);
    color: #F87171;
}

.modal-body {
    padding: 20px 30px;
    overflow-y: auto;
    flex: 1;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.gallery-item {
    aspect-ratio: 16/9;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: 0.2s;
    position: relative;
    background: #14131d;
}

.gallery-item:hover {
    transform: scale(1.05);
    border-color: var(--accent-purple);
    z-index: 5;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
    transition: 0.2s;
}

.gallery-item:hover img {
    opacity: 1;
}

.gallery-item.selected {
    border-color: var(--accent-pink);
    box-shadow: 0 0 15px rgba(248, 113, 113, 0.4);
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* DASHBOARD GRID SYSTEM (Desktop default) */
.stats-kpi-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}
.stats-courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}
.auth-grid-two-col {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
}

/* Ocultar elementos móviles por defecto */
.nav-toggle-btn {
    display: none;
}
.mobile-sidebar-overlay {
    display: none;
}

/* Forzar bloqueo de scroll en landing */
body.landing-active, 
body.landing-active html {
    overflow: hidden !important;
    height: 100vh !important;
    position: fixed;
    width: 100%;
}

/* =========================================
   RESPONSIVIDAD Y OPTIMIZACIÓN MÓVIL
   ========================================= */

@media (max-width: 1024px) {
    html {
        overflow: hidden !important;
        height: 100% !important;
    }
    body { 
        overflow-x: hidden !important; 
        overflow-y: auto !important; 
        height: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block !important; 
        -webkit-overflow-scrolling: touch;
    }
    
    .app-container {
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        min-height: 100% !important;
        padding-bottom: 70px !important; 
        margin: 0 !important;
        overflow: hidden !important;
    }

   /* Mobile Drawer - Hidden by default */
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -320px !important; 
        bottom: 0 !important;
        width: 280px !important;
        height: 100vh !important;
        background: #161521 !important; 
        backdrop-filter: blur(25px) !important;
        flex-direction: column !important;
        padding: 30px 20px !important;
        margin: 0 !important;
        justify-content: flex-start !important;
        align-items: stretch !important;
        border-right: 1px solid rgba(255,255,255,0.08) !important;
        border-top: none !important;
        z-index: 100000 !important; 
        box-shadow: none !important; 
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
        overflow-y: auto !important;
    }

    .sidebar.open {
        transform: translateX(320px) !important;
        box-shadow: 20px 0 50px rgba(0,0,0,0.5) !important;
    }

    .mobile-sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    .mobile-sidebar-overlay.visible {
        opacity: 1;
        pointer-events: all;
    }

    .nav-toggle-btn {
        display: flex !important;
    }

    .sidebar-logo, .section-label, #admin-group { display: block !important; }
    .sidebar-logo { margin-bottom: 30px !important; }
    
    .menu {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        height: auto !important;
        margin-bottom: 20px !important;
    }

    .menu a {
        flex-direction: row !important;
        gap: 12px !important;
        padding: 14px 18px !important;
        font-size: 0.95rem !important;
        text-transform: none !important;
        letter-spacing: normal !important;
        margin-bottom: 6px !important;
        background: rgba(255,255,255,0.02) !important;
        flex: none !important;
        text-align: left !important;
        justify-content: flex-start !important;
        border-radius: 12px !important;
    }
    
     /* Auth & Modals */
    .auth-overlay { overflow-y: auto !important; align-items: flex-start !important; padding: 20px 0 !important; }
    .auth-modal-card { 
        width: calc(100% - 30px) !important; 
        max-width: 420px !important;
        margin: 20px auto !important; 
        padding: 25px 15px !important; /* Reducir padding en móvil */
    }

    /* Panel de Notificaciones Adaptable */
    .notifications-dropdown {
        position: fixed !important;
        top: 80px !important;
        left: 15px !important;
        right: 15px !important;
        width: auto !important;
        max-width: none !important;
        z-index: 100000 !important;
    }

    /* Dropdown de Cuenta Adaptable */
    #account-dropdown {
        right: -10px !important;
        min-width: 220px !important;
    }

    .menu a .icon { width: 18px !important; height: 18px !important; }
    .menu a.active { background: rgba(157, 116, 255, 0.1) !important; border: 1px solid rgba(157, 116, 255, 0.2) !important; }

    /* Contenedor Principal */
    .main-content {
        margin: 0 !important;
        border-radius: 0 !important;
        border: none !important;
        padding: 15px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        min-height: 100vh !important;
        box-shadow: none !important;
        overflow-x: hidden !important;
        background-color: var(--bg-window) !important;
    }

    .topbar { 
        width: 100% !important; 
        flex-direction: row !important; 
        align-items: center !important; 
        justify-content: space-between !important;
        gap: 10px !important; 
        box-sizing: border-box !important; 
        margin-bottom: 20px !important;
        padding-bottom: 15px !important;
    }
    .topbar .greeting { display: none; } /* Ocultar saludo largo en móvil */
    .topbar-right { width: auto !important; gap: 10px !important; }
    .search-bar { display: none !important; } /* Ocultar buscador en móvil para ahorrar espacio */

    .view-section { 
        width: 100% !important; 
        overflow-x: hidden !important; 
        overflow-y: visible !important; 
        -webkit-overflow-scrolling: touch;
    }

    /* DASHBOARD RESPONSIVE */
    .stats-kpi-strip {
        display: flex !important;
        overflow-x: auto !important;
        gap: 15px !important;
        padding: 5px 2px 20px 2px !important;
        scroll-snap-type: x mandatory !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
        grid-template-columns: none !important;
    }
    .stats-kpi-strip::-webkit-scrollbar { display: none !important; }
    
    .stats-kpi-card {
        flex: 0 0 240px !important;
        scroll-snap-align: center !important;
        padding: 18px !important;
    }
    
    .stats-courses-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    .stats-course-card {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 15px !important;
    }

    /* Convertir la tarjeta en Grid Estricto (minmax previene estallidos por texto largo) */
    #store-step-content > .checkout-summary-container > div,
    #store-step-content > div[style*="580px"] > div {
        display: grid !important;
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) !important;
        grid-template-rows: auto auto auto !important;
        gap: 5px 15px !important;
        padding: 10px !important;
    }

    #store-step-content > .checkout-summary-container h3,
    #store-step-content > div[style*="580px"] h3 {
        grid-column: 1 / 3 !important;
        margin-bottom: 0 !important;
        font-size: 1.1rem !important;
    }

    /* Historial */
    #store-step-content > .checkout-summary-container > div > div:nth-of-type(1),
    #store-step-content > div[style*="580px"] > div > div:nth-of-type(1) {
        grid-column: 1 / 2 !important;
        grid-row: 2 / 4 !important;
        padding: 4px !important;
    }

    /* Obligamos al historial a envolver el texto si es muy largo */
    #store-step-content > .checkout-summary-container > div > div:nth-of-type(1) > div,
    #store-step-content > div[style*="580px"] > div > div:nth-of-type(1) > div {
        flex-wrap: wrap !important;
        padding-bottom: 2px !important;
        gap: 2px !important;
    }

    /* Calculadora / Totales */
    #store-step-content > .checkout-summary-container > div > div:nth-of-type(2),
    #store-step-content > div[style*="580px"] > div > div:nth-of-type(2) {
        grid-column: 2 / 3 !important;
        grid-row: 2 / 3 !important;
        margin-top: 0 !important;
        border-top: none !important;
        padding-top: 0 !important;
        gap: 4px !important;
    }

    /* Reducir bestialmente el texto de 500€ para ganar espacio vertical */
    #store-step-content > .checkout-summary-container > div > div:nth-of-type(2) > div:last-child,
    #store-step-content > div[style*="580px"] > div > div:nth-of-type(2) > div:last-child {
        padding: 5px 10px !important;
    }

    #store-step-content > .checkout-summary-container > div > div:nth-of-type(2) > div:last-child span[style*="font-size:2.4rem"],
    #store-step-content > div[style*="580px"] > div > div:nth-of-type(2) > div:last-child span[style*="font-size:2.4rem"] {
        font-size: 1.4rem !important; 
    }

    /* Botón / Checkbox Wrapper */
    #store-step-content > .checkout-summary-container > div > div:nth-of-type(3),
    #store-step-content > div[style*="580px"] > div > div:nth-of-type(3) {
        grid-column: 1 / 3 !important;
        grid-row: 4 !important;
        margin-top: 15px !important;
    }

    #store-step-content > .checkout-summary-container button,
    #store-step-content > div[style*="580px"] button {
        grid-column: 1 / 3 !important;
    }

    /* Contenido / Level 5 Grid */
    .player-split-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .player-frame-container {
        aspect-ratio: 16/9 !important;
        height: auto !important;
    }
    
    .episode-list {
        max-height: 400px !important;
    }
    
    .stats-course-card > div:first-child {
        flex-direction: column !important;
        gap: 20px !important;
        padding-bottom: 15px !important;
    }

    .stats-course-card .course-progress-ring-container {
        width: 100% !important;
        justify-content: center !important;
    }

    .stats-course-card .course-details-main {
        text-align: center !important;
    }

    .stats-course-card .course-subjects-mini-list {
        margin-top: 15px !important;
        border-top: 1px solid rgba(255,255,255,0.05) !important;
        padding-top: 15px !important;
    }
    
    .netflix-grid {
        display: grid !important;
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
        gap: 15px !important;
        padding: 10px 0 !important;
        overflow-x: visible !important;
        overflow-y: visible !important;
    }
    
    .netflix-card {
        flex: none !important;
        width: 100% !important;
        aspect-ratio: 16/9 !important;
        height: auto !important;
    }

    .netflix-card .card-info {
        padding: 12px !important;
    }

    .netflix-card .card-title { 
        font-size: 0.9rem !important; 
        line-height: 1.25 !important;
        font-weight: 700 !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        white-space: normal !important;
        word-wrap: break-word !important;
    }

    .netflix-card .card-subtitle {
        font-size: 0.65rem !important;
        line-height: 1.2 !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 1 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        white-space: normal !important;
        margin-bottom: 4px !important;
    }

    /* STORE RESPONSIVE */
    .store-horizontal-layout {
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        gap: 15px !important;
        padding: 20px 5px !important;
        scroll-snap-type: x mandatory !important;
        scrollbar-width: none !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .store-horizontal-layout::-webkit-scrollbar { display: none !important; }

    .store-option-card {
        flex: 0 0 260px !important;
        scroll-snap-align: center !important;
    }

    /* Stacked Cards (Ciclos) Mobile */
    .stats-kpi-strip .netflix-card.protected-card,
    .store-horizontal-layout .netflix-card.protected-card {
        height: 38vh !important;
        max-height: 280px !important;
        width: calc(38vh * 0.7) !important;
        min-width: 180px !important;
    }

    .stacked-covers-container {
        height: 80% !important;
    }

    .stacked-cover.back-card {
        left: 20% !important;
        transform: rotate(8deg) !important;
    }

    .stacked-cover.front-card {
        left: 5% !important;
        transform: rotate(-5deg) !important;
    }

    .netflix-card.protected-card .card-title {
        font-size: 1.2rem !important;
    }

    .netflix-card.protected-card .card-subtitle {
        font-size: 0.8rem !important;
    }

    /* Notifications Dropdown Mobile */
    .notifications-dropdown {
        position: fixed !important;
        top: 60px !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        max-height: calc(100vh - 120px) !important;
        transform: none !important;
    }


    .main-content {
        margin: 0 !important;
        border-radius: 0 !important;
        border: none !important;
        padding: 15px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        min-height: 100vh !important;
        box-shadow: none !important;
        overflow-x: hidden !important;
        background-color: var(--bg-window) !important;
    }

    .hide-mobile { display: none !important; }
    .show-mobile { display: block !important; }
    .flex-mobile { display: flex !important; }


    #mobile-sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 15000;
        opacity: 0;
        transition: opacity 0.4s ease;
    }

    #mobile-sidebar-overlay.visible {
        display: block;
        opacity: 1;
    }

    /* Estilos de Clases y Media (Vistas Profundas) */
    .breadcrumb-nav {
        font-size: 0.9rem !important;
        padding: 0 5px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .episode-row {
        padding: 12px 10px !important;
        gap: 10px !important;
        border-radius: 12px !important;
        margin-bottom: 8px !important;
        background: rgba(255,255,255,0.02) !important;
    }

    .episode-number { 
        font-size: 1.4rem !important; 
        width: 35px !important; 
        margin-right: 5px !important;
    }

    .episode-title { 
        font-size: 0.9rem !important; 
        line-height: 1.3 !important;
    }

    .episode-icons {
        gap: 8px !important;
        margin-left: 10px !important;
    }

    .epi-icon {
        width: 38px !important; /* Más grandes para touch */
        height: 38px !important;
        opacity: 0.4 !important; /* Más visibles en móvil por defecto */
    }
    
    .episode-row:hover .epi-icon {
        opacity: 1 !important;
    }

    /* Podcast Player */
    #podcast-player { padding: 15px !important; }

    .iti__dropdown-content {
        width: calc(100vw - 60px) !important;
        max-width: 300px !important;
    }

    .auth-grid-two-col {
        grid-template-columns: 1fr !important;
    }

    .type-tabs {
        gap: 15px !important;
        margin-bottom: 15px !important;
        justify-content: center !important;
    }

    .type-tab {
        font-size: 0.9rem !important;
        padding: 10px 0 !important;
    }
}

/* =========================================
   SISTEMA DE RESPONSIVIDAD PROFESIONAL (CRASH v2.6)
   ========================================= */

/* DISPOSITIVOS MÓVILES Y TABLETS (Cualquier tamaño < 1024px) */
@media screen and (max-width: 1024px) {
    html, body {
        overflow-x: hidden;
        overflow-y: auto;
        height: auto;
        min-height: 100%;
        position: relative;
        display: block;
    }

    body {
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        background-color: var(--bg-window) !important;
        -webkit-overflow-scrolling: touch;
    }

    .app-container {
        width: 100%;
        max-width: 100%;
        height: auto;
        min-height: 100%;
        display: flex;
        flex-direction: column;
        margin: 0;
        padding: 0;
    }

    /* MODO HORIZONTAL / LANDSCAPE OPTIMIZADO */
    @media (orientation: landscape) and (max-height: 600px) {
        .app-container { min-height: 100vh !important; }
        .main-content { 
            min-height: 100vh !important; 
            padding: 5px 10px 40px 10px !important; 
        }
        .topbar { 
            padding: 2px 10px !important; 
            margin-bottom: 5px !important;
        }
        .logo h2 { display: none; }
        .breadcrumb-nav { padding: 2px 5px !important; font-size: 0.8rem !important; }
        h1, .view-section h1 { font-size: 1rem !important; }
    }

    /* SIDEBAR -> DRAWER MÓVIL */
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 280px !important;
        height: 100% !important;
        background: #1c1a24 !important;
        box-shadow: 20px 0 50px rgba(0,0,0,0.8) !important;
        transform: translateX(-110%) !important;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 10001 !important;
        padding: 30px 20px !important;
        overflow-y: auto !important;
    }

    .sidebar.open {
        transform: translateX(0) !important;
    }

    .mobile-sidebar-overlay {
        position: fixed !important;
        inset: 0 !important;
        background: rgba(0,0,0,0.7) !important;
        backdrop-filter: blur(4px) !important;
        z-index: 10000 !important;
        opacity: 0 !important;
        pointer-events: none !important;
        transition: opacity 0.3s ease !important;
    }

    .mobile-sidebar-overlay.visible {
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    #mobile-menu-toggle { display: flex !important; }

    .main-content {
        margin: 0 !important;
        border-radius: 0 !important;
        width: 100% !important;
        border: none !important;
        min-height: 100vh !important;
        padding: 10px 10px 20px 10px !important;
        box-shadow: none !important;
        overflow: visible !important;
        display: block !important;
    }

    /* NAVEGACIÓN HORIZONTAL SCROLLABLE */
    .breadcrumb-nav, #store-breadcrumb-container {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        padding: 8px 5px !important;
        gap: 12px !important;
        -webkit-overflow-scrolling: touch;
        width: 100% !important;
        scrollbar-width: none;
        box-sizing: border-box !important;
    }
    .breadcrumb-nav::-webkit-scrollbar { display: none; }
    .breadcrumb-nav span, .breadcrumb-nav a, #store-breadcrumb-container > * {
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }

    /* TIPOGRAFÍA ADAPTATIVA */
    .topbar h1, .view-section h1 {
        font-size: clamp(1rem, 5vw, 1.3rem) !important;
        line-height: 1.1 !important;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    h2 { font-size: clamp(0.9rem, 4vw, 1.2rem) !important; }
    h1, h2, h3 { line-height: 1.2 !important; }

    .view-section {
        overflow: visible !important;
        height: auto !important;
        flex: none !important;
    }

    /* OPTIMIZACIÓN DE REPRODUCTOR PLYR PARA MÓVIL (Timeline Visible y Largo) */
    .plyr__controls {
        display: flex !important;
        flex-wrap: wrap !important;
        padding: 10px 15px !important;
        justify-content: space-between !important;
        align-items: center !important;
    }
    
    .plyr__progress {
        flex: 1 1 100% !important;
        order: -1 !important;
        padding: 10px 0 !important;
        display: block !important;
    }

    .plyr__time { font-size: 11px !important; flex: none !important; margin: 0 5px !important; }
    .plyr__volume { max-width: 60px !important; }

    @media (max-width: 400px) { .plyr__volume { display: none !important; } }

    /* GRIDS & CARDS */
    .stats-kpi-strip, .stats-courses-grid, .dashboard-grid {
        grid-template-columns: 1fr !important;
        display: grid !important;
        gap: 12px !important;
        width: 100% !important;
    }
    .card { padding: 15px !important; border-radius: 12px !important; }
}

/* TABLETS & LAPTOPS */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .stats-kpi-strip { grid-template-columns: 1fr 1fr 1fr !important; }
}

@media screen and (min-width: 1025px) and (max-width: 1366px) {
    .app-container { width: 99vw; height: 98vh; }
    .sidebar { width: 220px; }
    .main-content { margin: 5px 5px 5px 0; border-radius: 20px; }
}

/* UTILIDADES */
.nav-toggle-btn { display: none; }
@media (max-width: 1024px) { .nav-toggle-btn { display: flex !important; } }

.show-mobile, .flex-mobile { display: none; }
@media (max-width: 1024px) {
    .show-mobile { display: block !important; }
    .flex-mobile { display: flex !important; }
}

/* --- MEJORA: TÍTULO DE CLASE FULL-WIDTH EN MÓVIL --- */
@media (max-width: 768px) {
    .player-controls-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
        margin-bottom: 8px !important;
    }
    .player-controls-header h2 {
        font-size: 1.1rem !important;
        width: 100% !important;
        line-height: 1.3 !important;
        text-align: left !important;
    }
    .player-controls-header > div {
        width: 100% !important;
        justify-content: flex-start !important;
    }
}


/* --- OPTIMIZACIÓN LANDSCAPE MÓVIL (MAXIMIZACIÓN VERTICAL v3.1 - FINAL) --- */
@media screen and (max-height: 500px) and (orientation: landscape) {
    /* Forzar ocultación de elementos que roban altura */
    .topbar {
        padding: 5px 15px !important;
        margin-bottom: 0 !important; /* Eliminamos margen extra */
        border-bottom: 1px solid rgba(255,255,255,0.05) !important;
        min-height: 40px !important;
        height: 40px !important;
    }
    .greeting { font-size: 1rem !important; }
    .topbar-right { display: none !important; }

    .breadcrumb-nav { display: none !important; }

    /* Forzar eliminación de paddings inline de los contenedores por ID */
    #view-contenido.active, 
    #aulas-container {
        padding: 0 !important;
        margin: 0 !important;
        gap: 0 !important;
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .app-container {
        padding-bottom: 0 !important; /* Quitar los 70px de móvil vertical */
        height: auto !important;
        min-height: 100% !important;
        overflow: visible !important;
    }

    .main-content, .view-section, #view-store, #view-store.active, #store-active-step-container {
        padding: 0 5px !important; 
        margin: 0 !important;
        height: auto !important;
        min-height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: visible !important;
    }

    .player-split-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 5px !important;
        height: auto !important;
        padding-top: 5px !important;
    }

    /* Ocultar elementos secundarios del reproductor */
    .view-section button[onclick*="goBack"] { margin-bottom: 2px !important; font-size: 0.6rem !important; }
    .player-split-grid h2,
    .player-split-grid > div:last-child {
        display: none !important;
    }

    .player-frame-container {
        aspect-ratio: 16 / 9 !important;
        width: 100% !important;
        max-width: 610px !important; /* Maximizado casi al 100% del ancho del iPhone SE */
        margin: 0 auto !important;
        height: auto !important;
        background: #000 !important;
        border-radius: 8px !important;
    }

    .player-tab {
        padding: 3px 10px !important;
        font-size: 0.65rem !important;
    }

    .plyr {
        width: 100% !important;
        height: auto !important;
    }

    /* FIX: EVITAR QUE EL PODCAST SE CORTE Y ELIMINAR DOBLE MARCO NEGRO */
    .player-frame-container:has(#inline-player-frame.audio-active) {
        aspect-ratio: auto !important;
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
    }
    #inline-player-frame.audio-active {
        height: 320px !important; /* Altura fija sellada en portrait */
        min-height: 320px !important;
        max-height: 320px !important;
        overflow: hidden !important;
    }
}

/* =========================================
   ADAPTACIÓN RESPONSIVA FINAL (v3.2)
   Blindaje Desktop > 1440px
   ========================================= */

@media screen and (min-width: 1200px) and (max-width: 1440px) {
    .app-container { width: 100vw; height: 100%; gap: 5px; }
    .sidebar { width: 220px; padding: 20px 15px; }
    .player-split-grid { grid-template-columns: 2fr 1fr !important; gap: 15px !important; }
    .main-content { padding: 15px !important; margin: 5px; height: calc(100% - 10px); }
}

/* TABLETS (PORTRAIT & LANDSCAPE) */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    .player-split-grid {
        grid-template-columns: 1fr !important;
        display: flex !important;
        flex-direction: column !important;
    }
    .plyr-container-box {
        max-width: min(100%, calc(((100% - 180px) / 9) * 16)) !important;
    }
    .episode-list {
        max-height: 500px !important;
    }
}

/* MÓVILES PORTRAIT */
@media screen and (max-width: 767px) {
    .plyr-container-box {
        max-width: 100% !important;
        aspect-ratio: 16/9 !important;
        border-radius: 8px !important;
    }
    .player-split-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
    }
    .episode-list {
        max-height: none !important;
        overflow: visible !important;
    }
    .player-controls-header h2 {
        font-size: 1rem !important;
    }
}

/* OPTIMIZACIÓN LANDSCAPE MÓVIL (TEATRO MODO v3.2) */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .topbar { 
        height: 35px !important; 
        padding: 0 10px !important;
        margin-bottom: 5px !important;
    }
    .main-content { padding: 5px !important; }
    
    .player-split-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
    }

    /* Mostrar sidebar en landscape pero debajo del video para que sea navegable */
    .player-split-grid > div:last-child {
        display: flex !important;
        height: auto !important;
        max-height: none !important;
        margin-top: 10px !important;
    }

    .player-frame-container {
        width: 100% !important;
        max-width: none !important;
        margin: 0 auto !important;
        background: transparent !important; /* Quitar fondo negro exterior */
    }

    .plyr-container-box {
        max-width: min(100%, calc(((100% - 50px) / 9) * 16)) !important;
        width: 100% !important;
        height: auto !important;
        margin: 0 auto !important;
        box-shadow: 0 0 40px rgba(0,0,0,0.8) !important;
    }

    .plyr__video-wrapper {
        aspect-ratio: 16/9 !important;
    }
}

/* =========================================
   REFINAMIENTOS RESPONSIVOS v4.0
   EPISODE MENU & NEXT ACTION PILL
   ========================================= */

/* Next Action Pill (Siguiente Clase) */
.next-action-pill {
    position: absolute;
    bottom: 70px;
    right: 20px;
    z-index: 9999;
    animation: fadeInUp 0.4s ease;
    pointer-events: auto;
}

.next-action-btn {
    background: rgba(20, 18, 30, 0.92);
    backdrop-filter: blur(12px);
    color: white;
    border: 1px solid rgba(157, 116, 255, 0.6);
    padding: 12px 22px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    transition: all 0.2s;
}

.next-action-btn:hover {
    background: rgba(157, 116, 255, 0.25);
    border-color: rgba(157, 116, 255, 1);
}

.next-action-btn i[data-lucide] {
    width: 16px;
}

.next-action-btn i:last-child {
    width: 14px;
    opacity: 0.7;
}

/* Episode List & Rows */
.episode-list {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 10px;
    scrollbar-width: thin;
}

.episode-row {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.episode-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.episode-row.active {
    background: rgba(255, 255, 255, 0.08);
    border-left: 4px solid var(--accent-pink);
}

.episode-number {
    font-size: 1.4rem;
    font-family: 'Bebas Neue', sans-serif;
    color: var(--text-muted);
    min-width: 30px;
}

.episode-number.active {
    color: white;
    opacity: 1;
    padding-left: 5px;
}

.episode-title {
    font-size: 0.95rem;
    color: var(--text-light);
    line-height: 1.4;
}

.sidebar-prog-pct {
    font-size: 0.65rem;
    color: var(--accent-purple);
    font-weight: 800;
    margin-left: auto;
}

/* RESPONSIVE REFINEMENTS v4.0 */

/* Tablets & Mobile adjustments for new classes */
@media screen and (max-width: 1024px) {
    .next-action-pill {
        bottom: 60px;
        right: 15px;
    }
    .next-action-btn {
        padding: 10px 18px;
        font-size: 0.85rem;
    }
    
    .episode-list {
        max-height: 450px;
    }
    .episode-row {
        padding: 12px;
    }
}

@media screen and (max-width: 767px) {
    .next-action-pill {
        bottom: 50px;
        right: 10px;
    }
    .next-action-btn {
        padding: 8px 15px;
        font-size: 0.8rem;
    }
    .episode-list {
        max-height: none;
        overflow: visible;
    }
}

/* Landscape optimization for video-first experience */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .next-action-pill {
        bottom: 20px;
        right: 20px;
    }
    .episode-row {
        padding: 10px 15px;
    }
    .episode-title {
        font-size: 0.85rem;
    }
}

/* FINAL DOUBLE SCROLL ERADICATION (v4.1) - Modificado para permitir chat flexible */
@media screen and (max-width: 1024px) {
    html { overflow: hidden; height: 100%; }
    body { overflow-y: auto; height: 100%; -webkit-overflow-scrolling: touch; }
    
    /* Solo aplicamos height:auto si NO es el chat */
    .app-container, .main-content {
        overflow-y: visible;
        height: auto;
        min-height: 100%;
    }
    
    .view-section:not(#view-professor-ia) {
        overflow-y: visible;
        height: auto;
    }

    /* Restore aspect-ratio for mobile/tablet consistency */
    .plyr-container-box, .plyr, .plyr__video-wrapper {
        aspect-ratio: 16 / 9 !important;
    }
    .plyr video {
        object-fit: cover !important;
        height: 100% !important;
    }
}

/* =======================================================
   PODCAST PLAYER DEFINITIVO - NO TOCAR PC (>1024px)
   ======================================================= */

/* BASE (PC >1024px) - Estilos propios del player, no se tocan */
.podcast-player-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* CENTRADO COMPACTO */
    background: linear-gradient(160deg, #100f1c, #1a1728);
    padding: 30px 40px;
    box-sizing: border-box;
    gap: 15px;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid rgba(157,116,255,0.15);
    width: 100%;
    height: 100%;
}

.podcast-visualizer-area {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 160px;
    flex-shrink: 0;
    position: relative;
}

.podcast-mic-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(157,116,255,0.2), rgba(248,113,113,0.2));
    border: 2px solid rgba(157,116,255,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;  /* NUNCA absolute */
    z-index: 1;
    box-shadow: 0 0 40px rgba(157,116,255,0.12);
}

.podcast-mic-circle i { color: #C49DFF; width: 48px; height: 48px; }

.podcast-interaction-block {
    width: 95%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2;
}

/* Progress bar base */
.podcast-timeline-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.5);
}

#podcast-current, #podcast-duration {
    min-width: 40px;
    flex-shrink: 0;
    white-space: nowrap;
}

#podcast-track {
    flex: 1;
    position: relative;
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    cursor: pointer;
}

#podcast-fill {
    position: absolute;
    left: 0; top: 0; height: 100%; width: 0%;
    background: linear-gradient(90deg, #9D74FF, #F87171);
    border-radius: 4px;
    pointer-events: none;
}

.podcast-seek-handle {
    position: absolute;
    right: -6px; top: -4px;
    width: 14px; height: 14px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(157,116,255,0.8);
}

.podcast-controls-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 20px;
    gap: 10px;
}

.podcast-speed-box, .podcast-volume-box { width: 140px; }

.podcast-speed-rel {
    position: relative;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    overflow: hidden;
}

#podcast-speed {
    background: transparent;
    color: #C49DFF;
    font-weight: 700;
    padding: 8px 30px 8px 12px;
    font-size: 0.8rem;
    border: none;
    outline: none;
    appearance: none;
    cursor: pointer;
    width: 100%;
}

.podcast-speed-chevron {
    position: absolute;
    right: 8px; top: 50%;
    transform: translateY(-50%);
    width: 16px;
    color: rgba(255,255,255,0.5);
    pointer-events: none;
}

.podcast-main-btns {
    display: flex;
    align-items: center;
    gap: 25px;
}

#podcast-play {
    background: linear-gradient(135deg, #9D74FF, #6B45CC);
    color: white; border: none;
    width: 76px; height: 76px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 35px rgba(157,116,255,0.5);
    cursor: pointer;
    flex-shrink: 0;
}

#podcast-play i { width: 34px; height: 34px; margin-left: 4px; }

#podcast-rewind, #podcast-forward {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    width: 50px; height: 50px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.podcast-volume-box {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

#podcast-vol { width: 85px; accent-color: #9D74FF; cursor: pointer; }

/* -------------------------------------------------------
   MOVIL PORTRAIT < 1024px: Baseline PC reducida, controles en fila
   ------------------------------------------------------- */
@media screen and (max-width: 1024px) {
    .podcast-player-container {
        /* SE MANTIENE COLUMN DE PC */
        margin-top: auto !important;
        padding: 15px 12px 10px 12px !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        justify-content: center !important;
        width: 100% !important;
    }

    .podcast-visualizer-area {
        flex: none !important;
        min-height: 84px !important;
        flex-shrink: 0 !important;
        margin-bottom: 5px !important;
    }

    /* Icono Central (Micrófono): Reduce un 30% (base 120px -> 84px) */
    .podcast-mic-circle {
        width: 84px !important;
        height: 84px !important;
        flex-shrink: 0 !important;
        aspect-ratio: 1 / 1 !important;
    }

    .podcast-mic-circle i { width: 34px !important; height: 34px !important; }

    .podcast-interaction-block {
        width: 100% !important;
        max-width: 100% !important;
        gap: 12px !important;
    }

    .podcast-timeline-row {
        gap: 10px !important;
        font-size: 0.78rem !important;
    }

    #podcast-current, #podcast-duration {
        min-width: 35px !important;
    }

    /* Controles: UNA ÚNICA FILA HORIZONTAL perfectamente centrada */
    .podcast-controls-panel {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 10px !important;
        padding-bottom: 5px !important;
    }

    /* Subtítulos arriba en portrait: entre el micro y el timeline */
    .podcast-captions-overlay {
        margin-bottom: 5px !important;
        height: 60px !important;
    }

    /* Mostrar el contenedor de volumen pero solo para el botón CC */
    .podcast-volume-box { 
        display: flex !important; 
        order: 3 !important; 
        width: auto !important;
        background: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        gap: 0 !important;
        box-shadow: none !important;
    }
    .podcast-volume-box > i, .podcast-volume-box > input { display: none !important; }

    .podcast-main-btns { order: 2 !important; gap: 15px !important; }
    
    .podcast-speed-box {
        order: 1 !important;
        width: auto !important;
        display: flex !important;
        justify-content: center !important;
    }

    .podcast-speed-rel { width: auto !important; }
    #podcast-speed { padding: 6px 10px !important; font-size: 0.8rem !important; width: 65px !important; text-align: center; }
    .podcast-speed-chevron { display: none !important; }

    /* Reducir tamaño botones de Play para no tocar bordes */
    #podcast-play { width: 50px !important; height: 50px !important; box-shadow: none !important; }
    #podcast-play i { width: 24px !important; height: 24px !important; margin-left:2px !important; }
    #podcast-rewind, #podcast-forward { width: 38px !important; height: 38px !important; }
    #podcast-rewind i, #podcast-forward i { width: 20px !important; }

    .next-action-pill { display: none !important; }
}

/* -------------------------------------------------------
   LANDSCAPE MOVIL: MODO REPRODUCTOR HORIZONTAL SELLADO
   ------------------------------------------------------- */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .podcast-player-container {
        /* HORIZONTAL */
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 10px 20px !important;
        gap: 20px !important; 
        margin: 0 auto !important;
        height: auto !important;
        min-height: 200px !important;
        max-height: 100% !important; /* Limita la altura para que no desborde */
        overflow: hidden !important;
    }

    /* Columna 1: Micrófono a la izquierda */
    .podcast-visualizer-area {
        flex: none !important;
        min-height: 0 !important;
        width: 100px !important;
        height: 100px !important;
        flex-shrink: 0 !important;
        margin-bottom: 0 !important;
    }

    .podcast-mic-circle {
        width: 100px !important;
        height: 100px !important;
        flex-shrink: 0 !important;
        aspect-ratio: 1 / 1 !important;
        box-shadow: none !important;
    }

    .podcast-mic-circle i { width: 36px !important; height: 36px !important; }
    
    /* La onda ahora es visible en landscape gracias al lienzo dinámico y su ajuste automático */
    #podcast-waveform { display: block !important; }

    /* Columna 2: Línea de tiempo y Controles (Igual a la PC pero achicado) */
    .podcast-interaction-block {
        flex: 1 !important;
        width: auto !important;
        max-width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        gap: 12px !important;
    }

    .podcast-timeline-row {
        padding: 0 !important;
        font-size: 0.70rem !important;
        gap: 8px !important;
        width: 100% !important;
    }

    #podcast-current, #podcast-duration { min-width: 30px !important; }
    #podcast-track { flex: 1 !important; }

    /* Los controles vuelven al diseño original de PC (Space-Between) pero compactos */
    .podcast-controls-panel {
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding-bottom: 0 !important;
        gap: 15px !important;
        width: 100% !important;
    }

    .podcast-volume-box { display: flex !important; }

    .podcast-speed-box, .podcast-volume-box { width: auto !important; }
    
    .podcast-main-btns { gap: 15px !important; }

    #podcast-play {
        width: 44px !important;
        height: 44px !important;
        box-shadow: none !important;
    }
    #podcast-play i { width: 22px !important; height: 22px !important; margin-left: 2px !important; }

    #podcast-rewind, #podcast-forward { width: 34px !important; height: 34px !important; }

    .podcast-speed-rel { width: auto !important; }
    #podcast-speed { font-size: 0.7rem !important; padding: 4px 8px !important; width: 60px !important; text-align: center; }
    .podcast-speed-chevron { display: none !important; }
    
    #podcast-vol { width: 60px !important; }
    
    .next-action-pill { display: none !important; }
}

/* =======================================================
   ADAPTACIÓN RESPONSIVA: TIENDA / MÁSTERS (SENIOR ARCHITECT)
   Este bloque asegura compatibilidad total en móviles, tablets 
   y portátiles con resoluciones intermedias (1280px-1440px).
   ======================================================= */

/* 1. BLINDAJE Y AJUSTES PARA PORTÁTILES (1280px a 1440px) */
@media screen and (min-width: 1025px) and (max-width: 1440px) {
    #view-store {
        padding: 20px 30px !important;
    }
    #view-store > div {
        max-width: 1100px !important;
    }
    .store-option-card {
        padding: 30px 20px !important;
        flex: 1 1 220px !important; /* Más compacto */
    }
    #store-step-title {
        font-size: 1.3rem !important;
    }
}

/* 2. TABLETS Y MÓVILES (WIDTH < 1024px) */
@media screen and (max-width: 1024px) {
    #store-header {
        flex-direction: column !important;
        gap: 15px !important;
        text-align: center !important;
        padding-bottom: 20px !important;
    }
    
    #store-header > div {
        flex: none !important;
        width: 100% !important;
        justify-content: center !important;
    }

    #store-price-container {
        order: 3;
    }
    
    #store-price-container > div {
        align-items: center !important;
        margin: 0 auto !important;
        width: fit-content !important;
    }

    /* Mejora del Breadcrumb en tablets */
    #store-breadcrumb-container {
        padding: 10px 5px !important;
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    #store-breadcrumb-container::-webkit-scrollbar { display: none; }

    /* Layout de selección de módulos (Step 2C_num) */
    #store-step-content > div[style*="display:flex"] {
        flex-direction: column !important;
        align-items: center !important;
        gap: 30px !important;
    }

    /* Ocultamos los espaciadores inútiles en móvil */
    #store-step-content > div > div[style*="flex:1"] {
        display: none !important;
    }

    /* El botón de continuar módulos se centra */
    #store-step-content > div > div:last-child {
        display: flex !important;
        justify-content: center !important;
        padding-left: 0 !important;
        width: 100% !important;
    }

    #btn-continue-modules {
        width: 100% !important;
        max-width: 320px !important;
        padding: 15px 25px !important;
    }
}

/* 3. OPTIMIZACIÓN ESPECÍFICA MÓVIL (Portrait) */
@media screen and (max-width: 768px) {
    #view-store {
        padding: 15px 10px 0 10px !important;
    }

    #view-store h1 {
        font-size: 1.6rem !important;
        margin-bottom: 2px !important;
    }

    #store-step-title {
        font-size: 1rem !important;
        letter-spacing: 0.5px !important;
        padding: 0 10px !important;
    }

    /* Forzamos que las tarjetas de opción sean legibles */
    .store-option-card {
        padding: 20px 15px !important;
        min-height: 180px !important;
    }

    .store-option-card i {
        width: 32px !important;
        height: 32px !important;
        margin-bottom: 10px !important;
    }

    /* Netflix Cards en la tienda */
    .netflix-card.protected-card {
        height: 35vh !important;
        min-height: 240px !important;
        width: auto !important;
        aspect-ratio: 2/3 !important;
        max-width: 220px !important;
    }

    /* Reglas anteriores de la tablet (aquí no hay checkout grid) */
}

/* 4. MODO HORIZONTAL / LANDSCAPE (Blindaje contra recortes) */
@media screen and (max-height: 600px) and (orientation: landscape) {

    /* Bloqueo Nivel Sistema Operativo para la Tienda */
    html:has(#view-store.active),
    body:has(#view-store.active) {
        overflow: hidden !important;
        position: fixed !important;
        width: 100vw !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body:has(#view-store.active) .app-container {
        padding-bottom: 0 !important;
        height: 100% !important;
        overflow: hidden !important;
        width: 100vw !important;
        margin: 0 !important;
    }

    body:has(#view-store.active) .main-content {
        height: calc(100% - 35px) !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        border-radius: 0 !important;
        overflow: hidden !important;
    }

    /* Reducir topbar para dar más espacio neto */
    body:has(#view-store.active) .topbar {
        padding: 2px 10px !important;
        margin-bottom: 0 !important;
        min-height: 35px !important;
        height: 35px !important;
    }

    #view-store.active {
        overflow: hidden !important; /* Prohibido cualquier scroll */
        display: flex !important;
        flex-direction: column !important;
        flex: 1 !important; 
        height: auto !important;
        min-height: 0 !important;
        padding: 5px 10px 0 10px !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    #view-store.active > div {
        height: auto !important; 
        flex: 1 !important;
        min-height: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #store-active-step-container {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto !important;
        height: 100% !important; 
        justify-content: flex-start !important; 
        align-items: center !important;
        overflow: hidden !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }

    #store-active-step-container > div {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto !important;
        height: 100% !important;
        justify-content: flex-start !important; 
        align-items: center !important;
        width: 100% !important;
        overflow: hidden !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* Garantizar que la caja de CheckouT NO toque el borde: 10px de margen por cada lado */
    #store-step-content > .checkout-summary-container,
    #store-step-content > div[style*="580px"] {
        max-width: calc(100% - 20px) !important;
        width: 100% !important;
        margin: 0 10px !important;
        box-sizing: border-box !important;
    }

    #store-breadcrumb-container {
        margin-bottom: 2px !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        padding-bottom: 0 !important;
        -webkit-overflow-scrolling: touch;
    }

    #store-breadcrumb-container > div {
        white-space: nowrap !important; /* Prohibido que ocupen 2 líneas de alto */
        padding: 4px 8px !important;
    }
    
    #store-breadcrumb-container span {
        font-size: 0.65rem !important; /* Tipografía enana para los breadcrumbs */
    }

    #store-step-title {
        margin-top: 0 !important;
        margin-bottom: 5px !important;
        font-size: 0.95rem !important; /* Título aún más pequeño */
    }

    #store-step-content {
        padding: 5px 0 !important; 
        flex: 1 1 auto !important; height: auto !important; min-height: min-content !important;
        display: flex !important;
        align-items: center !important;
    }



    /* Eliminamos scroll lateral y ajustamos tarjetas para que quepan todas */
    .store-horizontal-layout {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: hidden !important; /* Forzar que no haya scroll lateral */
        justify-content: center !important;
        padding: 5px !important;
        gap: 12px !important;
        width: 100% !important;
    }

    .store-option-card {
        flex: 1 1 0px !important; 
        max-width: 250px !important;
        min-width: 80px !important; /* Permitir encogimiento extremo */
        height: auto !important;
        min-height: 80px !important; /* Ya no está forzado a 100px */
        padding: 8px 5px !important; 
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
    }

    .store-option-card i {
        width: 24px !important; 
        height: 24px !important;
        margin-bottom: 5px !important;
    }

    .store-option-card h3 {
        font-size: 0.85rem !important; /* Letra un poco más pequeña */
        margin-bottom: 2px !important;
    }

    .store-option-card p {
        font-size: 0.7rem !important;
    }

    /* Redimensionado Ajustado para las Tarjetas (Más elásticas) */
    .netflix-card.protected-card, #store-step-content .netflix-card {
        height: 220px !important;
        max-height: 55dvh !important;
        min-height: 80px !important; 
        min-width: 0 !important; /* CRÍTICO: Matar herencia de min-width: 180px de tablets */
        width: auto !important;
        max-width: 180px !important;
        aspect-ratio: 2/3 !important;
        margin: 0 !important;
    }

    /* Las tarjetas de módulos puros no necesitan ser tan altas, mejor cuadradas para espacio de texto */
    .netflix-card.module-multi-card {
        aspect-ratio: 4/5 !important;
        max-height: 48dvh !important;
        max-width: 200px !important;
        min-width: 0 !important;
    }

    .netflix-card .card-title {
        font-size: 0.95rem !important; /* Texto legible */
        line-height: 1.1 !important;
        word-break: normal !important;
    }

    /* FIX: Gravedad desde arriba para no invadir los breadcrumbs y EVITAR EL CORTE DEL FLEX CENTER */
    #store-active-step-container {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 0% !important;
        min-height: 0 !important;
        height: 100% !important; 
        justify-content: flex-start !important; 
        align-items: flex-start !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    #store-active-step-container > div {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto !important;
        min-height: min-content !important;
        height: auto !important;
        justify-content: flex-start !important; 
        align-items: center !important;
        width: 100% !important;
        overflow: visible !important;
    }
    #store-step-content > div[style*="display:flex"] {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 15px !important;
        width: 100% !important;
        justify-content: center !important;
        align-items: flex-start !important; /* Ya no crecen hacia arriba, solo hacia abajo */
    }

    #store-step-content > div > div[style*="gap:20px"] {
        gap: 10px !important;
        flex-wrap: nowrap !important;
        flex: none !important; /* El centro mide lo justo */
    }

    #store-step-content > div > div[style*="flex:1"]:first-child {
        display: flex !important; /* Restauramos espaciador izquierdo */
        flex: 1 !important;
    }

    #store-step-content > div > div:last-child {
        display: flex !important;
        flex: 1 !important; /* Botón a la derecha equilibrado */
        width: auto !important;
        padding-left: 10px !important;
        justify-content: flex-start !important;
    }

    #btn-continue-modules {
        padding: 10px 15px !important;
        justify-content: center !important;
        gap: 4px !important;
        width: auto !important;
    }

    #btn-continue-modules span {
        font-size: 0.9rem !important;
    }

    /* FIX MÁGICO: Ocultar el div espaciador inyectado en JS que rompía el nowrap */
    .store-horizontal-layout > div[style*="width:100%"] {
        display: none !important;
    }


    /* Ajuste de cabecera en landscape */
    #store-header {
        flex-direction: row !important;
        justify-content: space-between !important;
        padding-bottom: 10px !important;
    }

    #store-header h1 { font-size: 1.2rem !important; }
    #store-header p { display: none !important; } /* Ocultar para ahorrar espacio */
    
    #store-price-container {
        width: auto !important;
        flex: none !important;
    }
    
    #store-price-container > div {
        padding: 4px 10px !important;
    }
    
    #store-price-container span:last-child {
        font-size: 1rem !important;
    }
}

/* --- BLOQUE DE SEGURIDAD PARA EVITAR SOLAPAMIENTO DE VISTAS EN MÓVIL --- */
/* Cuando el main-content pasa a ser 'display: block' en móviles/tablets, las vistas
   podrían apilarse si la lógica JS no las oculta correctamente o si hay delays.
   Forzamos que solo la sección con clase .active sea visible. */
@media screen and (max-width: 1024px) {
    .view-section:not(.active) {
        display: none !important;
    }
}

/* =======================================================
   SUBTITLE OVERRIDES (PLYR Y PODCAST RESPONSIVE)
   ======================================================= */
/* Plyr Fluid Captions */
.plyr__captions {
    font-size: clamp(14px, 3.5vw, 24px) !important;
    line-height: 1.4 !important;
}
.plyr__captions .plyr__caption {
    background: rgba(0, 0, 0, 0.75) !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    text-shadow: 1px 1px 2px black, 0 0 10px black !important;
}

/* Custom Podcast Captions */
.podcast-captions-overlay {
    position: absolute;
    bottom: 0px;
    width: 100%;
    text-align: center;
    pointer-events: none;
    z-index: 10;
    padding: 0 15px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    transition: opacity 0.3s ease;
    opacity: 0;
}
.podcast-captions-overlay.active {
    opacity: 1;
}
.podcast-captions-text {
    background: rgba(0, 0, 0, 0.75);
    color: white;
    font-size: clamp(14px, 3.5vw, 24px);
    line-height: 1.4;
    padding: 4px 10px;
    border-radius: 6px;
    text-shadow: 1px 1px 2px black, 0 0 10px black;
    font-family: inherit;
    /* Evitar que toque el borde abajo en móvil */
    margin-bottom: 25px; 
    max-width: 90%;
    word-wrap: break-word; 
    overflow-wrap: break-word; 
}

/* Tooltip and Active CC Button effect */
#podcast-cc-btn {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    width: 44px; height: 44px; 
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}
#podcast-cc-btn.active-cc {
    background: rgba(157,116,255,0.25);
    color: white;
    border-color: #9D74FF;
    box-shadow: 0 0 15px rgba(157,116,255,0.4);
}
#podcast-cc-btn:hover {
    background: rgba(255,255,255,0.09);
}

/* Modificaciones Responsivas para el CC del podcast */
@media screen and (max-width: 1024px) {
    #podcast-cc-btn {
        width: 38px; height: 38px;
    }
    #podcast-cc-btn i { width: 20px; height: 20px; }
}
@media screen and (max-height: 500px) and (orientation: landscape) {
    #podcast-cc-btn {
        width: 34px; height: 34px;
    }
    #podcast-cc-btn i { width: 18px; height: 18px; }
}




/* --- FIX MOBILE SCROLL NATIVO (COMO EN EL BACKUP) --- */
@media (max-width: 768px) {
    html, body {
        position: relative !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        height: auto !important;
        min-height: 100vh !important;
        padding-bottom: 80px !important;
    }
    #app-content, .app-container {
        height: auto !important;
        min-height: 100vh !important;
        overflow: visible !important;
    }
    .main-content {
        margin: 0 !important;
        border-radius: 0 !important;
        border: none !important;
        height: auto !important;
        min-height: 100vh !important;
        width: 100% !important;
        overflow: visible !important;
        box-shadow: none !important;
    }
    .view-section, #view-store, #store-active-step-container {
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
        flex: none !important;
    }
}

/* --- FIX PLYR MOBILE OVERLAP --- */
@media (max-width: 600px) {
    /* En móviles el volumen se controla por botones físicos. Ocultarlo ahorra mucho espacio y evita solapamientos */
    [data-plyr="mute"], .plyr__volume, [data-plyr="pip"] {
        display: none !important;
    }
    .plyr__controls {
        gap: 5px !important;
    }
    /* Asegurar que el tiempo tenga espacio */
    .plyr__time {
        font-size: 12px !important;
        margin-right: 5px !important;
    }
    /* Si sigue faltando espacio, forzar márgenes más pequeños en los controles */
    .plyr__controls > button {
        padding: 5px !important;
    }
    .plyr__menu__container {
        right: 0 !important;
        bottom: 100% !important;
    }

    /* Asegurar que los controles hagan wrap en móviles muy estrechos */
    .plyr__controls {
        flex-wrap: wrap !important;
    }
    /* Mover la barra de progreso arriba para dar espacio a los botones abajo */
    .plyr__controls .plyr__progress {
        order: -1 !important;
        width: 100% !important;
        flex: 1 1 100% !important;
        margin-bottom: 5px !important;
    }
}
