/**
 * =========================================================================
 * JEIN — Professional Multilingual Dropdown Selector Component
 * Space / Cyberpunk Glassmorphic Aesthetics (JAXA Earth Observatory)
 * =========================================================================
 */

/* Container wrapper */
.lang-dropdown-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    user-select: none;
    z-index: 1100;
}

/* Trigger Button */
.lang-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 36px;
    padding: 0 11px 0 9px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.85) 0%, rgba(24, 36, 62, 0.8) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 240, 255, 0.28);
    border-radius: 9px;
    color: #e2e8f0;
    font-family: var(--font-sans, 'Outfit', 'Cairo', sans-serif);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

.lang-dropdown-btn:hover {
    border-color: rgba(0, 240, 255, 0.65);
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.92) 0%, rgba(30, 48, 80, 0.88) 100%);
    color: #ffffff;
    box-shadow: 0 0 16px rgba(0, 240, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.lang-dropdown-btn:active {
    transform: translateY(0);
}

.lang-dropdown-btn.open {
    border-color: var(--accent-cyan, #00f0ff);
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.16) 0%, rgba(15, 23, 42, 0.95) 100%);
    color: #ffffff;
    box-shadow: 0 0 22px rgba(0, 240, 255, 0.45), inset 0 0 12px rgba(0, 240, 255, 0.15);
}

/* Globe Icon */
.lang-globe-icon {
    width: 15px;
    height: 15px;
    color: var(--accent-cyan, #00f0ff);
    filter: drop-shadow(0 0 4px rgba(0, 240, 255, 0.5));
    flex-shrink: 0;
    transition: transform 0.4s ease;
}

.lang-dropdown-btn:hover .lang-globe-icon {
    transform: rotate(30deg) scale(1.08);
}

/* Flag & Text */
.lang-flag {
    font-size: 0.95rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

.flag-svg {
    width: 20px;
    height: 14px;
    border-radius: 3px;
    object-fit: cover;
    display: inline-block;
    vertical-align: middle;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.6);
    flex-shrink: 0;
}

.lang-text {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    font-family: var(--font-mono, 'JetBrains Mono', 'Cairo', monospace);
    color: #f1f5f9;
}

/* Chevron */
.lang-chevron {
    width: 13px;
    height: 13px;
    color: rgba(226, 232, 240, 0.7);
    stroke-width: 2.5;
    margin-left: 1px;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease;
    flex-shrink: 0;
}

.lang-dropdown-btn.open .lang-chevron {
    transform: rotate(180deg);
    color: var(--accent-cyan, #00f0ff);
}

/* Dropdown Menu Card */
.lang-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 260px;
    background: linear-gradient(180deg, rgba(11, 18, 38, 0.96) 0%, rgba(6, 11, 24, 0.98) 100%);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: 14px;
    padding: 7px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 25px rgba(0, 240, 255, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
    z-index: 10000;
}

/* RTL positioning: keep inside viewport */
[dir="rtl"] .lang-dropdown-menu,
[data-lang="ar"] .lang-dropdown-menu {
    right: auto;
    left: 0;
}

.lang-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Menu Header */
.lang-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 9px 8px 9px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 6px;
}

.lang-menu-title {
    font-size: 0.65rem;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    letter-spacing: 1px;
    color: var(--accent-cyan, #00f0ff);
    font-weight: 700;
    text-transform: uppercase;
}

.lang-menu-badge {
    font-size: 0.6rem;
    font-family: var(--font-mono, monospace);
    padding: 2px 7px;
    border-radius: 10px;
    background: rgba(0, 240, 255, 0.1);
    color: var(--accent-cyan, #00f0ff);
    border: 1px solid rgba(0, 240, 255, 0.25);
}

/* Options list */
.lang-options-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Option item */
.lang-option {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 10px;
    border-radius: 9px;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    user-select: none;
}

[dir="rtl"] .lang-option,
[data-lang="ar"] .lang-option {
    text-align: right;
}

.lang-option:hover {
    background: linear-gradient(90deg, rgba(0, 240, 255, 0.12), rgba(59, 130, 246, 0.12));
    border-color: rgba(0, 240, 255, 0.32);
    transform: translateX(3px);
}

[dir="rtl"] .lang-option:hover,
[data-lang="ar"] .lang-option:hover {
    transform: translateX(-3px);
}

/* Active option */
.lang-option.active {
    background: linear-gradient(90deg, rgba(0, 240, 255, 0.18), rgba(37, 99, 235, 0.22));
    border-color: rgba(0, 240, 255, 0.55);
    box-shadow: 0 0 14px rgba(0, 240, 255, 0.18);
}

.lang-option-flag {
    font-size: 1.25rem;
    line-height: 1;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.lang-option-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.lang-option-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: #f8fafc;
    line-height: 1.2;
    font-family: var(--font-sans, 'Outfit', 'Cairo', sans-serif);
}

.lang-option-sub {
    font-size: 0.68rem;
    color: #94a3b8;
    line-height: 1.2;
    margin-top: 2px;
    font-family: var(--font-sans, 'Outfit', 'Cairo', sans-serif);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lang-option.active .lang-option-name {
    color: #ffffff;
}

.lang-option.active .lang-option-sub {
    color: rgba(0, 240, 255, 0.85);
}

/* Checkmark badge */
.lang-option-check {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--accent-cyan, #00f0ff);
    background: rgba(0, 240, 255, 0.15);
    border: 1px solid rgba(0, 240, 255, 0.6);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
    margin-left: auto;
}

[dir="rtl"] .lang-option-check,
[data-lang="ar"] .lang-option-check {
    margin-left: 0;
    margin-right: auto;
}

.lang-option.active .lang-option-check {
    opacity: 1;
    transform: scale(1);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .lang-dropdown-btn {
        height: 32px;
        padding: 0 8px 0 7px;
        gap: 5px;
    }
    .lang-dropdown-btn .lang-text {
        font-size: 0.72rem;
    }
    .lang-dropdown-menu {
        min-width: 230px;
    }
}
