/* ── URBot Credits — Loyalty Dashboard Styles ─────────────────────── */

:root {
  --bronze: #cd7f32;
  --silver: #a8a9ad;
  --gold: #ffd700;
  --platinum: #e5e4e2;
  --bg: #0a0f1e;
  --surface: #111827;
  --surface2: #1a2235;
  --border: #2a3550;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #6366f1;
  --accent2: #818cf8;
  --success: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

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

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

/* ── Nav ─────────────────────────────────────────────────────────────── */
.loyalty-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.loyalty-nav .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
}
.loyalty-nav .logo svg { width: 28px; height: 28px; }
.nav-email { font-size: .8rem; color: var(--muted); }

/* ── Hero: Balance ────────────────────────────────────────────────────── */
.hero-section {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  padding: 60px 24px 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(99,102,241,0.15) 0%, transparent 70%);
  pointer-events: none;
}
.hero-label {
  font-size: .75rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--accent2);
  margin-bottom: 8px;
}
.hero-balance {
  font-size: clamp(3rem, 10vw, 6rem);
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(135deg, #818cf8 0%, #c084fc 50%, #e879f9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: all .4s cubic-bezier(.34,1.56,.64,1);
}
.hero-balance.bump {
  transform: scale(1.08);
  filter: brightness(1.2);
}
.hero-subtitle {
  margin-top: 8px;
  color: var(--muted);
  font-size: .95rem;
}
.hero-subtitle strong { color: var(--text); }

/* ── Tier Badge ──────────────────────────────────────────────────────── */
.tier-section {
  max-width: 480px;
  margin: 28px auto 0;
  padding: 0 16px;
}
.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.tier-badge.bronze  { background: rgba(205,127,50,.2);  border: 1px solid var(--bronze);   color: var(--bronze); }
.tier-badge.silver  { background: rgba(168,169,173,.15); border: 1px solid var(--silver);  color: var(--silver); }
.tier-badge.gold    { background: rgba(255,215,0,.15);   border: 1px solid var(--gold);    color: var(--gold); }
.tier-badge.platinum{ background: rgba(229,228,226,.12); border: 1px solid var(--platinum);color: var(--platinum); }

.tier-track {
  background: var(--border);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
  position: relative;
}
.tier-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 1s cubic-bezier(.4,0,.2,1);
  background: linear-gradient(90deg, var(--accent) 0%, #c084fc 100%);
}
.tier-track.gold    .tier-fill { background: linear-gradient(90deg, #d97706 0%, var(--gold) 100%); }
.tier-track.silver  .tier-fill { background: linear-gradient(90deg, #6b7280 0%, var(--silver) 100%); }
.tier-track.platinum .tier-fill { background: linear-gradient(90deg, var(--silver) 0%, var(--platinum) 100%); }

.tier-label-row {
  display: flex;
  justify-content: space-between;
  font-size: .75rem;
  color: var(--muted);
  margin-top: 6px;
}

/* ── Streak ──────────────────────────────────────────────────────────── */
.streak-banner {
  max-width: 820px;
  margin: 24px auto 0;
  padding: 14px 20px;
  background: linear-gradient(135deg, rgba(245,158,11,.1) 0%, rgba(251,191,36,.08) 100%);
  border: 1px solid rgba(245,158,11,.3);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .9rem;
}
.streak-banner .streak-icon { font-size: 1.6rem; flex-shrink: 0; }
.streak-banner .streak-num  { font-size: 1.3rem; font-weight: 800; color: var(--warn); }

/* ── Layout ──────────────────────────────────────────────────────────── */
.main-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title .icon { font-size: 1.2rem; }

/* ── How-to-Earn Grid ────────────────────────────────────────────────── */
.earn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 40px;
}
.earn-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  transition: border-color .2s, transform .2s;
}
.earn-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.earn-card .earn-icon { font-size: 1.8rem; margin-bottom: 6px; }
.earn-card .earn-pts  { font-size: 1.2rem; font-weight: 800; color: var(--accent2); }
.earn-card .earn-label{ font-size: .78rem; color: var(--muted); margin-top: 4px; }

/* ── Rewards Catalog ─────────────────────────────────────────────────── */
.rewards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}
.reward-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .2s, transform .2s, box-shadow .2s;
  position: relative;
  overflow: hidden;
}
.reward-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(99,102,241,.2);
}
.reward-card.insufficient { opacity: .5; }
.reward-card .reward-icon { font-size: 2rem; }
.reward-card .reward-name { font-weight: 700; font-size: .95rem; }
.reward-card .reward-desc { font-size: .8rem; color: var(--muted); flex: 1; }
.reward-card .reward-cost {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .85rem;
  font-weight: 700;
  color: var(--accent2);
}
.reward-card .reward-cost .coin { font-size: 1rem; }

.redeem-btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent) 0%, #818cf8 100%);
  color: #fff;
  transition: opacity .2s, transform .15s;
}
.redeem-btn:hover { opacity: .9; transform: scale(1.02); }
.redeem-btn:disabled {
  background: var(--border);
  color: var(--muted);
  cursor: not-allowed;
  transform: none;
}

/* ── Modal ───────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1);
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal h3 { font-size: 1.1rem; margin-bottom: 8px; }
.modal .modal-desc { font-size: .85rem; color: var(--muted); margin-bottom: 20px; }
.modal-btns { display: flex; gap: 10px; }
.modal-btns button {
  flex: 1; padding: 10px; border-radius: var(--radius-sm);
  font-weight: 700; font-size: .9rem; cursor: pointer; border: none;
}
.btn-cancel { background: var(--border); color: var(--muted); }
.btn-confirm { background: linear-gradient(135deg, var(--accent), #818cf8); color: #fff; }

/* ── Coupon Reveal ───────────────────────────────────────────────────── */
.coupon-reveal {
  background: var(--bg);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  margin: 16px 0;
}
.coupon-code {
  font-family: monospace;
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: .15em;
  color: var(--accent2);
}
.copy-btn {
  margin-top: 8px;
  padding: 6px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: .8rem;
  cursor: pointer;
}
.copy-btn:hover { border-color: var(--accent); color: var(--text); }

/* ── Transaction History ─────────────────────────────────────────────── */
.tx-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 40px; }

.tx-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: .88rem;
}
.tx-icon { font-size: 1.2rem; flex-shrink: 0; width: 28px; text-align: center; }
.tx-desc { flex: 1; }
.tx-desc .tx-action { font-weight: 600; color: var(--text); }
.tx-desc .tx-date   { font-size: .75rem; color: var(--muted); }
.tx-points {
  font-weight: 800;
  font-size: 1rem;
  white-space: nowrap;
}
.tx-points.earn  { color: var(--success); }
.tx-points.spend { color: var(--danger); }

.load-more-btn {
  width: 100%;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: .85rem;
  cursor: pointer;
  margin-top: 8px;
}
.load-more-btn:hover { border-color: var(--accent); color: var(--text); }

/* ── Leaderboard ─────────────────────────────────────────────────────── */
.leaderboard { margin-bottom: 40px; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
}
.lb-row:nth-child(odd) { background: var(--surface); }
.lb-rank {
  width: 28px;
  text-align: center;
  font-weight: 800;
  font-size: .85rem;
  color: var(--muted);
}
.lb-row:nth-child(1) .lb-rank { color: var(--gold); font-size: 1.1rem; }
.lb-row:nth-child(2) .lb-rank { color: var(--silver); }
.lb-row:nth-child(3) .lb-rank { color: var(--bronze); }
.lb-email { flex: 1; color: var(--muted); font-family: monospace; font-size: .82rem; }
.lb-pts   { font-weight: 700; color: var(--accent2); }
.lb-tier  {
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 8px; border-radius: 999px;
}
.lb-tier.bronze   { background: rgba(205,127,50,.2);  color: var(--bronze); }
.lb-tier.silver   { background: rgba(168,169,173,.15); color: var(--silver); }
.lb-tier.gold     { background: rgba(255,215,0,.15);   color: var(--gold); }
.lb-tier.platinum { background: rgba(229,228,226,.12); color: var(--platinum); }

/* ── Toast ───────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 24px;
  font-size: .9rem;
  box-shadow: var(--shadow);
  z-index: 500;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error   { border-color: var(--danger);  color: var(--danger); }

/* ── Skeleton loader ─────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Not-logged-in state ─────────────────────────────────────────────── */
.login-prompt {
  text-align: center;
  padding: 60px 20px;
}
.login-prompt h2 { font-size: 1.4rem; margin-bottom: 10px; }
.login-prompt p  { color: var(--muted); margin-bottom: 24px; }
.btn-primary {
  display: inline-block;
  padding: 12px 32px;
  background: linear-gradient(135deg, var(--accent), #818cf8);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-decoration: none;
  font-size: .95rem;
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .hero-balance { font-size: 3.5rem; }
  .rewards-grid { grid-template-columns: 1fr; }
  .earn-grid    { grid-template-columns: repeat(3, 1fr); }
  .tx-item      { padding: 10px; }
}
