/*
Theme Name: DASE
Theme URI: http://gye1.com
Author: Martin Tircio
Description: Plantilla institucional DASE con Mega Menú dinámico y Walker personalizado.
Version: 1.5
License: GNU General Public License v2 or later
Text Domain: dase-theme
*/

@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

/* === 1. RESET & GLOBAL === */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Montserrat', sans-serif;
    background-color: #ffffff;
    color: #1e2b3c;
    line-height: 1.5;
    overflow-x: hidden;
}

.wrapper {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* === 2. HEADER & LOGO === */
.main-header {
    background: white;
    padding: 0;
    box-shadow: 0 6px 12px rgba(26, 43, 60, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.main-header .wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-area { order: 2; }
.logo-area img { height: 70px; width: auto; display: block; padding: 5px 0; }

/* === 3. NAVEGACIÓN ESCRITORIO === */
.desktop-nav {
    order: 1;
}

.nav-list-desktop {
    display: flex;
    gap: 2.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-list-desktop > li {
    position: relative;
    padding: 1.8rem 0; /* Mantiene el área de hover activa */
}

.nav-list-desktop > li > a {
    text-decoration: none;
    font-weight: 700;
    color: #1e2b3c;
    font-size: 0.95rem;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s;
}

.nav-list-desktop > li > a:hover { color: #3498db; }

.mega-icon-arrow {
    font-size: 0.7rem;
    transition: transform 0.3s;
}

.nav-list-desktop > li:hover .mega-icon-arrow {
    transform: rotate(180deg);
}

/* === 4. LÓGICA DEL MEGA MENÚ (DINÁMICO) === */
.nav-list-desktop > li.has-mega-menu,
.nav-list-desktop > li.menu-item-has-children {
    position: static !important; /* Permite que el mega menú use todo el ancho del header */
}

.mega-menu-content {
    display: none;
    position: absolute;
    top: 100%; /* Justo debajo del header */
    left: 0;
    width: 100%;
    background: #ffffff !important; /* Fondo blanco sólido obligatorio */
    box-shadow: 0 20px 40px rgba(0,0,0,0.12);
    border-top: 4px solid #3498db;
    border-radius: 0 0 10px 10px;
    padding: 2.5rem 0;
    z-index: 9999;
}

/* Mostrar menú al hacer hover en el LI padre */
.nav-list-desktop > li:hover .mega-menu-content {
    display: block;
}

/* Contenedor flexible de las columnas (Generado por el Walker) */
.mega-menu-flex-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 40px;
    list-style: none;
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Estilo de cada columna */
.mega-menu-flex-container > li {
    flex: 1 1 220px;
    max-width: 300px;
}

/* Títulos de columna (Nivel 1 de submenú) */
.mega-menu-flex-container > li > a {
    display: block;
    font-weight: 800;
    color: #1a2b3c;
    text-transform: uppercase;
    margin-bottom: 1.2rem;
    border-bottom: 2px solid #f5b01b; /* Línea amarilla institucional */
    padding-bottom: 8px;
    text-decoration: none;
}

/* Lista de enlaces (Nivel 2) */
.sub-column-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sub-column-links li a {
    display: block;
    padding: 7px 0;
    font-size: 0.9rem;
    color: #4a5568;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sub-column-links li a:hover {
    color: #3498db;
    padding-left: 8px;
}

/* === 5. NAVEGACIÓN MÓVIL === */
.menu-toggle {
    display: none;
    font-size: 1.8rem;
    color: #1a2b3c;
    cursor: pointer;
    order: 3;
}

.mobile-nav {
    display: none;
    flex-direction: column;
    background: white;
    padding: 1rem 2rem;
    border-top: 2px solid #3498db;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.mobile-nav.active { display: flex; }

.nav-list-mobile { list-style: none; }
.nav-list-mobile li a {
    display: block;
    padding: 1rem 0;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: #1e2b3c;
    font-weight: 600;
}

/* === 6. SECCIONES (INDEX) === */
.hero { 
    background: linear-gradient(97deg, #f5faff 0%, #ebf5ff 100%); 
    padding: 6rem 0; 
    position: relative;
    z-index: 1; /* Menor que el mega menú */
}

.hero-text h1 { font-size: 3.5rem; font-weight: 800; color: #1a2b3c; line-height: 1.1; }
.hero-text h1 span { color: #3498db; }

.footer { background: #1a2b3c; color: white; padding: 2.5rem 0; text-align: center; }

/* === 7. RESPONSIVE === */
@media (max-width: 900px) {
    .desktop-nav { display: none; }
    .menu-toggle { display: block; }
    .logo-area { order: 1; }
    .main-header .wrapper { justify-content: space-between; }
}

/* === 8. BARRA SUPERIOR AZUL === */
.top-bar {
    background-color: #003366; /* Azul institucional */
    color: white;
    padding: 8px 0;
    font-size: 14px;
    position: relative;
    z-index: 1001; /* Por encima del header */
    border-bottom: 2px solid #f5b01b; /* Detalle amarillo institucional */
}

.top-bar-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

/* Redes sociales */
.top-bar-social {
    display: flex;
    gap: 15px;
    align-items: center;
}

.social-icon {
    color: white;
    font-size: 16px;
    transition: all 0.3s ease;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.social-icon:hover {
    background: #f5b01b;
    color: #003366;
    transform: translateY(-2px);
}

/* Área de contacto y búsqueda */
.top-bar-contact {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.contact-item {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.3s;
}

.contact-item:hover {
    color: #f5b01b;
}

.contact-item i {
    font-size: 16px;
}

/* Buscador */
.top-bar-search form {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.top-bar-search input {
    background: transparent;
    border: none;
    padding: 6px 12px;
    color: white;
    font-size: 13px;
    width: 180px;
}

.top-bar-search input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.top-bar-search input:focus {
    outline: none;
}

.top-bar-search button {
    background: transparent;
    border: none;
    color: white;
    padding: 6px 12px;
    cursor: pointer;
    transition: background 0.3s;
}

.top-bar-search button:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Autenticación en barra superior */
.top-bar-auth {
    display: flex;
    gap: 10px;
}

.top-bar-login, .top-bar-register {
    color: white;
    text-decoration: none;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 13px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.top-bar-login {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.top-bar-register {
    background: #f5b01b;
    color: #003366;
    font-weight: 600;
}

.top-bar-login:hover {
    background: rgba(255, 255, 255, 0.25);
}

.top-bar-register:hover {
    background: #ffc107;
    transform: translateY(-2px);
}

/* Usuario logueado en barra superior */
.top-bar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-name {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
}

.top-bar-logout {
    color: white;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.15);
    transition: background 0.3s;
}

.top-bar-logout:hover {
    background: #dc3545;
}

/* === 9. ELEMENTOS MOBILE EN MENÚ === */
.mobile-top-bar-elements {
    padding: 20px;
    border-top: 1px solid #eee;
    margin-top: 15px;
}

.mobile-social {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.mobile-social a {
    color: #003366;
    font-size: 20px;
    transition: color 0.3s;
}

.mobile-social a:hover {
    color: #f5b01b;
}

.mobile-contact {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.mobile-contact a {
    color: #1e2b3c;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.mobile-contact a i {
    width: 20px;
    color: #003366;
}

.mobile-search {
    margin-bottom: 20px;
}

.mobile-search form {
    display: flex;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.mobile-search input {
    flex: 1;
    padding: 12px;
    border: none;
    font-size: 14px;
}

.mobile-search input:focus {
    outline: none;
}

.mobile-search button {
    background: #003366;
    border: none;
    color: white;
    padding: 0 15px;
    cursor: pointer;
}

.mobile-auth, .mobile-user {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-login, .mobile-register, .mobile-logout {
    display: block;
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.mobile-login {
    background: #f5f5f5;
    color: #003366;
    border: 1px solid #003366;
}

.mobile-register {
    background: #003366;
    color: white;
}

.mobile-logout {
    background: #dc3545;
    color: white;
}

.mobile-user span {
    display: block;
    text-align: center;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 8px;
    font-weight: 600;
}

/* === 10. RESPONSIVE BARRA SUPERIOR === */
@media (max-width: 1024px) {
    .top-bar-contact {
        gap: 10px;
    }
    
    .contact-item span {
        display: none; /* Oculta texto en tablets, solo iconos */
    }
    
    .top-bar-search input {
        width: 140px;
    }
}

@media (max-width: 768px) {
    .top-bar-wrapper {
        flex-direction: column;
        gap: 10px;
        padding: 5px 2rem;
    }
    
    .top-bar-contact {
        width: 100%;
        justify-content: center;
    }
    
    .top-bar-auth .top-bar-login span,
    .top-bar-auth .top-bar-register span {
        display: none; /* En mobile, solo iconos en barra superior */
    }
    
    .contact-item span {
        display: none;
    }
}

/* Modal de Login */
.modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 40px;
    border-radius: 20px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal {
    position: absolute;
    right: 25px;
    top: 15px;
    font-size: 30px;
    cursor: pointer;
    color: #666;
    transition: color 0.3s;
}

.close-modal:hover {
    color: #003366;
}

.modal-content h2 {
    color: #003366;
    margin-bottom: 25px;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
}

.modal-content form p {
    margin-bottom: 20px;
}

.modal-content label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.modal-content input[type="text"],
.modal-content input[type="password"],
.modal-content input[type="email"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.modal-content input:focus {
    outline: none;
    border-color: #003366;
}

.modal-content button[type="submit"] {
    width: 100%;
    padding: 14px;
    background: #003366;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.modal-content button[type="submit"]:hover {
    background: #f5b01b;
}

.modal-content a {
    color: #003366;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.modal-content a:hover {
    color: #f5b01b;
}

.modal-message {
    margin-top: 20px;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
}

.modal-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.modal-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Checkbox remember me */
.modal-content input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.modal-content p:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
}