/* CurrencyChart — global CSS */

*, *::before, *::after { box-sizing: border-box; }

.cc-wrapper {
    font-family: 'Vazirmatn', sans-serif;
    width: 100%;
    padding: 0.5rem 0 1.5rem;
}

/* ── Card ─────────────────────────────────────────── */
.cc-card {
    background: linear-gradient(160deg,
        rgba(10, 18, 38, 0.96) 0%,
        rgba(14, 24, 50, 0.92) 100%);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 24px;
    padding: 1.5rem 1.5rem 1.25rem;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.2),
        0 24px 60px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    overflow: visible;
    position: relative;
}

.cc-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 80% -10%, rgba(56, 189, 248, 0.05) 0%, transparent 60%);
    pointer-events: none;
}

/* ── Top row ──────────────────────────────────────── */
.cc-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.cc-title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cc-title-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #38bdf8;
    flex-shrink: 0;
}

.cc-title {
    font-size: 1rem;
    font-weight: 800;
    color: #e2e8f0;
    margin: 0 0 0.1rem;
}

.cc-subtitle {
    font-size: 0.72rem;
    color: #475569;
    margin: 0;
}

/* ── Period tabs ──────────────────────────────────── */
.cc-period-tabs {
    display: flex;
    gap: 0.3rem;
    flex-shrink: 0;
}

.cc-period-btn {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #64748b;
    border-radius: 8px;
    padding: 0.3rem 0.65rem;
    font-size: 0.72rem;
    font-family: 'Vazirmatn', sans-serif;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.cc-period-btn:hover {
    color: #94a3b8;
    border-color: rgba(255, 255, 255, 0.12);
}

.cc-period-btn.active {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.35);
    color: #38bdf8;
    font-weight: 700;
}

/* ── Currency tabs ────────────────────────────────── */
.cc-currency-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
}

.cc-currency-tabs::-webkit-scrollbar { display: none; }

.cc-currency-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.07);
    color: #64748b;
    border-radius: 50px;
    padding: 0.4rem 0.9rem;
    font-size: 0.82rem;
    font-family: 'Vazirmatn', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.cc-currency-btn:hover {
    color: #94a3b8;
    border-color: rgba(255, 255, 255, 0.14);
}

.cc-currency-btn.active {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.18) 0%, rgba(99, 102, 241, 0.12) 100%);
    border-color: rgba(56, 189, 248, 0.4);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.12);
}

.cc-currency-code {
    font-family: monospace;
    font-size: 0.65rem;
    color: inherit;
    opacity: 0.65;
    letter-spacing: 0.03em;
}

/* ── Stats bar ────────────────────────────────────── */
.cc-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(8, 14, 30, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 0.75rem 1.1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.cc-stat-main {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
}

.cc-stat-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: #f1f5f9;
    letter-spacing: -0.01em;
}

.cc-stat-unit {
    font-size: 0.75rem;
    color: #475569;
}

.cc-stat-change {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 8px;
    padding: 0.25rem 0.65rem;
}

.cc-stat-change.up {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.08);
    border: 1px solid rgba(74, 222, 128, 0.18);
}

.cc-stat-change.down {
    color: #f87171;
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.18);
}

.cc-change-icon {
    font-size: 0.7rem;
}

.cc-change-pct {
    opacity: 0.7;
    font-size: 0.75rem;
}

.cc-stat-range {
    font-size: 0.68rem;
    color: #334155;
    margin-right: auto;
    font-family: monospace;
    letter-spacing: 0.02em;
}

/* ── Chart container ──────────────────────────────── */
.cc-chart-wrap {
    position: relative;
    height: 380px;
    width: 100%;
}

canvas#priceChart {
    width: 100% !important;
    height: 100% !important;
}

.cc-canvas-hidden {
    display: none !important;
}

/* ── Loading ──────────────────────────────────────── */
.cc-loading,
.cc-error,
.cc-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: #475569;
    font-size: 0.85rem;
}

.cc-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(56, 189, 248, 0.12);
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: cc-spin 0.8s linear infinite;
}

@keyframes cc-spin {
    to { transform: rotate(360deg); }
}

.cc-error {
    gap: 0.5rem;
}

.cc-error-icon {
    font-size: 1.5rem;
}

.cc-retry-btn {
    margin-top: 0.25rem;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.25);
    color: #38bdf8;
    border-radius: 8px;
    padding: 0.35rem 1rem;
    font-size: 0.78rem;
    font-family: 'Vazirmatn', sans-serif;
    cursor: pointer;
    transition: background 0.2s;
}

.cc-retry-btn:hover {
    background: rgba(56, 189, 248, 0.18);
}

/* ── High / Low stats ────────────────────────────── */
.cc-stat-hl {
    display: flex;
    align-items: center;
    gap: 0.28rem;
    font-size: 0.78rem;
}

.cc-hl-label {
    font-family: monospace;
    font-size: 0.65rem;
    color: #334155;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.cc-hl-val {
    font-weight: 700;
    font-size: 0.78rem;
}

.cc-hl-val.up   { color: #4ade80; }
.cc-hl-val.down { color: #f87171; }

/* ── External tooltip ────────────────────────────── */
.cc-ext-tooltip {
    position: absolute;
    background: rgba(5, 10, 25, 0.96);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 10px 13px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 11.5px;
    color: #e2e8f0;
    pointer-events: none;
    transition: opacity 0.12s ease;
    z-index: 20;
    min-width: 155px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    opacity: 0;
}

.cct-date {
    font-family: monospace;
    font-size: 10px;
    color: #64748b;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding-bottom: 6px;
    margin-bottom: 7px;
    letter-spacing: 0.03em;
}

.cct-rows { display: flex; flex-direction: column; gap: 3px; }

.cct-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
}

.cct-row span:first-child {
    color: #64748b;
    font-size: 10.5px;
}

.cct-change {
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-weight: 700;
    font-size: 11.5px;
    text-align: center;
}

.cct-up   { color: #4ade80; }
.cct-dn   { color: #f87171; }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 640px) {
    .cc-card {
        padding: 1.1rem 1rem 1rem;
        border-radius: 18px;
    }

    .cc-top {
        gap: 0.6rem;
    }

    .cc-stat-price {
        font-size: 1.2rem;
    }

    .cc-stats {
        padding: 0.6rem 0.85rem;
        gap: 0.6rem;
    }

    .cc-stat-range,
    .cc-stat-hl {
        display: none;
    }

    .cc-chart-wrap {
        height: 260px;
    }

    .cc-period-btn {
        font-size: 0.65rem;
        padding: 0.25rem 0.5rem;
    }
}
