/* ═══════════════════════════════════════════════════════════════
   GAT — Manual Language Switcher (floating slide-out widget)
   ═══════════════════════════════════════════════════════════════ */

.gat-switcher {
    position: fixed;
    z-index: 99998;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
}

/* Position variants */
.gat-switcher.gat-pos-top-left     { top: 20px;    left: 20px; }
.gat-switcher.gat-pos-top-right    { top: 20px;    right: 20px; }
.gat-switcher.gat-pos-middle-left  { top: 50%;     left: 0;       transform: translateY(-50%); }
.gat-switcher.gat-pos-middle-right { top: 50%;     right: 0;      transform: translateY(-50%); }
.gat-switcher.gat-pos-bottom-left  { bottom: 60px; left: 20px; }
.gat-switcher.gat-pos-bottom-right { bottom: 60px; right: 20px; }

/* Edge-snapped corners for middle positions */
.gat-switcher.gat-pos-middle-left  .gat-switcher-toggle { border-radius: 0 6px 6px 0; }
.gat-switcher.gat-pos-middle-right .gat-switcher-toggle { border-radius: 6px 0 0 6px; }

.gat-switcher-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #1a1a2e;
    color: #fff;
    border: none;
    padding: 10px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 10px rgba(0,0,0,0.25);
    transition: background 0.2s, transform 0.2s;
}

.gat-switcher-toggle:hover {
    background: #2a2a4e;
    transform: scale(1.02);
}

.gat-switcher-arrow {
    font-size: 10px;
    transition: transform 0.25s;
}

.gat-switcher.is-open .gat-switcher-arrow {
    transform: rotate(180deg);
}

.gat-switcher-list {
    list-style: none;
    margin: 6px 0 0 0;
    padding: 6px 0;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 180px;
    max-height: 320px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}

.gat-switcher.is-open .gat-switcher-list {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Align dropdown for right/left positions */
.gat-switcher.gat-pos-top-right    .gat-switcher-list,
.gat-switcher.gat-pos-bottom-right .gat-switcher-list,
.gat-switcher.gat-pos-middle-right .gat-switcher-list {
    position: absolute;
    right: 0;
}
.gat-switcher.gat-pos-top-left     .gat-switcher-list,
.gat-switcher.gat-pos-bottom-left  .gat-switcher-list,
.gat-switcher.gat-pos-middle-left  .gat-switcher-list {
    position: absolute;
    left: 0;
}

/* Open upward for bottom positions */
.gat-switcher.gat-pos-bottom-left  .gat-switcher-list,
.gat-switcher.gat-pos-bottom-right .gat-switcher-list {
    bottom: 100%;
    margin: 0 0 6px 0;
}

.gat-switcher-item {
    display: block;
    padding: 8px 16px;
    color: #1a1a2e;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
}

.gat-switcher-item:hover {
    background: #f0f4ff;
    color: #1a1a2e;
}

.gat-switcher-item.is-active {
    background: #1a1a2e;
    color: #fff;
    font-weight: 600;
}

.gat-switcher-item.is-active:hover {
    background: #2a2a4e;
    color: #fff;
}

/* Auto-detect entry — separated from language list */
.gat-switcher-item.gat-auto-detect {
    color: #555;
    font-style: italic;
    border-bottom: 1px solid #eee;
    margin-bottom: 4px;
    padding-bottom: 10px;
}

.gat-switcher-item.gat-auto-detect:hover {
    background: #fff8e1;
    color: #1a1a2e;
}

/* Flag images — used by both toggle button and dropdown items */
.gat-switcher .gat-flag-img,
.gat-switcher-item .gat-flag-img,
.gat-switcher-toggle .gat-flag-img {
    display: inline-block;
    width: 22px;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
    vertical-align: middle;
    flex-shrink: 0;
}

/* Make items flex-rows so flag + label align nicely */
.gat-switcher-toggle,
.gat-switcher-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gat-label-text {
    line-height: 1.2;
}

.gat-flag-emoji {
    font-size: 16px;
    line-height: 1;
}

/* Text badge fallback — shown when flag image fails to load or is unavailable.
   Looks like a small colored chip so the switcher never feels broken. */
.gat-flag-badge {
    display: inline-block;
    min-width: 28px;
    padding: 1px 6px;
    background: linear-gradient(180deg, #2a3956 0%, #1a1a2e 100%);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-align: center;
    border-radius: 3px;
    box-shadow: inset 0 -1px 0 rgba(0,0,0,0.2);
    line-height: 16px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Defeat LiteSpeed / WP Rocket / a3 Lazy Load on switcher flags */
.gat-switcher .gat-flag-img {
    visibility: visible !important;
    opacity: 1 !important;
}

/* Mobile — pull middle-position switchers to bottom for thumb reach */
@media (max-width: 600px) {
    .gat-switcher.gat-pos-middle-left,
    .gat-switcher.gat-pos-middle-right {
        top: auto;
        bottom: 80px;
        transform: none;
    }
    .gat-switcher.gat-pos-middle-left  { left: 10px; }
    .gat-switcher.gat-pos-middle-right { right: 10px; }
}

/* ─── Admin: language checkbox grid ───────────────────────────────────── */
/* (Loaded only on the switcher's settings page row — kept here so the
   switcher module owns all its styles in one file.) */
.gat-switcher-langs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
    max-width: 900px;
    padding: 12px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.gat-lang-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.gat-lang-checkbox:hover {
    border-color: #2271b1;
    background: #f0f6fc;
}
.gat-lang-checkbox input { margin: 0; }
.gat-lang-checkbox .gat-flag { font-size: 18px; }
.gat-lang-checkbox .gat-flag-img {
    width: 24px;
    height: 18px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
    flex-shrink: 0;
}
.gat-lang-checkbox code {
    margin-left: auto;
    background: #f0f0f1;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
}
