/* ------------------------------------------------------------------
   CryptoDesk – استایل اصلی (تم تاریک، RTL، ریسپانسیو)
   ------------------------------------------------------------------ */
:root {
  --bg: #070b14;
  --bg-soft: #0b1220;
  --panel: #0d1626;
  --panel-2: #111d31;
  --border: #1c2a41;
  --border-soft: #16233a;
  --text: #e8eef8;
  --muted: #8fa2bd;
  --muted-2: #64748b;
  --accent: #22d3a0;
  --accent-soft: rgba(34, 211, 160, 0.14);
  --blue: #4f8cff;
  --up: #16c784;
  --down: #ea3943;
  --warn: #f5b544;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 45px rgba(2, 6, 18, 0.55);
  --font: "Vazirmatn", "IRANSansX", "IRANSans", "Segoe UI", Tahoma, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 520px at 90% -10%, rgba(34, 211, 160, 0.10), transparent 60%),
    radial-gradient(900px 460px at 5% 0%, rgba(79, 140, 255, 0.12), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #22304a; border-radius: 999px; border: 2px solid var(--bg); }

.num, .last-price, .kpi strong, .watch-price, .mover-change, .big-result { direction: ltr; }

/* ------------------------------ نوار بالا ------------------------------ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 22px;
  background: rgba(7, 11, 20, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }

.brand .logo {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, #22d3a0, #0e9f7a);
  color: #04140f;
  font-size: 21px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(34, 211, 160, 0.28);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { font-size: 16px; letter-spacing: 0.2px; }
.brand-text small { color: var(--muted); font-size: 11.5px; }

.topnav { display: flex; gap: 6px; margin-inline-start: 14px; }
.topnav a {
  padding: 7px 13px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  transition: background 0.18s ease, color 0.18s ease;
}
.topnav a:hover { background: var(--panel-2); color: var(--text); }

.conn {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

.conn .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 4px rgba(245, 181, 68, 0.14);
}

.conn[data-state="live"] { color: #7ef3cb; border-color: rgba(34, 211, 160, 0.35); }
.conn[data-state="live"] .dot { background: var(--accent); box-shadow: 0 0 0 4px rgba(34, 211, 160, 0.16); animation: pulse 2s infinite; }
.conn[data-state="error"] { color: #ffb3b8; border-color: rgba(234, 57, 67, 0.4); }
.conn[data-state="error"] .dot { background: var(--down); box-shadow: 0 0 0 4px rgba(234, 57, 67, 0.16); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ------------------------------ نوار قیمت ------------------------------ */
.ticker-strip {
  position: sticky;
  top: 65px;
  z-index: 35;
  overflow: hidden;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(9, 14, 25, 0.92);
  backdrop-filter: blur(10px);
}

.ticker-track {
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 8px 20px;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}
.ticker-track::-webkit-scrollbar { display: none; }

.ticker-placeholder { color: var(--muted-2); font-size: 12.5px; }

.ticker-item {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
  cursor: pointer;
  border: 0;
  background: none;
  padding: 2px 0;
  color: var(--text);
}
.ticker-item:hover .ticker-sym { color: var(--accent); }
.ticker-sym { color: #b9c8dd; font-weight: 600; }
.ticker-price { direction: ltr; color: #f2f7ff; }
.ticker-chg { direction: ltr; font-size: 12px; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--muted); }

/* ------------------------------ چیدمان ------------------------------ */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  max-width: 1560px;
  margin: 18px auto 0;
  padding: 0 20px;
}

.panel {
  background: linear-gradient(180deg, var(--panel), #0a1322);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px 0;
}

.panel-head h2 { font-size: 14.5px; margin: 0; font-weight: 700; }

.hint { color: var(--muted-2); font-size: 11.5px; }
.empty { color: var(--muted-2); font-size: 12.5px; padding: 0 18px 16px; margin: 0; }

/* ------------------------------ نمودار ------------------------------ */
.chart-panel { display: flex; flex-direction: column; min-width: 0; padding-bottom: 10px; }

.chart-toolbar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border-soft);
}

.symbol-picker { position: relative; }

.symbol-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.3px;
  direction: ltr;
}
.symbol-btn:hover { border-color: rgba(34, 211, 160, 0.45); }

.symbol-menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-start: 0;
  width: 320px;
  max-width: 80vw;
  background: #0e1a2c;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 10px;
  z-index: 60;
}

.symbol-menu input,
.modal-card input[type="search"] {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0a1424;
  outline: none;
}
.symbol-menu input:focus,
.modal-card input[type="search"]:focus { border-color: rgba(34, 211, 160, 0.5); }

.symbol-list { max-height: 300px; overflow-y: auto; margin-top: 8px; }

.symbol-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  text-align: start;
}
.symbol-option:hover, .symbol-option:focus-visible { background: #12243c; outline: none; }
.symbol-option .sym { font-weight: 600; direction: ltr; }
.symbol-option .nm { color: var(--muted-2); font-size: 11.5px; }

.price-block { display: flex; align-items: baseline; gap: 10px; }

.last-price { font-size: 26px; font-weight: 700; letter-spacing: -0.3px; }

.price-change {
  font-size: 13px;
  padding: 3px 8px;
  border-radius: 7px;
  background: rgba(148, 163, 184, 0.12);
}
.price-change.up { background: rgba(22, 199, 132, 0.12); }
.price-change.down { background: rgba(234, 57, 67, 0.12); }

.chart-stats {
  display: flex;
  gap: 20px;
  margin: 0;
  margin-inline-start: auto;
  flex-wrap: wrap;
}
.chart-stats div { display: flex; flex-direction: column; }
.chart-stats dt { color: var(--muted-2); font-size: 11px; }
.chart-stats dd { margin: 0; font-size: 13px; direction: ltr; font-weight: 600; }

.tf-row { display: flex; gap: 4px; padding: 10px 18px 4px; flex-wrap: wrap; }

.tf-row button {
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: none;
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.tf-row button:hover { color: var(--text); background: var(--panel-2); }
.tf-row button.active { color: #052019; background: var(--accent); font-weight: 700; }

.chart-wrap { position: relative; height: 430px; margin: 6px 10px 0; }

#chartCanvas { width: 100%; height: 100%; display: block; touch-action: none; }

.chart-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted-2);
  font-size: 13px;
  background: rgba(10, 18, 32, 0.6);
  border-radius: 12px;
  pointer-events: none;
}
.chart-overlay[hidden] { display: none; }

.chart-tooltip {
  position: absolute;
  z-index: 20;
  min-width: 168px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(12, 21, 36, 0.96);
  border: 1px solid var(--border);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  font-size: 12px;
  display: grid;
  gap: 2px;
}
.chart-tooltip[hidden] { display: none; }
.chart-tooltip .tt-row { display: flex; justify-content: space-between; gap: 14px; }
.chart-tooltip .tt-row span:first-child { color: var(--muted-2); }
.chart-tooltip .tt-time { color: var(--muted); border-top: 1px solid var(--border-soft); margin-top: 4px; padding-top: 5px; }
.chart-tooltip strong { direction: ltr; }

.chart-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px 4px;
  color: var(--muted-2);
  font-size: 11.5px;
  flex-wrap: wrap;
}

.tag {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #6ee7bf;
  font-size: 11px;
}

/* ------------------------------ ستون کنار ------------------------------ */
.side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.overview { padding-bottom: 6px; }

.kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 14px;
}

.kpi {
  padding: 10px 12px;
  border-radius: 12px;
  background: #0b1626;
  border: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kpi span { color: var(--muted-2); font-size: 11px; }
.kpi strong { font-size: 14px; font-weight: 700; letter-spacing: -0.2px; }

.movers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 14px 12px;
}
.movers-col h3 {
  margin: 0 0 4px;
  font-size: 11.5px;
  color: var(--muted-2);
  font-weight: 600;
}
.mover-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }

.mover-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 8px;
  border: 0;
  background: none;
  width: 100%;
  font-size: 11.5px;
  text-align: start;
}
.mover-row:hover { background: #11203a; }
.mover-row .sym { direction: ltr; font-weight: 600; color: #c8d6ea; }
.mover-change { font-size: 11px; font-weight: 600; }
.mover-list .placeholder { color: var(--muted-2); font-size: 11px; padding: 4px 8px; }

/* ------------------------------ واچ‌لیست ------------------------------ */
.watchlist { padding-bottom: 10px; }

.ghost-btn {
  padding: 6px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: #0f1c2f;
  color: var(--muted);
  font-size: 12px;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.ghost-btn:hover { border-color: rgba(34, 211, 160, 0.5); color: var(--accent); }

.watch-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0 8px;
  display: grid;
  gap: 2px;
  max-height: 340px;
  overflow-y: auto;
}

.watch-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
}
.watch-row:hover { background: #11203a; }

.watch-sym {
  border: 0;
  background: none;
  padding: 0;
  text-align: start;
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}
.watch-sym .sym { direction: ltr; font-weight: 600; font-size: 12.5px; }
.watch-sym .nm { color: var(--muted-2); font-size: 10.5px; }

.watch-price { font-size: 12.5px; font-weight: 600; }
.watch-chg { font-size: 11.5px; min-width: 58px; text-align: end; }

.watch-remove {
  border: 0;
  background: none;
  color: #3d4a60;
  font-size: 15px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.watch-row:hover .watch-remove { opacity: 1; }
.watch-remove:hover { color: var(--down); }

/* ------------------------------ ماشین‌حساب‌ها ------------------------------ */
.tools {
  max-width: 1560px;
  margin: 16px auto 26px;
  padding: 0 0 18px;
  overflow: hidden;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 12px 18px 0;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-soft);
  margin-top: 12px;
}

.tab {
  padding: 9px 16px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font-size: 13px;
  border-radius: 8px 8px 0 0;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); background: rgba(17, 29, 49, 0.6); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }

.tab-panel { display: none; padding: 18px; }
.tab-panel.active { display: block; }

.calc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.fields label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}

.fields input,
.fields select,
.dca-table input,
.dca-row input,
.modal-card input {
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0a1526;
  outline: none;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.fields input:focus,
.fields select:focus,
.dca-row input:focus {
  border-color: rgba(34, 211, 160, 0.55);
  box-shadow: 0 0 0 3px rgba(34, 211, 160, 0.10);
}

.checkbox-label {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  grid-column: span 2;
  cursor: pointer;
}
.checkbox-label input { width: 16px; height: 16px; accent-color: var(--accent); }

.results {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 14px;
  background: #0a1526;
  border: 1px solid var(--border-soft);
}

.result-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 7px;
  border-bottom: 1px dashed rgba(28, 42, 65, 0.9);
  font-size: 12.5px;
}
.result-row:last-child { border-bottom: 0; padding-bottom: 0; }
.result-row span { color: var(--muted); }
.result-row strong { direction: ltr; font-variant-numeric: tabular-nums; font-size: 13px; }
.result-row.primary {
  padding: 10px 12px;
  margin-bottom: 4px;
  border: 0;
  border-radius: 10px;
  background: var(--accent-soft);
}
.result-row.primary span { color: #9df3d7; }
.result-row.primary strong { color: #6ee7bf; font-size: 16px; }
.result-row.warn strong { color: var(--warn); }
.result-row.bad strong { color: var(--down); }
.result-row.good strong { color: var(--up); }

.calc-note {
  margin: 14px 0 0;
  color: var(--muted-2);
  font-size: 11.5px;
  line-height: 1.9;
}
.calc-note code {
  direction: ltr;
  display: inline-block;
  padding: 1px 6px;
  border-radius: 6px;
  background: #0b1626;
  border: 1px solid var(--border-soft);
  font-size: 11px;
}

/* میانگین ورود */
.dca-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.dca-head,
.dca-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 8px;
  align-items: center;
}

.mini-btn {
  padding: 7px 9px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: #0d1929;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.mini-btn:hover { border-color: rgba(34, 211, 160, 0.5); color: var(--accent); }

.ticker-item.active .ticker-sym { color: var(--accent); }

.dca-head {
  color: var(--muted-2);
  font-size: 11px;
  padding: 0 2px 6px;
}

.dca-row { margin-bottom: 8px; }

.icon-btn {
  width: 30px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: #0d1929;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
}
.dca-row .icon-btn:hover { color: var(--down); border-color: rgba(234, 57, 67, 0.5); }

#dcaAddBtn { width: 100%; }

/* تبدیل ارز */
.convert-result {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 14px;
  background: radial-gradient(600px 160px at 20% 0%, rgba(34, 211, 160, 0.12), transparent 70%), #0a1526;
  border: 1px solid var(--border-soft);
}

.big-result {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: #6ee7bf;
  word-break: break-word;
}

.quick-units {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 6px;
  margin-top: 4px;
}

.quick-units div {
  padding: 7px 10px;
  border-radius: 9px;
  background: #0e1c2f;
  border: 1px solid var(--border-soft);
  font-size: 11px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.quick-units b { color: #cfe0f5; direction: ltr; font-weight: 600; }

/* ------------------------------ مودال و اعلان ------------------------------ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 7, 15, 0.72);
  backdrop-filter: blur(4px);
}
.modal[hidden] { display: none; }

.modal-card {
  width: min(420px, 100%);
  padding: 18px;
  border-radius: 16px;
  background: #0c1728;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
}

.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-head h3 { margin: 0; font-size: 14.5px; }
.modal-head .icon-btn { height: 30px; }
.modal-head .icon-btn:hover { color: var(--down); border-color: rgba(234, 57, 67, 0.5); }

.modal-card .symbol-list { max-height: 320px; }

.toast-stack {
  position: fixed;
  inset-inline-end: 18px;
  bottom: 18px;
  z-index: 90;
  display: grid;
  gap: 8px;
  max-width: min(360px, calc(100vw - 36px));
}

.toast {
  padding: 10px 14px;
  border-radius: 11px;
  background: #0e1b2e;
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--accent);
  box-shadow: var(--shadow);
  font-size: 12.5px;
  animation: toast-in 0.2s ease-out;
}
.toast.error { border-inline-start-color: var(--down); }
.toast.warn { border-inline-start-color: var(--warn); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ------------------------------ فوتر ------------------------------ */
.footer {
  max-width: 1560px;
  margin: 0 auto 30px;
  padding: 0 22px;
  color: var(--muted-2);
  font-size: 11.5px;
  line-height: 1.9;
}
.footer p { margin: 0 0 4px; }
.footer .disclaimer { color: #5c6c84; }

/* ------------------------------ ریسپانسیو ------------------------------ */
@media (max-width: 1200px) {
  .layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .chart-wrap { height: 390px; }
}

@media (max-width: 1000px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { order: 2; }
  .chart-wrap { height: 360px; }
  .calc-grid, .dca-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .topnav { order: 3; width: 100%; margin: 0; overflow-x: auto; }
  .conn { margin-inline-start: 0; }
  .layout { padding: 0 12px; margin-top: 12px; }
  .tools { margin-inline: 12px; }
  .chart-toolbar { gap: 10px; }
  .chart-stats { margin-inline-start: 0; gap: 14px; }
  .last-price { font-size: 21px; }
  .chart-wrap { height: 300px; margin-inline: 6px; }
  .tf-row { padding-inline: 12px; overflow-x: auto; flex-wrap: nowrap; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .checkbox-label { grid-column: span 1; }
  .tab-panel { padding: 14px; }
  .tabs { padding-inline: 12px; }
  .big-result { font-size: 21px; }
  .watch-list { max-height: 260px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}




