/* ============================================================
   LIVE CURRENCY RATES (USD / EUR) — styles
   Mirrors the gold monitor visual language but is fully scoped
   to #currencyRates and uses only .currency-* class names so no
   existing rule is touched or overridden.
   ============================================================ */

#currencyRates .currency-monitor {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 16px);
  overflow: hidden;
  background: var(--bg-primary);
}

#currencyRates .currency-monitor-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

#currencyRates .live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--rate-up);
  background: rgba(34, 197, 94, 0.10);
  border: 1px solid rgba(34, 197, 94, 0.30);
  padding: 4px 10px;
  border-radius: 999px;
}
#currencyRates .live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--rate-up, #22c55e);
  animation: currencyLivePulse 2s ease-in-out infinite;
}
@keyframes currencyLivePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

#currencyRates .currency-refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: border-color 200ms ease, background 200ms ease, color 200ms ease;
}
#currencyRates .currency-refresh-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-accent-strong, var(--accent));
  background: rgba(var(--accent-rgb, 120 120 255), 0.10);
}
#currencyRates .currency-refresh-btn:disabled { cursor: default; opacity: 0.75; }
#currencyRates .currency-refresh-btn.is-loading .currency-refresh-icon { animation: currencyRefreshSpin 1.1s linear infinite; }
#currencyRates .currency-refresh-icon { transition: transform 400ms ease; }
#currencyRates .currency-refresh-btn:hover .currency-refresh-icon { transform: rotate(60deg); }
@keyframes currencyRefreshSpin { to { transform: rotate(360deg); } }

#currencyRates .currency-monitor-time {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-inline-start: auto;
  font-size: 12px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
#currencyRates.currency-has-error #currencyTimeLabel { color: var(--rate-down, #ef4444); }

#currencyRates .currency-monitor-body {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--border);
}
@media (max-width: 768px) {
  #currencyRates .currency-monitor-body { grid-template-columns: 1fr; }
}

#currencyRates .currency-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  background: var(--bg-primary);
  transition: background 250ms ease;
}
#currencyRates .currency-card:hover { background: var(--bg-secondary); }
#currencyRates .currency-card-featured { background: var(--bg-secondary); border-bottom: 1px solid var(--border-accent, var(--border)); }

#currencyRates .currency-card-icon {
  flex-shrink: 0;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: rgba(var(--accent-rgb, 120 120 255), 0.10);
  border: 1px solid var(--border-accent, var(--border));
  color: var(--accent-text, var(--accent));
}

#currencyRates .currency-card-info { flex: 1; min-width: 0; }
#currencyRates .currency-card-name { font-size: 14px; font-weight: 700; color: var(--text-primary); }
#currencyRates .currency-card-sub { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
#currencyRates .currency-card-time { font-size: 11px; color: var(--text-faint); margin-top: 2px; font-variant-numeric: tabular-nums; }
#currencyRates .currency-card-time:empty, #currencyRates .currency-card-change:empty { display: none; }

#currencyRates .currency-card-prices { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
#currencyRates .currency-card-toman {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
#currencyRates .currency-card-toman span {
  font-size: 16px;
  font-weight: 700;
  color: var(--monitor-price, var(--text-primary));
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
#currencyRates .currency-card-toman small {
  font-size: 10px;
  color: var(--text-faint);
  font-weight: 400;
}
#currencyRates .currency-card-change {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
  direction: ltr;
  unicode-bidi: plaintext;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}
#currencyRates .currency-up .currency-card-change { color: var(--rate-up, #22c55e); }
#currencyRates .currency-down .currency-card-change { color: var(--rate-down, #ef4444); }
#currencyRates .currency-na .currency-card-toman span { opacity: 0.5; }

/* ---- chart block (mirrors .gold-chart) ---- */
#currencyRates .currency-chart { margin-top: 14px; }
#currencyRates .currency-chart-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
#currencyRates .currency-chart-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
#currencyRates .currency-chart-range { font-size: 11px; color: var(--text-faint); }
#currencyRates .currency-chart-delta {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: plaintext;
}
#currencyRates .currency-chart.trend-up .currency-chart-delta { color: var(--rate-up, #22c55e); }
#currencyRates .currency-chart.trend-down .currency-chart-delta { color: var(--rate-down, #ef4444); }

#currencyRates .currency-chart-plot {
  position: relative;
  height: 72px;
  border-radius: 8px;
  background: rgba(var(--accent-rgb, 120 120 255), 0.04);
  overflow: hidden;
}
#currencyRates .currency-chart-svg { width: 100%; height: 100%; display: block; }
#currencyRates .currency-chart-line { stroke: var(--accent); stroke-width: 1.6; }
#currencyRates .currency-chart-end { fill: var(--accent); }
#currencyRates .currency-chart-cursor { stroke: var(--border-accent-strong, var(--accent)); stroke-width: 1; stroke-dasharray: 3 3; }
#currencyRates .currency-chart-dot { fill: var(--bg-primary); stroke: var(--accent); stroke-width: 2; }
#currencyRates .currency-chart.trend-up .currency-chart-line { stroke: var(--rate-up, #22c55e); }
#currencyRates .currency-chart.trend-up .currency-chart-end { fill: var(--rate-up, #22c55e); }
#currencyRates .currency-chart.trend-up .currency-chart-dot { stroke: var(--rate-up, #22c55e); }
#currencyRates .currency-chart.trend-down .currency-chart-line { stroke: var(--rate-down, #ef4444); }
#currencyRates .currency-chart.trend-down .currency-chart-end { fill: var(--rate-down, #ef4444); }
#currencyRates .currency-chart.trend-down .currency-chart-dot { stroke: var(--rate-down, #ef4444); }

#currencyRates .currency-chart-tip {
  position: absolute;
  top: 4px;
  padding: 6px 10px;
  background: var(--bg-elevated, var(--bg-secondary));
  border: 1px solid var(--border-accent, var(--border));
  border-radius: 8px;
  font-size: 11px;
  color: var(--text-primary);
  pointer-events: none;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
#currencyRates .currency-chart-tip b { font-weight: 700; font-variant-numeric: tabular-nums; }
#currencyRates .currency-chart-tip span { color: var(--text-faint); }
#currencyRates .currency-chart-msg {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 11px;
  color: var(--text-faint);
  pointer-events: none;
}
#currencyRates .currency-chart.is-error .currency-chart-msg { color: var(--rate-down, #ef4444); }

/* ---- range selector (mirrors .gold-range) ---- */
#currencyRates .currency-range {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-primary);
}
#currencyRates .currency-range button {
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
}
#currencyRates .currency-range button.active {
  background: var(--accent);
  color: var(--bg-primary);
}

#currencyRates .currency-monitor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}
#currencyRates .currency-disclaimer { font-size: 11px; color: var(--text-faint); }
#currencyRates .currency-source {
  font-size: 11px;
  color: var(--accent-text, var(--accent));
  text-decoration: none;
}
#currencyRates .currency-source:hover { text-decoration: underline; }
