/* ==========================================================================
   SwiftXchange — shared theme
   Dark modern fintech look used across the marketing site, auth pages and
   the account dashboard. Loaded after any legacy/vendor CSS so it wins.
   ========================================================================== */

:root {
  --bg: #0B0E14;
  --surface: #141924;
  --surface-alt: #0E1219;
  --border: #262E3D;
  --border-soft: #1B2230;

  --text: #F5F7FA;
  --text-muted: #C7CEDB;
  --text-dim: #9AA5B8;
  --text-faint: #5C6679;

  --primary: #4C7CFF;
  --primary-soft: #7BA3FF;
  --primary-bg: #1B2A55;

  --success: #1FD8A4;
  --success-bg: #17382C;
  --warning: #F5A947;
  --warning-bg: #3B2E14;
  --danger: #FF6B6B;
  --danger-bg: #3B1F22;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
}

/* ---- Reset / base ------------------------------------------------------ */

html { -webkit-text-size-adjust: 100%; }

body.theme-page {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

.theme-page * { box-sizing: border-box; }

.theme-page a { color: var(--primary); text-decoration: none; }
.theme-page a:hover { color: var(--primary-soft); }

.theme-page h1, .theme-page h2, .theme-page h3, .theme-page h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

.theme-page img { max-width: 100%; }

.theme-container {
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  padding: 0 clamp(20px, 5vw, 80px);
}

/* ---- Buttons ------------------------------------------------------------ */

.theme-page .btn,
.theme-page button[type="submit"],
.theme-page input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  padding: 13px 24px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  background: var(--primary);
  color: var(--bg);
  text-decoration: none;
  transition: filter 0.15s ease;
}
.theme-page .btn:hover,
.theme-page button[type="submit"]:hover,
.theme-page input[type="submit"]:hover { filter: brightness(1.1); }

.theme-page .btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.theme-page .btn-secondary,
.theme-page button[type="button"].btn-cancel {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.theme-page .btn-block { width: 100%; }

/* ---- Cards / surfaces ---------------------------------------------------- */

.theme-page .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}

.theme-page .stat-card { padding: 20px; }
.theme-page .stat-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
  display: block;
}
.theme-page .stat-value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
}

.theme-page .badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}
.theme-page .badge-success { background: var(--success-bg); color: var(--success); }
.theme-page .badge-warning { background: var(--warning-bg); color: var(--warning); }
.theme-page .badge-danger { background: var(--danger-bg); color: var(--danger); }
.theme-page .badge-info { background: var(--primary-bg); color: var(--primary-soft); }

/* ---- Forms --------------------------------------------------------------- */

.theme-page label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.theme-page input[type="text"],
.theme-page input[type="email"],
.theme-page input[type="password"],
.theme-page input[type="number"],
.theme-page input[type="tel"],
.theme-page input[type="date"],
.theme-page input[type="file"],
.theme-page select,
.theme-page textarea,
.theme-page .form-control {
  width: 100%;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  margin-bottom: 4px;
}

.theme-page select { appearance: auto; }

.theme-page input::placeholder,
.theme-page textarea::placeholder { color: var(--text-faint); }

.theme-page input:focus,
.theme-page select:focus,
.theme-page textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.theme-page .field {
  margin-bottom: 18px;
}

.theme-page .field-hint {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: -2px;
  margin-bottom: 6px;
}

.theme-page input[type="checkbox"],
.theme-page input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  margin-right: 8px;
}

/* Soften Django/crispy error + help text wherever it leaks through */
.theme-page .errorlist,
.theme-page .invalid-feedback {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
  color: var(--danger);
  font-size: 13px;
}
.theme-page .helptext { color: var(--text-faint); font-size: 12px; }

/* Legacy crispy/bootstrap4 structural leftovers on un-migrated pages */
.theme-page .form-group { margin-bottom: 18px; }
.theme-page .form-text { color: var(--text-faint); font-size: 12px; }

/* ---- Alerts / Django messages -------------------------------------------- */

.theme-page .alert {
  position: relative;
  border-radius: var(--radius);
  padding: 14px 40px 14px 16px;
  margin-bottom: 20px;
  font-size: 14px;
  border: 1px solid transparent;
}
.theme-page .alert-success { background: var(--success-bg); color: var(--success); border-color: rgba(31,216,164,0.3); }
.theme-page .alert-info { background: var(--primary-bg); color: var(--primary-soft); border-color: rgba(76,124,255,0.3); }
.theme-page .alert-warning { background: var(--warning-bg); color: var(--warning); border-color: rgba(245,169,71,0.3); }
.theme-page .alert-danger,
.theme-page .alert-error { background: var(--danger-bg); color: var(--danger); border-color: rgba(255,107,107,0.3); }
.theme-page .alert .close {
  position: absolute;
  top: 10px;
  right: 14px;
  color: inherit;
  opacity: 0.6;
  text-decoration: none;
  font-size: 16px;
}
.theme-page .alert .close:hover { opacity: 1; }

/* ---- Tables --------------------------------------------------------------- */

.theme-page table { width: 100%; border-collapse: collapse; }
.theme-page table thead tr {
  text-align: left;
  font-size: 12px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.theme-page table th { padding: 0 10px 10px 0; font-weight: 600; }
.theme-page table td { padding: 12px 10px 12px 0; font-size: 14px; color: var(--text-muted); }
.theme-page table tbody tr { border-top: 1px solid var(--border-soft); }
.theme-page .table-scroll { overflow-x: auto; }
.theme-page .table-scroll table { min-width: 480px; }

/* ---- Pagination ------------------------------------------------------------ */

.theme-page .pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
}
.theme-page .pagination .page-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-soft);
  text-decoration: none;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.theme-page .pagination .page-link:hover { border-color: var(--primary); }
.theme-page .pagination .page-link.disabled {
  color: var(--text-faint);
  pointer-events: none;
  opacity: 0.5;
}
.theme-page .pagination .page-current {
  font-size: 13px;
  color: var(--text-faint);
}

/* Legacy Bootstrap table classes on un-migrated pages */
.theme-page .table-bordered,
.theme-page .table-bordered th,
.theme-page .table-bordered td { border: 1px solid var(--border-soft); }

/* ---- Legacy Bootstrap grid fallback (orphan pages not yet migrated) ----- */

.theme-page .container-fluid { width: 100%; padding: 0 20px; }
.theme-page .row { display: flex; flex-wrap: wrap; margin: 0 -8px; }
.theme-page .row > [class*="col-"] { padding: 0 8px; margin-bottom: 16px; flex: 1 1 260px; min-width: 0; }
.theme-page .shadow { box-shadow: 0 10px 30px rgba(0,0,0,0.25); }
.theme-page .text-gray-800, .theme-page .text-gray-900 { color: var(--text); }
.theme-page .text-gray-400, .theme-page .text-muted { color: var(--text-faint); }
.theme-page hr { border: none; border-top: 1px solid var(--border-soft); margin: 16px 0; }

/* ---- Utility -------------------------------------------------------------- */

.theme-page .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

@media (max-width: 640px) {
  .theme-page .hide-mobile { display: none; }
}

/* ==========================================================================
   Marketing site (header / hero / sections / footer)
   ========================================================================== */

.mkt-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(20px, 5vw, 80px);
  background: rgba(11,14,20,0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
.mkt-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.mkt-brand-name { font-family: var(--font-display); font-weight: 700; font-size: 19px; color: var(--text); letter-spacing: -0.01em; }

.mkt-nav-toggle { display: none; }
.mkt-header .mkt-hamburger {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.mkt-hamburger span,
.mkt-hamburger span::before,
.mkt-hamburger span::after {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--text);
  position: relative;
}
.mkt-hamburger span::before { content: ""; position: absolute; top: -5px; }
.mkt-hamburger span::after { content: ""; position: absolute; top: 5px; }

.mkt-links {
  display: flex;
  align-items: center;
  gap: 32px;
}
.mkt-links a { color: var(--text-dim); font-size: 14px; font-weight: 500; }
.mkt-links a:hover { color: var(--text); }

.mkt-actions { display: flex; align-items: center; gap: 8px; }
.mkt-actions a.btn-login { color: var(--text); font-size: 14px; font-weight: 600; padding: 10px 16px; }

@media (max-width: 860px) {
  .mkt-header { gap: 10px; }
  .mkt-header .mkt-hamburger { display: flex; flex-shrink: 0; }
  .mkt-actions .btn-login { display: none; }
  .mkt-actions .btn { padding: 10px 16px; font-size: 13px; white-space: nowrap; }
  .mkt-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    background: var(--surface);
    border-bottom: 1px solid var(--border-soft);
    padding: 12px clamp(20px, 5vw, 80px) 18px;
  }
  .mkt-links a { padding: 10px 0; width: 100%; }
  .mkt-links a.mobile-only { display: block; border-top: 1px solid var(--border-soft); margin-top: 4px; padding-top: 14px; }
  .mkt-nav-toggle:checked ~ .mkt-links { display: flex; }
}

@media (min-width: 861px) {
  .mkt-links a.mobile-only { display: none; }
}

.mkt-hero {
  padding: clamp(48px, 9vw, 110px) clamp(20px, 5vw, 80px) 64px;
  display: flex;
  flex-wrap: wrap;
  gap: 48px;
  align-items: center;
  max-width: 1280px;
  margin: 0 auto;
}
.mkt-hero-copy { flex: 1 1 420px; min-width: 0; }
.mkt-hero-visual { flex: 1 1 380px; min-width: 0; max-width: 460px; }
.mkt-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px 6px 10px;
  font-size: 13px;
  color: var(--success);
  font-weight: 600;
  margin-bottom: 22px;
}
.mkt-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.mkt-hero h1 { font-size: clamp(32px, 5vw, 54px); line-height: 1.08; margin-bottom: 20px; }
.mkt-hero p.lead { font-size: 17px; line-height: 1.65; color: var(--text-dim); max-width: 460px; margin: 0 0 30px; }

.mkt-section {
  padding: 56px clamp(20px, 5vw, 80px);
  max-width: 1280px;
  margin: 0 auto;
}
.mkt-section.alt { background: var(--surface-alt); border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); max-width: none; }
.mkt-section.alt > .theme-container { max-width: 1280px; padding: 0; }
.mkt-section h2 { font-size: clamp(22px, 3vw, 32px); text-align: center; margin: 0 0 40px; }

.mkt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
  gap: 20px;
}

.mkt-footer {
  border-top: 1px solid var(--border-soft);
  padding: 44px clamp(20px, 5vw, 80px) 24px;
}
.mkt-footer-grid { display: flex; flex-wrap: wrap; gap: 36px; max-width: 1280px; margin: 0 auto; }
.mkt-footer-col { flex: 1 1 200px; min-width: 0; }
.mkt-footer-heading {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-faint); margin-bottom: 14px;
}
.mkt-social {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-dim); margin-right: 10px;
}
.mkt-footer-bottom {
  max-width: 1280px; margin: 32px auto 0; padding-top: 22px;
  border-top: 1px solid var(--border-soft); text-align: center;
  color: var(--text-faint); font-size: 13px;
}

/* ==========================================================================
   Auth (login / sign up / password reset)
   ========================================================================== */

.auth-shell { min-height: 100vh; display: flex; flex-direction: column; }
.auth-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px clamp(20px, 5vw, 60px);
}
.auth-main { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; padding: 24px 20px 72px; }
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 36px;
}
.auth-card h1 { font-size: 24px; margin-bottom: 6px; }
.auth-card .sub { font-size: 14px; color: var(--text-dim); margin: 0 0 24px; }
.auth-row { display: flex; gap: 12px; flex-wrap: wrap; }
.auth-row > * { flex: 1 1 180px; min-width: 0; }
.auth-foot { text-align: center; font-size: 13px; color: var(--text-faint); margin-top: 20px; }

/* ==========================================================================
   Account dashboard (sidebar / topbar / content)
   ========================================================================== */

.dash-shell { display: flex; flex-wrap: wrap; min-height: 100vh; }

.dash-sidebar {
  flex: 0 1 250px; min-width: 220px;
  background: var(--surface-alt); border-right: 1px solid var(--border-soft);
  padding: 22px 14px; display: flex; flex-direction: column; gap: 2px;
}
.dash-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 20px; text-decoration: none; }
.dash-brand-name { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--text); }

.dash-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 10px;
  color: var(--text-dim); text-decoration: none;
  font-size: 14px; font-weight: 500;
}
.dash-link svg { stroke: var(--text-dim); flex-shrink: 0; }
.dash-link:hover { color: var(--text); }
.dash-link.active { background: var(--primary-bg); color: var(--text); font-weight: 600; }
.dash-link.active svg { stroke: var(--primary-soft); }

.dash-logout-wrap { margin-top: auto; padding-top: 16px; }
.dash-logout-wrap .dash-link { border-top: 1px solid var(--border-soft); margin-top: 6px; }

.dash-main {
  flex: 999 1 560px; min-width: 0;
  padding: 26px clamp(20px, 3vw, 40px) 60px;
  display: flex; flex-direction: column; gap: 22px;
}

.dash-nav-toggle { display: none; }
.dash-mobile-bar { display: none; }
.dash-backdrop { display: none; }

@media (max-width: 900px) {
  .dash-mobile-bar {
    display: flex; flex: 1 1 100%; align-items: center; justify-content: space-between;
    padding: 16px clamp(20px, 5vw, 40px);
    background: var(--surface-alt); border-bottom: 1px solid var(--border-soft);
  }
  .dash-mobile-bar .dash-brand { padding: 0; }

  .dash-mobile-bar .dash-hamburger {
    display: flex; width: 38px; height: 38px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--surface);
    align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
  }
  .dash-hamburger span, .dash-hamburger span::before, .dash-hamburger span::after {
    display: block; width: 16px; height: 2px; background: var(--text); position: relative;
  }
  .dash-hamburger span::before { content: ""; position: absolute; top: -5px; }
  .dash-hamburger span::after { content: ""; position: absolute; top: 5px; }

  .dash-sidebar {
    display: none;
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 300;
    width: 85%; max-width: 300px;
    overflow-y: auto;
    box-shadow: 20px 0 40px rgba(0,0,0,0.4);
  }
  .dash-nav-toggle:checked ~ .dash-sidebar { display: flex; }

  .dash-backdrop {
    position: fixed; inset: 0; z-index: 250;
    background: rgba(5,7,12,0.6);
  }
  .dash-nav-toggle:checked ~ .dash-backdrop { display: block; }
}

@media (min-width: 901px) {
  .dash-mobile-bar .dash-hamburger { display: none; }
}

.dash-topbar {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 12px;
}
.dash-topbar h1 { font-size: 22px; }
.dash-uid {
  font-size: 12px; font-weight: 700; color: var(--primary-soft);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 12px;
}
.dash-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary-bg); color: var(--primary-soft);
  font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}

.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 16px; }
.dash-grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }

.dash-chart { height: 600px; }
@media (max-width: 600px) {
  .dash-chart { height: 440px; }
}

.coin-badge {
  width: 36px; height: 36px; border-radius: 50%;
  font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
