/* ---
   Hoja de Estilos Universal para Lecciones de "ElGuruJk"
   Autor: Gemini para Juank (ElGuruJk)
   Descripción: Estilos modernos con barra de navegación fija y estilos para el laboratorio vectorial.
--- */

/* ======== VARIABLES Y CONFIGURACIÓN GENERAL ======== */
:root {
    --color-bg: #121212;
    --color-surface: #1e1e1e;
    --color-primary: #BB86FC;
    --color-secondary: #03DAC6;
    --color-text: #e0e0e0;
    --color-text-secondary: #a0a0a0;
    --color-border: #333;
    --nav-height: 80px;
}

body.light-mode {
    --color-bg: #f4f4f9;
    --color-surface: #ffffff;
    --color-primary: #6200EE;
    --color-secondary: #018786;
    --color-text: #212121;
    --color-text-secondary: #5f5f5f;
    --color-border: #ddd;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { 
    font-family: 'Poppins', sans-serif; 
    background-color: var(--color-bg); 
    color: var(--color-text); 
    line-height: 1.7; 
    transition: background-color 0.3s, color 0.3s;
    padding-top: var(--nav-height);
}
.container { max-width: 1200px; margin: 0 auto; padding: 4rem 2rem; }
h1, h2, h3, h4 { font-weight: 600; margin-bottom: 1rem; color: var(--color-text); }
h1 { font-size: 3rem; }
h2 { font-size: 2.2rem; border-bottom: 3px solid var(--color-primary); padding-bottom: 0.5rem; display: inline-block; }
h3 { font-size: 1.5rem; color: var(--color-primary); }
h4 { font-size: 1.2rem; color: var(--color-text-secondary); border-bottom: 1px solid var(--color-border); padding-bottom: 0.5rem; margin-top: 1rem;}
.section-intro { max-width: 800px; margin: 1rem auto 3rem auto; text-align: center; font-size: 1.1rem; color: var(--color-text-secondary); }
i.fas { margin-right: 0.75rem; color: var(--color-secondary); }

/* ======== NAVEGACIÓN FIJA ======== */
nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background-color: var(--color-surface);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    height: var(--nav-height);
    transition: background-color 0.3s;
    border-bottom: 1px solid var(--color-border);
}

.back-to-menu { font-size: 1.5rem; color: var(--color-text); text-decoration: none; transition: color 0.3s, transform 0.3s; }
.back-to-menu:hover { color: var(--color-primary); transform: scale(1.1); }
.back-to-menu i { margin: 0; color: inherit; }
.nav-title { font-size: 1.2rem; font-weight: 600; color: var(--color-text-secondary); position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.theme-switcher { display: flex; align-items: center; gap: 0.5rem; }
.switch { position: relative; display: inline-block; width: 60px; height: 34px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; }
.slider:before { position: absolute; content: ""; height: 26px; width: 26px; left: 4px; bottom: 4px; background-color: white; transition: .4s; }
input:checked + .slider { background-color: var(--color-primary); }
input:checked + .slider:before { transform: translateX(26px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

/* ======== HEADER Y PORTADA (HERO) ======== */
.hero { 
    background-size: cover; 
    background-position: center; 
    height: calc(80vh - var(--nav-height));
    min-height: 300px;
    display: flex; 
    flex-direction: column; 
    text-align: center; 
    color: #fff;
}
.hero-content { flex-grow: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.hero .subtitle { font-size: 1.5rem; font-weight: 300; margin-bottom: 2rem; }
.cta-button, .cta-button-secondary { display: inline-block; padding: 1rem 2.5rem; border-radius: 50px; text-decoration: none; font-weight: 600; transition: transform 0.3s, background-color 0.3s; cursor: pointer; border: 2px solid var(--color-primary); }
.cta-button { background-color: var(--color-primary); color: #fff; }
.cta-button-secondary { background-color: transparent; color: var(--color-primary); margin-top: 1rem; }
.cta-button:hover, .cta-button-secondary:hover { transform: translateY(-5px); background-color: var(--color-primary); color: var(--color-surface); }


/* ======== SECCIÓN DE CAPAS TEÓRICAS ======== */
.layers-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 2rem; }
.layer-card { background-color: var(--color-surface); border: 1px solid var(--color-border); border-radius: 10px; overflow: hidden; transition: transform 0.3s, box-shadow 0.3s; display: flex; flex-direction: column; }
.layer-card:hover { transform: translateY(-10px); box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
.layer-header { background-color: rgba(0,0,0,0.2); padding: 1.5rem; display: flex; align-items: center; }
.layer-header .icon { font-size: 2rem; }
.layer-body { padding: 1.5rem; flex-grow: 1; }

/* ======== LABORATORIO VECTORIAL ======== */
.vector-lab { display: grid; grid-template-columns: 300px 1fr; gap: 2rem; background: var(--color-surface); padding: 2rem; border-radius: 15px; border: 1px solid var(--color-border); }
.controls-panel { display: flex; flex-direction: column; justify-content: center; gap: 1.5rem; }
.vector-input-group { background-color: var(--color-bg); padding: 1rem; border-radius: 8px; }
.vector-input-group h4 { margin-top: 0; color: var(--color-secondary); }
.vector-input-group label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; font-weight: 600; color: var(--color-text-secondary); }
.vector-input-group input[type="number"] { width: 70%; padding: 0.5rem; background-color: var(--color-surface); border: 1px solid var(--color-border); border-radius: 5px; color: var(--color-text); }

.render-container { background-color: var(--color-bg); border-radius: 8px; aspect-ratio: 1 / 1; width: 100%; min-height: 400px; position: relative; overflow: hidden; }
.render-container canvas { display: block; width: 100%; height: 100%; }

/* CORRECCIÓN: Se añade esta regla para forzar el color correcto en las fórmulas de KaTeX */
.stats-results .katex {
    color: var(--color-secondary); /* Hereda el color del elemento strong */
}

/* ======== SECCIÓN APLICACIONES ======== */
.apps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; }
.app-card { background-color: var(--color-surface); padding: 2rem; text-align: center; border-radius: 10px; border: 1px solid var(--color-border); }
.app-card i { font-size: 3rem; margin-bottom: 1rem; }

/* ======== SECCIÓN QUIZ ======== */
.quiz-question { background: var(--color-surface); padding: 1.5rem; border-radius: 8px; margin-bottom: 1.5rem; border-left: 5px solid var(--color-secondary); }
.quiz-options label { display: block; margin: 0.5rem 0; padding: 0.8rem; background: rgba(255,255,255,0.05); border-radius: 5px; cursor: pointer; transition: background-color 0.3s; }
.quiz-options label:hover { background: rgba(255,255,255,0.1); }
.quiz-options input { margin-right: 1rem; }
.quiz-feedback { margin-top: 2rem; font-size: 1.2rem; font-weight: bold; text-align: center; }
.correct { background-color: #2e7d32 !important; color: white; }
.incorrect { background-color: #c62828 !important; color: white; }

/* ======== FOOTER ======== */
#footer { background-color: var(--color-surface); text-align: center; padding: 3rem 2rem; margin-top: 3rem; border-top: 1px solid var(--color-border); }
#footer ul { list-style: none; padding: 0; margin: 1rem 0; display: flex; justify-content: center; gap: 2rem; flex-wrap: wrap; }
#footer a { color: var(--color-secondary); text-decoration: none; font-weight: 600; }
#footer .copyright { margin-top: 2rem; color: var(--color-text-secondary); font-size: 0.9rem; }

/* ======== RESPONSIVE DESIGN ======== */
@media (max-width: 992px) { 
    .vector-lab { grid-template-columns: 1fr; } 
}
@media (max-width: 768px) {
    h1 { font-size: 2.5rem; }
    h2 { font-size: 1.8rem; }
    .hero { height: auto; padding-bottom: 4rem; }
    .layers-container { grid-template-columns: 1fr; }
    .nav-title { display: none; }
}
