/**
 * Language Switcher Styling
 * Ensures proper display across all devices
 */

/* Language Switcher Container */
.language-switcher {
    position: relative;
    display: inline-block;
    z-index: 1001;
}

/* Language Toggle Button */
.language-switcher .lang-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 15px;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.language-switcher .lang-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(218, 165, 32, 0.5);
    box-shadow: 0 4px 12px rgba(218, 165, 32, 0.2);
}

.language-switcher .lang-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(218, 165, 32, 0.3);
}

/* Flag and Language Code */
#current-flag {
    font-size: 1.2em;
    line-height: 1;
}

#current-lang {
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Language Dropdown Menu */
.language-switcher .lang-menu {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    min-width: 170px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1002;
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.language-switcher .lang-menu[style*="display: block"] {
    opacity: 1;
    transform: translateY(0);
}

/* Scrollbar Styling for Dropdown */
.language-switcher .lang-menu::-webkit-scrollbar {
    width: 6px;
}

.language-switcher .lang-menu::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.language-switcher .lang-menu::-webkit-scrollbar-thumb {
    background: #DAA520;
    border-radius: 10px;
}

.language-switcher .lang-menu::-webkit-scrollbar-thumb:hover {
    background: #B8860B;
}

/* Language Menu Items */
.language-switcher .lang-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: #2c3e50;
    text-decoration: none;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 0.95em;
}

.language-switcher .lang-menu a:last-child {
    border-bottom: none;
}

.language-switcher .lang-menu a:hover {
    background: #f8f9fa;
    padding-left: 20px;
}

.language-switcher .lang-menu a:active {
    background: #e9ecef;
}

.language-switcher .lang-menu a span:first-child {
    font-size: 1.3em;
    line-height: 1;
}

.language-switcher .lang-menu a span:last-child {
    font-weight: 500;
}

/* RTL Support for Arabic */
html[dir="rtl"] .language-switcher .lang-menu {
    right: auto;
    left: 0;
}

html[dir="rtl"] .language-switcher .lang-menu a {
    flex-direction: row-reverse;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .language-switcher .lang-toggle {
        padding: 6px 10px;
        font-size: 0.8em;
        gap: 6px;
    }

    #current-flag {
        font-size: 1em;
    }

    #current-lang {
        font-size: 0.85em;
    }

    .language-switcher .lang-menu {
        min-width: 150px;
        right: -10px;
        max-height: 300px;
    }

    .language-switcher .lang-menu a {
        padding: 10px 12px;
        font-size: 0.9em;
    }

    .language-switcher .lang-menu a:hover {
        padding-left: 16px;
    }
}

@media (max-width: 480px) {
    .language-switcher .lang-toggle {
        padding: 5px 8px;
        font-size: 0.75em;
        gap: 4px;
    }

    #current-flag {
        font-size: 0.9em;
    }

    .language-switcher .lang-menu {
        min-width: 130px;
    }

    .language-switcher .lang-menu a {
        padding: 8px 10px;
        gap: 8px;
    }
}

/* Animation for menu opening */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.language-switcher .lang-menu[style*="display: block"] {
    animation: slideDown 0.3s ease;
}

/* Accessibility - Keyboard Navigation */
.language-switcher .lang-menu a:focus {
    outline: 2px solid #DAA520;
    outline-offset: -2px;
    background: #f8f9fa;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .language-switcher .lang-toggle {
        border: 2px solid white;
    }

    .language-switcher .lang-menu {
        border: 2px solid #2c3e50;
    }

    .language-switcher .lang-menu a {
        border-bottom: 2px solid #2c3e50;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .language-switcher .lang-menu {
        background: #2c3e50;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    }

    .language-switcher .lang-menu a {
        color: white;
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }

    .language-switcher .lang-menu a:hover {
        background: #34495e;
    }

    .language-switcher .lang-menu a:active {
        background: #1a252f;
    }
}

/* Ensure proper layering */
.site-header .language-switcher {
    z-index: 1001;
}

.language-switcher .lang-menu {
    z-index: 1002;
}
