@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Variable.woff2') format('woff2-variations'),
         url('../fonts/Vazirmatn-Variable.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
body, h1, h2, h3, h4, h5, h6, p, a, div, span, input, button, select, textarea, label, code, td, th, small {
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif !important;
}

:root {
    --primary: #2563eb; --primary-hover: #1d4ed8; --primary-soft: #eff6ff; --primary-soft-border: #bfdbfe;
    --success: #15803d; --success-soft: #f0fdf4; --success-soft-border: #bbf7d0;
    --danger: #dc2626; --danger-soft: #fef2f2; --danger-soft-border: #fecaca;
    --warning: #b45309; --warning-soft: #fffbeb; --warning-soft-border: #fde68a;
    --secondary: #64748b; --bg-main: #f8fafc; --bg-box: #ffffff;
    --text-main: #1e293b; --text-muted: #64748b; --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.12), 0 4px 6px -2px rgba(15, 23, 42, 0.05);
    --radius: 10px; --radius-sm: 6px; --transition: all 0.2s ease;
    --fs-xs: 0.8125rem; --fs-sm: 0.9375rem; --fs-base: 1rem; --fs-md: 1.0625rem; --fs-lg: 1.25rem; --fs-xl: 1.5rem; --fs-2xl: 1.75rem;
    --fw-regular: 400; --fw-medium: 600; --fw-bold: 700;
}
body { background-color: var(--bg-main); color: var(--text-main); }
.icon { width: 1.2em; height: 1.2em; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.is-hidden { display: none !important; }

.cv-page { max-width: 1300px; margin: 30px auto 60px; padding: 0 15px; }

/* ---------- هیرو ---------- */
.cv-hero { position: relative; overflow: hidden; border-radius: var(--radius); padding: 40px 36px; background: linear-gradient(135deg, #0f766e 0%, #115e59 100%); box-shadow: var(--shadow-md); }
.cv-hero__decor { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 88% -15%, rgba(255,255,255,0.16) 0%, transparent 55%), radial-gradient(circle at -10% 115%, rgba(255,255,255,0.12) 0%, transparent 45%); }
.cv-hero__content { position: relative; max-width: 780px; }
.cv-hero__badge { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.16); color: #fff; border: 1px solid rgba(255,255,255,0.28); border-radius: 50rem; padding: 5px 14px; font-size: var(--fs-xs); font-weight: var(--fw-medium); margin-bottom: 16px; }
.cv-live-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7); animation: cvPulse 1.6s infinite; }
.cv-live-dot.is-stale { background: #fbbf24; animation: none; }
@keyframes cvPulse { 0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7); } 70% { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); } 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); } }
.cv-hero__title { margin: 0 0 10px; color: #fff; font-size: var(--fs-2xl); font-weight: var(--fw-bold); }
.cv-hero__subtitle { margin: 0; color: rgba(255,255,255,0.88); font-size: var(--fs-sm); line-height: 1.9; }

/* ---------- چیدمان ---------- */
.cv-layout { display: grid; grid-template-columns: 420px minmax(0, 1fr); gap: 24px; margin-top: 24px; align-items: start; }
.cv-card { background: var(--bg-box); border: 1px solid var(--border-color); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; min-width: 0; }
.cv-converter { position: sticky; top: 90px; }
.cv-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border-color); flex-wrap: wrap; }
.cv-card__title { margin: 0; font-size: var(--fs-lg); font-weight: var(--fw-bold); }
.cv-card__subtitle { margin: 4px 0 0; font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.7; }

/* ---------- مبدل ---------- */
.cv-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cv-field label { font-size: var(--fs-xs); font-weight: var(--fw-medium); }
.cv-input { width: 100%; padding: 11px 14px; border: 2px solid var(--border-color); border-radius: var(--radius-sm); font-size: var(--fs-sm); background: var(--bg-main); color: var(--text-main); transition: var(--transition); font-variant-numeric: tabular-nums; }
.cv-input:focus { outline: none; border-color: var(--primary); background: var(--bg-box); box-shadow: 0 0 0 4px var(--primary-soft); }
.cv-input--num { font-size: var(--fs-lg); font-weight: var(--fw-medium); }
.cv-input-group { display: flex; align-items: stretch; }
.cv-input-group .cv-input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.cv-input-group__unit { display: flex; align-items: center; padding: 0 14px; border: 2px solid var(--border-color); border-right: none; border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--bg-box); color: var(--primary); font-weight: var(--fw-bold); font-size: var(--fs-sm); direction: ltr; }
.cv-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: end; margin-top: 16px; }
.cv-swap { width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--border-color); background: var(--bg-box); color: var(--primary); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: var(--transition); margin-bottom: 2px; }
.cv-swap:hover { background: var(--primary); color: #fff; border-color: var(--primary); transform: rotate(180deg); }
.cv-swap .icon { width: 20px; height: 20px; }

.cv-result { margin-top: 20px; background: linear-gradient(135deg, #0f766e 0%, #115e59 100%); color: #fff; border-radius: var(--radius); padding: 18px 20px; box-shadow: 0 6px 16px rgba(15, 118, 110, 0.3); display: flex; flex-direction: column; gap: 4px; }
.cv-result__from { font-size: var(--fs-sm); opacity: .9; }
.cv-result__eq { font-size: var(--fs-xs); opacity: .75; }
.cv-result__to { font-size: 1.9rem; font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; line-height: 1.25; word-break: break-all; }
.cv-result__to small { font-size: var(--fs-xs); font-weight: var(--fw-regular); opacity: .9; }
.cv-result__rate { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.2); font-size: 12px; opacity: .9; font-variant-numeric: tabular-nums; }
.cv-error { margin-top: 20px; background: var(--danger-soft); border: 1px solid var(--danger-soft-border); color: var(--danger); border-radius: var(--radius-sm); padding: 12px 14px; font-size: var(--fs-xs); }
.cv-unit-toggle { display: flex; align-items: center; gap: 14px; margin-top: 16px; font-size: var(--fs-xs); color: var(--text-muted); }
.cv-unit-toggle label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; color: var(--text-main); }
.cv-unit-toggle input { accent-color: var(--primary); }

/* ---------- جدول نرخ‌ها ---------- */
.cv-rates__tools { display: flex; align-items: center; gap: 10px; }
.cv-search { position: relative; }
.cv-search .icon { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); }
.cv-search input { padding: 8px 32px 8px 12px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); font-size: var(--fs-xs); background: var(--bg-main); width: 180px; }
.cv-search input:focus { outline: none; border-color: var(--primary); background: var(--bg-box); }
.cv-refresh { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: var(--bg-box); color: var(--text-muted); font-size: var(--fs-xs); cursor: pointer; transition: var(--transition); font-variant-numeric: tabular-nums; }
.cv-refresh:hover { color: var(--primary); border-color: var(--primary); }
.cv-refresh .icon { width: 15px; height: 15px; }
.is-spinning { animation: cvSpin .8s linear infinite; }
@keyframes cvSpin { to { transform: rotate(360deg); } }
.cv-stale { background: var(--warning-soft); border: 1px solid var(--warning-soft-border); color: var(--warning); border-radius: var(--radius-sm); padding: 10px 14px; font-size: var(--fs-xs); margin-bottom: 12px; }

.cv-table-wrap { overflow-x: auto; border: 1px solid var(--border-color); border-radius: var(--radius-sm); }
.cv-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.cv-table th { background: var(--bg-main); color: var(--text-muted); font-weight: var(--fw-medium); padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--border-color); white-space: nowrap; font-size: var(--fs-xs); }
.cv-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
.cv-table tr:last-child td { border-bottom: none; }
.cv-row { cursor: pointer; transition: var(--transition); }
.cv-row:hover td { background: var(--primary-soft); }
.cv-cell-cur { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.cv-symbol { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-weight: var(--fw-bold); font-size: var(--fs-xs); flex-shrink: 0; direction: ltr; }
.cv-cur-name { font-weight: var(--fw-medium); }
.cv-cell-cur code { font-family: 'Courier New', monospace !important; font-size: 12px; color: var(--text-muted); direction: ltr; }
.cv-cell-rate { font-variant-numeric: tabular-nums; direction: ltr; text-align: right; font-weight: var(--fw-bold); white-space: nowrap; }
.cv-cell-change { font-variant-numeric: tabular-nums; direction: ltr; text-align: right; white-space: nowrap; font-size: var(--fs-xs); font-weight: var(--fw-medium); }
.cv-cell-change small { color: var(--text-muted); font-weight: var(--fw-regular); }
.cv-change--up { color: var(--success); }
.cv-change--down { color: var(--danger); }
.cv-change--flat { color: var(--text-muted); }
.cv-cell-hl, .cv-cell-time { font-size: var(--fs-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; direction: ltr; text-align: right; white-space: nowrap; }
.cv-table__empty { text-align: center; color: var(--text-muted); padding: 24px; }
.cv-note { margin: 14px 0 0; font-size: 11.5px; color: var(--text-muted); line-height: 1.8; }

@media (max-width: 1024px) {
    .cv-layout { grid-template-columns: 1fr; }
    .cv-converter { position: static; }
}
@media (max-width: 640px) {
    .cv-hero { padding: 28px 20px; }
    .cv-card { padding: 18px 16px; }
    .cv-col-hl, .cv-col-time { display: none; }
    .cv-search input { width: 130px; }
    .cv-result__to { font-size: 1.5rem; }
}
