/* ==========================================================================
   Xyra Noir — Currency switcher & popup
   ========================================================================== */

/* ---- Header switcher ---- */
.xn-currency { position: relative; }
.xn-currency__toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid var(--xn-border);
    color: var(--xn-white);
    padding: 7px 10px;
    border-radius: var(--xn-radius);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    cursor: pointer;
    line-height: 1;
    transition: border-color var(--xn-transition), color var(--xn-transition);
}
.xn-currency__toggle:hover {
    border-color: var(--xn-gold);
    background: var(--xn-gold);
    color: #000;
}
button.xn-currency__toggle:hover span.xn-currency__code,
button.xn-currency__toggle:hover span.xn-currency__caret {
    color: #000;
}
.xn-currency__flag { display: inline-flex; align-items: center; line-height: 0; }
.xn-currency__flag .xn-flag {
    width: 18px; height: 12px;
    border-radius: 2px;
    border: 1px solid rgba(255,255,255,0.15);
    display: block;
}
.xn-currency-popup__opt .xn-flag { width: 28px; height: 19px; }
.xn-currency__caret { font-size: 0.6rem; opacity: 0.8; }

.xn-currency__menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--xn-bg-secondary);
    border: 1px solid var(--xn-border);
    list-style: none;
    margin: 0;
    padding: 6px;
    z-index: 700;
    display: none;
}
.xn-currency.is-open .xn-currency__menu { display: block; }
.xn-currency__menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    color: var(--xn-white);
    font-size: 0.82rem;
    border-radius: var(--xn-radius);
}
.xn-currency__menu a:hover { background: rgba(255,255,255,0.04); color: var(--xn-gold); }
.xn-currency__menu a.is-active { color: var(--xn-gold); }
.xn-currency__menu .xn-currency__code { font-weight: 600; min-width: 34px; }
.xn-currency__menu .xn-currency__label { color: var(--xn-muted); font-size: 0.76rem; }
.xn-currency__menu a:hover .xn-currency__label { color: var(--xn-white); }

/* ---- First-visit popup ---- */
.xn-currency-popup { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; }
.xn-currency-popup[hidden] { display: none; }
.xn-currency-popup__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.72); backdrop-filter: blur(3px); }
.xn-currency-popup__box {
    position: relative;
    background: var(--xn-bg-secondary);
    border: 1px solid var(--xn-border);
    max-width: 460px;
    width: calc(100% - 40px);
    padding: 36px 32px;
    text-align: center;
}
.xn-currency-popup__box h3 {
    font-family: var(--xn-font-head);
    font-size: 1.7rem;
    color: var(--xn-white);
    margin: 0 0 10px;
}
.xn-currency-popup__box p { color: var(--xn-muted); font-size: 0.88rem; margin: 0 0 24px; }
.xn-currency-popup__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.xn-currency-popup__opt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px 10px;
    border: 1px solid var(--xn-border);
    color: var(--xn-white);
    transition: all var(--xn-transition);
}
.xn-currency-popup__opt:hover { border-color: var(--xn-gold); color: var(--xn-gold); transform: translateY(-2px); }
.xn-currency-popup__opt .xn-currency__flag { font-size: 1.6rem; }
.xn-currency-popup__opt .xn-currency__code { font-weight: 700; letter-spacing: 0.08em; }
.xn-currency-popup__opt .xn-currency__label { color: var(--xn-muted); font-size: 0.74rem; }

@media (max-width: 420px) {
    .xn-currency-popup__grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Mobile side sticky currency tab (left edge, vertically centered)
   Shown only on mobile; desktop keeps the header dropdown.
   ========================================================================== */
.xn-currency-tab { display: none; }

@media (max-width: 1200px) {
    /* Hide the in-header switcher on mobile/tablet, show the side tab instead */
    .xn-currency--header { display: none; }

    .xn-currency-tab {
        display: block;
        position: fixed;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        z-index: 1200;
    }

    /* The always-visible handle stuck to the edge */
    .xn-currency-tab__handle {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        background: var(--xn-gold);
        color: #000;
        border: none;
        padding: 12px 8px;
        cursor: pointer;
        border-radius: 0 8px 8px 0;
        box-shadow: 2px 2px 12px rgba(0,0,0,0.45);
        line-height: 1;
    }
    .xn-currency-tab__handle:hover { background: var(--xn-gold-hover); }
    .xn-currency-tab__flag { line-height: 0; }
    .xn-currency-tab__flag .xn-flag { width: 22px; height: 15px; border-radius: 2px; display: block; }
    .xn-currency-tab__code { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; }

    /* Slide-out panel */
    .xn-currency-tab__panel {
        position: absolute;
        left: 0;
        top: 50%;
        transform: translate(-110%, -50%);
        width: 220px;
        background: var(--xn-bg-secondary);
        border: 1px solid var(--xn-border);
        border-left: none;
        border-radius: 0 8px 8px 0;
        padding: 14px 12px;
        box-shadow: 4px 4px 24px rgba(0,0,0,0.5);
        opacity: 0;
        visibility: hidden;
        transition: transform 0.28s ease, opacity 0.28s ease, visibility 0.28s;
    }
    /* When open, slide it to sit just right of the handle */
    .xn-currency-tab.is-open .xn-currency-tab__panel {
        transform: translate(46px, -50%);
        opacity: 1;
        visibility: visible;
    }
    .xn-currency-tab.is-open .xn-currency-tab__handle {
        border-radius: 0;
    }

    .xn-currency-tab__title {
        font-size: 0.68rem;
        letter-spacing: 0.2em;
        text-transform: uppercase;
        color: var(--xn-gold);
        margin: 0 0 10px;
    }
    .xn-currency-tab__opt {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 9px 8px;
        color: var(--xn-white);
        border-radius: var(--xn-radius);
        font-size: 0.82rem;
    }
    .xn-currency-tab__opt .xn-flag { width: 18px; height: 12px; border: 1px solid rgba(255,255,255,0.15); border-radius: 2px; }
    .xn-currency-tab__opt:hover { background: rgba(255,255,255,0.05); color: var(--xn-gold); }
    .xn-currency-tab__opt.is-active { color: var(--xn-gold); }
    .xn-currency-tab__opt .xn-currency__code { font-weight: 600; min-width: 34px; }
    .xn-currency-tab__opt .xn-currency__label { color: var(--xn-muted); font-size: 0.72rem; }
}
