/* ============================================
   1. RESET Y BASE
   ============================================ */
html, body {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100% !important;
    scroll-behavior: smooth; /* Scroll suave */
}
body {
    background: #fff !important;
    color: #333 !important;
    display: block !important;
}

/* ============================================
   2. HEADER Y MENÚ
   ============================================ */
#header {
    background: #fff !important;
    border-bottom: 1px solid #e0e4ea !important;
    padding: 15px 0 !important;
    position: relative !important;
    z-index: 100 !important;
}
#header .container {
    max-width: 1400px !important;
    margin: 0 auto !important;
    padding: 0 20px !important;
}
#header .section {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
}
#header #logo { flex: 0 0 auto !important; }
#header #logo img { max-width: 140px !important; height: auto !important; display: block !important; }
#header .custom_menu_4 { flex: 1 1 auto !important; display: flex !important; justify-content: flex-end !important; }

#header #menu > ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    gap: 15px !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
}
#header #menu > ul > li > a {
    text-decoration: none !important;
    color: #333 !important;
    font-size: 0.8em !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    font-weight: 500 !important;
    white-space: nowrap !important;
}
#header #menu > ul > li > a:hover { color: #1f3a5f !important; }

/* ============================================
   3. CONTENIDO PRINCIPAL
   ============================================ */
main.container {
    max-width: 1200px !important;
    margin: 30px auto !important;
    padding: 20px 20px 60px 20px !important;
    position: relative !important;
    z-index: 1 !important;
}

/* ============================================
   4. SECCIONES Y TARJETAS
   ============================================ */
h1 { margin-top: 30px; margin-bottom: 30px; }

.hero-descargas {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 50px;
    margin-top: 30px;
}
.hero-card {
    display: block;
    background: #fff;
    border: 1px solid #e0e4ea;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
    text-align: center;
}
.hero-card:hover {
    box-shadow: 0 8px 24px rgba(31, 58, 95, 0.15);
    transform: translateY(-3px);
}
.hero-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
}
.hero-card img.img-catalogos {
    object-fit: contain;
    background-color: #333333;
}
.hero-card h3 {
    margin: 15px 0 5px 0;
    color: #1f3a5f;
    font-size: 1.1em;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 15px;
}
.hero-card p {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 0.85em;
    padding: 0 15px;
}

.seccion-descargas { margin-bottom: 50px; }
.seccion-descargas h2 {
    color: #1f3a5f;
    font-size: 1.4em;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid #1f3a5f;
    padding-bottom: 10px;
    margin-bottom: 10px;
    margin-top: 40px;
}
.seccion-subtitulo { color: #666; font-size: 0.9em; margin-bottom: 20px; }

.grupo-descargas {
    background: #f8fafc;
    border: 1px solid #e0e4ea;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}
.grupo-descargas h3 {
    margin: 0 0 20px 0;
    color: #1f3a5f;
    font-size: 1.1em;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid #e0e4ea;
    padding-bottom: 10px;
}
.grupo-descargas h3 small {
    color: #888;
    font-weight: normal;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.9em;
}

.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}
.card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #e0e4ea;
    border-radius: 8px;
    padding: 20px 15px;
    text-decoration: none;
    color: #333;
    text-align: center;
    transition: all 0.2s;
    min-height: 200px;
}
.card:hover {
    border-color: #1f3a5f;
    box-shadow: 0 4px 12px rgba(31, 58, 95, 0.1);
    transform: translateY(-2px);
}
.card-icono { color: #1f3a5f; width: 42px; height: 42px; margin-bottom: 15px; }
.card-icono svg { width: 100%; height: 100%; }
.card-nombre { font-weight: 600; font-size: 0.95em; line-height: 1.3; margin-bottom: 8px; }
.card-meta { font-size: 0.8em; color: #888; }

/* ============================================
   5. FOOTER
   ============================================ */
#footer {
    position: relative !important;
    width: 100% !important;
    margin-top: 60px !important;
    background: #1a1a1a !important;
    color: #ccc !important;
    padding: 50px 0 0 0 !important;
    box-sizing: border-box !important;
}
#footer .container { max-width: 1200px !important; margin: 0 auto !important; padding: 0 20px !important; }
#footer .section {
    display: grid !important;
    grid-template-columns: 220px 1fr 1fr 1fr !important;
    gap: 40px !important;
    padding-bottom: 40px !important;
    align-items: start !important;
    width: 100% !important;
}
#footer .col, #footer .col.span_1_of_4, #footer .col.span_1_of_4.first, #footer .col.span_1_of_4.last {
    display: block !important;
    float: none !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    clear: none !important;
}
#footer .section::after { content: none !important; display: none !important; }
#footer .col img { max-width: 140px !important; width: auto !important; height: auto !important; display: block !important; margin: 0 !important; }
#footer h3 { color: #fff !important; font-size: 0.9em !important; text-transform: uppercase !important; letter-spacing: 1px !important; margin: 0 0 15px 0 !important; font-weight: 600 !important; }
#footer a { color: #ccc !important; text-decoration: none !important; line-height: 1.8 !important; display: inline-block !important; }
#footer a:hover { color: #fff !important; }
#footer .texto_footer { line-height: 1.8 !important; }
.footer_btm { border-top: 1px solid #333 !important; padding: 20px 0 !important; text-align: center !important; font-size: 0.85em !important; color: #888 !important; }

/* ============================================
   6. RESPONSIVE
   ============================================ */
@media (max-width: 900px) { .hero-descargas { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) {
    #footer .section { grid-template-columns: 1fr !important; gap: 20px !important; }
    #header .section { flex-direction: column !important; gap: 15px !important; }
    #header #menu > ul { flex-wrap: wrap !important; justify-content: center !important; }
}
@media (max-width: 500px) { .hero-descargas { grid-template-columns: 1fr; } }

/* ============================================
   7. BOTÓN MODO OSCURO Y BOTÓN SUBIR
   ============================================ */
.theme-toggle-container { 
    display: flex !important; 
    align-items: center !important; 
    margin-left: 10px !important; 
}

#theme-toggle {
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    color: #333 !important;
    padding: 5px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform 0.2s;
}

#theme-toggle:hover { 
    transform: scale(1.1); 
}

#theme-toggle svg {
    width: 22px !important;
    height: 22px !important;
    stroke: #333 !important; /* Fuerza a que el dibujo sea oscuro */
    fill: none !important;
    display: block !important;
}

#btn-volver-arriba {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: #1f3a5f;
    color: #fff;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 9999;
    transition: background-color 0.3s, transform 0.2s;
}
#btn-volver-arriba:hover { background-color: #15263f; transform: translateY(-3px); }
#btn-volver-arriba svg { width: 24px; height: 24px; }
/* ============================================
   8. ESTILOS DEL MODO OSCURO (DARK MODE)
   ============================================ */
body.dark-mode { background-color: #121212 !important; color: #e0e0e0 !important; }
body.dark-mode #header { background-color: #1e1e1e !important; border-bottom-color: #333 !important; }
body.dark-mode #header #menu > ul > li > a, body.dark-mode #theme-toggle { color: #e0e0e0 !important; }
body.dark-mode .hero-card { background-color: #1e1e1e !important; border-color: #333 !important; color: #e0e0e0 !important; }
body.dark-mode .hero-card h3 { color: #90caf9 !important; }
body.dark-mode .hero-card p { color: #aaa !important; }
body.dark-mode .grupo-descargas { background-color: #1e1e1e !important; border-color: #333 !important; }
body.dark-mode .card { background-color: #2a2a2a !important; border-color: #444 !important; color: #e0e0e0 !important; }
body.dark-mode .card:hover { border-color: #90caf9 !important; box-shadow: 0 4px 12px rgba(144, 202, 249, 0.1) !important; }
body.dark-mode .card-nombre { color: #e0e0e0 !important; }
body.dark-mode .seccion-descargas h2 { color: #90caf9 !important; border-bottom-color: #444 !important; }
body.dark-mode .seccion-subtitulo { color: #aaa !important; }
body.dark-mode #footer { background-color: #0a0a0a !important; }
body.dark-mode #btn-volver-arriba { background-color: #90caf9; color: #121212; }



/* ============================================
   NUEVO MENÚ (ESTILOS DEFINITIVOS A PRUEBA DE BALAS)
   ============================================ */

.mi-menu-nuevo > ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    gap: 20px !important;
    align-items: center !important;
}

.mi-menu-nuevo > ul > li {
    position: relative !important;
}

.mi-menu-nuevo > ul > li > a {
    text-decoration: none !important;
    color: #333 !important;
    font-size: 0.8em !important;
    text-transform: uppercase !important;
    font-weight: 500 !important;
    display: block !important;
    padding: 10px 0 !important;
}

.mi-menu-nuevo > ul > li > a:hover {
    color: #1f3a5f !important;
}

/* Estilos de los desplegables (Nivel 2 y 3) */
.mi-menu-nuevo .dropdown-content {
    display: none !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    background-color: #ffffff !important; /* Fuerza fondo blanco */
    min-width: 240px !important;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.1) !important;
    border: 1px solid #e0e4ea !important;
    z-index: 9999 !important;
    padding: 10px 0 !important;
    margin: 0 !important;
    flex-direction: column !important;
}

/* Mostrar el desplegable al pasar el ratón */
.mi-menu-nuevo .dropdown:hover > .dropdown-content {
    display: flex !important;
}

/* Submenús anidados (Nivel 3) */
.mi-menu-nuevo .dropdown-content .dropdown-content {
    top: 0 !important;
    left: 100% !important; /* Se abre a la derecha */
    margin-left: -1px !important;
}

.mi-menu-nuevo .dropdown-content .dropdown:hover > .dropdown-content {
    display: flex !important;
}

/* Estilos de los enlaces */
.mi-menu-nuevo .dropdown-content li {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
}

.mi-menu-nuevo .dropdown-content li a {
    padding: 12px 20px !important;
    text-transform: none !important;
    font-size: 0.85em !important;
    color: #333 !important; /* Letras oscuras */
    white-space: nowrap !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    background-color: transparent !important;
}

.mi-menu-nuevo .dropdown-content li a:hover {
    background-color: #f0f3f7 !important; /* Azul claro al pasar el ratón */
    color: #1f3a5f !important;
}

/* Flechitas para indicar que hay más */
.mi-menu-nuevo .dropdown-content .dropdown > a::after {
    content: "▸" !important;
    font-size: 1.2em !important;
    color: #999 !important;
}

/* Modo oscuro (para que siga funcionando bien) */
body.dark-mode .mi-menu-nuevo > ul > li > a { color: #e0e0e0 !important; }
body.dark-mode .mi-menu-nuevo .dropdown-content {
    background-color: #1e1e1e !important; /* Fondo oscuro */
    border-color: #333 !important;
}
body.dark-mode .mi-menu-nuevo .dropdown-content li a { color: #e0e0e0 !important; }
body.dark-mode .mi-menu-nuevo .dropdown-content li a:hover {
    background-color: #2a2a2a !important;
    color: #90caf9 !important;
}