/* ═══════════════════════════════════════════════════════════════════════
   SPK BEAM eStore — app.css
   Design system: Android 21 / Material You DNA
   Font: Nunito (rounded, warm) — loaded via Google Fonts
   ═══════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

/* ── Design tokens ─────────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg:        #0a0a0f;
  --bg2:       #111118;
  --surface:   #16161f;
  --surface2:  #1c1c27;
  --surface3:  rgba(255,255,255,.06);
  --line:      rgba(255,255,255,.1);
  --line2:     rgba(255,213,31,.3);

  /* Brand */
  --gold:      #ffd51f;
  --gold2:     #ffbe00;
  --gold-glow: rgba(255,213,31,.22);

  /* Semantic */
  --green:     #22c55e;
  --red:       #ef4444;
  --amber:     #f59e0b;
  --blue:      #3b82f6;
  --cyan:      #22d3ee;

  /* Text */
  --text:      #f1f5f9;
  --text2:     #94a3b8;
  --text3:     #64748b;
  --white:     #ffffff;

  /* Radius — Material You: very rounded */
  --r-xs:  10px;
  --r-sm:  16px;
  --r:     22px;
  --r-lg:  28px;
  --r-xl:  34px;
  --r-full: 999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0,0,0,.4);
  --shadow:    0 8px 32px rgba(0,0,0,.5);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.6);
  --glow-gold: 0 0 32px rgba(255,213,31,.28);

  /* Spacing */
  --gap:  14px;
  --pad:  16px;
  --safe-top:    env(safe-area-inset-top,    0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left:   env(safe-area-inset-left,   0px);
  --safe-right:  env(safe-area-inset-right,  0px);

  /* Bottom nav height */
  --nav-h: 62px;
  /* Topbar height */
  --topbar-h: 60px;

  /* Transitions */
  --t:    .2s cubic-bezier(.4,0,.2,1);
  --t-lg: .35s cubic-bezier(.4,0,.2,1);
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}
body {
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom));
}
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; }
input, textarea, select { font-family: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

/* ── Layout ────────────────────────────────────────────────────── */
.shell {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 var(--pad);
  padding-left:  calc(var(--pad) + var(--safe-left));
  padding-right: calc(var(--pad) + var(--safe-right));
}
.page { padding-top: calc(var(--topbar-h) + var(--safe-top) + 12px); }
.section { margin-bottom: 24px; }

/* ── Topbar ────────────────────────────────────────────────────── */
/* ── Topbar ─────────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: calc(var(--topbar-h) + var(--safe-top));
  padding-top: var(--safe-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left:  calc(var(--pad) + var(--safe-left));
  padding-right: calc(var(--pad) + var(--safe-right));
  background: rgba(8,8,13,.92);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border-bottom: 1px solid rgba(255,213,31,.12);
  box-shadow: 0 1px 0 rgba(255,213,31,.06), 0 4px 20px rgba(0,0,0,.4);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.topbar-brand:hover { text-decoration: none; }

/* Real logo image wrapper */
.topbar-logo-wrap {
  width: 40px; height: 40px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  background: #111118;
  border: 1.5px solid rgba(255,213,31,.25);
  box-shadow: 0 0 0 2px rgba(255,213,31,.08), 0 4px 14px rgba(0,0,0,.4);
  transition: box-shadow var(--t), border-color var(--t);
}
.topbar-brand:hover .topbar-logo-wrap {
  border-color: rgba(255,213,31,.55);
  box-shadow: 0 0 0 3px rgba(255,213,31,.12), 0 4px 20px rgba(255,213,31,.15);
}
.topbar-logo-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

.topbar-brand-text { display: flex; flex-direction: column; gap: 1px; }
.topbar-name {
  font-size: .92rem;
  font-weight: 900;
  letter-spacing: .02em;
  line-height: 1.1;
  color: var(--white);
}
.topbar-tagline {
  font-size: .6rem;
  color: rgba(255,213,31,.65);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.topbar-icon-btn {
  width: 40px; height: 40px;
  border-radius: 13px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  display: grid;
  place-items: center;
  color: rgba(255,255,255,.8);
  position: relative;
  text-decoration: none;
  transition: background var(--t), border-color var(--t), color var(--t);
  -webkit-tap-highlight-color: transparent;
}
.topbar-icon-btn:hover {
  background: rgba(255,213,31,.12);
  border-color: rgba(255,213,31,.3);
  color: var(--gold);
}
.topbar-icon-btn:active { transform: scale(.93); }
.topbar-cart-btn { position: relative; }
.cart-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  border-radius: var(--r-full);
  background: var(--gold);
  color: #0a0a0f;
  font-size: .62rem;
  font-weight: 900;
  display: none;
  align-items: center;
  justify-content: center;
}
.cart-badge.show { display: flex; }

/* ── Bottom Navigation ─────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(10,10,15,.97);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border-top: 1px solid rgba(255,213,31,.1);
  box-shadow: 0 -1px 0 rgba(255,213,31,.05), 0 -8px 32px rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-left:  var(--safe-left);
  padding-right: var(--safe-right);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: rgba(255,255,255,.35);
  font-size: .6rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 6px 4px;
  border-radius: var(--r);
  transition: color .18s ease;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.nav-label { line-height: 1; }

.nav-icon-wrap {
  position: relative;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1);
}
.nav-icon-wrap svg {
  transition: stroke .18s ease;
}
.nav-item:active .nav-icon-wrap { transform: scale(.87); }

/* Active state — gold pill indicator */
.nav-item.active {
  color: var(--gold);
}
.nav-item.active .nav-icon-wrap {
  transform: translateY(-2px);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 4px;
  width: 28px; height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--gold);
  box-shadow: 0 0 12px rgba(255,213,31,.6);
  animation: navPop .22s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes navPop {
  from { width: 0; opacity: 0; }
  to   { width: 28px; opacity: 1; }
}

.nav-cart-badge {
  position: absolute;
  top: -5px; right: -7px;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  border-radius: var(--r-full);
  background: var(--gold);
  color: #0a0a0f;
  font-size: .6rem;
  font-weight: 900;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(10,10,15,.97);
  box-shadow: 0 2px 8px rgba(255,213,31,.4);
}
.nav-cart-badge.show { display: flex; }

/* ── Typography ────────────────────────────────────────────────── */
.page-title {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -.03em;
  color: var(--white);
  margin-bottom: 4px;
}
.page-sub {
  font-size: .84rem;
  color: var(--text2);
  font-weight: 600;
}
.section-label {
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--pad);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.12), transparent);
}

/* ── Empty / error states ──────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text2);
}
.empty-state .es-icon { font-size: 3rem; margin-bottom: 14px; }
.empty-state h3 { font-size: 1.1rem; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.empty-state p  { font-size: .86rem; }

/* ── Toast notifications ───────────────────────────────────────── */
.toast-wrap {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: min(90vw, 360px);
}
.toast {
  padding: 12px 18px;
  border-radius: var(--r);
  font-weight: 700;
  font-size: .84rem;
  color: var(--white);
  background: var(--surface2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: toastIn .3s var(--t-lg) both, toastOut .3s var(--t-lg) 2.5s both;
  text-align: center;
}
.toast.success { background: rgba(34,197,94,.18); border-color: rgba(34,197,94,.4); color: #86efac; }
.toast.error   { background: rgba(239,68,68,.18);  border-color: rgba(239,68,68,.4);  color: #fca5a5; }
@keyframes toastIn  { from { opacity:0; transform:translateY(14px); } to { opacity:1; transform:none; } }
@keyframes toastOut { from { opacity:1; } to { opacity:0; } }

/* ── Divider ───────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--line);
  margin: 14px 0;
}

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

/* ── Utility ───────────────────────────────────────────────────── */
.text-gold    { color: var(--gold); }
.text-muted   { color: var(--text2); }
.text-center  { text-align: center; }
.font-bold    { font-weight: 800; }
.font-black   { font-weight: 900; }
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.gap-sm       { gap: 8px; }
.gap          { gap: var(--gap); }
.w-full       { width: 100%; }
.mt-sm        { margin-top: 8px; }
.mt           { margin-top: var(--gap); }
.mb-sm        { margin-bottom: 8px; }
.mb           { margin-bottom: var(--gap); }
.hidden       { display: none !important; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (min-width: 481px) {
  .shell { padding: 0 20px; }
}
@media (max-width: 360px) {
  :root { --pad: 12px; }
  body  { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
