/* NovaPay Design System */

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

:root {
  /* Color palette */
  --surface-0: #0f172a;
  --surface-1: #111827;
  --surface-2: #1a2234;
  --surface-3: #1e293b;
  --border:     #1e293b;
  --border-2:   #334155;

  --text:       #e2e8f0;
  --text-dim:   #94a3b8;
  --text-faint: #475569;

  --cyan:       #22d3ee;
  --cyan-dark:  #06b6d4;
  --blue:       #38bdf8;
  --green:      #34d399;
  --amber:      #fbbf24;
  --purple:     #a78bfa;
  --orange:     #fb923c;
  --red:        #f87171;
  --pink:       #f472b6;

  --accent:     var(--cyan);

  --radius:    10px;
  --radius-sm:  6px;
  --shadow:     0 2px 16px rgba(0,0,0,0.4);
  --shadow-lg:  0 4px 32px rgba(0,0,0,0.6);

  --mono: 'JetBrains Mono', 'Monaco', 'Courier New', monospace;
}

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

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background: var(--surface-0);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Nav ──────────────────────────────────────── */
.nav {
  background: var(--surface-3);
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

.nav-brand {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.5px;
  white-space: nowrap;
  margin-right: 32px;
  font-family: var(--mono);
}

.nav-brand span {
  color: var(--cyan);
  text-shadow: 0 0 7px rgba(34,211,238,0.9), 0 0 20px rgba(34,211,238,0.5);
}

.nav-links {
  display: flex;
  gap: 2px;
  flex: 1;
}

/* Lightsaber nav links */
.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
  transition: color 0.2s;
  white-space: nowrap;
}

.nav-links a::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 0;
  pointer-events: none;
  border-radius: var(--radius-sm);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0; left: 6px; right: 6px;
  height: 2px;
  opacity: 0;
  transition: opacity 0.2s, box-shadow 0.2s;
  z-index: 1;
  pointer-events: none;
  border-radius: 2px;
}

.nav-links a:hover::before { width: 100%; }
.nav-links a:hover::after  { opacity: 1; }
.nav-links a > * { position: relative; z-index: 2; }
.nav-links a:hover { color: var(--text); background: transparent; }

/* Lightsaber colors for nav links — 6-cycle */
.nav-links a:nth-child(6n+1)::before { background: linear-gradient(to right, rgba(56,189,248,0.18), rgba(56,189,248,0.04)); }
.nav-links a:nth-child(6n+1)::after  { background: #38bdf8; box-shadow: 0 0 8px #38bdf8, 0 0 20px rgba(56,189,248,0.4); }
.nav-links a:nth-child(6n+1):hover   { color: #38bdf8; }

.nav-links a:nth-child(6n+2)::before { background: linear-gradient(to right, rgba(34,211,238,0.18), rgba(34,211,238,0.04)); }
.nav-links a:nth-child(6n+2)::after  { background: #22d3ee; box-shadow: 0 0 8px #22d3ee, 0 0 20px rgba(34,211,238,0.4); }
.nav-links a:nth-child(6n+2):hover   { color: #22d3ee; }

.nav-links a:nth-child(6n+3)::before { background: linear-gradient(to right, rgba(52,211,153,0.18), rgba(52,211,153,0.04)); }
.nav-links a:nth-child(6n+3)::after  { background: #34d399; box-shadow: 0 0 8px #34d399, 0 0 20px rgba(52,211,153,0.4); }
.nav-links a:nth-child(6n+3):hover   { color: #34d399; }

.nav-links a:nth-child(6n+4)::before { background: linear-gradient(to right, rgba(167,139,250,0.18), rgba(167,139,250,0.04)); }
.nav-links a:nth-child(6n+4)::after  { background: #a78bfa; box-shadow: 0 0 8px #a78bfa, 0 0 20px rgba(167,139,250,0.4); }
.nav-links a:nth-child(6n+4):hover   { color: #a78bfa; }

.nav-links a:nth-child(6n+5)::before { background: linear-gradient(to right, rgba(251,191,36,0.18), rgba(251,191,36,0.04)); }
.nav-links a:nth-child(6n+5)::after  { background: #fbbf24; box-shadow: 0 0 8px #fbbf24, 0 0 20px rgba(251,191,36,0.4); }
.nav-links a:nth-child(6n+5):hover   { color: #fbbf24; }

.nav-links a:nth-child(6n+6)::before { background: linear-gradient(to right, rgba(251,146,60,0.18), rgba(251,146,60,0.04)); }
.nav-links a:nth-child(6n+6)::after  { background: #fb923c; box-shadow: 0 0 8px #fb923c, 0 0 20px rgba(251,146,60,0.4); }
.nav-links a:nth-child(6n+6):hover   { color: #fb923c; }

.nav-links a.active {
  background: rgba(34,211,238,0.12);
  color: var(--cyan);
  border-bottom: 2px solid var(--cyan);
}

.nav-user {
  margin-left: auto;
  font-size: 0.82rem;
  color: var(--text-dim);
  white-space: nowrap;
  padding-left: 16px;
  font-family: var(--mono);
}

.nav-user span { color: var(--cyan); font-weight: 600; }

/* ── Page Layout ──────────────────────────────── */
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 24px 72px;
}

.page-header { margin-bottom: 28px; }

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
  position: relative;
  display: inline-block;
  padding-bottom: 14px;
}

.page-header h1::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--cyan), transparent);
}

.page-header p {
  color: var(--text-dim);
  margin-top: 8px;
  font-size: 0.92rem;
}

/* ── Cards ────────────────────────────────────── */
.card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
  font-family: var(--mono);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

/* Journey cards */
.journey-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.journey-card::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  opacity: 0;
  transition: opacity 0.2s;
}

.journey-card:nth-child(8n+1)::before { background: linear-gradient(90deg, #38bdf8, transparent); }
.journey-card:nth-child(8n+2)::before { background: linear-gradient(90deg, #22d3ee, transparent); }
.journey-card:nth-child(8n+3)::before { background: linear-gradient(90deg, #34d399, transparent); }
.journey-card:nth-child(8n+4)::before { background: linear-gradient(90deg, #a78bfa, transparent); }
.journey-card:nth-child(8n+5)::before { background: linear-gradient(90deg, #fbbf24, transparent); }
.journey-card:nth-child(8n+6)::before { background: linear-gradient(90deg, #fb923c, transparent); }
.journey-card:nth-child(8n+7)::before { background: linear-gradient(90deg, #f87171, transparent); }
.journey-card:nth-child(8n+8)::before { background: linear-gradient(90deg, #f472b6, transparent); }

.journey-card:hover {
  border-color: var(--border-2);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.journey-card:hover::before { opacity: 1; }

.journey-card .journey-icon { font-size: 1.75rem; line-height: 1; }
.journey-card .journey-title { font-weight: 600; font-size: 1rem; color: var(--text); }
.journey-card .journey-scenario { font-size: 0.82rem; color: var(--text-dim); line-height: 1.5; }

/* ── Balance Display ──────────────────────────── */
.balance-display { text-align: center; padding: 8px 0 16px; }

.balance-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: var(--mono);
}

.balance-amount {
  font-size: 3rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  margin-top: 6px;
  font-family: var(--mono);
  background: linear-gradient(135deg, var(--text), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.balance-account-type {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-top: 4px;
  text-transform: capitalize;
  font-family: var(--mono);
}

/* ── Forms ────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-family: var(--mono);
  letter-spacing: 0.3px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface-1);
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

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

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34,211,238,0.12);
}

.form-group input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }

/* ── Buttons ──────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
  text-decoration: none;
  font-family: inherit;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--cyan);
  color: #0f172a;
  border-color: var(--cyan);
}

.btn-primary:hover:not(:disabled) {
  background: var(--cyan-dark);
  border-color: var(--cyan-dark);
  box-shadow: 0 0 12px rgba(34,211,238,0.35);
}

.btn-secondary {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border-2);
}

.btn-secondary:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--text-dim);
  background: var(--surface-3);
}

.btn-sm   { padding: 6px 14px; font-size: 0.78rem; }
.btn-full { width: 100%; }

/* ── Alerts ───────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-top: 12px;
  display: none;
  border-left: 3px solid;
}

.alert.show { display: block; }

.alert-success {
  background: rgba(52,211,153,0.1);
  color: #6ee7b7;
  border-color: var(--green);
}

.alert-error {
  background: rgba(248,113,113,0.1);
  color: #fca5a5;
  border-color: var(--red);
}

.alert-info {
  background: rgba(34,211,238,0.08);
  color: var(--cyan);
  border-color: var(--cyan);
}

/* ── Transaction List ─────────────────────────── */
.tx-list { list-style: none; }

.tx-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  border-radius: 4px;
  transition: background 0.1s;
}

.tx-item:last-child { border-bottom: none; }
.tx-item:hover { background: rgba(255,255,255,0.03); }

.tx-meta { display: flex; flex-direction: column; gap: 3px; }

.tx-type {
  font-weight: 500;
  text-transform: capitalize;
  color: var(--text);
}

.tx-date {
  color: var(--text-faint);
  font-size: 0.75rem;
  font-family: var(--mono);
}

.tx-amount {
  font-weight: 700;
  font-size: 0.92rem;
  font-family: var(--mono);
}

.tx-amount.credit { color: var(--green); text-shadow: 0 0 8px rgba(52,211,153,0.4); }
.tx-amount.debit  { color: var(--red); }

/* ── Status Badges ────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--mono);
}

.badge-active   { background: rgba(52,211,153,0.15); color: var(--green); border: 1px solid rgba(52,211,153,0.3); }
.badge-redeemed { background: rgba(148,163,184,0.1); color: var(--text-dim); border: 1px solid var(--border-2); }
.badge-expired  { background: rgba(248,113,113,0.12); color: var(--red); border: 1px solid rgba(248,113,113,0.3); }

/* ── Reward Items ─────────────────────────────── */
.reward-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.reward-item:last-child { border-bottom: none; }

.reward-info .reward-type { font-weight: 600; text-transform: capitalize; color: var(--text); }

.reward-info .reward-expires {
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-top: 2px;
  font-family: var(--mono);
}

.reward-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--green);
  white-space: nowrap;
  font-family: var(--mono);
  text-shadow: 0 0 8px rgba(52,211,153,0.4);
}

/* ── Checkout Products ────────────────────────── */
.product-list { display: flex; flex-direction: column; gap: 10px; }

.product-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface-1);
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.product-item:hover { border-color: var(--cyan); }

.product-item.selected {
  border-color: var(--cyan);
  background: rgba(34,211,238,0.06);
  box-shadow: inset 0 0 0 1px rgba(34,211,238,0.2);
}

.product-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--cyan);
  cursor: pointer;
  flex-shrink: 0;
}

.product-name { font-weight: 500; flex: 1; color: var(--text); }

.product-price {
  font-weight: 700;
  color: var(--cyan);
  font-family: var(--mono);
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0 8px;
  border-top: 1px solid var(--border-2);
  margin-top: 4px;
}

.total-label { font-weight: 600; color: var(--text-dim); font-size: 0.88rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.5px; }

.total-amount {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  font-family: var(--mono);
}

/* ── Settings Sections ────────────────────────── */
.settings-section {
  border-top: 1px solid var(--border);
  padding-top: 22px;
  margin-top: 22px;
}

.settings-section:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.settings-section h3 {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--cyan);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Auth Pages ───────────────────────────────── */
.auth-wrapper {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 440px;
}

.auth-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

.auth-card .auth-subtitle {
  color: var(--text-dim);
  font-size: 0.88rem;
  margin-bottom: 28px;
  font-family: var(--mono);
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.82rem;
  color: var(--text-faint);
}

.auth-footer a {
  color: var(--cyan);
  text-decoration: none;
  font-weight: 600;
}

.auth-footer a:hover { text-decoration: underline; }

/* ── Confirmation Box ─────────────────────────── */
.confirm-box {
  background: rgba(34,211,238,0.06);
  border: 1px solid rgba(34,211,238,0.25);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-top: 16px;
  display: none;
}

.confirm-box.show { display: block; }

.confirm-box h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--cyan);
  margin-bottom: 10px;
  font-family: var(--mono);
}

.confirm-detail { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 4px; }
.confirm-detail strong { color: var(--text); }

/* ── Gift Card Results ────────────────────────── */
.gc-result {
  background: var(--surface-1);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 12px;
  display: none;
}

.gc-result.show { display: block; }

.gc-balance {
  font-size: 2rem;
  font-weight: 700;
  color: var(--green);
  font-family: var(--mono);
  text-shadow: 0 0 10px rgba(52,211,153,0.4);
}

.gc-code-display {
  font-family: var(--mono);
  font-size: 0.85rem;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  padding: 4px 10px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 8px;
  color: var(--amber);
  letter-spacing: 0.5px;
}

/* ── Quick Links ──────────────────────────────── */
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.quick-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 500;
  text-align: center;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.quick-link:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(34,211,238,0.05);
}

.quick-link-icon { font-size: 1.4rem; }

/* ── Section Divider ──────────────────────────── */
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ── Spinner ──────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(15,23,42,0.4);
  border-top-color: #0f172a;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Lab info box (index page) ────────────────── */
.lab-info {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-left: 3px solid var(--cyan);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.lab-info strong { color: var(--text); }

.lab-info a { color: var(--cyan); text-decoration: none; }
.lab-info a:hover { text-decoration: underline; }

.persona-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.persona-grid div {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.persona-grid div strong { color: var(--amber); }

/* ── Scenario tip box ─────────────────────────── */
.tip-box {
  font-size: 0.82rem;
  color: var(--text-dim);
}

.tip-box ul {
  padding-left: 16px;
  line-height: 1.9;
}

.tip-box li strong { color: var(--cyan); }

.tip-box a { color: var(--cyan); text-decoration: none; }
.tip-box a:hover { text-decoration: underline; }

/* ── Code / mono ──────────────────────────────── */
code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--surface-3);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--amber);
}

/* ── Responsive ───────────────────────────────── */
@media (max-width: 680px) {
  .nav { padding: 0 12px; }
  .nav-links { display: none; }
  .page { padding: 20px 14px 48px; }
  .card { padding: 16px; }
  .auth-card { padding: 24px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .balance-amount { font-size: 2.2rem; }
}
