/* ==================================================================
   LANGUAGE SELECTOR DROPDOWN FIX - CSS
   Comprehensive styling fixes for dropdown functionality
   ================================================================== */

/* Reset and base styles for language switcher */
.language-switcher {
    position: relative;
    display: inline-block;
    z-index: 1000;
}

/* Language toggle button styling */
.language-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    min-width: 80px;
    justify-content: center;
}

.language-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.language-toggle.active {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Flag and language code styling */
.language-toggle .flag {
    font-size: 16px;
    line-height: 1;
    margin-right: 8px;
}

.language-toggle .lang-code {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.language-toggle .dropdown-arrow {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.language-toggle.active .dropdown-arrow {
    transform: rotate(180deg);
}

/* Language dropdown styling */
.language-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 999999 !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    max-height: 500px !important; /* Increased from 300px to show all languages */
    overflow-y: auto;
    display: none;
    /* Ensure dropdown is not clipped by parent containers */
    min-height: auto !important;
}

.language-dropdown.active,
.language-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    display: block;
}

/* Language option styling */
.language-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 14px;
}

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

.language-option:hover {
    background: #f8f9fa;
    color: #007bff;
}

.language-option .flag {
    font-size: 16px;
    line-height: 1;
    margin-right: 8px;
}

.language-option .lang-name {
    flex: 1;
    font-weight: 500;
}

.language-option .lang-code {
    font-size: 11px;
    color: #666;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Mobile specific styles */
@media (max-width: 768px) {
    .language-switcher {
        width: 100%;
    }
    
    .language-toggle {
        width: 100%;
        justify-content: space-between;
        padding: 12px 16px;
    }
    
    .language-dropdown {
        left: 0;
        right: 0;
        width: 100%;
    }
    
    .language-option {
        padding: 12px 16px;
        font-size: 15px;
    }
}

/* Desktop header specific styles */
.header .language-switcher {
    margin-left: auto;
}

/* Mobile header specific styles */
.mobile-header .language-switcher {
    width: auto;
    min-width: 80px;
}

/* Ensure dropdown appears above other elements */
.language-dropdown {
    z-index: 999999 !important;
}

/* Animation for smooth transitions */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.language-dropdown.active {
    animation: fadeInDown 0.3s ease;
}

/* Fix for any conflicting styles */
.language-switcher * {
    box-sizing: border-box;
}

/* Ensure proper stacking context */
.language-switcher {
    isolation: isolate;
}

/* Accessibility improvements */
.language-toggle:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.language-option:focus {
    outline: 2px solid #007bff;
    outline-offset: -2px;
    background: #f8f9fa;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .language-toggle {
        border: 2px solid white;
    }
    
    .language-dropdown {
        border: 2px solid black;
    }
    
    .language-option {
        border-bottom: 1px solid black;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .language-toggle,
    .language-dropdown,
    .language-option,
    .dropdown-arrow {
        transition: none;
    }
    
    .language-dropdown.active {
        animation: none;
    }
}