/* campaigns.tribalcrunch.com — public storefront */
:root {
  --bg-0: #0a0c18;
  --text: #e8ecf5;
  --muted: rgba(232,236,245,0.58);
  --accent: #5865f2;
  --accent-2: #7c8af7;
  --ok: #3ecf8e;
  --warn: #f5c542;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; min-height: 100vh;
  background: radial-gradient(ellipse at top left, #1a1f40 0%, var(--bg-0) 55%) fixed;
  color: var(--text);
  font-family: Inter, -apple-system, Segoe UI, Roboto, sans-serif;
}
h1, h2, h3 { margin: 0; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: rgba(255,255,255,0.06); padding: 0.15rem 0.4rem; border-radius: 6px; }

/* State containers */
.state { min-height: 100vh; display: flex; align-items: stretch; }
#store { display: block; }
.loading-inner { margin: auto; color: var(--muted); padding: 2rem; }

/* Glass box */
.glass-box {
  position: relative;
  border-radius: 22px;
  padding: 1.5rem;
  background: linear-gradient(160deg, rgba(255,255,255,0.07), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 24px 60px rgba(0,0,0,0.45), 0 1px 0 rgba(255,255,255,0.08) inset;
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}
.center { margin: auto; max-width: 540px; text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.micro { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.cta-link { color: var(--accent-2); }

/* Header */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: sticky; top: 0; z-index: 10;
  background: rgba(10,12,24,0.62);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.app-header h1 { font-size: 1.25rem; font-weight: 700; }
.app-header .subtitle { color: var(--muted); font-size: 0.88rem; margin-top: 0.2rem; }
.cart-badge {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  visibility: hidden;
}
.cart-badge:hover { background: rgba(255,255,255,0.14); }
#cartCount { color: var(--accent-2); margin-left: 0.25rem; }

.main {
  max-width: 1120px; margin: 0 auto; padding: 1.5rem;
  display: flex; flex-direction: column; gap: 1.5rem;
}
.section-title { font-size: 1rem; font-weight: 600; margin: 0 0 0.9rem; letter-spacing: 0.02em; }

/* Progress bar */
.progress-row { display: flex; gap: 1.5rem; align-items: center; }
.progress-goal { font-size: 1.4rem; font-weight: 700; }
.progress-bar-wrap { flex: 1; height: 14px; background: rgba(255,255,255,0.07); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--ok)); transition: width 0.35s cubic-bezier(0.22,1,0.36,1); }

/* Products grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.product-card {
  position: relative;
  padding: 1.1rem 1.15rem 1rem;
  transition: transform 0.2s cubic-bezier(0.22,1,0.36,1), box-shadow 0.2s, border-color 0.2s;
}
.product-card:hover { transform: translateY(-3px); box-shadow: 0 30px 60px rgba(0,0,0,0.5); }
.product-card.selected { border-color: rgba(88,101,242,0.5); box-shadow: 0 20px 48px rgba(88,101,242,0.22), inset 0 0 0 1px rgba(88,101,242,0.32); background: linear-gradient(160deg, rgba(88,101,242,0.14), rgba(88,101,242,0.02)); }
.product-icon {
  width: 56px; height: 56px; border-radius: 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 0.75rem;
}
.product-icon-glyph { font-size: 1.8rem; line-height: 1; }
.product-icon-img { width: 100%; height: 100%; object-fit: cover; border-radius: 16px; }
.product-name { font-weight: 600; font-size: 1rem; }
.product-desc { margin-top: 0.2rem; }
.product-price { margin-top: 0.6rem; font-weight: 600; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.product-stepper { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.85rem; }
.step-btn {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text); cursor: pointer; font: inherit; font-weight: 700; font-size: 1.15rem;
  line-height: 1;
}
.step-btn:hover { background: rgba(255,255,255,0.14); }
.step-qty { min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }

/* Cart */
.cart-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.cart-line { display: flex; justify-content: space-between; padding: 0.6rem 0.75rem; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 1rem; }
.cart-total-value { font-size: 1.4rem; font-weight: 700; }

/* Buttons */
.btn { padding: 0.75rem 1rem; border-radius: 12px; font: inherit; font-weight: 600; cursor: pointer; border: none; transition: transform 0.15s, box-shadow 0.2s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(88,101,242,0.4); }
.btn-primary:disabled { background: rgba(88,101,242,0.5); cursor: progress; }
.btn-lg { width: 100%; padding: 0.85rem 1rem; font-size: 1rem; margin-top: 0.85rem; }

/* Checkout overlay */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(6,8,20,0.7);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.overlay-card { width: min(520px, 100%); max-height: 92vh; overflow: auto; }
.overlay-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.overlay-close { background: transparent; border: none; color: var(--muted); font-size: 1.6rem; cursor: pointer; line-height: 1; padding: 0 0.3rem; }
.overlay-close:hover { color: var(--text); }
.field { margin-bottom: 0.85rem; }
.field label { display: block; font-size: 0.75rem; color: var(--muted); margin-bottom: 0.3rem; letter-spacing: 0.05em; text-transform: uppercase; }
.form-control {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font: inherit;
  outline: none;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(88,101,242,0.25); }
textarea.form-control { min-height: 3rem; resize: vertical; }
.checkout-review { display: flex; justify-content: space-between; align-items: baseline; margin: 0.85rem 0 0.4rem; }

/* Toasts */
.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 70; display: flex; flex-direction: column; gap: 0.5rem; pointer-events: none; }
.toast { pointer-events: auto; background: rgba(20,24,40,0.92); color: var(--text); padding: 0.75rem 1rem; border-radius: 12px; border: 1px solid rgba(255,255,255,0.08); box-shadow: 0 10px 30px rgba(0,0,0,0.5); font-size: 0.92rem; transition: opacity 0.3s; }
.toast-error { border-color: rgba(255,90,90,0.4); }
.toast-success { border-color: rgba(62,207,142,0.4); }

@media (max-width: 640px) {
  .app-header { padding: 0.9rem 1rem; }
  .main { padding: 1rem; gap: 1rem; }
  .progress-row { flex-direction: column; align-items: stretch; gap: 0.6rem; }
}
