/**
 * i18n Internationalization Styles for Review Agent
 * 
 * This stylesheet provides styling for the internationalization system
 * including language switcher, language popup, and direction support.
 * 
 * @author Review Agent Team
 * @version 1.0.0
 * @created 2025-01-16
 */

/* Language Popup Styles */
.language-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.language-popup.show {
    opacity: 1;
    visibility: visible;
}

.language-popup-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.language-popup.show .language-popup-content {
    transform: translateY(0);
}

.language-popup-header {
    display: flex;
    align-items: center;
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}

.language-popup-header .language-flag {
    font-size: 32px;
    margin-right: 12px;
    line-height: 1;
}

.language-popup-header h3 {
    margin: 0;
    flex: 1;
    font-size: 20px;
    font-weight: 600;
    color: #111827;
}

.language-popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    line-height: 1;
}

.language-popup-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.language-popup-body {
    padding: 24px;
}

.language-popup-body p {
    margin: 0 0 24px;
    color: #374151;
    line-height: 1.6;
    font-size: 16px;
}

.language-popup-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.language-popup-buttons .btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    text-decoration: none;
    display: inline-block;
}

.language-popup-buttons .btn-primary {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.language-popup-buttons .btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.language-popup-buttons .btn-secondary {
    background: white;
    color: #374151;
    border-color: #d1d5db;
}

.language-popup-buttons .btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

/* Language Switcher Styles */
.language-switcher {
    position: relative;
    display: inline-block;
    overflow: visible !important; /* Critical: Allow dropdown to escape */
}

.language-switcher-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #374151;
}

.language-switcher-button:hover {
    border-color: #9ca3af;
    background: #f9fafb;
}

.language-switcher-button .language-flag {
    font-size: 16px;
    line-height: 1;
}

.language-switcher-button .language-name {
    font-weight: 500;
}

.language-switcher-button .language-arrow {
    font-size: 12px;
    transition: transform 0.2s ease;
}

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

.language-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    margin-top: 4px;
}

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

.language-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 14px;
    color: #374151;
}

.language-option:hover {
    background: #f3f4f6;
}

.language-option.active {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 500;
}

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

.language-option .language-name {
    font-weight: inherit;
}

/* RTL Support */
[dir="rtl"] .language-popup-close {
    left: 16px;
    right: auto;
}

[dir="rtl"] .language-popup-header .language-flag {
    margin-left: 12px;
    margin-right: 0;
}

[dir="rtl"] .language-dropdown {
    left: 0;
    right: auto;
}

[dir="rtl"] .language-option {
    text-align: right;
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .language-popup-content {
        width: 95%;
        margin: 20px;
    }
    
    .language-popup-header {
        padding: 20px 20px 16px;
    }
    
    .language-popup-body {
        padding: 20px;
    }
    
    .language-popup-buttons {
        flex-direction: column;
    }
    
    .language-popup-buttons .btn {
        flex: none;
        width: 100%;
    }
    
    .language-switcher-button {
        padding: 10px 14px;
    }
    
    .language-dropdown {
        right: 0;
        left: auto;
        min-width: 180px;
    }
    
    [dir="rtl"] .language-dropdown {
        left: 0;
        right: auto;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .language-popup {
        background: rgba(0, 0, 0, 0.8);
    }
    
    .language-popup-content {
        border: 2px solid #000;
    }
    
    .language-switcher-button {
        border-width: 2px;
    }
    
    .language-dropdown {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .language-popup,
    .language-popup-content,
    .language-switcher-button,
    .language-dropdown,
    .language-option {
        transition: none;
    }
    
    .language-popup.show .language-popup-content {
        transform: none;
    }
    
    .language-dropdown.show {
        transform: none;
    }
}

/* Focus styles for accessibility */
.language-popup-close:focus,
.language-switcher-button:focus,
.language-option:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.language-popup-buttons .btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Animation for language switching - Enhanced smooth transitions */
.language-switching {
    opacity: 0.8;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: scale(0.98);
}

.language-switching-complete {
    opacity: 1;
    transform: scale(1);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Smooth transitions for all translatable elements */
[data-i18n] {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

[data-i18n-html] {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}


/* Smooth header transitions */
.header {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Smooth content transitions */
.content,
.main-content {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Language change animation wrapper */
.language-change-animation {
    position: relative;
    overflow: hidden;
}

.language-change-animation::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: languageChangeSwipe 0.8s ease-out;
    pointer-events: none;
    z-index: 1;
}

@keyframes languageChangeSwipe {
    0% {
        left: -100%;
    }
    50% {
        left: 0%;
    }
    100% {
        left: 100%;
    }
}

/* Smooth font changes for different languages */
.lang-en,
.lang-el,
.lang-de {
    transition: font-family 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}


/* Utility classes for language-specific styling */
.text-ltr {
    direction: ltr;
    text-align: left;
}

.text-rtl {
    direction: rtl;
    text-align: right;
}

.lang-en {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.lang-el {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Greek", sans-serif;
}

.lang-de {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}

/* Language indicator in navigation */
.nav-language-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 12px;
    color: #6b7280;
    margin-left: 8px;
}

.nav-language-indicator .language-flag {
    font-size: 14px;
}

[dir="rtl"] .nav-language-indicator {
    margin-right: 8px;
    margin-left: 0;
}

/* Navbar Language Switcher Component */
.language-switcher-container {
    display: flex;
    align-items: center;
    margin-left: auto;
    margin-right: 8px;
    position: relative;
    flex-shrink: 0;
    order: 10; /* Ensure it appears after navigation links */
}


.language-switcher {
    position: relative;
    display: inline-block;
}

.language-switcher-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--glass-background);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-size: 13px;
    color: var(--foreground-text);
    font-family: inherit;
    min-width: 90px;
    white-space: nowrap;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: var(--glass-shadow);
}

.language-switcher-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: var(--card-shadow);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

.language-switcher-btn:active {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.3);
}

.language-switcher-btn .language-flag {
    font-size: 16px;
    line-height: 1;
}

.language-switcher-btn .language-name {
    font-weight: 500;
    flex: 1;
    text-align: left;
}

.language-switcher-btn .language-arrow {
    font-size: 12px;
    transition: transform 0.2s ease;
    color: #6b7280;
}

.language-switcher[aria-expanded="true"] .language-arrow {
    transform: rotate(180deg);
}

.language-switcher-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--glass-background);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--glass-shadow);
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1000;
    margin-top: 4px;
    list-style: none;
    padding: 0;
    margin-left: 0;
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
}

.language-switcher-dropdown[aria-hidden="false"] {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    display: block !important;
    position: absolute !important;
    top: 100% !important;
    right: 0 !important;
    z-index: 1000 !important;
}

.language-switcher-dropdown li {
    margin: 0;
    padding: 0;
}

.language-switcher-dropdown .language-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-size: 14px;
    color: var(--foreground-text);
    text-decoration: none;
    border-radius: 0;
}

.language-switcher-dropdown .language-option:first-child {
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.language-switcher-dropdown .language-option:last-child {
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.language-switcher-dropdown .language-option:only-child {
    border-radius: var(--radius-sm);
}

.language-switcher-dropdown .language-option:hover {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transform: translateX(4px);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

.language-switcher-dropdown .language-option.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--ai-accent);
    font-weight: 500;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.language-switcher-dropdown .language-option .language-flag {
    font-size: 16px;
    line-height: 1;
}

.language-switcher-dropdown .language-option .language-name {
    font-weight: inherit;
}

/* Show only flag at medium screen sizes to save space */
@media (max-width: 1400px) {
    .language-switcher-btn .language-name {
        display: none; /* Hide text, show only flag */
    }
    
    .language-switcher-btn {
        min-width: 45px; /* Smaller width for flag-only */
        padding: 8px 12px;
        justify-content: center;
    }
    
    .language-switcher-btn .language-flag {
        font-size: 18px; /* Slightly larger flag */
    }
    
    .language-switcher-btn .language-arrow {
        margin-left: 4px;
    }
}

/* These styles are no longer needed since mobile menu starts at 1100px */

/* Mobile menu language switcher styles */
@media (max-width: 1400px) {
    /* Language switcher inside mobile menu */
    .language-switcher-btn {
        /* Style like other mobile menu items */
        padding: 1rem 1.5rem;
        font-size: 1rem;
        width: 100%;
        text-align: left;
        border-radius: var(--radius);
        justify-content: space-between;
        background: transparent;
        border: none;
        min-width: auto;
    }
    
    .language-switcher-btn:hover {
        background: rgba(255, 255, 255, 0.15);
        color: var(--foreground-text);
        transform: translateX(4px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        text-shadow: none;
    }
    
    .language-switcher-btn .language-name {
        display: block; /* Show text again in mobile menu */
        font-size: 1rem;
    }
    
    .language-switcher-btn .language-flag {
        font-size: 16px;
    }
    
    /* Dropdown positioning inside mobile menu - higher specificity */
    .navbar-links .language-switcher .language-switcher-dropdown {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        width: calc(100% - 0rem) !important; /* Use full width within container */
        margin: 0.5rem 0 0 0 !important; /* Only top margin */
        z-index: auto !important;
        background: rgba(255, 255, 255, 0.9) !important;
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
        border-radius: var(--radius) !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transform: translateY(-10px) !important;
        transition: all 0.3s ease !important;
        max-width: none !important;
        min-width: auto !important;
        padding: 0.5rem !important;
    }
    
    .navbar-links .language-switcher .language-switcher-dropdown[aria-hidden="false"] {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
        display: block !important;
        position: relative !important;
    }
    
    /* Style language options in mobile menu - higher specificity */
    .navbar-links .language-switcher .language-switcher-dropdown .language-option {
        padding: 0.75rem 1rem !important;
        font-size: 0.9rem !important;
        border-radius: calc(var(--radius) - 4px) !important;
        margin-bottom: 0.25rem !important;
        background: transparent !important;
        color: var(--foreground-text) !important;
        text-decoration: none !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .navbar-links .language-switcher .language-switcher-dropdown .language-option:hover {
        background: rgba(255, 255, 255, 0.7) !important;
        transform: none !important; /* No transform in mobile */
    }
    
    .navbar-links .language-switcher .language-switcher-dropdown .language-option.active {
        background: rgba(59, 130, 246, 0.1) !important;
        color: #2563eb !important;
        font-weight: 600 !important;
    }
}

/* Language Switcher as Navbar Element */
.language-switcher-item {
    position: relative;
    flex-shrink: 0;
    overflow: visible; /* Ensure dropdown can escape */
}

/* Language-specific navbar behavior - removed, now handled in layout.css */

/* Style the language switcher button like other navbar links */
.language-switcher-btn {
    position: relative;
    font-size: clamp(0.5rem, 0.3rem + 1.8vw, 0.9375rem); /* Ultra aggressive fluid typography */
    color: var(--foreground-text);
    text-decoration: none;
    font-weight: 600;
    padding: clamp(0.2rem, 0.1rem + 1.2vw, 0.75rem) clamp(0.3rem, 0.2rem + 2vw, 1.25rem); /* Ultra aggressive fluid padding */
    border-radius: var(--radius-pill);
    transition: var(--transition);
    background: transparent;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: clamp(0.1rem, 0.05rem + 1vw, 0.5rem); /* Ultra aggressive fluid gap */
    font-family: inherit;
    overflow: visible; /* Allow dropdown to escape */
    flex-shrink: 1;
    min-width: 0;
    max-width: min-content;
}

.language-switcher-btn:hover {
    color: var(--foreground-text);
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: var(--card-shadow);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}


.lang-el .language-switcher-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    min-width: 80px;
}

.lang-el .language-switcher-btn .language-name {
    font-size: 0.75rem;
}

/* Ensure dropdown positioning is not affected by language-specific styles */
.lang-el .language-switcher-dropdown,
.lang-de .language-switcher-dropdown {
    position: absolute;
    z-index: 1000;
}

/* Force dropdown to stay visible when opened, regardless of language */
.lang-el .language-switcher-dropdown[aria-hidden="false"],
.lang-de .language-switcher-dropdown[aria-hidden="false"],
.lang-en .language-switcher-dropdown[aria-hidden="false"] {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
    display: block !important;
    position: absolute !important;
    top: 100% !important;
    right: 0 !important;
    z-index: 9999 !important;
}

/* Prevent Bootstrap from interfering with our dropdown */
.language-switcher-dropdown.show,
.language-switcher-dropdown[data-bs-popper] {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
}

/* Override Bootstrap's dropdown classes */
.language-switcher .dropdown-menu {
    display: none !important;
}

.language-switcher-dropdown:not([aria-hidden="true"]) {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
    display: block !important;
}


.lang-de .language-switcher-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    min-width: 85px;
}

.lang-de .language-switcher-btn .language-name {
    font-size: 0.8rem;
}


/* Standard responsive adjustments */
@media (max-width: 1400px) {
    
    /* Language switcher responsive adjustments */  
    .lang-el .language-switcher-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
        min-width: 70px;
    }
    
    .lang-de .language-switcher-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
        min-width: 75px;
    }
}

/* Mobile responsive - adjust language switcher for small screens */
@media (max-width: 900px) {
    /* On mobile, the language switcher is in the mobile menu */
    .language-switcher-btn {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        width: 100%;
        text-align: left;
        border-radius: var(--radius);
        justify-content: space-between;
    }
    
    .language-switcher-btn:hover {
        background: rgba(255, 255, 255, 0.15);
        color: var(--foreground-text);
        transform: translateX(4px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        text-shadow: none;
    }
}

/* Language switcher dropdown - clean Bootstrap override */
.language-switcher-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--glass-background);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--glass-shadow);
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 9999;
    margin-top: 4px;
    list-style: none;
    padding: 0;
    margin-left: 0;
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    pointer-events: none;
    display: block;
}

.language-switcher-dropdown[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    display: block;
    position: absolute; /* Use absolute instead of fixed */
    z-index: 99999;
}

.language-switcher-dropdown .language-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-size: 14px;
    color: var(--foreground-text);
    text-decoration: none;
    border-radius: 0;
}

.language-switcher-dropdown .language-option:hover {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transform: translateX(4px);
}

.language-switcher-dropdown .language-option.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--ai-accent);
    font-weight: 500;
}

/* RTL support for navbar language switcher */
[dir="rtl"] .language-switcher-item {
    margin-left: 20px;
    margin-right: auto;
}

[dir="rtl"] .language-switcher-btn .language-name {
    text-align: right;
}

[dir="rtl"] .language-switcher-dropdown {
    left: 0;
    right: auto;
}

[dir="rtl"] .language-switcher-dropdown .language-option {
    text-align: right;
}

/* Focus styles for accessibility */
.language-switcher-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.language-switcher-dropdown .language-option:focus {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .language-switcher-btn {
        border-width: 2px;
    }
    
    .language-switcher-dropdown {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .language-switcher-btn,
    .language-switcher-dropdown,
    .language-switcher-dropdown .language-option {
        transition: none;
    }
    
    .language-switcher-dropdown[aria-hidden="false"] {
        transform: none;
    }
    
    .language-switcher[aria-expanded="true"] .language-arrow {
        transform: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .language-switcher-btn {
        background: #374151;
        border-color: #4b5563;
        color: #f3f4f6;
    }
    
    .language-switcher-btn:hover {
        background: #4b5563;
        border-color: #6b7280;
    }
    
    .language-switcher-dropdown {
        background: #374151;
        border-color: #4b5563;
    }
    
    .language-switcher-dropdown .language-option {
        color: #f3f4f6;
    }
    
    .language-switcher-dropdown .language-option:hover {
        background: #4b5563;
    }
    
    .language-switcher-dropdown .language-option.active {
        background: #1e40af;
        color: #dbeafe;
    }
}

/* Container overflow fixes for language dropdown */
.header {
    overflow: visible;
}

.navbar {
    overflow: visible;
}

.navbar .container {
    overflow: visible;
}

.language-switcher-item,
.language-switcher {
    overflow: visible;
    position: relative;
}

.language-switcher-btn {
    overflow: visible;
}

/* IMPROVED DROPDOWN DESIGN - Glassmorphism Theme with Fixed Positioning */
.language-switcher-dropdown {
    /* Enhanced glassmorphism styling with fixed positioning */
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.05) !important;
    min-width: 180px !important;
    transform: translateY(-10px) scale(0.95) !important;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    margin-top: 8px !important;
    padding: 8px !important;
    overflow: hidden !important;
    /* Fixed positioning to escape all containers */
    position: absolute !important;
    /* Allow JavaScript to set position dynamically */
    top: 100% !important;
    left: auto !important;
    right: 0 !important;
    bottom: auto !important;
    /* Ensure highest z-index */
    z-index: 99999 !important;
}

.language-switcher-dropdown[aria-hidden="false"] {
    transform: translateY(0) scale(1) !important;
}

.language-switcher-dropdown .language-option {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 12px 16px !important;
    border: none !important;
    background: transparent !important;
    width: 100% !important;
    text-align: left !important;
    cursor: pointer !important;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    font-size: 14px !important;
    color: #374151 !important;
    text-decoration: none !important;
    border-radius: 12px !important;
    margin-bottom: 2px !important;
    font-weight: 500 !important;
    position: relative !important;
    overflow: hidden !important;
}

.language-switcher-dropdown .language-option:hover {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    transform: translateX(2px) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
}

.language-switcher-dropdown .language-option.active {
    background: rgba(59, 130, 246, 0.1) !important;
    color: #2563eb !important;
    font-weight: 600 !important;
    border: 1px solid rgba(59, 130, 246, 0.2) !important;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1) !important;
}

.language-switcher-dropdown .language-option .language-flag {
    font-size: 18px !important;
    line-height: 1 !important;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1)) !important;
}

.language-switcher-dropdown .language-option .language-name {
    font-weight: inherit !important;
    letter-spacing: 0.025em !important;
}

/* Dark mode improvements */
@media (prefers-color-scheme: dark) {
    .language-switcher-dropdown {
        background: rgba(55, 65, 81, 0.95) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    }
    
    .language-switcher-dropdown .language-option {
        color: #f3f4f6 !important;
    }
    
    .language-switcher-dropdown .language-option:hover {
        background: rgba(75, 85, 99, 0.8) !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
    }
    
    .language-switcher-dropdown .language-option.active {
        background: rgba(59, 130, 246, 0.2) !important;
        color: #93c5fd !important;
        border: 1px solid rgba(59, 130, 246, 0.3) !important;
    }
}
