/*
 * Khmer language module — the EN | ខ្មែរ switch (common/i18n.func.php: i18n_switch()) and
 * what Khmer text needs from the page. Linked on the member portal, the sign-in pages and
 * the staff portal (/pos/), in both languages.
 */

/* ---------- the switch: two links in a pill, the current one filled ---------- */

.i18n-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .3);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
    line-height: 1;
    white-space: nowrap;
}
.i18n-switch a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 28px;
    padding: 0 11px;
    border-radius: 999px;
    font: 700 12px/1 "Outfit", "Segoe UI", system-ui, -apple-system, sans-serif;
    letter-spacing: .05em;
    color: rgba(255, 255, 255, .88);
    text-decoration: none !important;
    transition: background-color .18s ease, color .18s ease, box-shadow .18s ease;
}
.i18n-switch a[lang="km"] {
    font: 400 14px/1 "Suwannaphum", "Kantumruy Pro", "Khmer OS System", "Khmer UI", sans-serif;
    letter-spacing: 0;
    padding-top: 2px;
}
.i18n-switch a:hover { color: #fff; background: rgba(255, 255, 255, .14); }
.i18n-switch a.is-on,
.i18n-switch a.is-on:hover {
    background: #fff;
    color: #23407a;
    box-shadow: 0 1px 4px rgba(10, 25, 60, .28);
    cursor: default;
}
.i18n-switch a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* On a light background (the sign-in card pages use the dark one) */
.i18n-switch.is-light { background: #eef2f8; border-color: #dce3ef; box-shadow: none; }
.i18n-switch.is-light a { color: #4a5872; }
.i18n-switch.is-light a:hover { color: #1d2b4a; background: rgba(35, 64, 122, .08); }
.i18n-switch.is-light a.is-on { background: #23407a; color: #fff; }
.i18n-switch.is-light a:focus-visible { outline-color: #23407a; }

/* ---------- member portal header (member/mbrheader.php) ---------- */

.main-navbar .navbar-nav > li.hnav-i18n { display: flex; align-items: center; margin-right: 8px; }
.main-navbar .navbar-nav > li.hnav-i18n-ph { display: none; }

/* Phones: menu button, switch, the dock (centred, 25px between its tiles) and the profile
   picture. The switch is the desktop one, made smaller, 10px after the ☰. The dock is centred,
   so the room between the ☰ and the dock grows with the screen, and the switch comes in sizes
   that each leave 6px or more before the dock. */
@media (max-width: 575.98px) {
    .main-navbar .navbar-nav > li.hnav-i18n { display: none; }
    .main-navbar .navbar-nav > li.hnav-i18n-ph { display: flex; align-items: center; }
    /* The menu button moves 12px towards the edge (menu3d.css gives it 6px a side, !important);
       its right padding is the 10px before the switch. Scoped to the member header's .hnav-left:
       Admin > Khmer Language links this stylesheet too, and its header has a menu button. */
    .main-navbar .hnav-left { margin-right: 0 !important; margin-left: -12px; }
    .main-navbar .hnav-left .nav-link[data-toggle="sidebar"] { padding-left: 2px !important; padding-right: 10px !important; }
    .hnav-i18n-ph .i18n-switch { padding: 2px; gap: 1px; }
    .hnav-i18n-ph .i18n-switch a { min-width: 0; padding-left: 7px; padding-right: 7px; }
}
/* Below 412px: iPhone 12–16 and SE, most Androids (384–393px) */
@media (max-width: 411.98px) {
    .hnav-i18n-ph .i18n-switch a { height: 26px; padding-left: 5px; padding-right: 5px; font-size: 11px; }
    .hnav-i18n-ph .i18n-switch a[lang="km"] { font-size: 13px; }
}
/* Below 388px (375px iPhones, 360px Androids) the 10px still fits: the ☰ sits 2px nearer the
   edge, the switch is 2px narrower, and the dock's sides are 6px like its top and bottom
   (menu3d.css: 9px), which leaves its tiles and 25px gaps as they are. */
@media (max-width: 387.98px) {
    .main-navbar .hnav-left .nav-link[data-toggle="sidebar"] { padding-left: 0 !important; }
    .hnav-i18n-ph .i18n-switch a { padding-left: 4.5px; padding-right: 4.5px; }
    .main-navbar .mdock-bar { padding-left: 6px; padding-right: 6px; }
}
/* Below 375px: 360px Androids */
@media (max-width: 374.98px) {
    .hnav-i18n-ph .i18n-switch a { padding-left: 3px; padding-right: 3px; font-size: 10.5px; }
    .hnav-i18n-ph .i18n-switch a[lang="km"] { font-size: 12.5px; }
}

/* ---------- pages without the portal header: sign-in, sign-up (common/pub.header.php) ---------- */

.i18n-float { position: fixed; top: 14px; right: 14px; z-index: 1040; }
.i18n-float .i18n-switch { background: rgba(17, 24, 39, .32); border-color: rgba(255, 255, 255, .34);
                           -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }

/* ---------- Khmer text ---------- */

/* Letter-spacing pulls Khmer clusters apart — the words have no spaces of their own, so the
   gaps land inside words. Inputs keep theirs (codes, OTP boxes). */
html[lang="km"] body *:not(input):not(textarea):not(.i18n-switch a) { letter-spacing: normal !important; }
