/**
 * Language Switcher Styles
 * =========================
 *
 * Styles for the language switcher component.
 * Supports multiple display styles: dropdown, flags, buttons
 */

/* Base Styles */
.language-switcher {
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* Dropdown Style */
.language-switcher--dropdown {
    min-width: 120px;
}

.language-switcher__trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #374151;
    width: auto;
    min-width: auto;
}

.language-switcher__trigger:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: scale(1.05);
}

.language-switcher__trigger:focus {
    outline: none;
    background: rgba(0, 0, 0, 0.08);
}

.language-switcher__flag {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.language-switcher__globe {
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
    filter: grayscale(0.2);
}

.language-switcher__label {
    flex: 1;
    text-align: left;
}

.language-switcher__icon {
    flex-shrink: 0;
    transition: transform 0.2s ease;
    color: #9ca3af;
    display: none; /* Hidden for minimal design */
}

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

/* Dropdown Menu */
.language-switcher__dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    left: auto;
    min-width: 180px;
    max-height: 320px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 0.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    box-shadow:
        0 0 0 0.5px rgba(0, 0, 0, 0.04),
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 20px 48px rgba(0, 0, 0, 0.08);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.95);
    transform-origin: top right;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom scrollbar for dropdown - Apple style */
.language-switcher__dropdown::-webkit-scrollbar {
    width: 8px;
}

.language-switcher__dropdown::-webkit-scrollbar-track {
    background: transparent;
    margin: 8px 0;
}

.language-switcher__dropdown::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.language-switcher__dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* Firefox scrollbar */
.language-switcher__dropdown {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.language-switcher__dropdown--open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.language-switcher__option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    width: 100%;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    color: #1d1d1f;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: -0.01em;
    text-align: left;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
    position: relative;
    overflow: hidden;
}

.language-switcher__option::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.04);
    opacity: 0;
    transition: opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.language-switcher__option:hover::before {
    opacity: 1;
}

.language-switcher__option:hover {
    transform: scale(0.98);
}

.language-switcher__option:active {
    transform: scale(0.96);
    transition: all 0.05s cubic-bezier(0.4, 0, 0.2, 1);
}

.language-switcher__option--active {
    background: rgba(0, 122, 255, 0.08);
    color: #007AFF;
    font-weight: 500;
}

.language-switcher__option--active::before {
    background: rgba(0, 122, 255, 0.06);
}

.language-switcher__option:focus {
    outline: none;
}

.language-switcher__name {
    flex: 1;
}

.language-switcher__check {
    color: #007AFF;
    font-weight: 600;
    margin-left: auto;
}

/* Flags Style */
.language-switcher--flags {
    display: flex;
    gap: 8px;
}

.language-switcher__flag-btn {
    padding: 8px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 20px;
    line-height: 1;
}

.language-switcher__flag-btn:hover {
    border-color: #3b82f6;
    transform: scale(1.05);
}

.language-switcher__flag-btn:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.language-switcher__flag-btn--active {
    border-color: #3b82f6;
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Buttons Style */
.language-switcher--buttons {
    display: flex;
    gap: 4px;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 8px;
}

.language-switcher__button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
}

.language-switcher__button:hover {
    background: #e5e7eb;
    color: #374151;
}

.language-switcher__button:focus {
    outline: none;
    box-shadow: 0 0 0 2px #3b82f6;
}

.language-switcher__button--active {
    background: white;
    color: #3b82f6;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.language-switcher__text {
    font-weight: 600;
}

/* Compact Mode (for mobile) */
.language-switcher--compact .language-switcher__trigger {
    padding: 6px 10px;
    min-width: auto;
}

.language-switcher--compact .language-switcher__label {
    display: none;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .language-switcher__trigger,
    .language-switcher__dropdown,
    .language-switcher__flag-btn {
        background: #1f2937;
        border-color: #374151;
        color: #f3f4f6;
    }

    .language-switcher__trigger:hover,
    .language-switcher__flag-btn:hover {
        background: #374151;
        border-color: #4b5563;
    }

    .language-switcher__option {
        color: #f3f4f6;
    }

    .language-switcher__option:hover {
        background: #374151;
    }

    .language-switcher__option--active {
        background: #1e3a8a;
        color: #60a5fa;
    }

    .language-switcher__flag-btn--active {
        background: #1e3a8a;
        border-color: #60a5fa;
    }

    .language-switcher--buttons {
        background: #374151;
    }

    .language-switcher__button {
        color: #9ca3af;
    }

    .language-switcher__button:hover {
        background: #4b5563;
        color: #f3f4f6;
    }

    .language-switcher__button--active {
        background: #1f2937;
        color: #60a5fa;
    }
}

/* Mobile Menu Styles */
.language-switcher--in-mobile-menu .language-switcher__trigger {
    width: 100%;
    justify-content: flex-start;
    padding: 12px 16px;
    gap: 12px;
}

.language-switcher--in-mobile-menu .language-switcher__label {
    font-size: 16px;
    font-weight: 400;
    color: #1d1d1f;
}

.language-switcher--in-mobile-menu .language-switcher__globe {
    font-size: 20px;
}

/* Responsive */
@media (max-width: 640px) {
    .language-switcher--dropdown:not(.language-switcher--compact):not(.language-switcher--in-mobile-menu) .language-switcher__trigger {
        padding: 6px 10px;
    }

    .language-switcher--dropdown:not(.language-switcher--compact):not(.language-switcher--in-mobile-menu) .language-switcher__label {
        display: none;
    }
}

/* Positioning Utilities */
.language-switcher-container--top-right {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999;
}

.language-switcher-container--top-left {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 999;
}

.language-switcher-container--inline {
    display: inline-block;
}

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

.language-switcher__dropdown--open {
    animation: slideDown 0.2s ease;
}
