:root {
    --primary-color: #0b2545;   /* Azul Marino del escudo */
    --secondary-color: #d90429; /* Rojo institucional del escudo */
    --accent-color: #8da9c4;
    --light-bg: #f8f9fa;
    --text-color: #333333;
    --white: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    font-family: 'Open Sans', sans-serif;
    color: var(--text-color);
    line-height: 1.6;
}

h1, h2, h3, h4, .nav-links a, .logo {
    font-family: 'Cinzel', serif;
}

/* Barra superior con lema */
.top-bar {
    background-color: var(--primary-color);
    color: var(--white);
    text-align: center;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    letter-spacing: 1px;
    font-weight: 600;
}

.top-bar span {
    color: var(--secondary-color);
    margin: 0 5px;
}

/* Header y Navegación */
header {
    background: var(--white);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo span {
    color: var(--secondary-color);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.3s;
    padding: 0.5rem 0;
}

.nav-links a:hover {
    color: var(--secondary-color);
}

/* Menú Desplegable */
.dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--white);
    min-width: 220px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    border-radius: 5px;
    padding: 0.5rem 0;
    z-index: 1;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    transform: translateY(10px);
    border-top: 3px solid var(--secondary-color);
}

.dropdown:hover .dropdown-content {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-content li {
    list-style: none;
}

.dropdown-content a {
    color: var(--primary-color);
    padding: 0.75rem 1.5rem;
    display: block;
    text-align: left;
    font-size: 0.9rem;
}

.dropdown-content a:hover {
    background-color: var(--light-bg);
    color: var(--secondary-color);
}

/* Hero Section */
.hero {
    background-color: transparent;
    height: 350px; 
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
    gap: 40px; 
}

.hero-logo-container {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-logo-container img {
    height: 100%;
    width: auto;
    object-fit: contain;
}

.hero-content {
    background-color: #0b2545;
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 3rem;
    color: var(--white);
    text-align: left;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.hero h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}

.hero p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    font-family: 'Open Sans', sans-serif;
}

.btn {
    display: inline-block;
    background: var(--secondary-color);
    color: var(--white);
    padding: 0.8rem 2rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    font-family: 'Cinzel', serif;
    transition: background 0.3s, transform 0.2s;
    border: none;
    cursor: pointer;
}

.btn:hover {
    background: #b50322;
    transform: translateY(-2px);
}

/* Secciones Generales */
section {
    padding: 5rem 2rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    text-align: center;
    font-size: 2.3rem;
    color: var(--primary-color);
    margin-bottom: 3rem;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background-color: var(--secondary-color);
    margin: 10px auto 0;
}

/* Oferta Educativa Carrusel */
.oferta-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.grid-niveles {
    display: flex;
    gap: 2rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding-bottom: 1rem;
    width: 100%;
    scrollbar-width: none;
    align-items: stretch;
}

.grid-niveles::-webkit-scrollbar {
    display: none;
}

.card {
    background: var(--white);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    text-align: center;
    transition: transform 0.3s;
    border-bottom: 3px solid var(--primary-color);
    flex: 0 0 calc(33.333% - 1.35rem);
    scroll-snap-align: start;
}

@media (max-width: 900px) {
    .card { flex: 0 0 calc(50% - 1rem); }
}

@media (max-width: 600px) {
    .card { flex: 0 0 100%; }
}

.card:hover {
    transform: translateY(-5px);
    border-bottom-color: var(--secondary-color);
}

.card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.card-body {
    padding: 1.5rem;
}

.card-body h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.card-body a.card-link {
    display: inline-block;
    margin-top: 1rem;
    color: var(--secondary-color);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.card-body a.card-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.scroll-arrow {
    position: absolute;
    background: var(--white);
    border: none;
    font-size: 2.2rem;
    color: var(--primary-color);
    cursor: pointer;
    z-index: 10;
    padding: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    border-radius: 50%;
    width: 55px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s, color 0.3s;
}

.scroll-arrow.prev {
    left: -25px;
}

.scroll-arrow.next {
    right: -25px;
}

.scroll-arrow:hover {
    background: var(--primary-color);
    color: var(--white);
}

/* Secciones Detalladas por Nivel Educativo y Nosotros */
.detalle-nivel {
    padding: 5rem 2rem;
    border-bottom: 1px solid #eaeaea;
}

.detalle-nivel:nth-child(even) {
    background-color: var(--light-bg);
}

.detalle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}

.detalle-grid.reverse {
    direction: rtl;
}

.detalle-grid.reverse > * {
    direction: ltr;
}

.detalle-texto h3 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 1rem;
}

.detalle-texto p {
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

.detalle-imagen img {
    width: 100%;
    height: 320px;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Sección Expandida tipo "Ventana Nueva" */
.detalle-ampliado {
    display: none;
    margin-top: 3rem;
    padding: 3rem;
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border-top: 4px solid var(--secondary-color);
    grid-column: 1 / -1;
}

.detalle-ampliado h4 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 1rem;
    font-family: 'Cinzel', serif;
}

.detalle-ampliado p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: var(--text-color);
}

.btn-cerrar-ventana {
    background: var(--primary-color);
    margin-bottom: 1.5rem;
}
.btn-cerrar-ventana:hover {
    background: #05162b;
}

.carousel-interno {
    position: relative;
    width: 100%;
    max-width: 700px;
    height: 380px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.carousel-interno-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.carousel-interno-slide.active {
    opacity: 1;
}

.carousel-interno-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ESTILOS PARA MATERNAL */
.maternal-interactive-container {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.maternal-buttons-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.maternal-btn {
    background: linear-gradient(135deg, #0b2545 0%, #133863 100%);
    color: #ffffff;
    border: 2px solid var(--secondary-color);
    padding: 12px 20px;
    border-radius: 10px;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    text-align: center;
    min-width: 160px;
}

.maternal-btn:hover, .maternal-btn.active {
    background: var(--secondary-color);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(217, 4, 41, 0.3);
}

.maternal-display-box {
    background: linear-gradient(135deg, #0b2545 0%, #112e51 100%);
    border: 3px solid var(--secondary-color);
    border-radius: 12px;
    padding: 2.5rem;
    color: #ffffff;
    min-height: 220px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
    animation: fadeInPanel 0.4s ease-in-out;
}

.maternal-panel-content {
    display: none;
}

.maternal-panel-content.active {
    display: block;
}

.maternal-panel-content h5 {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    margin-bottom: 1.2rem;
    color: #ffffff;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    padding-bottom: 0.5rem;
}

.maternal-panel-content ul {
    list-style: none;
    padding: 0;
}

.maternal-panel-content li {
    font-size: 1.05rem;
    margin-bottom: 0.8rem;
    line-height: 1.5;
    color: #f1f1f1;
}

@keyframes fadeInPanel {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* SECCIÓN UBICACIÓN */
.ubicacion-container {
    max-width: 1200px;
    margin: 0 auto;
}

.map-responsive {
    overflow: hidden;
    padding-bottom: 450px;
    position: relative;
    height: 0;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 3px solid var(--primary-color);
}

.map-responsive iframe {
    left: 0;
    top: 0;
    height: 100%;
    width: 100%;
    position: absolute;
    border: 0;
}

/* SECCIÓN FORMULARIO FIREBASE */
.contacto-form-section {
    background-color: var(--light-bg);
    padding: 5rem 2rem;
}

.contacto-grid {
    max-width: 800px;
    margin: 0 auto;
    background: var(--white);
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border-top: 4px solid var(--secondary-color);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: 'Open Sans', sans-serif;
    font-size: 1rem;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

#form-mensaje {
    margin-top: 1rem;
    font-weight: 600;
    text-align: center;
}

/* Footer */
footer {
    background: var(--primary-color);
    color: var(--white);
    padding: 3rem 2rem 1rem;
    border-top: 4px solid var(--secondary-color);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-col h4 {
    margin-bottom: 1rem;
    color: var(--accent-color);
    font-size: 1.1rem;
}

.footer-col p, .footer-col a {
    color: #ddd;
    text-decoration: none;
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.footer-col a:hover {
    color: var(--white);
}

.footer-bottom {
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 1.5rem;
    font-size: 0.85rem;
    color: #aaa;
}

/* ==========================================================
   AJUSTES PARA EL MODO VENTANA ACTIVA
   ========================================================== */
body.modo-ventana-activa .top-bar,
body.modo-ventana-activa #inicio,
body.modo-ventana-activa #oferta,
body.modo-ventana-activa #ubicacion,
body.modo-ventana-activa .detalle-nivel:not(:has(.detalle-ampliado[style*="block"])) {
    display: none !important;
}

body.modo-ventana-activa .detalle-nivel:has(.detalle-ampliado[style*="block"]) {
    display: block !important;
    padding: 2rem 1rem;
    min-height: 70vh;
}

body.modo-ventana-activa .detalle-nivel:has(.detalle-ampliado[style*="block"]) .detalle-grid > *:not(.detalle-ampliado) {
    display: none !important;
}

body.modo-ventana-activa .detalle-ampliado {
    display: block !important;
    margin-top: 0;
    box-shadow: none;
    border: none;
    width: 100%;
}

@media (max-width: 768px) {
    .detalle-grid { grid-template-columns: 1fr; }
    .detalle-grid.reverse { direction: ltr; }
    .nav-links { display: none; }
    .hero { height: auto; flex-direction: column; }
    .hero-content { padding: 2rem; }
    .scroll-arrow { display: none; }
}