/**
 * Language Switcher Component Styles
 * Modern, clean design that matches XBrand brand colors
 */

/* Base Language Switcher Styles */
.language-switcher {
    display: inline-flex;
    align-items: center;
    font-family: var(--ff-text);
    user-select: none;
}

/* Toggle Style Switcher */
.language-switcher--toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    padding: 8px 14px;
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 6px;
    backdrop-filter: blur(15px);
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.language-switcher--toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 107, 107, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.language-switcher--toggle .lang-flag {
    font-size: 1.1rem;
    line-height: 1;
}

.language-switcher--toggle .lang-text {
    font-weight: 600;
    letter-spacing: 0.025em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.language-switcher--toggle:active {
    transform: translateY(0);
}

.language-switcher--toggle .lang-flag {
    font-size: 1rem;
    line-height: 1;
}

.language-switcher--toggle .lang-text {
    font-weight: 600;
    letter-spacing: 0.025em;
}

/* Dropdown Style Switcher */
.language-switcher--dropdown {
    position: relative;
}

.lang-dropdown-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 6px 12px;
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(10px);
}

.lang-dropdown-button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--coral-accent);
}

.lang-dropdown-button[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--coral-accent);
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid rgba(42, 92, 130, 0.1);
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    min-width: 100px;
    z-index: 1000;
    backdrop-filter: blur(15px);
}

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

.lang-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    background: none;
    border: none;
    color: var(--dark-charcoal);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-option:hover {
    background: var(--light-bg);
    color: var(--primary-blue);
}

.lang-option:first-child {
    border-radius: 7px 7px 0 0;
}

.lang-option:last-child {
    border-radius: 0 0 7px 7px;
}

.lang-option:only-child {
    border-radius: 7px;
}

.lang-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

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

/* Flags Style Switcher */
.language-switcher--flags {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 4px;
    backdrop-filter: blur(10px);
}

.lang-flag-button {
    background: transparent;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.lang-flag-button:hover {
    background: rgba(255, 255, 255, 0.2);
    opacity: 0.9;
}

.lang-flag-button.active {
    background: rgba(255, 255, 255, 0.25);
    opacity: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Mobile Language Switcher - Always visible and properly positioned */
.mobile-language-switcher {
    position: fixed !important;
    top: 22px !important; /* near header */
    right: 75px !important;
    z-index: 1000 !important;
    background: rgba(255, 255, 255, 0.15) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 12px !important;
    backdrop-filter: blur(20px) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12) !important;
    min-width: 70px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: white !important;
}

.mobile-language-switcher.language-switcher--toggle {
    padding: 4px 8px !important;
    font-size: 0.8rem !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important; /* PROPER space between flag and text */
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    background: transparent !important;
}

.mobile-language-switcher:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    border-color: rgba(255, 107, 107, 0.5) !important;
    transform: translateY(-2px) scale(1.05) !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2) !important;
}

.mobile-language-switcher:active {
    transform: translateY(-1px) scale(1.02) !important;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Desktop language switcher - hide on mobile */
    .language-switcher:not(.mobile-language-switcher) {
        display: none !important;
    }
    
    .language-switcher--toggle:not(.mobile-language-switcher) {
        display: none !important;
    }
    
    /* Mobile-specific adjustments */
    .mobile-language-switcher .lang-flag {
        font-size: 1.1rem !important;
        line-height: 1 !important;
        margin-right: 4px !important; /* Extra space after flag */
    }
    
    .mobile-language-switcher .lang-text {
        font-weight: 600 !important;
        letter-spacing: 0.025em !important;
        font-size: 0.75rem !important;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
        color: white !important;
        margin-left: 2px !important; /* Extra space before text */
    }
    
    /* Force white color for all child elements */
    .mobile-language-switcher * {
        color: white !important;
    }

    .lang-dropdown {
        right: -10px;
    }
    
    .language-switcher--flags {
        padding: 3px;
        gap: 2px;
        position: fixed;
        top: 15px;
        right: 15px;
        z-index: 1001;
    }
    
    .lang-flag-button {
        padding: 3px 6px;
        font-size: 0.9rem;
    }
    
    /* When mobile menu is open, move below header */
    .mobile-nav-overlay.active ~ .mobile-language-switcher,
    body.mobile-nav-open .mobile-language-switcher {
        top: 70px !important;
    }
}

/* Desktop - hide mobile switcher */
@media (min-width: 769px) {
    .mobile-language-switcher {
        display: none !important;
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .lang-dropdown {
        background: var(--dark-charcoal);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .lang-option {
        color: white;
    }
    
    .lang-option:hover {
        background: rgba(255, 255, 255, 0.1);
        color: var(--yellow-accent);
    }
}

/* Animation for language switching */
.lang-switching {
    opacity: 0.7;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Language-specific text adjustments */
.lang-bg {
    font-family: var(--ff-text);
}

.lang-en {
    font-family: var(--ff-text);
    letter-spacing: 0.01em;
}

/* Focus styles for accessibility */
.language-switcher--toggle:focus,
.lang-dropdown-button:focus,
.lang-option:focus,
.lang-flag-button:focus,
.mobile-language-switcher:focus {
    outline: 2px solid var(--yellow-accent);
    outline-offset: 2px;
}

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