/*
 * ============================================================================
 *  Zxo.farm — shared dashboard styles  (style/dashboard.css)
 * ============================================================================
 *  Used by every zxo.farm dashboard page (referral-dashboard, reward-dashboard,
 *  …) together with js/dashboard.js. Same color tokens and light/dark theme as
 *  referral-tools.html; the theme class (html.light) is set by each page's
 *  pre-paint script from the shared "theme" cookie.
 *
 *  Page-specific tweaks belong in a small <style> block on that page, not here.
 * ============================================================================
 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Space+Grotesk:wght@500;600;700&family=Teko:wght@500;600;700&display=swap');

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

/* Same tokens as referral-tools.html */
:root {
  --bg-page: #0a0a08;
  --bg-container: #0d0f0a;
  --bg-section: #10120c;
  --bg-input: #0a0c08;
  --text-primary: #f5f0e4;
  --text-secondary: rgba(245,240,228,0.68);
  --text-muted: rgba(245,240,228,0.5);
  --border-color: rgba(224,172,84,0.18);
  --border-strong: #3f3f2e;
  --accent-gold: #e0ac54;
  --accent-green: #469160;
  --accent-red: #ba4c34;
  --btn-text: #0e0f0b;
  --meter-track: rgba(224,172,84,0.12);
  --row-hover: rgba(224,172,84,0.05);
  --clip: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
}
html.light {
  --bg-page: #faf6ec;
  --bg-container: #ffffff;
  --bg-section: #f5f0e4;
  --bg-input: #ffffff;
  --text-primary: #2b2318;
  --text-secondary: rgba(43,35,24,0.72);
  --text-muted: rgba(43,35,24,0.55);
  --border-color: rgba(43,35,24,0.12);
  --border-strong: rgba(43,35,24,0.22);
  --accent-gold: #8a5c19;
  --accent-green: #245c3a;
  --accent-red: #8f3324;
  --btn-text: #ffffff;
  --meter-track: rgba(138,92,25,0.12);
  --row-hover: rgba(138,92,25,0.05);
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  padding: 40px 20px;
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent-gold); outline-offset: 3px; }

.logo-font { font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; letter-spacing: -0.03em; }
.num { font-family: 'Teko', sans-serif; font-weight: 600; line-height: .9; font-variant-numeric: tabular-nums; }

.container {
  max-width: 1040px;
  margin: 0 auto;
  background: var(--bg-container);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 28px 32px 32px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

/* ---- top bar ---- */
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 44px; height: auto; filter: drop-shadow(0 0 12px rgba(224,172,84,.45)); }
.brand span { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1.05rem; color: var(--text-primary); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  background: var(--bg-section); border: 1px solid var(--border-color); color: var(--text-secondary);
  width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 0.95rem; transition: border-color .2s ease, color .2s ease; text-decoration: none;
}
.icon-btn:hover { border-color: var(--accent-gold); color: var(--accent-gold); }

/* ---- header ---- */
h1 { font-size: 2.3rem; line-height: 1.05; margin-bottom: 10px; }
.lede { color: var(--text-secondary); font-size: 1rem; max-width: 62ch; margin-bottom: 26px; }

/* ---- spotlight: the one bold element ---- */
.spotlight {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: 8px 36px;
  align-items: center;
  padding: 26px 30px;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(224,172,84,.14), transparent 55%),
    var(--bg-section);
  overflow: hidden;
  margin-bottom: 18px;
}
html.light .spotlight { background: radial-gradient(120% 140% at 0% 0%, rgba(138,92,25,.10), transparent 55%), var(--bg-section); }
.spot-rate { display: flex; flex-direction: column; }
.spot-rate .num { font-size: clamp(5.2rem, 13vw, 8.5rem); color: var(--accent-gold); letter-spacing: -.01em; }
.spot-rate small { color: var(--text-secondary); font-size: .9rem; margin-top: 6px; max-width: 22ch; }
.spot-detail { min-width: 0; }
.spot-kicker { color: var(--accent-green); font-weight: 600; font-size: .9rem; margin-bottom: 8px; }
html.light .spot-kicker { color: var(--accent-green); }
.spot-pool { display: flex; align-items: center; gap: 12px; min-width: 0; margin-bottom: 6px; }
.spot-pool .pair-name { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1.5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.spot-where { color: var(--text-secondary); font-size: .9rem; margin-bottom: 16px; }
.spot-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.spot-loading { color: var(--text-muted); grid-column: 1 / -1; padding: 28px 0; }

/* buttons — site style (clipped corners, Teko caps) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border: 0; border-radius: 0; clip-path: var(--clip);
  font-family: 'Teko', sans-serif; font-weight: 700; font-size: 1.1rem; letter-spacing: .05em; text-transform: uppercase;
  text-decoration: none; cursor: pointer; transition: opacity .15s ease; line-height: 1;
}
.btn:hover { opacity: .88; }
.btn-gold { background: var(--accent-gold); color: var(--btn-text); }
.btn-green { background: var(--accent-green); color: var(--btn-text); }
.btn-ghost { background: rgba(224,172,84,.08); color: var(--accent-gold); }
html.light .btn-ghost { background: rgba(138,92,25,.08); }

/* ---- quiet summary ---- */
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--border-color); border-radius: 14px; margin-bottom: 28px; }
.summary > div { padding: 14px 18px; min-width: 0; }
.summary > div + div { border-left: 1px solid var(--border-color); }
.summary dt { color: var(--text-muted); font-size: .8rem; }
.summary dd { font-family: 'Teko', sans-serif; font-size: 2rem; font-weight: 600; line-height: 1.1; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary dd small { font-family: 'Inter', sans-serif; font-size: .75rem; color: var(--text-muted); font-weight: 500; margin-left: 4px; }

/* ---- controls ---- */
.controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px;
  border: 1px solid var(--border-strong); border-radius: 999px; background: transparent; color: var(--text-secondary);
  font: 500 .85rem 'Inter', sans-serif; cursor: pointer; transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.chip.no-logo { padding-left: 12px; }
.chip:hover { color: var(--text-primary); border-color: var(--accent-gold); }
.chip[aria-pressed="true"] { background: var(--accent-gold); border-color: var(--accent-gold); color: var(--btn-text); }
/* "Show Testnet" — a switch, not a chain filter, so it reads quieter than the chain chips */
.chip.quiet { border-style: dashed; padding-left: 12px; }
.chip.quiet i { font-size: .8rem; }
.sort { display: inline-flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: .85rem; }
.sort select {
  background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 7px 10px; font: 500 .85rem 'Inter', sans-serif;
}

/* ---- chain sections ---- */
.chain { border: 1px solid var(--border-strong); border-radius: 16px; background: var(--bg-section); margin-bottom: 18px; overflow: hidden; }
.chain-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border-color); flex-wrap: wrap; }
.chain-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chain-title h2 { font-family: 'Space Grotesk', sans-serif; font-size: 1.2rem; font-weight: 700; }
.chain-meta { color: var(--text-muted); font-size: .85rem; }
.pill { font-size: .68rem; font-weight: 700; letter-spacing: .06em; padding: 2px 9px; border-radius: 999px; color: var(--accent-gold); border: 1px solid var(--border-color); background: rgba(224,172,84,.1); vertical-align: middle; }
.faucet { text-decoration: none; font-size: 1rem; line-height: 1; }
.chain-link { color: var(--accent-gold); font-weight: 600; font-size: .85rem; text-decoration: none; white-space: nowrap; }
.chain-link:hover { text-decoration: underline; }

.table { width: 100%; }
.thead, .row { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.6fr) minmax(0, .9fr) minmax(0, .55fr) 176px; gap: 16px; align-items: center; padding: 12px 20px; }
.thead { color: var(--text-muted); font-size: .78rem; padding-top: 10px; padding-bottom: 6px; }
.thead .r, .row .r { text-align: right; }
.row { border-top: 1px solid var(--border-color); transition: background .15s ease; }
.row:hover { background: var(--row-hover); }

.pool-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pool-text { min-width: 0; }
.pool-name { font-weight: 600; font-size: .98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pool-sub { color: var(--text-muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.rate-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.rate-cell .num { font-size: 2.15rem; color: var(--accent-gold); min-width: 3.4em; } /* fixed width so every bar starts at the same x */
.meter { flex: 1; min-width: 40px; height: 6px; border-radius: 999px; background: var(--meter-track); overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent-green), var(--accent-gold)); transition: width .9s cubic-bezier(.2,.7,.2,1); }
.metric { font-variant-numeric: tabular-nums; }
.metric b { font-weight: 600; }
.metric small { display: block; color: var(--text-muted); font-size: .74rem; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.row-actions .btn { padding: 8px 14px; font-size: 1rem; }
.row.unavailable .num, .row.unavailable .metric { color: var(--text-muted); }

.state { padding: 22px 20px; color: var(--text-muted); font-size: .92rem; }
.state.error { color: var(--accent-red); }
.state button { margin-left: 8px; background: none; border: 0; color: var(--accent-gold); font: 600 .9rem 'Inter', sans-serif; cursor: pointer; text-decoration: underline; }
.skeleton { height: 54px; margin: 10px 20px; border-radius: 10px; background: linear-gradient(90deg, var(--meter-track), transparent, var(--meter-track)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---- logos (used by js/dashboard.js helpers) ---- */
.zd-logo { position: relative; display: inline-flex; border-radius: 50%; overflow: hidden; border: 2px solid var(--bg-section); flex-shrink: 0; background: var(--bg-section); }
.zd-logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.zd-logo-letter { display: none; width: 100%; height: 100%; align-items: center; justify-content: center; background: var(--accent-gold); color: var(--btn-text); font-weight: 700; }
.zd-pair-logos { display: inline-flex; align-items: center; flex-shrink: 0; }
.zd-chain-logo { border-color: var(--border-color); }

/* ---- explainer + upcoming ---- */
.notes { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 28px; margin-top: 30px; padding-top: 26px; border-top: 1px solid var(--border-color); }
.notes h3 { font-family: 'Space Grotesk', sans-serif; font-size: 1.05rem; margin-bottom: 8px; }
.notes p { color: var(--text-secondary); font-size: .92rem; max-width: 60ch; }
.notes p + p { margin-top: 8px; }
.notes a { color: var(--accent-gold); font-weight: 600; }
.upcoming { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
/* Direct children only: the chips. A plain ".upcoming span" also matched the
   spans inside each chain logo and switched its hidden fallback letter back on. */
.upcoming > span { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--text-secondary); border: 1px dashed var(--border-strong); border-radius: 999px; padding: 4px 10px 4px 5px; }
.stamp { color: var(--text-muted); font-size: .8rem; margin-top: 14px; }

/* Each link is as wide as its label plus an even share of the spare room, and
   the row wraps rather than breaking a label over two lines. */
.footer-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; padding-top: 26px; border-top: 1px solid var(--border-color); }
.footer-link {
  flex: 1 1 auto; display: block; padding: 16px 16px; white-space: nowrap; background: rgba(224, 172, 84, 0.08); color: var(--accent-gold); text-align: center;
  clip-path: var(--clip); text-decoration: none; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  font-family: 'Teko', sans-serif; font-size: 1.1rem; transition: background .2s ease;
}
.footer-link:hover { background: rgba(224, 172, 84, 0.15); }
.footer-link.green { background: rgba(70, 145, 96, 0.1); color: var(--accent-green); }
.footer-link.green:hover { background: rgba(70, 145, 96, 0.18); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- tablet ---- */
@media (max-width: 860px) {
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary > div:nth-child(3) { border-left: 0; }
  .summary > div:nth-child(n+3) { border-top: 1px solid var(--border-color); }
  .notes { grid-template-columns: minmax(0, 1fr); }
}

/* ---- phones: rows become stacked blocks ---- */
@media (max-width: 720px) {
  body { padding: 16px 6px; }
  .container { padding: 18px 14px 22px; border-radius: 14px; }
  h1 { font-size: 1.75rem; }
  .lede { font-size: .92rem; }
  .spotlight { grid-template-columns: minmax(0, 1fr); padding: 20px 18px; gap: 4px; }
  .spot-pool .pair-name { font-size: 1.2rem; }
  .spot-actions .btn { flex: 1 1 100%; }
  .summary dd small { display: block; margin-left: 0; line-height: 1.2; }
  .rate-cell .num { min-width: 0; }
  .chain-head { padding: 14px 14px; }
  .thead { display: none; }
  .row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "pool pool" "rate rate" "apr stakes" "act act";
    gap: 10px 12px; padding: 14px;
  }
  .row > .pool-cell { grid-area: pool; }
  .row > .rate-cell { grid-area: rate; }
  .row > .apr { grid-area: apr; text-align: left; }
  .row > .stakes { grid-area: stakes; }
  .row > .row-actions { grid-area: act; justify-content: stretch; }
  .row-actions .btn { flex: 1; }
  .metric small { display: inline; margin-left: 4px; }
  .footer-links { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .meter > i, .skeleton { transition: none; animation: none; }
}
