/* Pre-auth language switcher + picker modal. Shared by landing, login,
 * signup, verify-email, reset-password. Self-contained `.lang-*` classes
 * (no host-CSS dependency), mirroring the visual language of the shared
 * abuse-modal (dark slate card, cyan title) for consistency.
 *
 * The trigger shows ONLY the current language (flag + endonym). Clicking
 * it opens a modal listing the other available languages. lang-switch.js
 * builds the trigger content + the modal from a single LANGS registry, so
 * adding a language later needs no markup/CSS change. */

/* Kill Android System WebView's default blue tap-highlight rectangle — it reads
   as an "ugly blue box" over tapped buttons (e.g. the nav Log in) in the
   Capacitor app. Inherited, so one rule on <html> covers the whole pre-auth
   page (landing, login, signup, verify-email, reset-password). */
html { -webkit-tap-highlight-color: transparent; }

/* ---- Trigger (current language) ---- */
.lang-switch-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 4px 6px;
    margin: 0;
    cursor: pointer;
    color: #94a3b8;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1;
    border-radius: 8px;
}
.lang-switch-btn:hover { color: #f1f5f9; }
.lang-switch-btn:focus-visible { outline: 2px solid #38bdf8; outline-offset: 2px; }

.lang-flag {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    flex: none;
    display: block;
    object-fit: cover;
}

/* ---- Picker modal (mirrors abuse-modal) ---- */
.lang-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, visibility 0.18s ease;
}
.lang-modal-overlay.open { opacity: 1; visibility: visible; pointer-events: auto; }
.lang-modal-card { transform: translateY(6px) scale(0.985); transition: transform 0.18s ease; }
.lang-modal-overlay.open .lang-modal-card { transform: none; }
/* Kill the mobile blue tap-highlight box on the trigger + options. */
.lang-switch-btn, .lang-modal-option, .lang-modal-close { -webkit-tap-highlight-color: transparent; }

.lang-modal-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 16px;
    padding: 24px 20px;
    width: 100%;
    max-width: 340px;
    font-family: 'Manrope', 'Segoe UI', system-ui, sans-serif;
    color: #f1f5f9;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    /* Bound the height so a long language list scrolls inside the card
       instead of overflowing the centered fixed overlay (where the
       off-screen options become unreachable on short viewports). */
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
}

.lang-modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #38bdf8;
    margin: 0 0 16px;
    text-align: center;
    font-family: 'Bricolage Grotesque', 'Segoe UI', sans-serif;
    flex: none;
}

.lang-modal-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* The scroll region when the list is taller than the bounded card. */
    overflow-y: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.lang-modal-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    text-align: start;
    color: #f1f5f9;
    background: #0b1220;
    border: 1px solid #334155;
    min-height: 44px;
    transition: border-color 0.12s, background 0.12s, transform 0.08s;
}
.lang-modal-option:hover { border-color: #38bdf8; transform: translateY(-1px); }
.lang-modal-option:active { transform: translateY(0); }

.lang-modal-close {
    flex: none;
    width: 100%;
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    background: transparent;
    color: #94a3b8;
    border: 1px solid transparent;
    min-height: 40px;
}
.lang-modal-close:hover { color: #f1f5f9; }

.lang-modal-overlay button:focus-visible {
    outline: 2px solid #38bdf8;
    outline-offset: 2px;
}

@media (max-width: 480px) {
    .lang-modal-card { padding: 20px 16px; }
    .lang-modal-title { font-size: 1.05rem; }
}
