/* --- Header Styles --- */
.main-header {
    background: var(--white);
    width: 100%;
    z-index: 1000;
    position: sticky;
    top: 0;
    transition: box-shadow 0.3s ease;
}

.main-header.scrolled {
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

/* Top Bar */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 5%;
    max-width: 1400px;
    margin: 0 auto;
    min-height: 100px; /* Reserva espacio vertical */
    transition: padding 0.3s ease, min-height 0.3s ease;
}

.main-header.scrolled .top-header {
    padding: 6px 5%;
    min-height: 60px;
}

.logo img {
    height: 70px;
    width: 280px; /* Ancho reservado para evitar CLS horizontal */
    object-fit: contain;
    transition: height 0.3s ease, width 0.3s ease;
}

.main-header.scrolled .logo img {
    height: 42px;
    width: 170px;
}

.quick-actions {
    display: flex;
    gap: 15px;
}

.btn-action {
    height: 45px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    color: var(--white);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    cursor: pointer;
}

.main-header.scrolled .btn-action {
    height: 36px;
    font-size: 13px;
}

/* Stable widths for each button to prevent layout shifts */
.btn-pac { 
    width: 140px; 
    background-color: var(--secondary-color); 
}
.btn-purple:nth-of-type(2) { width: 210px; }
.btn-purple:nth-of-type(3) { width: 170px; }

.btn-action span {
    white-space: nowrap;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon {
    width: 0;
    height: 24px;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    filter: brightness(0) invert(1);
    display: block;
}

.btn-action:hover {
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.btn-action:hover .btn-icon {
    width: 24px;
    opacity: 1;
    transform: translateX(0);
}

.btn-pac {
    background-color: var(--secondary-color);
}

.btn-pac:hover {
    background-color: #3e7bb3;
    transform: translateY(-2px);
}

.btn-purple {
    background-color: var(--accent-color);
    padding: 10px 20px;
    font-size: 15px;
}

.btn-purple:hover {
    background-color: #3b236d;
    transform: translateY(-2px);
}

/* Navigation Bar */
.nav-header {
    background-color: var(--secondary-color);
    padding: 0 5%;
    min-height: 54px; /* Reserva espacio para la barra de navegación */
    transition: min-height 0.3s ease;
}

.main-header.scrolled .nav-header {
    min-height: 42px;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
}

.main-nav {
    display: flex;
    list-style: none;
}

.nav-item {
    position: relative;
}

.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    padding: 15px 25px;
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    gap: 5px;
    transition: var(--transition), padding 0.3s ease, font-size 0.3s ease;
}

.main-header.scrolled .nav-link {
    padding: 10px 22px;
    font-size: 14px;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Animated underline indicator */
.nav-link::after {
    content: '';
    position: absolute;
    left: 25px;
    right: 25px;
    bottom: 8px;
    height: 2px;
    background: var(--white);
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.25s ease;
}

.nav-item:hover .nav-link::after,
.nav-link.active::after {
    transform: scaleX(1);
}

/* Arrow rotation on hover */
.nav-link img {
    transition: transform 0.25s ease;
}

.nav-item:hover .nav-link img {
    transform: rotate(180deg);
}

.nav-link span.material-symbols-rounded {
    font-size: 18px;
}

/* Dropdown */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--white);
    min-width: 250px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    list-style: none;
    border-radius: 0 0 10px 10px;
    border-top: 3px solid var(--accent-color);
    padding: 6px 0;
    overflow: hidden;
    z-index: 10;
}

.nav-item:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item a {
    display: block;
    padding: 12px 20px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 14px;
    border-left: 3px solid transparent;
    transition: var(--transition);
}

.dropdown-item a:hover {
    background-color: var(--bg-light);
    color: var(--primary-color);
    border-left-color: var(--accent-color);
    padding-left: 25px;
}

/* --- Mobile Menu Toggle --- */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 1100;
    transition: var(--transition);
}

.mobile-menu-toggle img {
    filter: brightness(0) saturate(100%) invert(35%) sepia(91%) decode(6231) hue-rotate(193deg) brightness(91%) contrast(101%); /* Same blue as brand */
}

@media (max-width: 992px) {
    .top-header {
        flex-direction: row; /* Logo and Hamburger on the same line */
        justify-content: space-between;
        padding: 10px 5%;
        align-items: center;
    }

    .logo img {
        height: 50px;
        width: 180px; /* Ancho ajustado para móviles */
    }

    .quick-actions {
        display: none; /* Hidden on mobile as requested */
    }

    .mobile-menu-toggle {
        display: block;
    }

    /* Navigation Drawer */
    .nav-header {
        position: fixed;
        top: 0;
        right: -100%; /* Hidden off-screen */
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: var(--white);
        box-shadow: -5px 0 25px rgba(0,0,0,0.1);
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1050;
        padding-top: 80px;
    }

    .nav-header.active {
        right: 0;
    }

    .nav-container {
        display: block;
    }

    .main-nav {
        flex-direction: column;
        padding: 20px;
    }

    .nav-link {
        color: var(--text-dark);
        justify-content: space-between;
        padding: 15px 0;
        border-bottom: 1px solid #eee;
    }

    .nav-link::after {
        display: none; /* No underline indicator in drawer */
    }

    .nav-link.active {
        color: var(--primary-color);
        font-weight: 600;
    }

    .nav-link img {
        filter: none; /* Dark arrow on mobile */
    }

    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: #f9f9f9;
        border-top: none;
        display: none; /* Hidden until clicked */
        padding-left: 20px;
    }

    .nav-item.active .dropdown-menu {
        display: block;
    }

    /* Overlay */
    .menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        opacity: 0;
        visibility: hidden;
        transition: var(--transition);
        z-index: 1000;
    }

    .menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}
