/* ── poly-data web interface — shared styles ── */

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

:root {
  --bg:         #0a0a14;
  --surface:    #12122a;
  --border:     #1e1e3a;
  --accent:     #a78bfa;
  --accent2:    #7c3aed;
  --text:       #e0e0e0;
  --muted:      #6b7280;
  --green:      #10b981;
  --red:        #ef4444;
  --orange:     #fb923c;
  --blue:       #60a5fa;
  --font:       -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Navigation ── */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}
nav .brand {
  font-weight: 700;
  font-size: 16px;
  color: var(--accent);
  text-decoration: none;
  margin-right: 16px;
  letter-spacing: -0.01em;
}
nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
nav a:hover { background: var(--border); color: var(--text); }
nav a.active { background: var(--border); color: var(--accent); }
nav .nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nav-status { font-size: 12px; display: flex; align-items: center; gap: 6px; color: var(--muted); }
.live-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}
.live-dot.offline { background: var(--muted); animation: none; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ── Layout ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px;
}

/* ── Stat cards ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 5px;
}
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.stat-value.green  { color: var(--green); }
.stat-value.red    { color: var(--red); }
.stat-value.purple { color: var(--accent); }
.stat-value.orange { color: var(--orange); }
.stat-sub { font-size: 11px; color: var(--muted); }

/* ── Sections ── */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.section-title { font-size: 15px; font-weight: 600; color: #d1d5db; }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  padding: 8px 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #1a1a2e; }
tr.no-data td { border-bottom: none; }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.badge.UP   { background: #064e3b; color: #34d399; }
.badge.DOWN { background: #450a0a; color: #f87171; }
.badge.BUY  { background: #064e3b; color: #34d399; }
.badge.SELL { background: #450a0a; color: #f87171; }
.badge.BTC  { background: #1c2a4a; color: #60a5fa; }
.badge.ETH  { background: #1a2a1a; color: #34d399; }
.badge.CLOSED  { background: #1e1e3a; color: var(--muted); }
.badge.ACTIVE  { background: #064e3b; color: #34d399; }

/* ── Price bar ── */
.price-bar-wrap { margin-bottom: 14px; }
.price-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.price-bar {
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  background: #1e1e3a;
}
.bar-up {
  background: linear-gradient(90deg, #059669, #10b981);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 4px 0 0 4px;
}
.bar-down {
  background: linear-gradient(90deg, #dc2626, #ef4444);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 0 4px 4px 0;
  margin-left: -1px;
}

/* ── Asset price cards ── */
.price-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}
.price-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}
.price-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.price-card-title {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.asset-icon { font-size: 20px; }
.window-timer { font-size: 12px; color: var(--muted); }
.window-timer span { color: var(--accent); font-weight: 600; }

.token-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.token-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}
.token-item.up   { border-left: 3px solid var(--green); }
.token-item.down { border-left: 3px solid var(--red); }
.token-label { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.token-price { font-size: 20px; font-weight: 700; }
.token-price.up   { color: var(--green); }
.token-price.down { color: var(--red); }
.token-pct { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.15s;
  text-decoration: none;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent2); color: #fff; border-color: var(--accent2); }
.btn-primary:hover:not(:disabled) { background: #6d28d9; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--border); color: var(--text); }
.btn-danger { background: #450a0a; color: #f87171; border-color: #7f1d1d; }
.btn-danger:hover:not(:disabled) { background: #7f1d1d; }
.btn .spinner {
  width: 12px; height: 12px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Filter bar ── */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.filter-bar label { font-size: 12px; color: var(--muted); }
.filter-bar select,
.filter-bar input {
  padding: 5px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
}
.filter-bar select:focus,
.filter-bar input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── Pagination ── */
.pagination {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  align-items: center;
}
.pagination button {
  padding: 5px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.pagination button:hover:not(:disabled) { background: var(--border); color: var(--text); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination .page-info { font-size: 12px; color: var(--muted); margin-left: auto; }

/* ── Misc ── */
.pnl-pos { color: var(--green); }
.pnl-neg { color: var(--red); }
.no-data { text-align: center; color: var(--muted); padding: 28px; font-size: 13px; }
.mono { font-family: 'SF Mono', 'Consolas', monospace; font-size: 12px; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 12px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ── Flash animations ── */
.price-card.flash-up { animation: flashGreen 0.5s ease-out; }
.price-card.flash-down { animation: flashRed 0.5s ease-out; }
@keyframes flashGreen {
  0%   { border-color: var(--green); box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
  50%  { border-color: var(--green); box-shadow: 0 0 0 6px rgba(16,185,129,0.15); }
  100% { border-color: var(--border); box-shadow: none; }
}
@keyframes flashRed {
  0%   { border-color: var(--red); box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50%  { border-color: var(--red); box-shadow: 0 0 0 6px rgba(239,68,68,0.15); }
  100% { border-color: var(--border); box-shadow: none; }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .container { padding: 16px 12px; }
  .price-grid { grid-template-columns: 1fr; gap: 12px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  nav { padding: 0 12px; }
}
@media (max-width: 480px) {
  nav a:not(.brand) { padding: 5px 8px; font-size: 12px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}
