/**
 * LANGUAGE & CURRENCY SELECTOR - MODERN UI
 * Globe icon avec dropdown bi-niveau (langues + devises)
 */

/* Globe Button */
.lang-currency-selector {
    position: relative;
    display: inline-flex;
    margin: 0 4px;
}

.globe-button {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: white;
    position: relative;
}

.globe-icon {
    width: 24px;
    height: 24px;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.3s ease;
}

.globe-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.globe-button:hover .globe-icon {
    transform: rotate(15deg) scale(1.15);
}

.globe-button:active {
    background: rgba(255, 255, 255, 0.15);
}

/* Dropdown Menu */
.selector-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow: hidden;
    z-index: 10000;
}

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

/* Section Header */
.selector-section {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.selector-section:last-child {
    border-bottom: none;
}

.section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #999;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

/* Options List */
.selector-options {
    display: grid;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
}

/* Scrollbar Styling */
.selector-options::-webkit-scrollbar {
    width: 6px;
}

.selector-options::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 10px;
}

.selector-options::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.selector-options::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Option Item */
.selector-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
}

.selector-option:hover {
    background: #f8f9fa;
    transform: translateX(4px);
}

.selector-option.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.selector-option.active .option-name {
    color: white;
}

.option-flag {
    font-size: 24px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #f5f5f5;
}

.selector-option.active .option-flag {
    background: rgba(255, 255, 255, 0.2);
}

.option-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.option-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.option-code {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    font-weight: 600;
}

.selector-option.active .option-code {
    color: rgba(255, 255, 255, 0.8);
}

/* Check Icon */
.option-check {
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.selector-option.active .option-check {
    opacity: 1;
}

/* Current Selection Badge */
.current-selection {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    background: #10b981;
    border-radius: 50%;
    border: 3px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: white;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
}

/* Loading State */
.globe-button.loading {
    pointer-events: none;
}

.globe-button.loading .globe-icon {
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .globe-button {
        width: 40px;
        height: 40px;
    }

    .globe-icon {
        width: 20px;
        height: 20px;
    }

    .selector-dropdown {
        width: 280px;
        right: -10px;
    }

    .selector-options {
        max-height: 200px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .selector-dropdown {
        background: #1f2937;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    }

    .selector-section {
        border-bottom-color: #374151;
    }

    .section-title {
        color: #9ca3af;
    }

    .selector-option {
        color: #e5e7eb;
    }

    .selector-option:hover {
        background: #374151;
    }

    .option-flag {
        background: #374151;
    }

    .option-name {
        color: #e5e7eb;
    }

    .option-code {
        color: #9ca3af;
    }
}

/* RTL Support */
html[dir="rtl"] .selector-dropdown {
    left: 0;
    right: auto;
}

html[dir="rtl"] .selector-option:hover {
    transform: translateX(-4px);
}
