@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;700;900&display=swap');

:root {
    /* 2. PALETA DE COLORES (MODO OSCURO - DEFAULT) */
    --fondo-pagina: #0f172a;
    /* Slate 900 */
    --fondo-tarjeta: #1e293b;
    /* Slate 800 */
    --fondo-input: #334155;
    /* Slate 700 */

    /* VARIABLES DE CRISTAL (Glassmorphism) */
    --bg-glass-card: rgba(15, 23, 42, 0.05);
    /* 5% de opacidad */
    --bg-glass-nav: rgba(15, 23, 42, 0.8);
    --bg-glass-ctrl: rgba(15, 23, 42, 0.6);

    /* Texto */
    --texto-principal: #f8fafc;
    /* Casi blanco */
    --texto-secundario: #94a3b8;
    /* Gris azulado */
    --borde-ui: #334155;
    /* Color de bordes */

    /* Acentos */
    --gradiente-titulo: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 50%, #d946ef 100%);
    --color-fluor: #22d3ee;
    /* Cian eléctrico */
    --color-video: #a855f7;
    /* Púrpura para vídeos */
    --color-error: #ef4444;
    /* Rojo */
    --color-success: #10b981;
    /* Verde */

    /* 3. FORMAS */
    --radio: 20px;

    /* 4. TIPOGRAFÍA */
    --fuente: 'Montserrat', sans-serif;
}

/* --- PALETA MODO CLARO (LIGHT THEME) --- */
:root[data-theme="light"] {
    --fondo-pagina: #f8fafc;
    /* BLANCO ROTO (Slate 50) */
    --fondo-tarjeta: #ffffff;
    --fondo-input: #f1f5f9;

    /* Ajuste de cristal para modo claro */
    --bg-glass-card: rgba(255, 255, 255, 0.6);
    --bg-glass-nav: rgba(255, 255, 255, 0.95);
    --bg-glass-ctrl: rgba(255, 255, 255, 0.9);

    /* TEXTOS MÁS OSCUROS */
    --texto-principal: #020617;
    /* Slate 950 */
    --texto-secundario: #334155;
    /* Slate 700 */
    --borde-ui: #94a3b8;
    /* Slate 400 */

    /* Acentos ajustados */
    --color-fluor: #0891b2;
    /* Cyan 600 */
    --color-video: #7e22ce;
    /* Purple 700 */
}

/* --- BASE --- */
html {
    background-color: var(--fondo-pagina);
    transition: background-color 0.3s ease;
}

body {
    background-color: transparent;
    color: var(--texto-principal);
    font-family: var(--fuente);
    margin: 0;
    padding: 0;
    line-height: 1.7;
    font-weight: 400;
    overflow-x: hidden;
    transition: color 0.3s ease;
}

body[data-theme="light"] {
    background-color: var(--fondo-pagina) !important;
}

/* --- SCROLLBAR PERSONALIZADA (PREMIUM) --- */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--fondo-pagina);
}

::-webkit-scrollbar-thumb {
    background: rgba(34, 211, 238, 0.3);
    border-radius: 5px;
    border: 2px solid var(--fondo-pagina);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-video);
}

/* --- SCROLL REVEAL ANIMATION --- */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
    will-change: opacity, transform;
}

.scroll-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- NOISE EFFECT (PREMIUM TEXTURE) --- */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9000;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* --- ANIMATED BACKGROUND (SHADER) --- */
#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    transition: filter 0.5s ease, opacity 0.5s ease;
}

html[data-theme="light"] #canvas-container {
    filter: invert(1) hue-rotate(180deg) brightness(1.1) contrast(0.9);
    opacity: 0.6;
    mix-blend-mode: multiply;
    background-color: transparent;
}

/* Container General */
.app-container {
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
}

/* --- TIPOGRAFÍA --- */
h1,
h2,
h3,
h4 {
    font-family: var(--fuente);
    margin-top: 0;
    font-weight: 900;
    letter-spacing: -1px;
    color: var(--texto-principal);
    position: relative;
    z-index: 5;
}

h1 {
    background: var(--gradiente-titulo);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    line-height: 1.1;
}

h2 {
    color: var(--texto-principal);
    font-size: 2.2rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

h3 {
    font-size: 1.5rem;
    background: var(--gradiente-titulo);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 25px;
    display: inline-block;
}

.texto-gradiente {
    background: var(--gradiente-titulo);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent !important;
    display: inline-block;
}

p,
li {
    color: var(--texto-secundario);
    margin-bottom: 20px;
    text-align: justify;
}

/* --- SHINE BORDER ANIMATION --- */
@keyframes shine-pulse {
    0% {
        background-position: 0% 0%;
    }

    50% {
        background-position: 100% 100%;
    }

    100% {
        background-position: 0% 0%;
    }
}

.tarjeta,
.resource-item,
.sa-container,
.video-promo-container {
    position: relative;
    background-color: var(--bg-glass-card);
    backdrop-filter: blur(8px);
    border-radius: var(--radio);
    padding: 8px 15px 15px 15px;
    border: none !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
    z-index: 0;
}

.tarjeta::before,
.resource-item::before,
.sa-container::before,
.video-promo-container::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 2px;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle at 50% 50%, transparent, var(--color-fluor), transparent, var(--color-video), transparent);
    background-size: 300% 300%;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: shine-pulse 14s infinite linear;
    pointer-events: none;
    z-index: 1;
}

.tarjeta>*,
.resource-item>*,
.sa-container>* {
    position: relative;
    z-index: 2;
}

.tarjeta,
.sa-container,
.video-promo-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: space-between;
}

.tarjeta h3 {
    margin-bottom: 5px !important;
}

.tarjeta p {
    margin-top: 0 !important;
}

.resource-item {
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    text-align: center;
    height: 100%;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.resource-item>*:last-child {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.resource-item>img,
.resource-item>.resource-icon,
.resource-item>h4,
.resource-item>p {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.resource-item h4 {
    line-height: 1.1;
    font-size: 0.95rem;
}

.sa-container {
    background-image: linear-gradient(135deg, rgba(34, 211, 238, 0.05) 0%, rgba(15, 23, 42, 0.05) 100%);
}

.tarjeta li {
    margin-bottom: 5px;
}

/* --- BRAND BUTTON INTEGRATION --- */
.boton-ultra {
    background: linear-gradient(90deg, #2563eb, #d946ef) !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 0 15px rgba(217, 70, 239, 0.4) !important;
    opacity: 1 !important;
    font-weight: 700 !important;
    padding: 12px 30px !important;
    border-radius: 50px !important;
}

.boton-ultra:hover {
    box-shadow: 0 0 25px rgba(217, 70, 239, 0.8) !important;
    transform: translateY(-2px) !important;
}

.boton-back {
    margin-bottom: 20px;
}

/* --- IDIOMAS (Toggle) --- */
.lang-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.05);
    padding: 5px;
    border-radius: 50px;
    width: fit-content;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toggle-btn {
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--texto-secundario);
    transition: all 0.3s ease;
    display: inline-block;
}

.toggle-btn:hover {
    color: var(--color-fluor);
    background: rgba(255, 255, 255, 0.05);
}

.toggle-btn.active-lang {
    background: linear-gradient(90deg, #2563eb, #d946ef);
    color: white;
    box-shadow: 0 0 10px rgba(217, 70, 239, 0.3);
}

/* --- SPA NAVIGATION --- */
section.view {
    display: none;
    animation: fadeIn 0.5s ease;
}

section.view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- LAYOUTS --- */
.contenedor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.notebook-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
    margin-bottom: 30px;
}

/* --- DESAFIO LAYOUT (2/3 + 1/3) --- */
.desafio-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

@media (max-width: 900px) {
    .desafio-layout {
        grid-template-columns: 1fr;
    }
}

.video-promo-container {
    padding: 8px 15px 15px 15px;
    /* Match standard container padding */
    justify-content: center;
    /* Override space-between for vertical centering */
    align-items: center;
    text-align: center;
}

.video-promo-container h4 {
    margin-bottom: 20px;
    background: var(--gradiente-titulo);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
    font-size: 1.1rem;
}

/* Layout Translation Fix: Ensure column stacking */
.video-promo-container .content-es {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.lang-container.show-dariya .video-promo-container .content-dariya {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    animation: fadeIn 0.3s;
}

.unit-nav {
    position: sticky;
    top: 0;
    background: var(--bg-glass-nav);
    padding: 15px 0;
    border-bottom: 1px solid var(--color-fluor);
    z-index: 100;
    margin-bottom: 40px;
    display: flex;
    gap: 15px;
    overflow-x: auto;
    white-space: nowrap;
    backdrop-filter: blur(10px);
}

.unit-nav a {
    color: var(--texto-secundario);
    text-decoration: none;
    font-weight: 700;
    padding: 5px 15px;
    border-radius: 20px;
    transition: all 0.3s;
}

.unit-nav a:hover,
.unit-nav a.active-link {
    color: var(--fondo-pagina);
    background-color: var(--color-fluor);
}

[data-theme="light"] .unit-nav a:hover,
[data-theme="light"] .unit-nav a.active-link {
    color: #ffffff;
}

.content-es {
    display: block;
}

.content-dariya {
    display: none;
}

.lang-container.show-dariya .content-es {
    display: none;
}

.lang-container.show-dariya .content-dariya {
    display: block;
    animation: fadeIn 0.3s;
}

/* Estilos específicos de Secciones Interiores */
.section-block {
    margin-bottom: 60px;
    scroll-margin-top: 100px;
}

/* --- CAJONES ADICIONALES --- */
.video-card {
    background-color: rgba(168, 85, 247, 0.05);
}

.resource-icon {
    font-size: 2.2rem;
    line-height: 1;
    display: block;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.resource-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3), 0 5px 10px rgba(0, 0, 0, 0.15), 0 0 15px rgba(34, 211, 238, 0.1);
}

.resource-item:hover .resource-icon {
    transform: scale(1.1);
}

[data-theme="light"] .resource-item {
    background: var(--bg-glass-card);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05), 0 2px 5px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .resource-item:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1), 0 5px 15px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .video-card {
    background: rgba(250, 245, 255, 0.5);
}

/* Evaluación */
.rubrica-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.rubrica-table th,
.rubrica-table td {
    border: 1px solid var(--borde-ui);
    padding: 15px;
    text-align: left;
    color: var(--texto-secundario);
    font-size: 0.85rem;
}

.rubrica-table th {
    color: var(--color-fluor);
    background-color: var(--fondo-pagina);
}

.criterios-lista {
    background-color: var(--bg-glass-card);
    backdrop-filter: blur(8px);
    padding: 20px;
    border-radius: 15px;
    margin-top: 20px;
    border-left: 4px solid var(--color-fluor);
}

.criterios-lista h4 {
    color: var(--color-fluor);
    margin-top: 0;
}

.criterios-lista ul {
    padding-left: 20px;
    margin-bottom: 0;
}

.criterios-lista li {
    margin-bottom: 10px;
    font-size: 0.9rem;
}

/* BOTONES FLOTANTES */
.fab-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 1000;
}

.fab-btn {
    background: var(--gradiente-titulo);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    border: none;
}

.fab-btn:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.6);
}

.theme-toggle-btn {
    background: var(--fondo-tarjeta);
    border: 2px solid var(--color-fluor);
    color: var(--color-fluor);
}

/* MODALES */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

html[data-theme="light"] .modal-overlay {
    background: rgba(255, 255, 255, 0.85);
}

.modal-viewer-content {
    width: 95%;
    height: 95%;
    max-width: none;
    max-height: none;
    padding: 0;
    background: var(--fondo-pagina);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-fluor);
    border-radius: var(--radio);
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-viewer-content:fullscreen {
    width: 100vw;
    height: 100vh;
    border: none;
    border-radius: 0;
}

.viewer-header {
    padding: 15px 25px;
    background: var(--fondo-tarjeta);
    border-bottom: 1px solid var(--borde-ui);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--texto-principal);
}

.slide-controls {
    display: none;
    gap: 15px;
    align-items: center;
}

footer {
    margin-top: 60px;
    text-align: center;
    color: var(--texto-secundario);
    font-size: 0.9rem;
    border-top: 1px solid var(--borde-ui);
    padding-top: 30px;
    padding-bottom: 30px;
}

footer a {
    color: var(--texto-principal);
    text-decoration: none;
    border-bottom: 1px dotted var(--texto-secundario);
}

footer a:hover {
    color: var(--color-fluor);
    border-bottom: 1px solid var(--color-fluor);
}

#exam-password-input:focus {
    outline: none;
    border-color: var(--color-fluor);
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.2);
}

.top-right-logo {
    position: absolute;
    top: 0;
    right: 0;
    height: 80px;
    width: auto;
    z-index: 50;
}

@media (max-width: 768px) {
    .top-right-logo {
        position: relative;
        display: block;
        margin: 0 auto 20px auto;
        height: 60px;
        top: auto;
        right: auto;
    }
}

#intro-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #000;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 1.5s ease-in-out;
}

#intro-video {
    width: 60%;
    max-width: 800px;
    height: auto;
}

#start-btn-container {
    position: absolute;
    bottom: 20%;
    opacity: 1;
    transition: opacity 0.5s;
    z-index: 10001;
}

.btn-start {
    padding: 15px 40px;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(90deg, #2563eb, #d946ef);
    color: white;
    border: none;
    border-radius: 50px;
    box-shadow: 0 0 30px rgba(217, 70, 239, 0.5);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-start:hover {
    transform: scale(1.05);
    box-shadow: 0 0 40px rgba(217, 70, 239, 0.8);
}