/* Language picker in the app header (_Layout.cshtml) and the map's top bar, from the shared
   partial _LanguagePicker.cshtml. Net-new widget only: the button takes the class of the
   buttons beside it, the menu uses the notification panel's surface (card bg, hairline, 12px
   radius). Direction-neutral throughout, so it mirrors with the page in Arabic.

   Back in the header since 6 Oct (Ali): from the footer it could not be found on short pages
   or at all on the map, which has no footer. */

/* Icon, language code and caret, so it reads as a control with a choice behind it and not
   one more icon. Width follows the content in both bars. */
.language-picker-header .language-picker-trigger {
    width: auto;
    gap: 6px;
    padding-inline: 10px 8px;
}

/* In the app header the neighbours are bare icons, so the picker takes the outlined control
   shape (8px, hairline) the way a select does, which is what it is. The map's buttons are
   outlined already; there it keeps theirs. */
.header .language-picker-trigger {
    height: 34px;
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--bs-body-color);
    font-size: 1rem;
}

.header .language-picker-trigger:hover {
    border-color: var(--bs-gray-300);
    background: var(--bs-gray-100);
    color: var(--bs-body-color);
}

.header .language-picker-trigger[aria-expanded="true"] {
    border-color: rgba(var(--bs-primary-rgb), 0.35);
}

.header .language-picker-trigger:focus-visible {
    outline: none;
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), 0.15);
}

.language-picker-header .ri-translate-2 {
    font-size: 1rem;
    color: var(--bs-tertiary-color);
}

.language-picker-header .language-picker-trigger[aria-expanded="true"] .ri-translate-2 {
    color: inherit;
}

.language-picker-short {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.language-picker-header .language-picker-caret {
    color: var(--bs-tertiary-color);
    margin-inline-start: -2px;
}

.language-picker-header .language-picker-trigger[aria-expanded="true"] .language-picker-caret {
    color: inherit;
}

.language-picker-header .language-picker-menu {
    margin-top: 8px !important;
}

.language-picker-current {
    font-size: 0.8125rem;
    font-weight: 600;
}

.language-picker-caret {
    font-size: 0.95rem;
    transition: transform var(--ease-fast);
}

.language-picker-trigger[aria-expanded="true"] {
    background: rgba(var(--bs-primary-rgb), 0.12);
    color: var(--bs-primary);
}

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

.language-picker-menu {
    width: 248px;
    padding: 6px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.language-picker-heading {
    padding: 8px 10px 6px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--bs-secondary-color);
}

.language-picker-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    font-weight: 600;
    transition: background var(--ease-fast), color var(--ease-fast);
}

.language-picker-option:hover,
.language-picker-option:focus {
    background: var(--bs-gray-100);
    color: var(--bs-body-color);
}

.language-picker-option:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), 0.15);
}

.language-picker-code {
    flex: none;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.6875rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: var(--bs-gray-100);
    color: var(--bs-tertiary-color);
    transition: background var(--ease-fast), color var(--ease-fast);
}

.language-picker-option:hover .language-picker-code {
    background: var(--bs-gray-200);
}

.language-picker-name {
    flex: 1;
    min-width: 0;
}

.language-picker-check {
    font-size: 1.1rem;
    color: var(--bs-primary);
    visibility: hidden;
}

/* Beats Bootstrap's solid-primary .dropdown-item.active: the tint + tick carry the state. */
.language-picker-option.active,
.language-picker-option.active:hover,
.language-picker-option.active:focus,
.language-picker-option:active {
    background: var(--primary-muted);
    color: var(--primary-hover); /* brand blue on the tint is 4.04:1 */
}

/* The hover blue, not the brand blue: white 11px bold on #2F6BFF is 4.49:1, just under AA. */
.language-picker-option.active .language-picker-code {
    background: var(--primary-hover);
    color: var(--bs-white);
}

.language-picker-option.active .language-picker-check {
    visibility: visible;
}

.language-picker-option[aria-disabled="true"] {
    pointer-events: none;
    opacity: 0.55;
}

.language-picker-option.is-switching {
    opacity: 1;
}

.language-picker-option .spinner-border {
    width: 0.9rem;
    height: 0.9rem;
    border-width: 2px;
    color: var(--bs-primary);
}

/* Dark mode: match the notification panel beside it (site.css) — the shared .dropdown-menu
   surface keeps a light shadow and a lighter card background, so two popovers from adjacent
   header buttons would not look alike. */
[data-bs-theme="dark"] .language-picker-menu {
    background: var(--bs-gray-100);
    border-color: var(--bs-gray-300);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .language-picker-option:hover,
[data-bs-theme="dark"] .language-picker-option:focus {
    background: var(--bs-gray-200);
}

[data-bs-theme="dark"] .language-picker-code {
    background: var(--bs-gray-200);
}

/* Blue text on the dark menu falls under AA; the tint, the filled code and the tick carry the
   selection there. */
[data-bs-theme="dark"] .language-picker-option.active,
[data-bs-theme="dark"] .language-picker-option.active:hover,
[data-bs-theme="dark"] .language-picker-option.active:focus {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .language-picker-option:hover .language-picker-code {
    background: var(--bs-gray-300);
}
