/* ===== VARIABLES ===== */
:root {
    --primary-color: #2c5aa0;
    --secondary-color: #005450;
    --accent-color: #007a74;
    --text-color: #333333;
    --light-text: #ffffff;
    --dark-bg: #0a1a2f;
    --transition: all 0.3s ease;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* ===== RESET BÁSICO ===== */
* {
    box-sizing: border-box;
}

/* ===== TOP BAR ===== */
.top-bar {
    background-color: var(--dark-bg);
    color: var(--light-text);
    padding: 10px 0;
    font-size: 14px;
}

.top-bar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.contact-info {
    display: flex;
    gap: 20px;
}

.contact-info a {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--light-text);
    text-decoration: none;
    transition: var(--transition);
}

.contact-info a:hover {
    color: var(--accent-color);
}

.cta-button a {
    background-color:#005450;
    color: var(--light-text);
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}

.cta-button a:hover {
    background-color: #007a74;
}

/* ===== MAIN HEADER ===== */
.main-header {
    background-color: white;
    box-shadow: var(--box-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 3px solid var(--secondary-color);
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ===== LOGO ===== */
.logo img {
    max-width: 235px;
    height: auto;
}

/* ===== BOTÓN HAMBURGUESA MEJORADO ===== */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1003;
    position: relative;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.menu-toggle:hover {
    background: var(--secondary-color);
    transform: scale(1.05);
}

.menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background-color: white;
    border-radius: 1px;
    transition: all 0.3s ease;
    position: absolute;
}

.menu-toggle span:nth-child(1) {
    top: 9px;
}

.menu-toggle span:nth-child(2) {
    top: 15px;
}

.menu-toggle span:nth-child(3) {
    top: 21px;
}

/* Animación X PERFECTA */
.menu-toggle.active {
    background: var(--accent-color);
}

.menu-toggle.active span:nth-child(1) {
    top: 15px;
    transform: rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.menu-toggle.active span:nth-child(3) {
    top: 15px;
    transform: rotate(-45deg);
}

/* ===== NAVEGACIÓN DESKTOP ===== */
#main-menu {
    display: block;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
    margin: 0;
    padding: 0;
    align-items: center;
}

.menu-item {
    position: relative;
}

.menu-item > a {
    color: var(--primary-color);
    font-weight: 500;
    padding: 10px 0;
    text-decoration: none;
    transition: var(--transition);
    font-size: 14px;
    letter-spacing: 0.5px;
    display: block;
}

.menu-item > a:hover {
    color: var(--secondary-color);
}

/* ===== SUBMENÚ DESKTOP - SOLUCIÓN SIMPLE ===== */
.has-submenu {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 5px;
}

.has-submenu > a {
    color: var(--primary-color);
    font-weight: 500;
    padding: 10px 0;
    text-decoration: none;
    transition: var(--transition);
    font-size: 14px;
    letter-spacing: 0.5px;
    display: block;
}

.dropdown-toggle {
    cursor: pointer;
    font-size: 12px;
    color: var(--primary-color);
    transition: transform 0.3s ease;
    padding: 5px;
}

.has-submenu > a:hover,
.has-submenu:hover .dropdown-toggle {
    color: var(--secondary-color);
}

.submenu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    box-shadow: var(--box-shadow);
    min-width: 250px;
    border-radius: 8px;
    padding: 10px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    z-index: 1000;
    border-top: 3px solid var(--secondary-color);
    list-style: none;
    margin: 0;
}

.has-submenu:hover .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.has-submenu:hover .dropdown-toggle {
    transform: rotate(180deg);
}

.submenu li {
    list-style: none;
    margin: 0;
}

.submenu a {
    padding: 12px 20px;
    display: block;
    font-weight: 400;
    font-size: 13px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s ease;
    border-bottom: 1px solid #f0f0f0;
}

.submenu a:hover {
    background-color: rgba(44, 90, 160, 0.1);
    color: var(--primary-color);
    padding-left: 25px;
}

.submenu li:last-child a {
    border-bottom: none;
}

/* ===== OVERLAY ===== */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ===== RESPONSIVE MÓVIL ===== */
@media screen and (max-width: 768px) {
    
    /* Top bar móvil - OCULTAR en móvil para dar más espacio */
    .top-bar {
        display: none;
    }
    
    /* Header móvil */
    .main-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
    }
    
    .main-header .container {
        padding: 12px 15px;
        position: relative;
    }
    
    .logo img {
        max-width: 140px;
    }
    
    /* Mostrar botón hamburguesa */
    .menu-toggle {
        display: flex;
        position: absolute;
        top: 50%;
        right: 15px;
        transform: translateY(-50%);
    }
    
    /* Compensar header fijo */
    body {
        padding-top: 80px;
    }
    
    /* Menú móvil */
    #main-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 320px;
        max-width: 90vw;
        height: 100vh;
        background: var(--primary-color);
        z-index: 1002;
        transition: right 0.3s ease;
        overflow-y: auto;
        padding-top: 80px;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
    }
    
    #main-menu.active {
        right: 0;
    }
    
    /* Lista del menú móvil */
    .nav-menu {
        flex-direction: column;
        gap: 0;
        padding: 0;
        margin: 0;
        width: 100%;
    }
    
    /* Items del menú móvil */
    .menu-item {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        width: 100%;
        position: relative;
    }
    
    .menu-item:last-child {
        border-bottom: none;
    }
    
    .menu-item > a {
        display: block;
        padding: 1.2rem 1.5rem;
        color: white;
        font-size: 1rem;
        font-weight: 500;
        letter-spacing: normal;
        width: 100%;
        transition: all 0.3s ease;
    }
    
    .menu-item > a:hover {
        background: rgba(255, 255, 255, 0.1);
        color: white;
        padding-left: 2rem;
    }
    
    /* Submenú móvil MEJORADO - RESETEAR FLEX */
    .has-submenu {
        display: block !important;
        flex-direction: initial !important;
        gap: 0 !important;
        position: relative;
    }
    
    .has-submenu > a {
        display: block;
        padding: 1.2rem 1.5rem;
        padding-right: 60px;
        color: white;
        font-size: 1rem;
        font-weight: 500;
        letter-spacing: normal;
        width: 100%;
        transition: all 0.3s ease;
    }
    
    .dropdown-toggle {
        position: absolute;
        top: 0;
        right: 0;
        width: 60px;
        height: 100%;
        color: white;
        cursor: pointer;
        font-size: 1rem;
        transition: all 0.3s ease;
        user-select: none;
        display: flex;
        align-items: center;
        justify-content: center;
        border-left: 1px solid rgba(255, 255, 255, 0.1);
        background: rgba(0, 0, 0, 0.1);
        padding: 0;
    }
    
    .dropdown-toggle:hover {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .has-submenu.active .dropdown-toggle {
        transform: rotate(180deg);
        background: rgba(255, 255, 255, 0.15);
    }
    
    .submenu {
        position: static;
        background: rgba(0, 0, 0, 0.3);
        box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
        border-radius: 0;
        border-top: none;
        padding: 0;
        min-width: auto;
        opacity: 1;
        visibility: visible;
        transform: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease;
    }
    
    .has-submenu.active .submenu {
        max-height: 450px;
    }
    
    .submenu a {
        padding: 1rem 2.5rem;
        color: rgba(255, 255, 255, 0.9);
        font-size: 0.9rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        transition: all 0.3s ease;
    }
    
    .submenu a:hover {
        background: rgba(255, 255, 255, 0.1);
        color: white;
        padding-left: 3rem;
    }
    
    /* Prevenir scroll cuando menú está abierto */
    body.menu-open {
        overflow: hidden;
    }
}

/* ===== MÓVIL PEQUEÑO ===== */
@media screen and (max-width: 480px) {
    .main-header .container {
        padding: 10px 12px;
    }
    
    .logo img {
        max-width: 120px;
    }
    
    .menu-toggle {
        width: 30px;
        height: 30px;
        right: 12px;
    }
    
    .menu-toggle span {
        width: 16px;
    }
    
    .menu-toggle span:nth-child(1) {
        top: 8px;
    }
    
    .menu-toggle span:nth-child(2) {
        top: 14px;
    }
    
    .menu-toggle span:nth-child(3) {
        top: 20px;
    }
    
    .menu-toggle.active span:nth-child(1),
    .menu-toggle.active span:nth-child(3) {
        top: 14px;
    }
    
    #main-menu {
        width: 300px;
        padding-top: 70px;
    }
    
    body {
        padding-top: 70px;
    }
}

/* ===== TABLET ===== */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .nav-menu {
        gap: 20px;
    }
    
    .menu-item > a {
        font-size: 13px;
    }
    
    .logo img {
        max-width: 200px;
    }
}
