/* Вынесено из layouts/_region_switcher.php (ревью 18.11, A1-21, волна 5): было встроено в каждую страницу админки, теперь файл кэшируется браузером. Правка — здесь. */
    /* ==================================================================
       Region switcher — scoped iOS-style pill dropdown (self-contained)
       ================================================================== */
    .ks-region-switcher { position: relative; display: inline-block; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
    .ks-region-switcher__trigger {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        height: 36px;
        padding: 0 12px 0 10px;
        border: 1px solid rgba(15, 23, 42, 0.1);
        border-radius: 999px;
        background: #fff;
        color: #0f172a;
        font-family: inherit;
        font-size: 13px;
        font-weight: 600;
        letter-spacing: -0.005em;
        line-height: 1;
        cursor: pointer;
        transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
        white-space: nowrap;
    }
    /* Hover only on real hover-capable pointers (fixes iOS Safari sticky-hover
       bug that otherwise requires a double-tap to activate the trigger). */
    @media (hover: hover) and (pointer: fine) {
        .ks-region-switcher__trigger:hover {
            background: #fafafa;
            border-color: rgba(15, 23, 42, 0.18);
            box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
        }
    }
    .ks-region-switcher__trigger:active { transform: scale(0.97); }
    .ks-region-switcher__trigger:focus-visible { outline: 2px solid #6366f1; outline-offset: 2px; }
    .ks-region-switcher.is-open .ks-region-switcher__trigger {
        background: rgba(99, 102, 241, 0.1);
        border-color: #6366f1;
        color: #6366f1;
    }
    /* Corner help badge on the trigger (.help-anchor, see base.php). The default
       -4/-4 offset is tuned for square-ish controls; on a 999px pill that corner
       of the bounding box is empty, so the badge would float off the rounded
       edge. 0/-3 keeps roughly half of it on the cap, and 13px keeps it inside
       the navbar's top padding. */
    .ks-region-switcher .help-anchor > .help-tip {
        top: -3px;
        right: 0;
        width: 13px;
        height: 13px;
        font-size: 8px;
    }
    .ks-region-switcher__flag { font-size: 16px; line-height: 1; filter: saturate(1.1); }
    /* Globe icon — always visible in the trigger. Coloured with the brand blue
       so the region pill is visually distinct from the neighbouring language
       pill (which uses a country flag emoji). */
    .ks-region-switcher__icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 16px;
        height: 16px;
        color: #007aff;
        transition: color 0.18s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .ks-region-switcher__icon svg { display: block; width: 100%; height: 100%; }
    @media (hover: hover) and (pointer: fine) {
        .ks-region-switcher__trigger:hover .ks-region-switcher__icon { transform: rotate(18deg); }
    }
    .ks-region-switcher.is-open .ks-region-switcher__icon { color: #6366f1; transform: rotate(18deg); }
    .ks-region-switcher__code { font-size: 12px; font-weight: 700; letter-spacing: 0.02em; }
    .ks-region-switcher__name {
        color: #64748b;
        font-weight: 500;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .ks-region-switcher.is-open .ks-region-switcher__name { color: #6366f1; }
    .ks-region-switcher__chev {
        color: #94a3b8;
        transition: transform 0.2s ease, color 0.2s ease;
        margin-left: 2px;
    }
    .ks-region-switcher.is-open .ks-region-switcher__chev { transform: rotate(-180deg); color: #6366f1; }

    .ks-region-switcher__menu {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        min-width: 260px;
        padding: 6px;
        background: rgba(255, 255, 255, 0.95);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        backdrop-filter: saturate(180%) blur(20px);
        border: 1px solid rgba(15, 23, 42, 0.08);
        border-radius: 14px;
        box-shadow: 0 18px 50px -12px rgba(15, 23, 42, 0.28), 0 3px 10px rgba(15, 23, 42, 0.06);
        opacity: 0;
        transform: translateY(-6px) scale(0.96);
        transform-origin: top right;
        pointer-events: none;
        transition: opacity 0.18s ease, transform 0.18s ease;
        z-index: 9999;
        max-height: min(70vh, 420px);
        overflow-y: auto;
    }
    .ks-region-switcher.is-open .ks-region-switcher__menu {
        opacity: 1;
        transform: translateY(0) scale(1);
        pointer-events: auto;
    }
    .ks-region-switcher__menu-header {
        padding: 8px 10px 6px;
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: #94a3b8;
    }
    .ks-region-switcher__item {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        padding: 9px 10px;
        border: 0;
        background: transparent;
        border-radius: 10px;
        color: #0f172a;
        font-family: inherit;
        font-size: 14px;
        text-align: left;
        cursor: pointer;
        transition: background 0.15s ease, color 0.15s ease;
    }
    /* Keep :focus-visible (keyboard) unconditional, gate :hover behind real pointers
       so the first tap on iPad/Safari acts as a click, not a sticky-hover gesture. */
    .ks-region-switcher__item:focus-visible { background: rgba(99, 102, 241, 0.08); outline: none; }
    @media (hover: hover) and (pointer: fine) {
        .ks-region-switcher__item:hover { background: rgba(99, 102, 241, 0.08); outline: none; }
    }
    .ks-region-switcher__item:active { background: rgba(99, 102, 241, 0.14); }
    .ks-region-switcher__item.is-active { background: rgba(99, 102, 241, 0.1); }
    .ks-region-switcher__item-flag {
        font-size: 20px;
        line-height: 1;
        width: 24px;
        text-align: center;
        filter: saturate(1.1);
    }
    .ks-region-switcher__item-label {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 1px;
        line-height: 1.2;
    }
    .ks-region-switcher__item-code { font-size: 15px; font-weight: 700; letter-spacing: 0.03em; color: #0f172a; }
    .ks-region-switcher__item-name { font-size: 11px; font-weight: 500; color: #94a3b8; }
    .ks-region-switcher__item-check {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 20px;
        height: 20px;
        color: #6366f1;
        opacity: 0;
        transform: scale(0.6);
        transition: opacity 0.15s ease, transform 0.2s ease;
    }
    .ks-region-switcher__item.is-active .ks-region-switcher__item-check { opacity: 1; transform: scale(1); }
    .ks-region-switcher.is-compact .ks-region-switcher__name { display: none; }

    @media (max-width: 1199px) {
        .ks-region-switcher__name { display: none; }
    }
    @media (max-width: 767px) {
        .ks-region-switcher__trigger { height: 38px; padding: 0 10px; }
        .ks-region-switcher__menu { right: -4px; min-width: 220px; }
    }
    @media (max-width: 479px) {
        .ks-region-switcher__code { font-size: 11px; }
    }

    /* Legacy alias so the existing gal2 editor markup keeps working */
    .gal2-region-switcher { position: relative; display: inline-block; }
