/**
 * Enhanced Navigation Styles
 * Active states, sticky header, improved dropdowns, and accessibility
 */

/* ========================================
   STICKY HEADER
   ======================================== */

.universal-header {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

.universal-header.sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.3s ease-out;
}

.universal-header.sticky.hidden {
    transform: translateY(-100%);
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Prevent content jump when header becomes fixed */
body.header-sticky-active {
    padding-top: 90px;
}

/* ========================================
   ACTIVE PAGE INDICATOR
   ======================================== */

.header-nav a.active {
    position: relative;
    color: #D4A017 !important;
    font-weight: 600;
}

.header-nav a.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: #D4A017;
    border-radius: 2px;
    animation: expandWidth 0.3s ease-out;
}

@keyframes expandWidth {
    from {
        width: 0;
    }
    to {
        width: 30px;
    }
}

/* ========================================
   ENHANCED SERVICES DROPDOWN
   ======================================== */

.services-toggle {
    background: none;
    border: none;
    color: #F8F9FA;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem 0;
    font-family: 'Poppins', sans-serif;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.services-toggle:hover,
.services-dropdown.active .services-toggle {
    color: #D4A017;
}

.services-toggle .dropdown-icon {
    transition: transform 0.3s ease;
    font-size: 0.75rem;
}

.services-dropdown.active .services-toggle .dropdown-icon {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    min-width: 500px;
    margin-top: 15px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 24px;
}

.services-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    margin-top: 10px;
}

/* Dropdown arrow */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid white;
}

.dropdown-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dropdown-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: #6b7280;
    margin: 0 0 8px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #f0f0f0;
    letter-spacing: 0.5px;
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: #014385;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
}

.dropdown-menu a i {
    width: 20px;
    text-align: center;
    color: #D4A017;
    font-size: 16px;
}

.dropdown-menu a:hover {
    background: #f8f9fa;
    color: #D4A017;
    transform: translateX(4px);
}

.dropdown-menu a:hover i {
    transform: scale(1.1);
}

/* ========================================
   ACCESSIBILITY ENHANCEMENTS
   ======================================== */

/* Focus styles for keyboard navigation */
.header-nav a:focus,
.services-toggle:focus,
.account-btn:focus,
.header-login:focus {
    outline: 3px solid #D4A017;
    outline-offset: 2px;
    border-radius: 4px;
}

.dropdown-menu a:focus {
    outline: 2px solid #014385;
    outline-offset: 2px;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #D4A017;
    color: #014385;
    padding: 8px 16px;
    text-decoration: none;
    font-weight: 600;
    z-index: 10000;
    border-radius: 0 0 4px 0;
}

.skip-to-content:focus {
    top: 0;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 1024px) {
    .dropdown-menu {
        min-width: 400px;
        padding: 20px;
        gap: 16px;
    }
    
    .dropdown-menu a {
        font-size: 13px;
        padding: 8px 10px;
    }
}

@media (max-width: 768px) {
    /* Disable sticky on mobile */
    .universal-header.sticky {
        position: relative;
        box-shadow: none;
    }
    
    .universal-header.sticky.hidden {
        transform: none;
    }
    
    /* Mobile dropdown adjustments */
    .dropdown-menu {
        position: static;
        transform: none;
        grid-template-columns: 1fr;
        min-width: auto;
        width: 100%;
        margin-top: 10px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .dropdown-menu::before {
        display: none;
    }
    
    .services-dropdown {
        width: 100%;
    }
    
    .services-toggle {
        width: 100%;
        justify-content: space-between;
        padding: 1rem;
    }
    
    .header-nav a.active::after {
        bottom: -4px;
    }
}

/* ========================================
   MOBILE MENU ENHANCEMENTS
   ======================================== */

/* Add user-select: none to prevent text selection on toggle */
.mobile-services-toggle {
    user-select: none;
}

.mobile-services-toggle .dropdown-icon {
    transition: transform 0.3s ease;
}

/* Smooth rotation for mobile dropdown icon */
#mobileServicesIcon {
    transition: transform 0.3s ease;
}

/* Touch-friendly tap targets */
@media (max-width: 768px) {
    .mobile-nav a,
    .mobile-dropdown-menu a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* Improve mobile menu overlay */
.mobile-menu-overlay {
    transition: opacity 0.3s ease;
}

.mobile-menu-content {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Prevent body scroll when mobile menu is open */
body.mobile-menu-open {
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
}

/* ========================================
   HOVER EFFECTS & ANIMATIONS
   ======================================== */

.header-nav > a {
    position: relative;
    transition: color 0.3s ease;
}

.header-nav > a::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: #D4A017;
    transition: width 0.3s ease;
    border-radius: 2px;
}

.header-nav > a:hover::before {
    width: 100%;
}

.header-nav > a:hover {
    color: #D4A017;
}

/* Prevent underline animation on active items */
.header-nav > a.active::before {
    display: none;
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */

/* Use will-change for smooth animations */
.universal-header.sticky {
    will-change: transform;
}

.dropdown-menu {
    will-change: opacity, visibility;
}

/* Hardware acceleration */
.services-toggle .dropdown-icon,
.dropdown-menu a {
    transform: translateZ(0);
    backface-visibility: hidden;
}
