/**
 * Unified Language Switcher Styles
 * Consistent styling across all pages for desktop and mobile
 * Touch-friendly sizing and smooth animations
 */

/* ===== DESKTOP LANGUAGE SWITCHER ===== */
.language-switcher {
    position: relative;
    display: inline-block;
    z-index: 1000;
}

.language-switcher.desktop-lang {
    margin-right: 1rem;
    position: relative;
    z-index: 1001;
}

.lang-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 40px;
    min-width: 80px;
    font-weight: 500;
    font-size: 0.9rem;
}

.lang-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.lang-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.lang-btn i {
    color: white;
    font-size: 1rem;
    pointer-events: none;
}

.lang-btn span {
    color: white;
    font-weight: 500;
    pointer-events: none;
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    z-index: 1002;
    min-width: 150px;
    display: none;
    margin-top: 0.5rem;
    visibility: hidden;
    opacity: 0;
    transition: all 0.2s ease;
}

.lang-dropdown.show {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.lang-option {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s ease;
    font-size: 0.9rem;
    color: #333;
    min-height: 44px;
}

.lang-option:hover {
    background-color: #f8f9fa;
}

.lang-option.active {
    background-color: #3b82f6;
    color: white;
}

.lang-option .flag {
    font-size: 1.1rem;
    margin-right: 0.5rem;
}

/* ===== MOBILE LANGUAGE SWITCHER ===== */
.mobile-lang-section {
    border-top: 1px solid #e1e5e9;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    position: relative;
    z-index: 1001;
    background: white;
}

.mobile-lang-dropdown {
    position: relative;
    display: inline-block;
    z-index: 1000;
}

.mobile-lang-btn {
    width: auto;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #111827 !important;
    min-height: 44px;
    min-width: 120px;
    position: relative;
    z-index: 1002;
}

.mobile-lang-btn:hover {
    border-color: #3b82f6;
    background: #f8f9fa;
}

.mobile-lang-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.mobile-lang-btn i:first-child { color: #3b82f6 !important; margin-right: 0.4rem; font-size: 0.8rem; }
.mobile-lang-btn span { color: #111827 !important; }
.mobile-lang-btn * { color: inherit; }

.mobile-lang-btn i:last-child {
    color: #666;
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.mobile-lang-btn.open i:last-child {
    transform: rotate(180deg);
}

.mobile-lang-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 2px solid #3b82f6;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    z-index: 10000;
    display: none;
    margin-top: 0.25rem;
    min-width: 100%;
    max-width: 200px;
}

.mobile-lang-dropdown-menu.show {
    display: block !important;
    z-index: 10000;
}

.mobile-lang-option {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    border-bottom: 1px solid #f1f3f4;
    min-height: 44px;
    color: #111827 !important;
}

.mobile-lang-option:last-child {
    border-bottom: none;
}

.mobile-lang-option:hover {
    background: #f8f9fa;
}

.mobile-lang-option.active {
    background: #3b82f6;
    color: white;
}

.mobile-lang-option .flag {
    font-size: 1rem;
    margin-right: 0.4rem;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    /* Hide desktop language switcher on mobile */
    .language-switcher.desktop-lang,
    .desktop-lang,
    #langBtn,
    #langDropdown {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* Mobile menu optimizations */
    .mobile-lang-section {
        position: sticky;
        bottom: 0;
        background: #ffffff !important;
        border-top: 2px solid #3b82f6;
        margin-top: 1rem;
        padding: 0.75rem 0.5rem;
        z-index: 1001;
        width: fit-content;
    }
    
    .mobile-lang-btn {
        background: #ffffff;
        color: #111827;
        border: 1px solid #e1e5e9;
    }
    
    .mobile-lang-btn:hover {
        background: #f8f9fa;
        border-color: #cfd5dc;
    }
    
    .mobile-lang-btn i:first-child {
        color: #3b82f6;
    }
    
    .mobile-lang-btn span {
        color: #111827;
    }
    .mobile-lang-dropdown-menu .lang-option { color: #111827 !important; }
}

@media (min-width: 769px) {
    /* Hide mobile language section on desktop */
    .mobile-lang-section,
    .mobile-lang-dropdown,
    .mobile-lang-btn,
    .mobile-lang-dropdown-menu {
        display: none !important;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes slideInDown {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOutUp {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-10px);
        opacity: 0;
    }
}

.lang-dropdown.show {
    animation: slideInDown 0.2s ease;
}

.mobile-lang-dropdown-menu.show {
    animation: slideInDown 0.2s ease;
}

/* ===== ACCESSIBILITY ===== */
.lang-btn:focus-visible,
.mobile-lang-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.lang-option:focus-visible,
.mobile-lang-option:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    .lang-btn {
        border: 2px solid #000;
    }
    
    .lang-dropdown {
        border: 2px solid #000;
    }
    
    .mobile-lang-btn {
        border: 2px solid #000;
    }
    
    .mobile-lang-dropdown-menu {
        border: 2px solid #000;
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    .lang-btn,
    .lang-option,
    .mobile-lang-btn,
    .mobile-lang-option {
        transition: none;
    }
    
    .lang-dropdown,
    .mobile-lang-dropdown-menu {
        animation: none;
    }
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
    .lang-dropdown {
        background: #1a1a1a;
        border-color: #333;
        color: #fff;
    }
    
    .lang-option {
        color: #fff;
    }
    
    .lang-option:hover {
        background-color: #333;
    }
    
    .mobile-lang-dropdown-menu {
        background: #1a1a1a;
        border-color: #333;
    }
    
    .mobile-lang-option {
        color: #fff;
    }
    
    .mobile-lang-option:hover {
        background: #333;
    }
}
