/* ══════════════════════════════════════════════════════
   APXTrading Components v1.0
   bot/assets/css/components.css
   ══════════════════════════════════════════════════════ */

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

html, body {
  min-height:100%;
  background: var(--surface-page);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--color-blue); text-decoration:none; }
a:hover { text-decoration:underline; }
button { font-family:inherit; cursor:pointer; border:none; }
input, select, textarea { font-family:inherit; }

::-webkit-scrollbar { width:8px; height:8px; }
::-webkit-scrollbar-thumb { background: var(--gray-400); border-radius:4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ── Buttons ───────────────────────────────────────── */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap: var(--sp-2);
  padding: 11px 20px;
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  font-weight: 600;
  border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); text-decoration:none; }
.btn:disabled { opacity:.45; cursor:not-allowed; transform:none; }
.btn-block { width:100%; }
.btn-sm { padding: 7px 14px; font-size: var(--fs-xs); }
.btn-lg { padding: 14px 26px; font-size: var(--fs-base); }

.btn-primary {
  background: linear-gradient(135deg, var(--color-gold), var(--color-gold-dark));
  color: var(--color-navy);
  box-shadow: var(--shadow-gold);
}
.btn-secondary {
  background: var(--surface-card);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--color-gold); color: var(--color-gold-dark); }
.btn-success { background: var(--color-teal); color:#fff; }
.btn-danger  { background: var(--color-red);  color:#fff; }
.btn-ghost   { background: transparent; color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--gray-100); color: var(--text-primary); }

/* ── Cards ─────────────────────────────────────────── */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display:flex; align-items:center; justify-content:space-between;
  gap: var(--sp-3); flex-wrap:wrap;
  margin-bottom: var(--sp-4);
}
.card-title { font-size: var(--fs-lg); font-weight:700; }
.card-sub   { font-size: var(--fs-sm); color: var(--text-muted); }

/* Stat card */
.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-4) var(--sp-5);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content:''; position:absolute; top:0; left:0; right:0; height:3px;
  background: var(--gray-200);
}
.stat-card.gold::before  { background: linear-gradient(90deg, var(--color-gold), var(--color-gold-light)); }
.stat-card.teal::before  { background: var(--color-teal); }
.stat-card.green::before { background: var(--color-green); }
.stat-card.amber::before { background: var(--color-amber); }
.stat-card.red::before   { background: var(--color-red); }
.stat-card.blue::before  { background: var(--color-blue); }
.stat-label {
  font-size: var(--fs-xs); font-weight:700; letter-spacing:.06em;
  text-transform: uppercase; color: var(--text-muted);
  margin-bottom: var(--sp-2);
}
.stat-value {
  font-family: var(--font-mono);
  font-size: var(--fs-xl); font-weight:700;
  letter-spacing:-.02em; word-break: break-all;
}
.stat-hint { font-size: var(--fs-xs); color: var(--text-faint); margin-top: var(--sp-1); }

/* ── Badges / pills ────────────────────────────────── */
.badge {
  display:inline-flex; align-items:center; gap: var(--sp-1);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs); font-weight:700;
}
.badge-gold   { background: var(--color-gold-light);   color: var(--color-gold-dark); }
.badge-teal   { background: var(--color-teal-light);   color: var(--color-teal); }
.badge-green  { background: var(--color-green-light);  color: var(--color-green); }
.badge-red    { background: var(--color-red-light);    color: var(--color-red); }
.badge-amber  { background: var(--color-amber-light);  color: var(--color-amber); }
.badge-blue   { background: var(--color-blue-light);   color: var(--color-blue); }
.badge-purple { background: var(--color-purple-light); color: var(--color-purple); }
.badge-gray   { background: var(--gray-100);           color: var(--text-muted); }

.dot {
  width:7px; height:7px; border-radius:50%;
  background: var(--color-green); display:inline-block;
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%     { opacity:.45; transform:scale(1.35); }
}

/* ── Alerts ────────────────────────────────────────── */
.alert {
  display:flex; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  line-height:1.55;
  border:1px solid;
  margin-bottom: var(--sp-3);
}
.alert-info    { background: var(--color-blue-light);  border-color:rgba(26,95,168,.25);  color: var(--color-blue); }
.alert-success { background: var(--color-green-light); border-color:rgba(21,128,61,.25);  color: var(--color-green); }
.alert-warn    { background: var(--color-amber-light); border-color:rgba(180,83,9,.25);   color: var(--color-amber); }
.alert-danger  { background: var(--color-red-light);   border-color:rgba(185,28,28,.25);  color: var(--color-red); }
.alert b { font-weight:700; }

/* ── Forms ─────────────────────────────────────────── */
.field { margin-bottom: var(--sp-4); }
.field label {
  display:block; font-size: var(--fs-xs); font-weight:700;
  text-transform:uppercase; letter-spacing:.05em;
  color: var(--text-muted); margin-bottom: var(--sp-2);
}
.input {
  width:100%;
  padding: 11px 14px;
  background: var(--surface-card);
  border:1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: var(--fs-base);
  color: var(--text-primary);
  transition: var(--transition);
}
.input:focus {
  outline:none;
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,.18);
}
.input[readonly] { background: var(--gray-100); color: var(--text-muted); }
.input-row { display:flex; gap: var(--sp-2); }
.input-row .input { flex:1; min-width:0; }
.field-hint { font-size: var(--fs-xs); color: var(--text-faint); margin-top: var(--sp-1); }
.field-msg  { font-size: var(--fs-sm); font-weight:600; min-height:18px; margin-top: var(--sp-2); }
.field-msg.ok { color: var(--color-green); }
.field-msg.err{ color: var(--color-red); }
.field-msg.ld { color: var(--text-muted); }

/* ── Tables ────────────────────────────────────────── */
.table-wrap { overflow-x:auto; -webkit-overflow-scrolling:touch; }
.table { width:100%; border-collapse:collapse; font-size: var(--fs-sm); }
.table th {
  text-align:left; white-space:nowrap;
  padding: var(--sp-3);
  font-size: var(--fs-xs); font-weight:700;
  text-transform:uppercase; letter-spacing:.06em;
  color: var(--text-muted);
  border-bottom:2px solid var(--border-subtle);
}
.table td {
  padding: var(--sp-3);
  border-bottom:1px solid var(--border-subtle);
  vertical-align:middle;
}
.table tbody tr:last-child td { border-bottom:none; }
.table tbody tr:hover td { background: var(--gray-50); }
.table .num { font-family: var(--font-mono); font-weight:600; }
.table .right { text-align:right; }
.table .center { text-align:center; }

.empty-state {
  padding: var(--sp-10) var(--sp-5);
  text-align:center;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  line-height:1.7;
}
.loading-state {
  padding: var(--sp-8);
  text-align:center;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  display:flex; align-items:center; justify-content:center; gap: var(--sp-2);
}

/* ── Tabs ──────────────────────────────────────────── */
.tabs {
  display:flex; gap: var(--sp-1); flex-wrap:wrap;
  border-bottom:1px solid var(--border-subtle);
  padding-bottom: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.tab {
  background:transparent;
  border:1px solid transparent;
  border-radius: var(--radius-md);
  padding: 6px 14px;
  font-size: var(--fs-sm); font-weight:600;
  color: var(--text-muted);
  transition: var(--transition);
}
.tab:hover { color: var(--text-primary); border-color: var(--border-subtle); }
.tab.active { background: var(--color-gold-light); border-color: var(--color-gold); color: var(--color-gold-dark); }
.tab-count {
  display:inline-block; min-width:18px;
  padding:0 5px; margin-left: var(--sp-1);
  border-radius: var(--radius-full);
  background: var(--color-navy-mid); color:#fff;
  font-size:10px; font-weight:700; line-height:18px; text-align:center;
}
.tab-panel { display:none; }
.tab-panel.active { display:block; animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity:0; transform:translateY(4px);} to { opacity:1; transform:none;} }

/* ── Modal ─────────────────────────────────────────── */
.modal {
  position:fixed; inset:0; z-index:200;
  background: rgba(13,27,42,.72);
  backdrop-filter: blur(4px);
  display:none; align-items:center; justify-content:center;
  padding: var(--sp-5);
}
.modal.open { display:flex; }
.modal-box {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-6);
  width:100%; max-width:460px;
  max-height: 90vh; overflow-y:auto;
}
.modal-icon  { font-size:38px; text-align:center; margin-bottom: var(--sp-2); }
.modal-title { font-size: var(--fs-xl); font-weight:700; text-align:center; margin-bottom: var(--sp-2); }
.modal-desc  { font-size: var(--fs-sm); color: var(--text-muted); text-align:center; line-height:1.65; margin-bottom: var(--sp-5); }

/* ── Toast ─────────────────────────────────────────── */
.toast {
  position:fixed; left:50%; bottom: var(--sp-6);
  transform: translateX(-50%) translateY(14px);
  z-index:9999;
  display:flex; align-items:center; gap: var(--sp-3);
  max-width: 92%;
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-md);
  background: var(--color-navy);
  color: var(--text-on-dark);
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-lg);
  border-left:4px solid var(--color-gold);
  opacity:0; pointer-events:none;
  transition: var(--transition);
}
.toast.show { opacity:1; transform:translateX(-50%) translateY(0); pointer-events:auto; }
.toast.ok   { border-left-color: var(--color-teal); }
.toast.err  { border-left-color: var(--color-red); }
.toast.warn { border-left-color: var(--color-amber); }
.toast-close { background:none; color:inherit; opacity:.6; font-size:16px; margin-left:auto; }
.toast-close:hover { opacity:1; }

/* ── Busy bar ──────────────────────────────────────── */
.busy-bar {
  position:fixed; top:0; left:0; right:0; z-index:9998;
  display:none; align-items:center; gap: var(--sp-3);
  padding: 10px var(--sp-5);
  background: linear-gradient(90deg, var(--color-gold), var(--color-gold-dark));
  color: var(--color-navy);
  font-size: var(--fs-sm); font-weight:700;
}
.busy-bar.show { display:flex; }
.spinner {
  width:14px; height:14px;
  border:2px solid rgba(13,27,42,.3);
  border-top-color: var(--color-navy);
  border-radius:50%;
  animation: spin .8s linear infinite;
  display:inline-block; flex-shrink:0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Grids ─────────────────────────────────────────── */
.grid { display:grid; gap: var(--sp-3); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 820px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ── Utility ───────────────────────────────────────── */
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); }
.center-text { text-align:center; }
.hidden { display:none !important; }
.pos { color: var(--color-green); }
.neg { color: var(--color-red); }
.gold { color: var(--color-gold-dark); }
.kv {
  display:flex; align-items:center; justify-content:space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom:1px solid var(--border-subtle);
  font-size: var(--fs-sm);
}
.kv:last-child { border-bottom:none; }
.kv-key { color: var(--text-muted); }
.kv-val { font-family: var(--font-mono); font-weight:600; text-align:right; word-break:break-all; }
