/* ─── Trigger Button ─────────────────────────────────────────────────────── */
.gbist-agl-nav-item {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
}
.gbist-agl-trigger {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    padding: 5px 10px;
    border: 1px solid rgba(0, 0, 0, 0.13);
    border-radius: 7px;
    background: #fff;
    color: #1d2327;
    font: inherit;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.gbist-agl-trigger:hover {
    border-color: rgba(0, 0, 0, 0.28);
    background: #fafafa;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
}
.gbist-agl-trigger:focus-visible {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}
.gbist-agl-country {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 20px;
    border-radius: 5px;
    background: #f2f4f7;
    font-size: 17px;
    line-height: 1;
}
.gbist-agl-text {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.gbist-agl-text span {
    color: #9ca3af;
    font-weight: 400;
}
.gbist-agl-caret {
    display: inline-block;
    width: 14px;
    height: 14px;
    color: #9ca3af;
    flex-shrink: 0;
    transition: transform 0.2s;
    border: none;
    background: none;
    position: relative;
}
.gbist-agl-caret::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translate(-1px, -2px);
    margin: auto;
    margin-top: 2px;
}
[aria-expanded="true"] .gbist-agl-caret::before {
    transform: rotate(-135deg) translate(-1px, -3px);
}

/* ─── Backdrop ───────────────────────────────────────────────────────────── */
.gbist-agl-overlay {
    position: fixed;
    inset: 0;
    z-index: 999997;
    display: none;
    background: transparent;
}

/* ─── Panel ──────────────────────────────────────────────────────────────── */
.gbist-agl-panel,
.gbist-agl-panel * {
    box-sizing: border-box;
}
.gbist-agl-panel {
    position: fixed;
    top: 64px;
    right: 12px;
    z-index: 999998;
    display: none;
    width: min(330px, calc(100vw - 22px));
    max-height: min(520px, calc(100vh - 84px));
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.14);
    border-radius: 12px;
    background: #fff;
    color: #1d2327;
    box-shadow:
        0 2px 8px rgba(15, 23, 42, 0.08),
        0 18px 42px rgba(15, 23, 42, 0.16);
    animation: gbist-panel-in 0.12s ease-out;
    transform-origin: top center;
}
@keyframes gbist-panel-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes gbist-sheet-in {
    from { opacity: 0; transform: translateY(40px); }
    to   { opacity: 1; transform: translateY(0); }
}
body.gbist-agl-open .gbist-agl-overlay,
body.gbist-agl-open .gbist-agl-panel {
    display: block;
}

/* ─── Search Input ───────────────────────────────────────────────────────── */
.gbist-agl-search {
    display: block;
    width: 100%;
    height: 42px;
    padding: 0 14px;
    border: 0;
    border-bottom: 1px solid #e7eaf0;
    border-radius: 12px 12px 0 0;
    background: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 400;
    color: #1d2327;
    line-height: 42px;
    transition: box-shadow 0.18s;
    outline: none;
    margin: 0;
}
.gbist-agl-search:focus {
    box-shadow: inset 0 -2px 0 #c8cdd6;
}
.gbist-agl-search::placeholder {
    color: #b0b7c3;
}

/* ─── Country List ───────────────────────────────────────────────────────── */
.gbist-agl-list {
    max-height: min(390px, calc(100vh - 190px));
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding: 4px 8px;
    scrollbar-width: thin;
    scrollbar-color: #c8cdd6 transparent;
}
.gbist-agl-list::-webkit-scrollbar { width: 4px; }
.gbist-agl-list::-webkit-scrollbar-track { background: transparent; }
.gbist-agl-list::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 99px; }
.gbist-agl-list::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

.gbist-agl-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 6px 8px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #1d2327;
    font: inherit;
    font-size: 15px;
    line-height: 1.15;
    text-align: left;
    cursor: pointer;
    transition: background 0.13s;
    appearance: none;
    -webkit-appearance: none;
}
.gbist-agl-row:hover {
    background: #f4f6f9;
}
.gbist-agl-row.is-active {
    background: #f2f2f2;
}
.gbist-agl-row.is-active .gbist-agl-row-currency {
    color: #1d2327;
}
.gbist-agl-row-main {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1 1 auto;
    gap: 10px;
    overflow: hidden;
}
.gbist-agl-row-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 34px;
    min-width: 34px;
    height: 24px;
    overflow: hidden;
    font-size: 23px;
    line-height: 1;
}
.gbist-agl-row-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.15;
}
.gbist-agl-row-currency {
    flex: 0 0 auto;
    color: #6f737b;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.15;
    white-space: nowrap;
}

/* ─── Language Section ───────────────────────────────────────────────────── */
.gbist-agl-lang {
    display: block;
    padding: 9px 12px 11px;
    border-top: 1px solid #e7eaf0;
    background: #fff;
}
.gbist-agl-lang-label {
    display: block;
    margin: 0 0 6px;
    color: #6f737b;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.gbist-agl-language-control {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}
.gbist-agl-language-check {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    color: #fff;
    font-size: 12px;
    line-height: 1;
    pointer-events: none;
}
.gbist-agl-language-select {
    width: 100%;
    height: 36px;
    padding: 0 30px 0 36px;
    border: 0;
    border-radius: 8px;
    background: #2f2f32;
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 36px;
    cursor: pointer;
    transition: background 0.18s, box-shadow 0.18s;
    outline: none;
    appearance: none;
}
.gbist-agl-language-select:focus {
    box-shadow: 0 0 0 3px rgba(47, 47, 50, 0.16);
}
.gbist-agl-language-caret {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.gbist-agl-language-caret::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(45deg) translate(-1px, -2px);
}

/* ─── Mobile (Bottom Sheet) ──────────────────────────────────────────────── */
@media (max-width: 849px) {
    .gbist-agl-overlay { background: transparent; }
    .gbist-agl-panel {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: 78vh;
        border-radius: 14px 14px 0 0;
        transform-origin: bottom center;
        animation: gbist-sheet-in 0.26s cubic-bezier(0.22, 1, 0.36, 1);
    }
    .gbist-agl-list { max-height: 52vh; }
    .gbist-agl-trigger { min-height: 32px; padding: 5px 9px; }
}