/* =========================================
   1. VARIABLES Y CONFIGURACIÓN GENERAL
   ========================================= */
:root {
    --primary-blue: #0A6970;      /* Color de GRAMÁTICA */
    --accent-magenta: #9C2E5D;    /* Color de ÉRASE */
    --dark-green: #5A7E28;        /* Color de VIDA */
    
    --header-bg: #012f62; 
    --text-dark: #333;
    --text-light: #f4f4f4;
    --page-bg: #f4f4f4; 
    
    /* Colores base */
    --btn-amarillo-bg: #F7B500; 
    --btn-amarillo-hover: #e0a300; 
    
    --btn-rosa-bg: #E06D8A;
    --btn-rosa-hover: #C75271;
}

html {
    scroll-behavior: smooth; 
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', sans-serif;
    color: var(--text-dark);
    line-height: 1.6;
    background-color: var(--page-bg); 
    overflow-x: hidden; 
}

h1, h2, h3, h4 {
    font-family: 'Bubblegum Sans', cursive;
    margin-bottom: 10px;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: auto;
    overflow: hidden;
    padding: 0; 
}

/* =========================================
   2. ENCABEZADO Y NAVEGACIÓN
   ========================================= */
.main-header {
    background-color: var(--header-bg);
    color: var(--text-light);
    padding: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 10;
    margin-bottom: 30px; 
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 90%;
    max-width: 1200px;
}

.logo-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-right: 30px;
}

.logo-text {
    font-family: 'Bubblegum Sans', cursive;
    font-size: 3em;
    color: var(--text-light);
    line-height: 1.2;
    position: relative;
    padding-left: 120px; 
}

.logo-text::before {
    content: '';
    position: absolute;
    left: 0px; 
    top: 80%;
    transform: translateY(-50%);
    width: 100px; 
    height: 100px;
    background: url('logo.png') no-repeat center center / contain;
}

.program-text {
    font-family: 'Comfortaa', sans-serif; 
    font-size: 1em;
    margin-top: 0px;
    line-height: 1;
    color: var(--text-light);
    padding-left: 120px;
}

.main-nav ul {
    list-style: none;
    display: flex;
}

.main-nav ul li {
    margin-left: 30px;
}

.main-nav ul li a {
    color: var(--text-light);
    text-decoration: none;
    font-weight: bold;
    display: flex; 
    flex-direction: column; 
    align-items: center;
    transition: transform 0.3s ease;
    text-align: center;
}

.main-nav ul li a:hover {
    transform: translateY(-5px);
}

.main-nav ul li a img { 
    width: 68px;
    height: 68px;
    margin-bottom: 5px; 
}

.main-nav ul li a span {
    display: block; 
    margin-top: 5px; 
    font-family: 'Open Sans', sans-serif;
    font-weight: 600;
    line-height: 1.2;
    font-size: 0.8em;
}

/* =========================================
   3. SECCIÓN PRINCIPAL (HERO)
   ========================================= */
.hero-section {
    background: url('hero-principal-background.jpg') no-repeat center center / cover; 
    height: 420px; 
    position: relative;
    z-index: 5;
    width: 90%; 
    max-width: 1200px; 
    margin: 0 auto; 
    background-color: #f4f4f4; 
    border-radius: 18px; 
    overflow: hidden; 
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex; 
    align-items: center; 
    justify-content: flex-start; 
    padding: 0 5%; 
}

.hero-content-text {
    background-color: rgba(10, 105, 112, 0.85); 
    color: var(--text-light);
    padding: 30px 40px;
    border-radius: 12px;
    max-width: 540px; 
    text-align: left;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.hero-content-text h1 {
    font-family: 'Bubblegum Sans', cursive;
    font-size: 3em;
    margin-bottom: 15px;
    line-height: 1.1;
}

.hero-content-text p {
    font-size: 1.3em;
    margin-bottom: 0; 
}

/* =========================================
   4. TARJETAS DEL ÍNDICE PRINCIPAL
   ========================================= */
.sections-overview {
    padding: 60px 0;
    background-color: var(--page-bg);
}

.sections-overview .container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.card {
    background-color: #fff;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.card-icon img {
    width: 200px;
    height: 200px;
    margin-bottom: 20px;
    border-radius: 50%;
    object-fit: contain;
    background-color: transparent;
}

.card h2 {
    font-size: 1.8em;
    margin-bottom: 15px;
    color: var(--text-light);
    line-height: 1;
}

.card p {
    font-size: 1em;
    color: var(--text-light);
    margin-bottom: 25px;
    flex-grow: 1;
}

#gramatica-fantastica {
    background-color: var(--primary-blue);
    color: var(--text-light);
}

#erase-una-vez {
    background-color: var(--accent-magenta);
    color: var(--text-light);
}

#vida-en-los-mundos {
    background-color: var(--dark-green);
    color: var(--text-light);
}

/* =========================================
   5. PÁGINAS DE SECCIÓN INTERNAS
   ========================================= */
.section-page-hero {
    color: var(--text-light);
    width: 90%;
    max-width: 1200px;
    margin: 30px auto 0 auto; 
    padding: 40px 0; 
    text-align: center;
    border-radius: 15px; 
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.section-hero-gramatica { background-color: var(--primary-blue); }
.section-hero-erase { background-color: var(--accent-magenta); }
.section-hero-vida { background-color: var(--dark-green); }

.page-title-box img {
    width: 200px; 
    height: 200px;
    margin-bottom: 10px; 
}

.page-title-box h1 {
    font-size: 2.5em; 
    line-height: 1;
    margin-bottom: 5px;
}

.page-title-box h2 {
    font-size: 1.5em; 
    margin-bottom: 15px; 
}

.page-title-box p {
    font-size: 1.1em; 
    max-width: 700px; 
    margin: 0 auto;
}

/* =========================================
   6. CONTROL CORRECTO DE BOTONES (.btn-secondary)
   ========================================= */

/* Estilo base por defecto para botones generales (amarillos) */
.btn-secondary {
    display: inline-block !important;
    background-color: var(--btn-amarillo-bg) !important;
    color: var(--text-dark) !important;
    padding: 10px 20px !important;
    text-decoration: none !important;
    border-radius: 25px !important;
    font-weight: bold !important;
    border: none !important;
    cursor: pointer !important;
    font-family: 'Bubblegum Sans', cursive !important;
    font-size: 1.1em !important;
    transition: background-color 0.3s ease !important;
}

.btn-secondary:hover {
    background-color: var(--btn-amarillo-hover) !important;
}

/* Excepción específica para el botón "Volver" según la sección temática */
.section-hero-gramatica .btn-secondary {
    background-color: var(--primary-blue) !important;
    color: var(--text-light) !important;
    border: 2px solid var(--text-light) !important;
}
.section-hero-gramatica .btn-secondary:hover {
    background-color: #074e54 !important;
}

.section-hero-erase .btn-secondary {
    background-color: var(--accent-magenta) !important;
    color: var(--text-light) !important;
    border: 2px solid var(--text-light) !important;
}
.section-hero-erase .btn-secondary:hover {
    background-color: #792349 !important;
}

.section-hero-vida .btn-secondary {
    background-color: var(--dark-green) !important;
    color: var(--text-light) !important;
    border: 2px solid var(--text-light) !important;
}
.section-hero-vida .btn-secondary:hover {
    background-color: #456120 !important;
}

/* =========================================
   7. MÓDULOS, LECTURAS Y MISIONES
   ========================================= */
.modules-overview {
    padding: 60px 0;
}

.modules-overview h3 {
    font-family: 'Bubblegum Sans', cursive;
    font-size: 2.2em;
    text-align: center;
    color: var(--primary-blue);
    margin-bottom: 40px;
}

.lecturas-overview h3,
.misiones-overview h3 {
    font-size: 2.3rem !important; 
    font-weight: 700;
    margin-bottom: 25px;
    color: var(--text-dark);
    text-align: center;
}

.lecturas-grid-2 {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 20px;
    margin-bottom: 30px;
}

.lecturas-overview .module-card,
.misiones-overview .module-card {
    display: flex !important;
    align-items: center !important;
    background-color: #fff;
    border-radius: 10px;
    margin-bottom: 25px;
    padding: 12px 15px !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.lecturas-overview .module-card:hover,
.misiones-overview .module-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

/* CUADRITOS DE COLORES (A1, A2, etc.) */
.lecturas-overview .module-card .module-icon,
.misiones-overview .module-card .module-icon {
    width: 45px !important;
    height: 45px !important;
    min-width: 45px !important;
    max-height: 45px !important;
    border-radius: 8px !important;
    padding: 0 !important;
    margin-right: 15px !important;
    font-size: 0.9rem !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    font-weight: bold;
    color: var(--text-light);
}

.module-color-blue .module-icon { background-color: var(--primary-blue) !important; }
.module-color-magenta .module-icon { background-color: var(--accent-magenta) !important; }
.module-color-green .module-icon { background-color: var(--dark-green) !important; }

.lecturas-overview .module-card .module-content,
.misiones-overview .module-card .module-content {
    padding: 0 !important;
    flex-grow: 1 !important;
}

.lecturas-overview .module-card .module-content h4,
.misiones-overview .module-card .module-content h4 {
    font-family: 'Open Sans', sans-serif;
    font-weight: 700;
    font-size: 1.2em !important;
    color: var(--text-dark);
    margin-bottom: 4px !important;
}

.lecturas-overview .module-card .module-content p,
.misiones-overview .module-card .module-content p {
    color: var(--text-dark);
    font-size: 0.9em !important;
    margin-bottom: 8px !important;
}

.nivel-destacado {
    display: block;
    font-family: 'Bubblegum Sans', cursive;
    color: #FFE600;
    font-size: 1.2em;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
    margin-top: 5px;
}

/* =========================================
   8. MODALES Y VENTANAS EMERGENTES
   ========================================= */
.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    position: relative;
    width: 90% !important;
    max-width: 1200px !important;
    height: 85vh !important;
    max-height: 900px !important;
    background-color: transparent; 
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.image-embed-container, 
.image-embed-container iframe, 
.image-embed-container img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}

.modal-content.video-content {
    max-width: 900px !important;
    height: auto !important;
    background-color: var(--text-dark); 
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.5);
}

.video-embed-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; 
    height: 0;
    overflow: hidden;
    z-index: 1; 
}

.video-embed-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    background-color: #000; 
}

.close-btn {
    position: absolute;
    top: -35px; 
    right: -10px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
    transition: color 0.2s;
    z-index: 1001; 
}

.close-btn:hover {
    color: var(--btn-amarillo-bg); 
}

.custom-image-resource {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    border-radius: 8px; 
}

/* =========================================
   9. PIE DE PÁGINA Y RESPONSIVE
   ========================================= */
.main-footer {
    background-color: var(--header-bg); 
    color: var(--text-light);
    text-align: center;
    padding: 30px 0;
    margin-top: 30px;
    font-size: 1.1em; 
}

.main-footer p {
    margin-bottom: 10px;
}

.social-links a {
    color: var(--text-light);
    font-size: 1.5em;
    margin: 0 10px;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: var(--btn-amarillo-bg);
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .logo-section {
        align-items: center;
        margin-right: 0;
        margin-bottom: 20px;
    }

    .logo-text {
        font-size: 2.5em;
        padding-left: 0;
    }
    
    .logo-text::before {
        display: none;
    }
    
    .main-nav ul {
        justify-content: center;
        width: 100%;
    }
    
    .main-nav ul li {
        margin: 0 10px;
    }

    .main-nav ul li a img {
        width: 45px;
        height: 45px;
    }

    .close-btn {
        top: -40px;
        right: 0;
        font-size: 35px;
    }
    
    .modal-content.video-content {
        width: 95%;
    }
    
    .hero-section {
        height: 400px;
        padding: 0 20px;
    }

    .hero-content-text {
        max-width: 100%;
        padding: 25px;
    }
    
    .hero-content-text h1 {
        font-size: 2.2em;
    }
    
    .hero-content-text p {
        font-size: 1.1em;
    }

    .lecturas-grid-2 {
        grid-template-columns: 1fr !important;
    }
}