:root { --primario: #225868; --acento: #01A0C7; }
* { box-sizing: border-box; }
body { margin: 0; background-color: var(--primario); font-family: 'Segoe UI', sans-serif; }

.container-global {
    width: 95%; max-width: 1160px;
    margin: 15px auto; background: white;
    border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    overflow: hidden;
}

/* CABECERA */
.ad-top-box { text-align: center; padding: 10px; background: #f8f8f8; border-bottom: 1px solid #ddd; }
.main-header { text-align: center; padding: 10px 0 0 0; }
.main-header h1 { color: var(--primario); font-size: 2.5rem; margin: 0 0 10px 0; }

/* NAVEGACIÓN */
.nav { background: var(--primario); display: flex; list-style: none; padding: 0; margin: 0; justify-content: center; }
.nav > li { 
    flex: 1; 
    min-width: 120px; 
    position: relative; /* Importante para que el submenú se posicione respecto al botón */
    display: flex;
    justify-content: center; /* Centra el texto del enlace padre */
}
.nav li a { color: white; display: block; padding: 10px; text-decoration: none; font-weight: bold; text-align: center; }
.nav li a:hover { background: var(--acento); color: #FF0; }
.nav li ul { 
    display: none; 
    position: absolute; 
    background: white; 
    width: 180px; 
    z-index: 100; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.3); 
    list-style: none; 
    padding: 0;
    
    /* CENTRADO DEL DESPLEGABLE */
    top: 100%;       /* Justo debajo del botón */
    left: 50%;       /* Empieza en la mitad del botón */
    transform: translateX(-50%); /* Se echa hacia atrás la mitad de su propio ancho */
}
.nav li:hover ul { 
    display: block; 
}
.nav li ul li a { 
    color: var(--primario); 
    border-bottom: 1px solid #eee; 
    text-align: center; /* Centramos también el texto de las opciones de dentro */
    border-right: none; 
}

/* LAYOUT 75/25 */
.main-layout-flex { display: flex; padding: 20px; gap: 20px; flex-wrap: nowrap; }
.content-area { width: 75%; flex: 0 0 75%; }
.sidebar-right { width: 25%; flex: 0 0 25%; background: #f9f9f9; padding: 15px; border-radius: 8px; border: 1px solid #eee; }


.grid-eso { 
    display: flex; 
    justify-content: space-between; 
    gap: 10px; 
    margin-top: 15px; 
    flex-wrap: nowrap;
}
.grid-eso a { flex: 1; text-align: center; }
.grid-eso img { 
    width: 100%; 
    max-width: 150px; 
    height: 100px; 
    object-fit: contain; 
    border: 1px solid #eee; 
    border-radius: 5px;
}
.intro-text { 
    display: block;  margin: 10px 0 15px 0; font-weight: 700;color: #333;  font-size: 1.15rem; line-height: 1.4; 
    border-left: 4px solid var(--acento);  padding-left: 10px;
}
/* AVISO Y TEXTO AZUL */
.aviso-parpadeo { text-align: center; color: darkgreen; font-weight: bold; animation: flash 2s infinite; font-size: 1.3rem; margin: 15px 0; }
@keyframes flash { 50% { opacity: 0.3; } }
.info-adicional-azul { color: var(--primario); margin: 15px 0; line-height: 1.6; text-align: center; }
.info-adicional-azul a { color: var(--primario); font-weight: bold; text-decoration: underline; }

/* SECCIONES */
.section-card { margin-bottom: 25px; }
.section-title { color: var(--primario); border-bottom: 3px solid var(--acento); display: inline-block; margin: 5px 0; padding-bottom: 2px; }
.header-blue { background: var(--primario); color: white; padding: 10px; border-radius: 5px; text-align: center; margin: 15px 0; }

/* BACHILLERATO */
.bach-container { display: flex; gap: 15px; }
.bach-sub { flex: 1; background: #fafafa; padding: 10px; border-radius: 8px; border: 1px solid #ddd; }
.bach-links a { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; text-decoration: none; color: var(--primario); font-weight: bold; }
.bach-links img { width: 50px; height: 50px; border-radius: 5px; }

/* PRIMARIA - UNA FILA */
.grid-primaria-final { display: flex; justify-content: space-between; gap: 5px; }
.prim-box { flex: 1; text-align: center; font-weight: bold; }
.prim-box img { width: 100%; height: 95px; object-fit: contain; }

/* RECURSOS */
.grid-recursos-completo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.rec-item { text-align: center; border: 1px solid #eee; padding: 15px; border-radius: 10px; background: #fff; }
.rec-item span { font-weight: bold; font-size: 1.1rem; color: var(--primario); display: block; margin-bottom: 8px; }
.rec-item img { width: 100%; height: 100px; object-fit: contain; }

/* CONTADOR */
.contador-box { margin-bottom: 20px; text-align: center; }

/* FOOTER (Memorial Técnico) */
.main-footer { padding: 40px 0; background: #f4f4f4; border-top: 2px solid #eee; width: 100%; }
.footer-inner { max-width: 900px; margin: 0 auto; text-align: center; font-weight: bold; padding: 0 20px; }
.footer-how-to p { text-align: justify; line-height: 1.6; margin-bottom: 15px; }

/* Regla Márgenes Estrictos */
h3, p { margin-top: 5px; margin-bottom: 10px; }

@media (max-width: 900px) {
    .main-layout-flex { flex-direction: column; }
    .content-area, .sidebar-right { width: 100%; flex: 0 0 100%; }
    .grid-eso, .grid-primaria-final { flex-wrap: wrap; }
    .grid-recursos-completo { grid-template-columns: repeat(2, 1fr); }
}