/* ══════════════════════════════════════
   NEXUS Exchange — Main Stylesheet
══════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Syne:wght@400;500;600;700;800&display=swap');

/* ── Theme Variables ─────────────────── */
:root {
  --bg:       #080B12;
  --bg2:      #0D1117;
  --bg3:      #131923;
  --bg4:      #1A2232;
  --bg5:      #222d3d;
  --border:   rgba(255,255,255,0.07);
  --border2:  rgba(255,255,255,0.14);
  --accent:   #00E5CC;
  --accent2:  #0066FF;
  --accent-d: rgba(0,229,204,0.12);
  --accent2-d:rgba(0,102,255,0.12);
  --green:    #00C896;
  --red:      #FF4466;
  --gold:     #FFB800;
  --purple:   #A855F7;
  --text:     #F0F4FF;
  --text2:    #8892A4;
  --text3:    #4A5568;
  --radius:   14px;
  --radius-sm:8px;
  --shadow:   0 4px 24px rgba(0,0,0,0.4);
  --font-display: 'Syne', sans-serif;
  --font-mono:    'Space Mono', monospace;
  --font-body:    'Syne', sans-serif;
}

[data-theme="light"] {
  --bg:       #F5F7FA;
  --bg2:      #FFFFFF;
  --bg3:      #EEF1F7;
  --bg4:      #E4E8F0;
  --bg5:      #D8DDE8;
  --border:   rgba(0,0,0,0.08);
  --border2:  rgba(0,0,0,0.14);
  --accent:   #008F7F;
  --accent2:  #0052CC;
  --accent-d: rgba(0,143,127,0.1);
  --accent2-d:rgba(0,82,204,0.1);
  --green:    #00875A;
  --red:      #DE350B;
  --gold:     #B8860B;
  --purple:   #6554C0;
  --text:     #172B4D;
  --text2:    #5E6C84;
  --text3:    #97A0AF;
  --shadow:   0 4px 24px rgba(0,0,0,0.08);
}

/* ── Reset ───────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font-body); }
input, select, textarea { font-family: var(--font-body); }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--bg5); border-radius: 4px; }

/* ── Typography ──────────────────────── */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; }
.text-mono { font-family: var(--font-mono); }
.text-green { color: var(--green) !important; }
.text-red   { color: var(--red) !important; }
.text-accent{ color: var(--accent) !important; }
.text-gold  { color: var(--gold) !important; }
.text-dim   { color: var(--text2); }
.text-xs    { font-size: 0.72rem; }
.text-sm    { font-size: 0.82rem; }
.text-lg    { font-size: 1.1rem; }
.fw-600     { font-weight: 600; }
.fw-700     { font-weight: 700; }

/* ── Layout ──────────────────────────── */
.container   { max-width: 480px; margin: 0 auto; padding: 0 16px; }
.p16         { padding: 16px; }
.p20         { padding: 20px; }
.mt8         { margin-top: 8px; }
.mt12        { margin-top: 12px; }
.mt16        { margin-top: 16px; }
.mt20        { margin-top: 20px; }
.mt24        { margin-top: 24px; }
.mb8         { margin-bottom: 8px; }
.mb12        { margin-bottom: 12px; }
.mb16        { margin-bottom: 16px; }
.mb20        { margin-bottom: 20px; }
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.flex-center { align-items: center; justify-content: center; }
.flex-between{ align-items: center; justify-content: space-between; }
.gap8        { gap: 8px; }
.gap12       { gap: 12px; }
.gap16       { gap: 16px; }
.w100        { width: 100%; }
.relative    { position: relative; }

/* ── Cards ───────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 20px;
  transition: background 0.3s, border-color 0.3s;
}
.card-subtle {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

/* ── Inputs ──────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.input {
  width: 100%;
  padding: 13px 16px;
  background: var(--bg3);
  border: 1.5px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.92rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.input:focus {
  border-color: var(--accent);
  background: var(--bg4);
  box-shadow: 0 0 0 3px var(--accent-d);
}
.input::placeholder { color: var(--text3); }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 46px; }
.input-icon {
  position: absolute; right: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--text3); cursor: pointer;
  transition: color 0.2s;
}
.input-icon:hover { color: var(--text2); }
.input-suffix {
  display: flex; align-items: stretch;
}
.input-suffix .input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); border-right: none; flex: 1; }
.input-suffix-btn {
  padding: 0 16px;
  background: var(--accent);
  color: #000;
  font-weight: 700;
  font-size: 0.78rem;
  border: 1.5px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  white-space: nowrap;
  transition: background 0.2s;
}
.input-suffix-btn:hover { background: #00ffeb; }
select.input { appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238892A4' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }

/* ── Buttons ─────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 700;
  border: none;
  transition: all 0.2s;
  cursor: pointer;
  white-space: nowrap;
}
.btn-full { width: 100%; padding: 15px; font-size: 0.95rem; }
.btn-accent {
  background: var(--accent);
  color: #000;
}
.btn-accent:hover { background: #00ffeb; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,229,204,0.35); }
[data-theme="light"] .btn-accent { background: var(--accent); color: #fff; }
[data-theme="light"] .btn-accent:hover { background: #00a896; }

.btn-accent2 {
  background: var(--accent2);
  color: #fff;
}
.btn-accent2:hover { background: #0077ff; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,102,255,0.35); }

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}
.btn-outline:hover { background: var(--accent-d); }

.btn-ghost {
  background: var(--bg3);
  color: var(--text2);
  border: 1.5px solid var(--border2);
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); background: var(--bg4); }

.btn-danger {
  background: rgba(255,68,102,0.15);
  color: var(--red);
  border: 1.5px solid rgba(255,68,102,0.3);
}
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-sm { padding: 7px 14px; font-size: 0.78rem; border-radius: 20px; }
.btn-xs { padding: 4px 10px; font-size: 0.72rem; border-radius: 6px; }

/* ── Pills / Badges ──────────────────── */
.pill {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 600;
}
.pill-green  { background: rgba(0,200,150,0.15); color: var(--green); }
.pill-red    { background: rgba(255,68,102,0.15); color: var(--red); }
.pill-gold   { background: rgba(255,184,0,0.15);  color: var(--gold); }
.pill-accent { background: var(--accent-d);        color: var(--accent); }
.pill-dim    { background: var(--bg4);             color: var(--text2); }
.pill-purple { background: rgba(168,85,247,0.15);  color: var(--purple); }

/* ── Section title ───────────────────── */
.section-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 14px;
}

/* ── Divider ─────────────────────────── */
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border2); }
.divider span { color: var(--text3); font-size: 0.75rem; font-weight: 600; }

/* ── Topbar ──────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px;
  background: rgba(8,11,18,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s;
}
[data-theme="light"] .topbar {
  background: rgba(245,247,250,0.94);
}
.topbar-logo {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.5px;
}
.topbar-logo span { color: var(--text3); }
.topbar-center {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}
.back-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg3); border: 1.5px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.back-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Bottom Nav ──────────────────────── */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  display: flex;
  background: var(--bg2);
  border-top: 1px solid var(--border2);
  height: 65px;
  transition: background 0.3s;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; cursor: pointer;
  color: var(--text3);
  font-size: 0.62rem; font-weight: 600;
  border: none; background: none; font-family: var(--font-body);
  transition: color 0.2s;
  padding: 8px 0;
}
.nav-item svg { transition: all 0.2s; }
.nav-item.active { color: var(--accent); }
.nav-item.active svg { filter: drop-shadow(0 0 5px var(--accent)); }

/* ── Toast ───────────────────────────── */
.toast {
  position: fixed; bottom: 85px; left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--bg4); border: 1.5px solid var(--border2);
  color: var(--text); border-radius: 10px;
  padding: 10px 20px; font-size: 0.82rem; font-weight: 600;
  z-index: 9999; opacity: 0; transition: all 0.25s;
  pointer-events: none; white-space: nowrap; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.toast-error { border-color: rgba(255,68,102,0.4); background: rgba(255,68,102,0.12); color: var(--red); }
.toast.toast-success { border-color: rgba(0,200,150,0.4); background: rgba(0,200,150,0.12); color: var(--green); }

/* ── Notice banner ───────────────────── */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 13px 14px; border-radius: var(--radius-sm);
  font-size: 0.8rem; line-height: 1.5;
}
.notice-warn { background: rgba(255,184,0,0.08); border: 1px solid rgba(255,184,0,0.2); color: var(--gold); }
.notice-error { background: rgba(255,68,102,0.08); border: 1px solid rgba(255,68,102,0.2); color: var(--red); }
.notice-info  { background: var(--accent-d); border: 1px solid rgba(0,229,204,0.2); color: var(--accent); }
.notice svg { flex-shrink: 0; margin-top: 1px; }

/* ── Coin icon ───────────────────────── */
.coin-icon {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.68rem;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* ── Network buttons ─────────────────── */
.network-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.network-btn {
  padding: 11px 8px; text-align: center;
  border-radius: var(--radius-sm);
  background: var(--bg3); border: 1.5px solid var(--border2);
  cursor: pointer; font-size: 0.8rem; font-weight: 600;
  color: var(--text2); transition: all 0.2s; font-family: var(--font-body);
}
.network-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-d); }
.network-btn:not(.active):hover { border-color: var(--border2); color: var(--text); background: var(--bg4); }

/* ── Address box ─────────────────────── */
.address-box {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--bg3); border: 1.5px solid var(--border2);
  border-radius: var(--radius-sm);
}
.address-text {
  flex: 1; font-family: var(--font-mono); font-size: 0.68rem;
  color: var(--text2); word-break: break-all; line-height: 1.6;
}

/* ── Info table ──────────────────────── */
.info-table { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; font-size: 0.82rem;
  border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; }
.info-row-label { color: var(--text2); }
.info-row-value { font-weight: 600; text-align: right; }

/* ── History items ───────────────────── */
.history-item {
  display: flex; align-items: center; padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.history-item:last-child { border-bottom: none; }
.history-icon {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-right: 12px; flex-shrink: 0;
}
.history-info { flex: 1; }
.history-title { font-size: 0.88rem; font-weight: 600; }
.history-sub   { font-size: 0.72rem; color: var(--text3); margin-top: 2px; }
.history-amount { font-family: var(--font-mono); font-size: 0.88rem; font-weight: 700; text-align: right; }
.history-status { font-size: 0.68rem; margin-top: 3px; text-align: right; }

/* ── Amount input ────────────────────── */
.amount-wrap { position: relative; }
.amount-input {
  width: 100%; padding: 16px 100px 16px 16px;
  background: var(--bg3); border: 1.5px solid var(--border2);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: var(--font-mono); font-size: 1.4rem; font-weight: 700;
  outline: none; transition: all 0.2s;
}
.amount-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-d); }
.amount-suffix {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; gap: 6px;
}
.max-tag {
  padding: 4px 9px; border-radius: 6px;
  background: var(--accent-d); color: var(--accent);
  font-size: 0.7rem; font-weight: 700; cursor: pointer; border: none;
  font-family: var(--font-body); transition: all 0.2s;
}
.max-tag:hover { background: var(--accent); color: #000; }
.coin-tag { font-size: 0.82rem; font-weight: 700; color: var(--text2); }

/* ── Theme toggle ────────────────────── */
.theme-toggle {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg3); border: 1.5px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s; color: var(--text2);
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ── Page system ─────────────────────── */
.page { display: none; min-height: calc(100vh - 65px); animation: fadeIn 0.2s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }

/* ── Loading spinner ─────────────────── */
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Hero image overlay ──────────────── */
.hero-img-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(8,11,18,0.3) 0%, rgba(8,11,18,0.85) 70%, var(--bg) 100%);
  pointer-events: none;
}
[data-theme="light"] .hero-img-overlay {
  background: linear-gradient(to bottom, rgba(245,247,250,0.2) 0%, rgba(245,247,250,0.8) 70%, var(--bg) 100%);
}

/* ── Coin select dropdown ────────────── */
.coin-select-btn {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px;
  background: var(--bg3); border: 1.5px solid var(--border2);
  border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s;
}
.coin-select-btn:hover { border-color: var(--accent); }
.coin-select-left { display: flex; align-items: center; gap: 10px; }

/* ── Balance bar ─────────────────────── */
.balance-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px;
  background: var(--bg3); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
}
