/* Header language switcher (includes/language-switcher.html) */

.ayat-lang-switch {
    position: relative;
    margin: 0;
}

.ayat-lang-switch__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 2.1rem;
    padding: 0 0.6rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #4b5563;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.ayat-lang-switch__btn:hover,
.ayat-lang-switch.is-open .ayat-lang-switch__btn {
    border-color: #cfe3fc;
    background: #f0f7ff;
    color: #2563eb;
}

.ayat-lang-switch__btn:focus-visible,
.ayat-lang-switch__option:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.ayat-lang-switch__flag {
    font-size: 1rem;
    line-height: 1;
}

.ayat-lang-switch__label {
    display: none;
}

.ayat-lang-switch__chevron {
    font-size: 0.6rem;
    transition: transform 0.15s ease;
}

.ayat-lang-switch.is-open .ayat-lang-switch__chevron {
    transform: rotate(180deg);
}

.ayat-lang-switch__menu {
    position: absolute;
    top: calc(100% + 0.4rem);
    inset-inline-end: 0;
    z-index: 1050;
    min-width: 13rem;
    max-height: min(70vh, 30rem);
    overflow-y: auto;
    margin: 0;
    padding: 0.3rem;
    list-style: none;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}

.ayat-lang-switch__menu[hidden] {
    display: none;
}

/* Signed-in hamburger menu stacks items at the start edge. */
@media (max-width: 991px) {
    .ayat-header .navbar-nav:not(.ayat-nav-actions) .ayat-lang-switch__menu {
        inset-inline-start: 0;
        inset-inline-end: auto;
    }
}

.ayat-lang-switch__option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    font-size: 0.875rem;
    line-height: 1.3;
    color: #374151;
    cursor: pointer;
    white-space: nowrap;
}

.ayat-lang-switch__option:hover,
.ayat-lang-switch__option:focus {
    background: #f0f7ff;
    outline: none;
}

.ayat-lang-switch__option[aria-selected="true"] {
    font-weight: 650;
    color: #111827;
}

.ayat-lang-switch__option[aria-selected="true"]::after {
    content: "\2713";
    margin-inline-start: auto;
    color: #2563eb;
}

/*
 * RTL hooks (html[dir="rtl"], currently Arabic). Bootstrap 4 utilities are
 * physical (left/right), so mirror the few the header relies on. A full RTL
 * audit of page bodies belongs to the translation pass.
 */

[dir="rtl"] .ayat-header .ml-auto {
    margin-left: 0 !important;
    margin-right: auto !important;
}

[dir="rtl"] .ayat-header .mr-auto {
    margin-right: 0 !important;
    margin-left: auto !important;
}

[dir="rtl"] .ayat-header .ayat-navbar-guest .ayat-nav-actions {
    margin-left: 0;
    margin-right: auto;
}

[dir="rtl"] .ayat-nav-user.header-level-info {
    margin-right: 0;
    margin-left: 0.75rem;
}


/* Settings hub: fuller language control (same set_language form) */
.ayat-settings-lang {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
    padding: 1rem 1.15rem;
    background: #fff;
    border: 1px solid #e5e9ef;
    border-radius: 12px;
}

.ayat-settings-lang__head {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.ayat-settings-lang__icon {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #f3f4f6;
    color: #374151;
    font-size: 1.05rem;
}

.ayat-settings-lang__body {
    flex: 1;
    min-width: 0;
}

.ayat-settings-lang__title {
    margin: 0 0 0.2rem;
    font-size: 1rem;
    font-weight: 600;
    color: #1a1d21;
    line-height: 1.3;
}

.ayat-settings-lang__desc {
    margin: 0;
    font-size: 0.8125rem;
    color: #6b7280;
    line-height: 1.4;
}

.ayat-settings-lang__control {
    display: flex;
    justify-content: center;
    width: 100%;
}

.ayat-lang-switch--settings {
    /* ~90% of the card so side gutters make centering visible */
    width: 90%;
    max-width: 28rem;
    margin-inline: auto;
}

.ayat-lang-switch--settings .ayat-lang-switch__code {
    display: none;
}

.ayat-lang-switch--settings .ayat-lang-switch__label {
    display: inline;
    flex: 1;
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    text-align: start;
}

.ayat-lang-switch--settings .ayat-lang-switch__btn {
    display: inline-flex;
    width: 100%;
    height: 2.75rem;
    padding: 0 1rem;
    gap: 0.65rem;
    justify-content: flex-start;
    font-size: 0.9375rem;
}

.ayat-lang-switch--settings .ayat-lang-switch__menu {
    inset-inline-start: 0;
    inset-inline-end: 0;
    width: 100%;
    min-width: 0;
    max-width: none;
}
