﻿:root {
    --navy: #0a2d52;
    --navy-2: #0d3a68;
    --bg: #071828;
    --bg-2: #0c2138;
    --surface: #ffffff;
    --surface-2: #f4f7fb;
    --hairline: #e6ebf2;
    --gold: #d4a017;
    --gold-bright: #f0c14b;
    --brass: #c4920f;
    --text: #152033;
    --text-on-dark: #ffffff;
    --muted: #6b7789;
    --muted-2: #8a94a6;
    --up: #1b9e55;
    --down: #d43d3d;
    --buy: #1d6fd8;
    --buy-bright: #1d6fd8;
    --buy-soft: rgba(29, 111, 216, .12);
    --buy-border: rgba(29, 111, 216, .28);
    --sell: #e11d2e;
    --sell-bright: #e11d2e;
    --sell-soft: rgba(225, 29, 46, .12);
    --sell-border: rgba(225, 29, 46, .28);
    --radius: 14px;
    --shadow-card: 0 8px 24px rgba(0, 0, 0, .18);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    direction: rtl;
}

body,
body *,
body *::before,
body *::after {
    font-family: 'Vazirmatn', sans-serif !important;
}

body {
    background:
        radial-gradient(ellipse 90% 70% at 15% 85%, rgba(212, 160, 23, .22), transparent 55%),
        radial-gradient(ellipse 60% 50% at 80% 12%, rgba(30, 90, 140, .35), transparent 55%),
        linear-gradient(160deg, #071828 0%, #0f3350 45%, #163a42 100%);
    background-attachment: fixed;
    color: var(--text-on-dark);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

html {
    scroll-behavior: smooth;
}

a {
    color: var(--gold-bright);
}

/* ---------- Sticky top (header + nav + ticker) ---------- */
.site-top {
    position: sticky;
    top: 0;
    z-index: 200;
    background: linear-gradient(180deg, rgba(10, 45, 82, .96) 0%, rgba(13, 58, 104, .94) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .28);
}

/* ---------- Header ---------- */
header {
    position: relative;
    padding: 16px 20px 12px;
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    overflow: hidden;
}

    header::before {
        content: "";
        position: absolute;
        inset: 0;
        background-image:
            radial-gradient(circle at 20% 30%, rgba(255, 220, 140, .1) 0 2px, transparent 3px),
            radial-gradient(circle at 70% 60%, rgba(255, 255, 255, .05) 0 1.5px, transparent 2.5px);
        background-size: 180px 180px, 140px 140px;
        opacity: .65;
        pointer-events: none;
    }

.header-row {
    position: relative;
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(155deg, var(--gold-bright), var(--brass));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    color: #1a1400;
    font-size: 20px;
    box-shadow: 0 4px 14px rgba(212, 160, 23, .28);
    flex-shrink: 0;
}

.brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, .18);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
    background: rgba(255, 255, 255, .1);
}

    .brand-logo img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        display: block;
    }

.brand h1 {
    font-size: 1.32rem;
    font-weight: 900;
    margin: 0;
    letter-spacing: -.2px;
    line-height: 1.25;
    color: #fff;
}

.brand p {
    margin: 2px 0 0;
    font-size: .78rem;
    color: rgba(255, 255, 255, .72);
    font-weight: 600;
}

.status-cluster {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .14);
    padding: 7px 12px;
    border-radius: 999px;
    font-size: .78rem;
    color: rgba(255, 255, 255, .85);
    font-weight: 600;
}

/* ---------- Section nav ---------- */
.section-nav {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 1180px;
    margin: 0 auto;
    padding: 10px 20px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.section-nav::-webkit-scrollbar {
    display: none;
}

.section-nav-btn {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, .16);
    background: rgba(255, 255, 255, .08);
    color: rgba(255, 255, 255, .78);
    font-family: inherit;
    font-size: .82rem;
    font-weight: 700;
    padding: 8px 15px;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: color .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.section-nav-btn:hover {
    color: #fff;
    border-color: rgba(240, 193, 75, .45);
    background: rgba(255, 255, 255, .14);
}

.section-nav-btn.is-active {
    color: #1a1400;
    background: linear-gradient(180deg, var(--gold-bright), var(--brass));
    border-color: transparent;
    box-shadow: 0 3px 12px rgba(212, 160, 23, .35);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--up);
    box-shadow: 0 0 0 3px rgba(27, 158, 85, .22);
}

    .dot.blink {
        animation: pulse 1.8s ease-in-out infinite;
    }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .35; }
}

.clock {
    font-weight: 900;
    color: #fff;
    direction: ltr;
    unicode-bidi: isolate;
}

.jdate {
    font-size: .72rem;
    color: rgba(255, 255, 255, .72);
    margin-top: 2px;
    font-weight: 600;
}

.clock-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* ---------- Ticker ---------- */
.ticker-wrap {
    background: linear-gradient(90deg, #0a1a2e 0%, #122843 40%, #0d2138 100%);
    border-bottom: 1px solid rgba(240, 193, 75, .28);
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    direction: ltr;
}

    .ticker-wrap::before, .ticker-wrap::after {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        width: 56px;
        z-index: 2;
        pointer-events: none;
    }

    .ticker-wrap::before {
        right: 0;
        background: linear-gradient(to left, #0d2138, transparent);
    }

    .ticker-wrap::after {
        left: 0;
        background: linear-gradient(to right, #0a1a2e, transparent);
    }

.ticker-track {
    display: inline-flex;
    width: max-content;
    padding: 9px 0;
    animation: scroll-ticker var(--ticker-duration, 60s) linear infinite;
    will-change: transform;
}

.ticker-wrap:hover .ticker-track {
    animation-play-state: paused;
}

.ticker-group {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 28px;
    padding-inline-end: 28px;
}

@keyframes scroll-ticker {
    from { transform: translateX(0); }
    to { transform: translateX(calc(-1 * var(--ticker-shift, 50%))); }
}

.tick-item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: .82rem;
    color: rgba(255, 255, 255, .75);
    flex-shrink: 0;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .08);
}

.tick-name {
    font-weight: 800;
    color: #fff;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tick-quote {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    direction: ltr;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(0, 0, 0, .2);
    border: 1px solid rgba(255, 255, 255, .06);
}

.tick-quote-label {
    font-size: .62rem;
    font-weight: 900;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    color: #fff;
}

    .tick-quote-label.buy {
        background: #1d6fd8;
    }

    .tick-quote-label.sell {
        background: #e11d2e;
    }

.tick-quote-val {
    font-family: 'Vazirmatn', sans-serif !important;
    font-weight: 900;
    direction: ltr;
    unicode-bidi: isolate;
}

.tick-quote-buy {
    color: #6db3ff;
}

.tick-quote-sell {
    color: #ff7b86;
}

.tick-quote-sep {
    width: 1px;
    height: 12px;
    background: rgba(255, 255, 255, .25);
    flex-shrink: 0;
}

.tick-quote--single .tick-quote-val {
    color: #f0c14b;
}

    .tick-item .tchg {
        font-weight: 800;
        direction: ltr;
        display: inline-block;
    }

        .tick-item .tchg.up {
            color: #6ddea0;
        }

        .tick-item .tchg.down {
            color: #ff8f8f;
        }

/* ---------- Layout ---------- */
main {
    max-width: 1180px;
    margin: 0 auto;
    padding: 26px 20px 10px;
}

.section {
    margin-bottom: 34px;
    scroll-margin-top: var(--sticky-offset, 190px);
}

.section-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, .14);
}

    .section-head .eyebrow {
        font-size: .68rem;
        color: #1a1400;
        letter-spacing: .4px;
        font-weight: 800;
        background: linear-gradient(180deg, var(--gold-bright), var(--brass));
        padding: 3px 9px;
        border-radius: 6px;
    }

    .section-head h2 {
        font-size: 1.08rem;
        margin: 0;
        font-weight: 900;
        letter-spacing: -.2px;
        color: #fff;
    }

    .section-head span.sub {
        font-size: .78rem;
        color: rgba(255, 255, 255, .7);
        margin-inline-start: auto;
        font-weight: 600;
    }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}

.rate-card {
    background: rgba(255, 255, 255, .96);
    border: 1px solid rgba(255, 255, 255, .55);
    border-radius: 18px;
    padding: 15px 15px 13px;
    position: relative;
    transition: border-color .2s, transform .2s, box-shadow .2s;
    overflow: hidden;
    cursor: pointer;
    color: var(--text);
    box-shadow: var(--shadow-card);
}

    .rate-card::before {
        content: "";
        position: absolute;
        top: 0;
        left: 10%;
        right: 10%;
        height: 3px;
        background: linear-gradient(90deg, transparent, rgba(240, 193, 75, .85), transparent);
        pointer-events: none;
    }

    .rate-card:hover {
        border-color: rgba(212, 160, 23, .45);
        transform: translateY(-2px);
        box-shadow: 0 14px 32px rgba(0, 0, 0, .22);
    }

.rate-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 8px;
}

.rate-label {
    font-weight: 800;
    font-size: .94rem;
    letter-spacing: -.15px;
    color: #182433;
}

.rate-unit {
    font-size: .66rem;
    color: var(--muted);
    background: #f4f7fb;
    border: 1px solid var(--hairline);
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
    font-weight: 700;
}

/* ---------- Quote panel (buy / sell) ---------- */
.quote-panel {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: stretch;
    margin-bottom: 12px;
    border-radius: 12px;
    border: 1px solid var(--hairline);
    background: #f4f7fb;
    overflow: hidden;
}

.quote-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 10px 12px;
    min-width: 0;
}

.quote-side--buy {
    background: linear-gradient(165deg, rgba(29, 111, 216, .12), rgba(29, 111, 216, .03) 58%, transparent);
}

.quote-side--sell {
    background: linear-gradient(195deg, rgba(225, 29, 46, .12), rgba(225, 29, 46, .03) 58%, transparent);
}

.quote-split {
    width: 1px;
    align-self: stretch;
    margin: 10px 0;
    background: linear-gradient(180deg, transparent, #d5dbe6 15%, #c5cedb 50%, #d5dbe6 85%, transparent);
    position: relative;
}

    .quote-split span {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) rotate(45deg);
        width: 6px;
        height: 6px;
        border: 1px solid #c5cedb;
        background: #fff;
    }

.quote-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .04em;
    padding: 4px 10px;
    border-radius: 6px;
    line-height: 1;
}

.quote-badge-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.quote-badge--buy {
    color: var(--buy);
    background: var(--buy-soft);
    border: 1px solid var(--buy-border);
}

.quote-badge--sell {
    color: var(--sell);
    background: var(--sell-soft);
    border: 1px solid var(--sell-border);
}

.quote-amount {
    font-family: 'Vazirmatn', sans-serif !important;
    direction: ltr;
    text-align: center;
    width: 100%;
    font-weight: 900;
    font-size: 1.2rem;
    letter-spacing: -.02em;
    line-height: 1.15;
    color: var(--buy);
    transition: opacity .18s ease, color .18s ease, transform .18s ease;
    word-break: break-all;
}

.quote-amount--sell {
    color: var(--sell);
}

.quote-panel--single {
    grid-template-columns: 1fr;
}

.quote-side--single {
    background: linear-gradient(160deg, rgba(212, 160, 23, .1), rgba(29, 111, 216, .05) 55%, transparent);
    padding: 16px 10px 14px;
}

.quote-amount--single {
    color: #101929;
    font-size: 1.28rem;
}

.flip-number.flip {
    animation: flashvalue .5s ease;
}

@keyframes flashvalue {
    0% { opacity: 1; transform: scale(1); }
    35% { opacity: .4; transform: scale(.98); }
    100% { opacity: 1; transform: scale(1); }
}

.rate-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 6px;
    border-top: 1px solid var(--hairline);
}

.delta {
    font-size: .8rem;
    font-weight: 800;
    direction: ltr;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

    .delta.up { color: var(--up); }
    .delta.down { color: var(--down); }

.spark {
    width: 78px;
    height: 26px;
    flex-shrink: 0;
}

    .spark polyline {
        fill: none;
        stroke-width: 2;
    }

/* ---------- Settings ---------- */
.settings {
    background: rgba(255, 255, 255, .96);
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-top: 6px;
    color: var(--text);
    box-shadow: var(--shadow-card);
}

.settings-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    gap: 10px;
}

    .settings-top h3 {
        margin: 0;
        font-size: .92rem;
        font-weight: 800;
        color: #182433;
    }

    .settings-top .hint {
        font-size: .75rem;
        color: var(--muted);
        font-weight: 600;
    }

.chev {
    transition: transform .2s;
    color: var(--muted);
}

.settings.open .chev {
    transform: rotate(180deg);
}

.settings-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
}

.settings.open .settings-body {
    max-height: 340px;
}

.settings-inner {
    padding-top: 14px;
    font-size: .85rem;
    color: var(--muted);
    line-height: 2;
}

.key-row {
    display: flex;
    gap: 8px;
    margin: 10px 0;
    flex-wrap: wrap;
}

    .key-row input {
        flex: 1;
        min-width: 180px;
        background: var(--surface-2);
        border: 1px solid var(--hairline);
        color: var(--text);
        padding: 9px 12px;
        border-radius: 8px;
        font-family: inherit;
        font-size: .85rem;
    }

    .key-row button {
        background: linear-gradient(180deg, var(--gold-bright), var(--brass));
        border: none;
        color: #1a1400;
        font-weight: 800;
        padding: 9px 18px;
        border-radius: 8px;
        cursor: pointer;
        font-family: inherit;
        font-size: .85rem;
    }

        .key-row button:active {
            transform: scale(.97);
        }

.mode-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .74rem;
    color: var(--muted);
    background: var(--surface-2);
    padding: 4px 10px;
    border-radius: 999px;
    margin-top: 6px;
    font-weight: 600;
}

footer {
    text-align: center;
    padding: 26px 20px 40px;
    color: rgba(255, 255, 255, .65);
    font-size: .76rem;
    line-height: 2;
    font-weight: 600;
}

    footer a {
        color: var(--gold-bright);
    }

@media (max-width:560px) {
    .brand h1 {
        font-size: 1.08rem;
    }

    .clock {
        font-size: .95rem;
    }

    .flip-tile {
        font-size: 1rem;
        padding: 4px 3px;
    }

    .section-head span.sub {
        display: none;
    }

    header {
        padding: 14px 14px 10px;
    }

    .section-nav {
        padding: 8px 14px 10px;
        gap: 6px;
    }

    .section-nav-btn {
        font-size: .76rem;
        padding: 7px 12px;
    }

    main {
        padding: 20px 14px 6px;
    }

    .quote-amount {
        font-size: 1.02rem;
    }

    .tick-name {
        max-width: 88px;
    }
}

/* ---------- Price history modal ---------- */
.price-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

    .price-modal[hidden] {
        display: none !important;
    }

.price-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 24, 40, .78);
    backdrop-filter: blur(6px);
}

.price-modal-dialog {
    position: relative;
    width: min(960px, 100%);
    max-height: min(88vh, 760px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid rgba(212, 160, 23, .35);
    border-radius: 18px;
    box-shadow: 0 28px 64px rgba(0, 0, 0, .4);
    overflow: hidden;
    animation: priceModalIn .28s ease;
    color: var(--text);
}

@keyframes priceModalIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.price-modal-close {
    position: absolute;
    top: 14px;
    left: 14px;
    width: 36px;
    height: 36px;
    border: 1px solid var(--hairline);
    border-radius: 10px;
    background: #f4f7fb;
    color: var(--muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: color .2s, border-color .2s, background .2s;
    z-index: 2;
}

    .price-modal-close:hover {
        color: var(--text);
        border-color: rgba(212, 160, 23, .45);
        background: rgba(240, 193, 75, .12);
    }

.price-modal-head {
    padding: 22px 24px 16px;
    border-bottom: 1px solid var(--hairline);
    background: linear-gradient(180deg, #f8fafc, #fff);
}

.price-modal-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding-left: 44px;
}

    .price-modal-title-row h2 {
        margin: 0;
        font-size: 1.25rem;
        font-weight: 900;
        color: #182433;
    }

.price-modal-unit {
    font-size: .72rem;
    color: var(--muted);
    background: #f4f7fb;
    border: 1px solid var(--hairline);
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    font-weight: 700;
}

.price-modal-quotes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.price-modal-quote {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--hairline);
    background: #f4f7fb;
}

    .price-modal-quote strong {
        font-family: 'Vazirmatn', sans-serif !important;
        font-size: 1.35rem;
        font-weight: 900;
        letter-spacing: -.02em;
        direction: ltr;
        unicode-bidi: isolate;
    }

.price-modal-quote--buy {
    background: linear-gradient(160deg, rgba(29, 111, 216, .12), rgba(29, 111, 216, .03));
    border-color: var(--buy-border);
}

    .price-modal-quote--buy strong,
    .price-modal-quote--buy .price-modal-quote-label {
        color: var(--buy);
    }

.price-modal-quote--sell {
    background: linear-gradient(160deg, rgba(225, 29, 46, .12), rgba(225, 29, 46, .03));
    border-color: var(--sell-border);
}

    .price-modal-quote--sell strong,
    .price-modal-quote--sell .price-modal-quote-label {
        color: var(--sell);
    }

.price-modal-quote-label {
    font-size: .72rem;
    color: var(--muted);
    font-weight: 700;
}

.price-modal-quotes--single {
    grid-template-columns: 1fr;
}

.price-modal-quote--single {
    text-align: center;
    background: linear-gradient(160deg, rgba(212, 160, 23, .12), rgba(29, 111, 216, .04));
    border-color: rgba(212, 160, 23, .3);
}

    .price-modal-quote--single strong {
        color: #101929;
    }

    .price-modal-quotes--single .price-modal-quote--buy {
        text-align: center;
        background: linear-gradient(160deg, rgba(212, 160, 23, .12), rgba(29, 111, 216, .04));
        border-color: rgba(212, 160, 23, .3);
    }

        .price-modal-quotes--single .price-modal-quote--buy strong {
            color: #101929;
        }

        .price-modal-quotes--single .price-modal-quote--buy .price-modal-quote-label {
            color: var(--muted);
        }

.price-modal-body {
    position: relative;
    flex: 1;
    min-height: 320px;
    padding: 18px 20px 22px;
}

.price-modal-loading,
.price-modal-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    color: var(--muted);
    font-size: .92rem;
    font-weight: 600;
}

    .price-modal-loading[hidden],
    .price-modal-empty[hidden],
    .price-modal-chart-wrap[hidden] {
        display: none !important;
    }

.price-modal-chart-wrap {
    position: relative;
    height: min(52vh, 420px);
}

@media (max-width: 640px) {
    .price-modal {
        padding: 12px;
    }

    .price-modal-dialog {
        max-height: 92vh;
    }

    .price-modal-quotes {
        grid-template-columns: 1fr;
    }

    .price-modal-quote strong {
        font-size: 1.15rem;
    }

    .price-modal-chart-wrap {
        height: min(46vh, 340px);
    }
}
