/* ===== DROPDOWN MENU COMPONENT STYLES ===== */

/* Desktop Dropdown Styles */
.dropdown {
    position: relative !important;
}

/* Ensure dropdown container has proper positioning context */
.navbar-nav .dropdown {
    position: relative !important;
}

.dropdown-toggle {
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
}

.dropdown-toggle .caret {
    margin-left: 5px !important;
    transition: transform 0.2s ease !important;
    border-top: 4px solid !important;
    border-right: 4px solid transparent !important;
    border-left: 4px solid transparent !important;
    display: inline-block !important;
    vertical-align: middle !important;
}

.dropdown.open .dropdown-toggle .caret {
    transform: rotate(180deg) !important;
}

.dropdown-menu {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    min-width: 220px !important;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(0, 67, 143, 0.1) !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1) !important;
    padding: 8px 0 !important;
    margin-top: 2px !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(-5px) !important;
    transition: all 0.3s ease !important;
    z-index: 9999 !important;
    list-style: none !important;
}

/* Ensure dropdown menu is positioned relative to its parent dropdown */
.navbar-nav .dropdown .dropdown-menu {
    position: fixed !important;
    top: auto !important;
    left: auto !important;
    z-index: 9999 !important;
}

/* Alternative positioning approach - use JavaScript to position */
.dropdown-menu {
    position: fixed !important;
    z-index: 9999 !important;
}

/* Add invisible buffer area above dropdown menu */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 0;
    right: 0;
    height: 15px;
    background: transparent;
    pointer-events: auto;
}

/* Ensure dropdown stays open when hovering over the buffer area */
.dropdown:hover .dropdown-menu,
.dropdown-menu:hover {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

.dropdown.open .dropdown-menu {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

.dropdown-menu > li {
    margin: 0 !important;
    padding: 0 !important;
}

.dropdown-menu > li > a {
    display: block !important;
    padding: 12px 20px !important;
    color: #00438F !important;
    text-decoration: none !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    border-radius: 4px !important;
    margin: 2px 8px !important;
    white-space: nowrap !important;
}

.dropdown-menu > li > a:hover {
    background: rgba(0, 67, 143, 0.1) !important;
    color: #002855 !important;
    transform: translateX(5px) !important;
    text-decoration: none !important;
}

.dropdown-menu > li > a:focus {
    background: rgba(0, 67, 143, 0.1) !important;
    color: #002855 !important;
    text-decoration: none !important;
}

/* Language dropdown specific styles */
.dropdown-menu .fa-globe {
    margin-right: 8px !important;
    color: #00438F !important;
}

/* Mobile Dropdown Styles */
@media (max-width: 767px) {
    .mobile-dropdown {
        position: relative !important;
    }

    .mobile-dropdown-toggle {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        cursor: pointer !important;
    }

    .mobile-dropdown-icon {
        transition: transform 0.2s ease !important;
        margin-left: auto !important;
    }

    .mobile-dropdown.active .mobile-dropdown-icon {
        transform: rotate(180deg) !important;
    }

    #navSmall .mobile-dropdown-menu {
        display: none !important;
        padding-left: 20px !important;
        background: rgba(0, 67, 143, 0.05) !important;
        margin: 0 !important;
        list-style: none !important;
        border-left: 2px solid rgba(0, 67, 143, 0.1) !important;
    }

    #navSmall .mobile-dropdown.active .mobile-dropdown-menu {
        display: block !important;
        /* Force visible for debugging */
        background: red !important;
        border: 2px solid blue !important;
        position: relative !important;
        z-index: 9999 !important;
        width: 100% !important;
        min-height: 200px !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
    }

    #navSmall .mobile-dropdown-menu > li {
        margin: 0 !important;
        padding: 0 !important;
    }

    #navSmall .mobile-dropdown-menu > li > a {
        display: block !important;
        padding: 12px 15px !important;
        color: #00438F !important;
        text-decoration: none !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        transition: all 0.2s ease !important;
        border-radius: 4px !important;
        margin: 2px 0 !important;
    }

    #navSmall .mobile-dropdown-menu > li > a:hover {
        background: rgba(0, 67, 143, 0.1) !important;
        color: #002855 !important;
        padding-left: 20px !important;
        text-decoration: none !important;
    }

    #navSmall .mobile-dropdown-menu > li > a i {
        margin-right: 10px !important;
        width: 16px !important;
        text-align: center !important;
    }
}

/* Dropdown positioning fixes */
@media (min-width: 769px) {
    .dropdown-menu {
        right: auto !important;
        left: 0 !important;
    }

    /* Ensure dropdown doesn't go off-screen on the right */
    .dropdown:last-child .dropdown-menu {
        right: 0 !important;
        left: auto !important;
    }
}

/* Animation enhancements */
.dropdown-menu {
    animation: dropdownFadeIn 0.3s ease-out !important;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0 !important;
        transform: translateY(-10px) !important;
    }
    to {
        opacity: 1 !important;
        transform: translateY(0) !important;
    }
}

/* Accessibility improvements */
.dropdown-toggle:focus {
    outline: 2px solid rgba(0, 67, 143, 0.3) !important;
    outline-offset: 2px !important;
}

.dropdown-menu > li > a:focus {
    outline: 2px solid rgba(0, 67, 143, 0.3) !important;
    outline-offset: -2px !important;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .dropdown-menu {
        border: 2px solid #00438F !important;
        background: #ffffff !important;
    }

    .dropdown-menu > li > a:hover {
        background: #00438F !important;
        color: #ffffff !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .dropdown-menu,
    .dropdown-toggle .caret,
    .mobile-dropdown-icon {
        transition: none !important;
    }

    .dropdown-menu {
        animation: none !important;
    }
}

/* ===== LANGUAGE SELECTOR COMPONENT STYLES ===== */

/* Desktop Language Selector */
.language-selector .dropdown-toggle {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 8px 12px !important;
    color: #333 !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
}

.language-selector .dropdown-toggle:hover,
.language-selector .dropdown-toggle:focus {
    color: #007bff !important;
    background-color: #f8f9fa !important;
    text-decoration: none !important;
}

.language-selector .dropdown-toggle svg {
    flex-shrink: 0 !important;
    opacity: 0.7 !important;
}

.current-lang {
    font-weight: 600 !important;
    font-size: 12px !important;
    min-width: 20px !important;
    text-align: center !important;
}

.language-menu {
    min-width: 140px !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid #e9ecef !important;
}

.language-menu .language-option {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 8px 16px !important;
    color: #333 !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    border-bottom: 1px solid #f8f9fa !important;
}

.language-menu .language-option:last-child {
    border-bottom: none !important;
}

.language-menu .language-option:hover {
    background-color: #f8f9fa !important;
    color: #007bff !important;
    text-decoration: none !important;
}

.language-menu .flag-icon {
    flex-shrink: 0 !important;
    opacity: 0.8 !important;
}

/* Mobile Language Selector Styles (specific to language selector) */
.mobile-dropdown .mobile-dropdown-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 12px 16px !important;
    color: #333 !important;
    text-decoration: none !important;
    border-bottom: 1px solid #eee !important;
}

.mobile-dropdown .mobile-dropdown-toggle:hover {
    background-color: #f8f9fa !important;
    color: #007bff !important;
    text-decoration: none !important;
}

.mobile-dropdown-menu {
    display: none !important;
    background-color: #f8f9fa !important;
    border-left: 3px solid #007bff !important;
}

.mobile-dropdown.active .mobile-dropdown-menu {
    display: block !important;
}

.mobile-dropdown-menu .language-option {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 12px 20px !important;
    color: #333 !important;
    text-decoration: none !important;
    border-bottom: 1px solid #e9ecef !important;
}

.mobile-dropdown-menu .language-option:last-child {
    border-bottom: none !important;
}

.mobile-dropdown-menu .language-option:hover {
    background-color: #e9ecef !important;
    color: #007bff !important;
    text-decoration: none !important;
}

/* Mobile Navigation Language Options - Consistent with other menu items */
@media (max-width: 767px) {
    /* Style language options in mobile nav to match other menu items */
    #navSmall .language-option {
        display: block !important;
        padding: 8px 0 !important;
        color: #00438F !important;
        text-decoration: none !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        transition: all 0.2s ease !important;
        border-bottom: 1px solid rgba(0, 67, 143, 0.1) !important;
        margin: 0 !important;
        background: none !important;
        border-radius: 0 !important;
    }
    
    #navSmall .language-option:last-child {
        border-bottom: none !important;
    }
    
    #navSmall .language-option:hover {
        color: #002855 !important;
        background: rgba(0, 67, 143, 0.05) !important;
        padding-left: 10px !important;
        text-decoration: none !important;
    }
    
    /* Ensure language options have consistent spacing and alignment */
    #navSmall li:has(.language-option) {
        margin: 0 !important;
        border-bottom: 1px solid rgba(0, 67, 143, 0.1) !important;
    }
    
    #navSmall li:has(.language-option):last-child {
        border-bottom: none !important;
    }
}

/* Language Selector Responsive Adjustments */
@media (max-width: 767px) {
    .language-selector {
        display: none !important;
    }
}

@media (min-width: 768px) {
    .mobile-dropdown {
        display: none !important;
    }
}
