/*
----------------------------------------------------------------------------------
                                ESTILO DE LA PAGINA
----------------------------------------------------------------------------------
*/
:root {
    --primary-color: #3b82f6;
    /* Blue 500 */
    --primary-dark: #1d4ed8;
    /* Blue 700 */
    --accent-color: #8b5cf6;
    /* Violet 500 */
    --text-primary: #1f2937;
    /* Gray 800 */
    --text-secondary: #4b5563;
    /* Gray 600 */
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-page: #0f172a;
    --border-color: rgba(255, 255, 255, 0.2);
    --shadow-card: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --font-heading: 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-page);
    background-image: linear-gradient(135deg, #1e3a8a 0%, #0c111e 74%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 800'%3E%3Cg fill='none' stroke='%233b82f6' stroke-width='1'%3E%3Ccircle cx='400' cy='400' r='200' stroke-opacity='0.2'/%3E%3Ccircle cx='400' cy='400' r='250' stroke-opacity='0.15'/%3E%3Ccircle cx='400' cy='400' r='300' stroke-opacity='0.1'/%3E%3Ccircle cx='400' cy='400' r='350' stroke-opacity='0.05'/%3E%3C/g%3E%3C/svg%3E");
    background-attachment: fixed;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    color: var(--text-primary);
}

/* --- Layout: Flashcard Container --- */
.flashcard-container {
    height: 100vh;
    width: 100vw;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    background: transparent;
}

.flashcard {
    height: 100vh;
    width: 100vw;
    scroll-snap-align: start;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    box-sizing: border-box;
    position: relative;
}

.card-content {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    box-shadow: var(--shadow-card);
    width: 100%;
    max-width: 1400px;
    height: 90vh;
    /* Leave some space */
    display: flex;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.info-side {
    flex: 1;
    padding: 2.5rem;
    overflow-y: auto;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* --- LADO VISUAL CORREGIDO --- */
.visual-side {
    flex: 1;
    background: #f8fafc;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* Habilita el scroll vertical */
    position: relative;

    align-items: center;
}

/* Estilos de la barra de scroll para que se vea moderna */
.visual-side::-webkit-scrollbar {
    width: 8px;
}
.visual-side::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}
.visual-side::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.visual-side::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .card-content {
        flex-direction: column;
        height: auto;
        min-height: 90vh;
        overflow-y: visible;
        /* Allow content to flow */
    }

    .flashcard {
        height: auto;
        min-height: 100vh;
        padding: 1rem;
        padding-top: 4rem;
        /* Space for nav if fixed */
    }

    .info-side {
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        padding: 1.5rem;
    }

    .visual-side {
        padding: 1rem;
        min-height: 300px;
    }

    /* Disable layout scroll snap on very small screens if UX is bad */
    .flashcard-container {
        scroll-snap-type: none;
        /* Often better for mobile flow */
        height: auto;
        overflow-y: visible;
    }
}

/* --- Navigation --- */
.side-nav {
    position: fixed;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 50;
}

.nav-dot {
    width: 12px;
    height: 12px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.nav-dot:hover,
.nav-dot.active {
    background-color: var(--primary-color);
    transform: scale(1.3);
    box-shadow: 0 0 10px var(--primary-color);
}

.nav-dot.active {
    background-color: var(--accent-color);
}

/* --- Typography & Components --- */
.step-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: #dbeafe;
    color: var(--primary-dark);
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.section-title {
    font-size: 2.25rem;
    padding-bottom: 2.25rem;
    font-weight: 800;
    color: #111827;
    margin: 0;
}

.section-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: -0.5rem;
}

.text-content {
    font-size: 1rem;
    line-height: 1.625;
    color: var(--text-primary);
}

.text-content strong {
    color: var(--primary-dark);
}

.formula-box {
    background-color: #f3f4f6;
    border-left: 4px solid var(--accent-color);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0.5rem;
    font-size: 1.1rem;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    color: white;
    font-weight: 600;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: white;
    color: var(--text-secondary);
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-secondary:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
}

.input-field {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.alert-box {
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
}

.hidden {
    display: none !important;
}

/* --- Specific Components (Video y Gráficos) --- */

/* Estilos originales para un solo video (Secciones antiguas) */
.video-container {
    width: 100%;
    max-width: 800px;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-card);
    background: #000;
}

.video-player {
    width: 100%;
    display: block;
}

/* NUEVAS CLASES PARA EL DISEÑO DE MÚLTIPLES VIDEOS (TARJETAS) */
.videos-layout {
    display: flex;
    flex-direction: column;
    gap: 2.5rem; /* El espacio en blanco que separa los videos */
    width: 100%;
    max-width: 800px;
    margin: 0 auto; /* Centrado horizontal */
    flex-shrink: 0; /* Evita que los videos se aplasten */
}

.video-card {
    background: white; /* Cajas con fondo blanco */
    border-radius: 1rem; /* Bordes curvos */
    overflow: hidden;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb; /* Borde sutil */
}

.video-card .video-title {
    margin: 0;
    padding: 1.25rem 1rem;
    text-align: center;
    font-size: 1.15rem;
    color: var(--text-primary);
    font-weight: 700;
    background: white;
}

.video-card .video-player {
    width: 100%;
    display: block;
    background: #000;
    border-bottom-left-radius: 1rem; /* Mantiene la curvatura abajo */
    border-bottom-right-radius: 1rem;
}

/* --- D3 & Interactive Graph Containers --- */
.graph-container {
    width: 100%;
    background: white;
    border-radius: 1rem;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    position: relative;
    overflow: hidden;
}

/* Legacy Support / JS Compatibility */
.tts-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.tts-btn:hover {
    color: var(--primary-color);
}

.tts-btn.playing {
    color: #ef4444;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.loader {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* JACOBIANO */
#jacobiano-controles {
    display: grid;
    grid-template-columns: 80% 20%;
    gap: 10px;
    padding: 10px;
}

#funjacobiano {
    padding: 8px;
}

#graficarJacobiano {
    padding: 8px;
}

#contenedor-jacobiano {
    width: 100%;
    height: 300px;
}

#contenedor-jacobiano canvas {
    width: 100%;
    height: 100%;
}

/* Grid Layout for Conformal Maps */
#conformal-codomain-container,
#conformal-domain-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

#conformal-codomain-container svg,
#conformal-domain-container svg {
    border: 1px solid #ccc;
    background-color: #f9f9f9;
}

.funcion-path {
    fill: none;
    stroke: #ff4500;
    stroke-width: 2px;
}

.domain {
    stroke: #333;
    stroke-width: 1.5px;
}

.tick line {
    stroke: #999;
}

.x-grid .tick line,
.y-grid .tick line {
    stroke: #e0e0e0;
    stroke-dasharray: 2, 2;
}

.tick text {
    font-size: 10px;
    fill: #666;
}

.maps-container {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 1rem;
    width: 100%;
}

/* Utilities for dynamic JS content */
.loader-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 1rem;
}

.text-error {
    color: #ef4444;
    font-weight: 500;
}

.text-secondary {
    color: var(--text-secondary);
}

.inline-code {
    background-color: #e5e7eb;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-family: monospace;
    font-size: 0.875em;
}

.separator {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.link-primary {
    color: var(--primary-color);
    font-weight: 500;
    text-decoration: none;
    font-size: 0.875rem;
}

.link-primary:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* --- MAPAS INTERACTIVOS --- */
.vector {
    stroke-width: 2;
}

.vector-z1 {
    stroke: var(--primary-color);
}

.vector-z2 {
    stroke: var(--accent-color);
}

.vector-sum {
    stroke: var(--primary-dark);
}

.parallelogram-line {
    stroke: #9ca3af;
    stroke-dasharray: 4;
    stroke-width: 1.5;
}

.handle {
    fill: var(--primary-color);
    stroke: var(--primary-dark);
    stroke-width: 2;
}

/* --- PAUSAS ACTIVAS (LECTURA ACTIVA) --- */
.active-reading-block {
    background-color: #f8fafc;
    border-left: 5px solid var(--accent-color);
    border-radius: 0 0.5rem 0.5rem 0;
    padding: 1.5rem;
    margin: 2rem 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.active-reading-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.active-reading-header h4 {
    margin: 0;
    color: var(--primary-dark);
    font-size: 1.1rem;
    font-weight: 700;
}

.active-reading-question {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

.active-reading-input {
    background-color: white;
    resize: vertical;
    min-height: 80px;
}

.active-reading-hint {
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.active-reading-hint summary {
    cursor: pointer;
    color: var(--accent-color);
    font-weight: 600;
    list-style: none;
    display: inline-flex;
    align-items: center;
    transition: opacity 0.2s;
}

.active-reading-hint summary:hover {
    opacity: 0.8;
}

.active-reading-hint summary::-webkit-details-marker {
    display: none;
}

.active-reading-hint p {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background-color: #f3f4f6;
    border-left: 3px solid #9ca3af;
    border-radius: 0 0.25rem 0.25rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* Centrar específicamente el logo de la sección de inicio */
#intro .visual-side svg {
    margin: auto;
}