/* ================= VARIABLES Y CONFIGURACIÓN BASE ================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500&display=swap');

:root {
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --border-color: #334155;
    --error-color: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

/* ================= COMPONENTES GLOBALES ================= */
main {
    padding: 3rem 5%;
    max-width: 1000px;
    margin: 0 auto;
}

/* ================= ENCABEZADO (HEADER) ================= */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 5%;
    background-color: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.logo:hover {
    opacity: 0.8;
}

.logo span {
    color: var(--accent-color);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-link-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.3s ease;
}

.header-link-btn:hover {
    color: var(--accent-color);
}

.menu-btn {
    padding: 10px 18px;
    background-color: var(--accent-color);
    color: #ffffff;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
}

.menu-btn:hover {
    background-color: var(--accent-hover);
}

.menu-btn:active {
    transform: scale(0.97);
}

/* ================= MENÚ LATERAL (SIDEBAR) ================= */
.sidebar {
    position: fixed;
    top: 0;
    right: -350px; /* Oculto por defecto */
    width: 350px;
    height: 100vh;
    background-color: var(--surface-color);
    box-shadow: -5px 0 15px rgba(0,0,0,0.5);
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    padding: 2rem;
    overflow-y: auto;
}

.sidebar.open {
    right: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s;
}

.close-btn:hover {
    color: var(--error-color);
}

.sidebar ul {
    list-style: none;
}

.sidebar ul li {
    margin-bottom: 1rem;
}

.sidebar ul li a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1.1rem;
    transition: all 0.3s;
    display: block;
    padding: 0.5rem;
    border-radius: 8px;
}

.sidebar ul li a:hover, 
.sidebar ul li a.active-link {
    color: var(--text-primary);
    background-color: var(--border-color);
    padding-left: 1rem;
    border-left: 4px solid var(--accent-color);
}

/* Fondo oscuro al abrir el menú */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ================= SECCIONES Y CONTENIDO ================= */
.content-section {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hero Section (Inicio) */
.hero {
    text-align: center;
    margin-bottom: 4rem;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

.hero .description {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
}

/* Tipografía de Módulos */
.module-tag {
    background-color: var(--accent-color);
    color: #000;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
}

.content-section h2 {
    font-size: 2.5rem;
    margin: 1rem 0 2rem 0;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.content-section h3 {
    font-size: 1.5rem;
    margin: 2rem 0 1rem 0;
    color: #cbd5e1;
}

/* ================= TARJETAS (CARDS) Y CUADRÍCULAS ================= */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
    align-items: stretch;
}

.summary-card {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column; 
}

.summary-card:hover {
    transform: translateY(-5px);
}

.summary-card h4 {
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.summary-card p {
    flex-grow: 1; 
    margin-bottom: 1.5rem;
}

/* Botones dentro de tarjetas */
.resource-btn {
    margin-top: auto; 
    padding: 8px 12px;
    background-color: transparent;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    width: 100%;
}

.resource-btn:hover {
    background-color: var(--accent-color);
    color: #ffffff;
}

/* ================= CALL TO ACTION (Botón Principal) ================= */
.cta-container {
    text-align: center;
    margin-top: 4rem;
    margin-bottom: 2rem;
}

.main-cta-btn {
    background-color: var(--accent-color);
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    padding: 16px 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.main-cta-btn:hover {
    background-color: var(--accent-hover);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.main-cta-btn:active {
    transform: translateY(1px);
}

/* ================= VENTANA EMERGENTE (MODAL) ================= */
.modal-overlay-alert {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay-alert.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--surface-color);
    padding: 2.5rem 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    position: relative;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.modal-overlay-alert.active .modal-content {
    transform: scale(1);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: var(--error-color);
}

.modal-content h3 {
    color: var(--accent-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.modal-content p {
    margin-bottom: 2rem;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.external-link-btn {
    display: inline-block;
    background-color: var(--accent-color);
    color: #ffffff;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: background-color 0.3s;
}

.external-link-btn:hover {
    background-color: var(--accent-hover);
}

/* ================= ELEMENTOS MULTIMEDIA Y CÓDIGO ================= */
.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    max-width: 100%;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    margin: 2rem 0;
    background-color: #000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.code-block {
    background-color: #020617;
    border-radius: 8px;
    overflow: hidden;
    margin: 1.5rem 0;
    border: 1px solid var(--border-color);
}

.code-header {
    background-color: var(--surface-color);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    font-family: 'Fira Code', monospace;
}

pre {
    padding: 1rem;
    overflow-x: auto;
}

code {
    font-family: 'Fira Code', monospace;
    font-size: 0.95rem;
    color: #38bdf8;
}

/* ================= NAVEGACIÓN ENTRE MÓDULOS ================= */
.module-navigation {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.module-navigation.single-btn {
    justify-content: flex-end;
}

.nav-module-btn {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.3s ease, color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-module-btn.next {
    background-color: var(--accent-color);
    color: #ffffff;
    border: none;
}

.nav-module-btn.next:hover {
    background-color: var(--accent-hover);
    transform: translateX(4px);
}

.nav-module-btn.prev {
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.nav-module-btn.prev:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
    transform: translateX(-4px);
}

/* ================= PANTALLA DE FINALIZACIÓN ================= */
.completion-container {
    text-align: center;
    padding: 4rem 2rem;
    background-color: var(--surface-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-top: 2rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.completion-container h2 {
    color: var(--accent-color);
    margin-bottom: 1rem;
    border-bottom: none;
    font-size: 2.2rem;
}

.completion-container p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.email-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background-color: var(--border-color);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: background-color 0.3s ease, color 0.3s ease;
    margin-top: 1rem;
}

.email-link:hover {
    background-color: #475569;
    color: var(--accent-color);
}

/* ================= DISEÑO RESPONSIVO (MÓVILES) ================= */
@media (max-width: 768px) {
    .sidebar { width: 100%; right: -100%; }
    .hero h1 { font-size: 2rem; }
    .header-controls { gap: 1rem; }
    
    /* Mejoras extra para móviles */
    .module-navigation {
        flex-direction: column-reverse;
        gap: 1rem;
    }
    
    .nav-module-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ================= DISEÑO IMÁGENES DE CADA MÓDULO ================= */

.module-image{
    display: block;
    margin: 40px auto;     /* centra la imagen */
    max-width: 600px;      /* tamaño máximo */
    width: 80%;            /* adaptable */
    height: auto;
    border-radius: 10px;   /* bordes suaves */
    box-shadow: 0 8px 20px rgba(0,0,0,0.15); /* sombra profesional */
}

/* ================= DISEÑO VIDEOS DE CADA MÓDULO ================= */

/* Contenedor del video */
.video-tutorial {
    display: flex;
    justify-content: center;
    margin: 30px auto; /* Centra el contenedor y le da espacio arriba y abajo */
    width: 100%;
    max-width: 800px; /* Evita que el video se vea gigante en pantallas muy grandes */
    border-radius: 12px; /* Bordes redondeados para un toque moderno */
    overflow: hidden; /* Asegura que el iframe respete los bordes redondeados */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15); /* Sombra elegante para resaltar el video */
}

/* El iframe del video de YouTube */
.video-tutorial iframe {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9; /* Mantiene la proporción perfecta de YouTube automáticamente */
    border: none; /* Elimina cualquier borde por defecto */
}