/* ═══════════════════════════════════════════════
   COMPONENTS — Binance Mobile Design System
═══════════════════════════════════════════════ */

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  padding: 11px 20px;
  white-space: nowrap;
  transition: opacity .15s, background .15s;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}
.btn:active { opacity: .8; }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary { background: var(--yellow); color: var(--on-yellow); }
.btn-primary:active { background: var(--yellow-active); }
.btn-buy  { background: var(--up);   color: #fff; border-radius: var(--r-sm); }
.btn-sell { background: var(--down); color: #fff; border-radius: var(--r-sm); }
.btn-ghost { background: var(--surface-card); color: var(--text-body); border: 1px solid var(--hairline); }
.btn-ghost:active { background: var(--surface-elevated); }
.btn-sm { padding: 7px 14px; font-size: 12px; min-height: 32px; border-radius: var(--r-sm); }
.btn-xs { padding: 5px 10px; font-size: 11px; min-height: 28px; border-radius: 4px; }
.btn-block { width: 100%; }
.btn-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }

/* ── CARDS ── */
.card {
  background: var(--surface-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--hairline);
  overflow: hidden;
}
.card-body { padding: var(--sp-4); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--hairline);
}
.card-title { font-size: 13px; font-weight: 700; color: var(--text-on-dark); }
.card-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

/* ── STAT CARD ── */
.stat-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.stat-strip-3 { grid-template-columns: 1fr 1fr 1fr; }

.stat-cell {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-3);
}
.stat-cell-label { font-size: 10px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; }
.stat-cell-value { font-size: 18px; font-weight: 700; font-family: 'SF Mono','Roboto Mono',monospace; line-height: 1; margin-bottom: 4px; }
.stat-cell-value.yellow { color: var(--yellow); }
.stat-cell-value.up     { color: var(--up); }
.stat-cell-value.down   { color: var(--down); }
.stat-cell-value.white  { color: var(--text-on-dark); }
.stat-cell-change { font-size: 11px; font-weight: 600; }
.stat-cell-change.up   { color: var(--up); }
.stat-cell-change.down { color: var(--down); }
.stat-cell-change.muted{ color: var(--text-muted); }

/* ── MARKETS TABLE ROW (Binance style) ── */
.market-row {
  display: flex;
  align-items: center;
  padding: 12px var(--sp-4);
  border-bottom: 1px solid var(--hairline);
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
.market-row:active { background: var(--surface-elevated); }
.market-row:last-child { border-bottom: none; }

.market-coin { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.market-logo { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; flex-shrink: 0; background: var(--surface-elevated); }
.market-logo img { width: 100%; height: 100%; object-fit: cover; }
.market-sym { font-size: 14px; font-weight: 700; color: var(--text-on-dark); }
.market-full { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.market-price {
  text-align: right;
  flex: 1;
}
.market-price-val { font-size: 13px; font-weight: 600; font-family: 'SF Mono','Roboto Mono',monospace; color: var(--text-on-dark); }
.market-price-sub { font-size: 11px; color: var(--text-muted); font-family: 'SF Mono','Roboto Mono',monospace; }

.market-change {
  min-width: 68px;
  text-align: right;
}
.change-pill {
  display: inline-block;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 700;
  font-family: 'SF Mono','Roboto Mono',monospace;
}
.change-pill.up   { background: rgba(14,203,129,.12); color: var(--up); }
.change-pill.down { background: rgba(246,70,93,.12);  color: var(--down); }

/* ── FORM ELEMENTS ── */
.form-group { margin-bottom: var(--sp-4); }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; letter-spacing: .2px; }
.form-hint  { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.select-wrap { position: relative; }
.select-wrap::after { content: ''; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid var(--text-muted); pointer-events: none; }
.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }

/* ── TOGGLE ── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--hairline);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-name { font-size: 14px; font-weight: 500; color: var(--text-body); }
.toggle-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.toggle-btn {
  width: 44px; height: 24px;
  background: var(--surface-elevated);
  border-radius: var(--r-pill);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  border: none;
  transition: background .2s;
}
.toggle-btn::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  background: var(--text-muted);
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: left .2s, background .2s;
}
.toggle-btn.on { background: rgba(14,203,129,.15); }
.toggle-btn.on::after { left: 23px; background: var(--up); }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; border-radius: var(--r-sm); font-size: 11px; font-weight: 600; }
.badge svg { width: 10px; height: 10px; }
.badge-yellow { background: rgba(252,213,53,.15); color: var(--yellow); }
.badge-up     { background: rgba(14,203,129,.12); color: var(--up); }
.badge-down   { background: rgba(246,70,93,.12);  color: var(--down); }
.badge-muted  { background: var(--surface-elevated); color: var(--text-muted); }
.badge-info   { background: rgba(59,130,246,.12); color: var(--info); }

/* ── ALERTS ── */
.alert {
  display: flex;
  gap: 10px;
  padding: 12px var(--sp-3);
  border-radius: var(--r-md);
  border-left: 3px solid;
  margin-bottom: var(--sp-3);
  font-size: 13px;
}
.alert svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
.alert-body { flex: 1; }
.alert-title { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.alert-msg { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.alert-warn    { background: rgba(252,213,53,.08); border-color: var(--yellow); color: var(--yellow); }
.alert-danger  { background: rgba(246,70,93,.08);  border-color: var(--down);  color: var(--down); }
.alert-success { background: rgba(14,203,129,.08); border-color: var(--up);    color: var(--up); }
.alert-info    { background: rgba(59,130,246,.08); border-color: var(--info);  color: var(--info); }

/* ── STEPS ── */
.steps { display: flex; margin-bottom: var(--sp-5); overflow-x: auto; }
.step  { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; min-width: 52px; }
.step:not(:last-child)::after { content: ''; position: absolute; top: 13px; left: 50%; width: 100%; height: 1px; background: var(--hairline); }
.step.done:not(:last-child)::after  { background: var(--up); }
.step.active:not(:last-child)::after { background: var(--yellow); }
.step-circle { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--hairline); background: var(--canvas); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; position: relative; z-index: 1; color: var(--text-muted); }
.step-circle svg { width: 12px; height: 12px; }
.step.done   .step-circle { border-color: var(--up);     background: rgba(14,203,129,.1);  color: var(--up); }
.step.active .step-circle { border-color: var(--yellow); background: rgba(252,213,53,.1);  color: var(--yellow); }
.step-lbl { font-size: 9px; color: var(--text-muted); margin-top: 5px; text-align: center; font-weight: 500; line-height: 1.3; }
.step.done   .step-lbl { color: var(--up); }
.step.active .step-lbl { color: var(--yellow); }

/* ── TABS ── */
.tabs { display: flex; border-bottom: 1px solid var(--hairline); margin-bottom: var(--sp-4); overflow-x: auto; }
.tab  { padding: 10px var(--sp-4); font-size: 13px; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.tab.active { color: var(--yellow); border-bottom-color: var(--yellow); }

/* ── DIVIDER ── */
.divider { height: 1px; background: var(--hairline); margin: var(--sp-4) 0; }
.divider-lg { height: 8px; background: var(--canvas); margin: 0 calc(-1 * var(--sp-4)); }

/* ── PROGRESS ── */
.progress { height: 4px; background: var(--surface-elevated); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: var(--yellow); transition: width .4s; }
.progress-fill.up   { background: var(--up); }
.progress-fill.down { background: var(--down); }

/* ── NOTIFICATION ITEM ── */
.notif-item { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--hairline); }
.notif-item:last-child { border-bottom: none; }
.notif-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.notif-title { font-size: 13px; font-weight: 500; color: var(--text-body); }
.notif-time  { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── BAR CHART ── */
.bar-chart { display: flex; align-items: flex-end; gap: 5px; height: 90px; }
.bar-item  { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; height: 100%; justify-content: flex-end; }
.bar-fill  { width: 100%; border-radius: 3px 3px 0 0; min-height: 3px; }
.bar-day   { font-size: 9px; color: var(--text-muted); }
.bar-val   { font-size: 9px; font-family: 'SF Mono',monospace; color: var(--text-muted); }

/* ── MODAL (bottom sheet) ── */
.modal-backdrop { display: none; position: fixed; inset: 0; max-width: 480px; margin: 0 auto; background: rgba(0,0,0,.6); z-index: 400; align-items: flex-end; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--surface-card); border-radius: var(--r-lg) var(--r-lg) 0 0; width: 100%; max-height: 90vh; overflow-y: auto; animation: slideUp .25s ease; padding: var(--sp-5) var(--sp-4) calc(var(--sp-5) + env(safe-area-inset-bottom)); }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle { width: 40px; height: 4px; background: var(--border-strong); border-radius: 99px; margin: 0 auto var(--sp-5); }
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: var(--sp-4); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-4); }
.modal-close { width: 32px; height: 32px; background: var(--surface-elevated); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.modal-close svg { width: 14px; height: 14px; color: var(--text-muted); }

/* ── TRADINGVIEW MODAL (full screen) ── */
.tv-modal-backdrop { display: none; position: fixed; inset: 0; max-width: 480px; margin: 0 auto; background: var(--canvas); z-index: 500; flex-direction: column; }
.tv-modal-backdrop.open { display: flex; }
.tv-modal-header { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--hairline); flex-shrink: 0; background: var(--surface-card); }
.tv-modal-back { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-muted); flex-shrink: 0; }
.tv-modal-back svg { width: 20px; height: 20px; }
.tv-coin-info { flex: 1; min-width: 0; }
.tv-coin-top { display: flex; align-items: center; gap: 8px; }
.tv-coin-logo { width: 24px; height: 24px; border-radius: 50%; overflow: hidden; background: var(--surface-elevated); flex-shrink: 0; }
.tv-coin-logo img { width: 100%; height: 100%; object-fit: cover; }
.tv-coin-sym { font-size: 15px; font-weight: 700; }
.tv-coin-full { font-size: 11px; color: var(--text-muted); }
.tv-pnl-badge { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: var(--r-sm); font-family: 'SF Mono',monospace; }
.tv-pnl-badge.up   { background: rgba(14,203,129,.12); color: var(--up); }
.tv-pnl-badge.down { background: rgba(246,70,93,.12);  color: var(--down); }
.tv-interval-bar { display: flex; padding: 0 var(--sp-4); background: var(--surface-card); border-bottom: 1px solid var(--hairline); overflow-x: auto; flex-shrink: 0; gap: 0; }
.tv-int-btn { padding: 8px 12px; font-size: 12px; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; flex-shrink: 0; }
.tv-int-btn.active { color: var(--yellow); border-bottom-color: var(--yellow); }
.tv-iframe-wrap { flex: 1; overflow: hidden; }
.tv-iframe-wrap iframe { width: 100%; height: 100%; border: none; display: block; }
.tv-modal-footer { background: var(--surface-card); border-top: 1px solid var(--hairline); padding: var(--sp-3) var(--sp-4); flex-shrink: 0; }
.tv-pos-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: var(--sp-2); margin-bottom: var(--sp-3); }
.tv-pos-item { text-align: center; }
.tv-pos-label { font-size: 10px; color: var(--text-muted); margin-bottom: 2px; }
.tv-pos-val   { font-size: 13px; font-weight: 700; font-family: 'SF Mono',monospace; }

/* ── STRATEGY CARD ── */
.strategy-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.strategy-card { background: var(--surface-card); border: 1.5px solid var(--hairline); border-radius: var(--r-lg); padding: var(--sp-3); cursor: pointer; text-align: center; transition: border-color .15s; }
.strategy-card.selected { border-color: var(--yellow); background: rgba(252,213,53,.05); }
.strategy-card:active { opacity: .8; }
.strategy-code   { font-size: 28px; font-weight: 700; margin-bottom: 4px; font-family: 'SF Mono',monospace; }
.strategy-name   { font-size: 11px; font-weight: 700; color: var(--text-body); margin-bottom: 2px; }
.strategy-target { font-size: 10px; color: var(--text-muted); }
.risk-bar  { height: 3px; background: var(--hairline); border-radius: 99px; margin-top: 8px; overflow: hidden; }
.risk-fill { height: 100%; border-radius: 99px; }

/* ── LEADERBOARD ── */
.lb-row { display: flex; align-items: center; gap: 12px; padding: 12px var(--sp-4); border-bottom: 1px solid var(--hairline); }
.lb-row:last-child { border-bottom: none; }
.lb-row.me { background: rgba(252,213,53,.05); }
.lb-rank { font-size: 13px; font-weight: 700; width: 24px; color: var(--text-muted); flex-shrink: 0; font-family: 'SF Mono',monospace; }
.lb-rank.gold   { color: #fcd535; }
.lb-rank.silver { color: #929aa5; }
.lb-rank.bronze { color: #c47a3a; }
.lb-avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; flex-shrink: 0; }
.lb-name   { flex: 1; font-size: 13px; font-weight: 500; }
.lb-profit { font-size: 14px; font-weight: 700; color: var(--up); font-family: 'SF Mono',monospace; }

/* ── COIN GROUP CARD ── */
.coin-group-card { background: var(--surface-card); border: 1.5px solid var(--hairline); border-radius: var(--r-lg); padding: var(--sp-4); margin-bottom: var(--sp-2); display: flex; align-items: center; gap: var(--sp-3); cursor: pointer; }
.coin-group-card:active { background: var(--surface-elevated); }
.coin-group-card.active { border-color: var(--up); }
.coin-group-icon { width: 44px; height: 44px; border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.coin-group-icon svg { width: 22px; height: 22px; }
.coin-group-body { flex: 1; min-width: 0; }
.coin-group-name  { font-size: 14px; font-weight: 700; }
.coin-group-coins { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.coin-group-right { flex-shrink: 0; }

/* ── CHECKLIST ITEM ── */
.check-item { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: var(--r-md); border: 1px solid var(--hairline); margin-bottom: var(--sp-2); font-size: 13px; font-weight: 500; }
.check-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.check-item.ok  { border-color: rgba(14,203,129,.3); background: rgba(14,203,129,.06); color: var(--up); }
.check-item.no  { border-color: rgba(246,70,93,.3);  background: rgba(246,70,93,.06);  color: var(--down); }
.check-item.ok svg  { color: var(--up); }
.check-item.no svg  { color: var(--down); }

/* ── INFO ROW ── */
.info-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--hairline); }
.info-row:last-child { border-bottom: none; }
.info-key { font-size: 13px; color: var(--text-muted); }
.info-val { font-size: 13px; font-weight: 600; color: var(--text-body); font-family: 'SF Mono',monospace; }
.info-val.yellow { color: var(--yellow); }
.info-val.up   { color: var(--up); }
.info-val.down { color: var(--down); }

/* ── EMPTY / HELPER ── */
.empty { text-align: center; padding: 40px var(--sp-4); color: var(--text-muted); font-size: 13px; }
.topup-fee-box { background: var(--surface-elevated); border-radius: var(--r-md); padding: var(--sp-3); margin-bottom: var(--sp-3); display: none; }
.topup-fee-row { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 13px; }
.topup-fee-row:last-child { margin-bottom: 0; border-top: 1px solid var(--hairline); padding-top: 6px; font-weight: 700; }
