/* DogeSoft Shop — styled to sit inside the app's in-app browser without
   feeling like you left it. Palette matches lib/app/theme/app_theme.dart
   (AppTheme): gold primary, void-black background, "cardLift" surfaces. */

:root {
  --gold: #D4AF37;
  --gold-light: #E6C65C;
  --gold-dark: #B8962E;
  --void: #000000;
  --lift: #1A1A1E;
  --card: #121214;
  --muted: #8A8A8E;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.18);
  --danger: #E4584C;
  --good: #6BCB77;
  --nav-h: 58px;
  --radius: 16px;
  --radius-lg: 24px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--void);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  padding-bottom: env(safe-area-inset-bottom);
}

img { max-width: 100%; display: block; }

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

a { color: inherit; text-decoration: none; }

/* ---------- top nav (pinned) ---------- */

.topnav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  background: rgba(0, 0, 0, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topnav .brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.topnav .brand img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex: none;
}

.topnav .brand .word {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.topnav .brand .word .accent { color: var(--gold); }

.topnav .actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.pill.gold {
  background: rgba(212, 175, 55, 0.14);
  border-color: rgba(212, 175, 55, 0.4);
  color: var(--gold-light);
}

.pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--good);
  flex: none;
}

.icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 1px solid var(--line);
}

.icon-btn svg { width: 18px; height: 18px; }

.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--gold);
  color: #1a1200;
  font-size: 10px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--void);
}

/* ---------- layout ---------- */

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

.hero {
  padding: 22px 4px 10px;
}

.hero h1 {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.4px;
  margin: 0 0 6px;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.section-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 22px 2px 10px;
}

/* ---------- category filter chips ---------- */

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 4px;
  margin: 18px 0 4px;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar { display: none; }

.filter-chip {
  flex: none;
  height: 34px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  font-size: 12.5px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
}

.filter-chip.active {
  background: var(--gold);
  border-color: var(--gold);
  color: #1a1200;
}

/* ---------- swipeable product deck ---------- */

.deck {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
}

.deck-viewport {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  touch-action: pan-y;
  border-radius: var(--radius-lg);
}

.deck-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  user-select: none;
  cursor: pointer;
  will-change: transform;
}

.deck-card .thumb {
  aspect-ratio: 1.05;
  background: var(--lift);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 34px;
  position: relative;
}

.deck-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.chip {
  position: absolute;
  top: 12px;
  left: 12px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.16);
  color: var(--gold-light);
  border: 1px solid rgba(212, 175, 55, 0.35);
}

.chip.sold-out {
  background: rgba(228, 88, 76, 0.16);
  color: #ff9b91;
  border-color: rgba(228, 88, 76, 0.35);
}

.chip.drop {
  left: auto;
  right: 12px;
  background: rgba(255, 113, 56, 0.18);
  color: #ffab7f;
  border-color: rgba(255, 113, 56, 0.4);
}

.deck-card .body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.deck-card .name {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -0.2px;
}

.deck-card .sub {
  font-size: 12px;
  color: var(--muted);
}

.deck-card .price {
  margin-top: 8px;
  font-size: 16px;
  font-weight: 900;
  color: var(--gold-light);
}

.deck-card .price .doge {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 6px;
}

.deck-card .tap-hint {
  margin-top: 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.deck-nav {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--line-strong);
  font-size: 18px;
  font-weight: 900;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.deck-nav:disabled { opacity: 0.25; pointer-events: none; }

.deck-counter {
  text-align: center;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  margin-top: 10px;
}

/* ---------- buttons ---------- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  border-radius: 14px;
  font-weight: 900;
  font-size: 14.5px;
  width: 100%;
}

.btn.primary {
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
  color: #1a1200;
}

.btn.primary:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: #fff;
}

.btn.small {
  height: 38px;
  font-size: 13px;
  border-radius: 11px;
}

/* ---------- sheets (bottom-sheet modals, matches the app's dApp-approval UI) --- */

.sheet-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.sheet-scrim.open {
  opacity: 1;
  pointer-events: auto;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 61;
  max-width: 720px;
  margin: 0 auto;
  background: var(--card);
  border-radius: 24px 24px 0 0;
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
  max-height: 88vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(.32,.72,0,1);
}

.sheet-scrim.open .sheet { transform: translateY(0); }

.sheet .handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--line-strong);
  margin: 0 auto 16px;
}

.sheet h2 {
  font-size: 18px;
  font-weight: 900;
  margin: 0 0 4px;
  letter-spacing: -0.3px;
}

.sheet .close-x {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--muted);
}

/* ---------- product detail sheet ---------- */

.pd-thumb {
  aspect-ratio: 1.4;
  background: var(--lift);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  margin: 8px 0 14px;
}

.pd-thumb img { width: 100%; height: 100%; object-fit: contain; }

.pd-desc {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
  margin: 0 0 16px;
}

.size-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.size-chip {
  min-width: 48px;
  height: 40px;
  padding: 0 12px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  font-weight: 800;
  font-size: 13px;
  background: transparent;
  color: #fff;
}

.size-chip.selected {
  background: var(--gold);
  border-color: var(--gold);
  color: #1a1200;
}

.size-chip:disabled {
  opacity: 0.3;
  text-decoration: line-through;
  pointer-events: none;
}

.stock-note {
  font-size: 11.5px;
  color: var(--muted);
  margin: -8px 0 16px;
}

.stock-note.low { color: var(--gold-light); }

.qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.qty-stepper {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--lift);
  border-radius: 12px;
  padding: 6px 14px;
}

.qty-stepper button {
  width: 26px;
  height: 26px;
  font-size: 16px;
  font-weight: 900;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.qty-stepper .n { min-width: 18px; text-align: center; font-weight: 800; }

/* ---------- cart ---------- */

.cart-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.cart-item .thumb-sm {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: var(--lift);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  flex: none;
}

.cart-item .info { flex: 1; min-width: 0; }
.cart-item .info .n { font-weight: 800; font-size: 13.5px; }
.cart-item .info .s { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

.cart-item .row2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.link-danger {
  color: #ff9b91;
  font-size: 11.5px;
  font-weight: 700;
}

.mini-stepper {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--lift);
  border-radius: 9px;
  padding: 4px 10px;
}

.mini-stepper button {
  width: 20px;
  height: 20px;
  font-size: 13px;
  font-weight: 900;
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  padding: 6px 0;
}

.summary-row.total {
  font-size: 16px;
  font-weight: 900;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  margin-top: 6px;
}

.summary-row .muted { color: var(--muted); }

.empty-state {
  text-align: center;
  padding: 40px 10px;
  color: var(--muted);
  font-size: 13.5px;
}

/* ---------- forms ---------- */

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input, .field select {
  width: 100%;
  height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--lift);
  color: #fff;
  padding: 0 14px;
  font-size: 14px;
  font-family: inherit;
}

.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--gold);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.note-box {
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
  margin: 6px 0 16px;
}

.warn-box {
  background: rgba(228, 88, 76, 0.1);
  border: 1px solid rgba(228, 88, 76, 0.3);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.5;
  color: #ffb3ab;
  margin: 6px 0 16px;
}

.addr-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--lift);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  word-break: break-all;
  margin-bottom: 14px;
}

.addr-box button {
  flex: none;
  font-size: 11px;
  font-weight: 800;
  color: var(--gold-light);
}

/* ---------- order history ---------- */

.order-card {
  background: var(--lift);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
}

.order-card .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.order-card .id {
  font-size: 11px;
  font-family: ui-monospace, monospace;
  color: var(--muted);
}

.status-pill {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
}

.status-pill.pending_payment { background: rgba(212,175,55,0.16); color: var(--gold-light); }
.status-pill.paid { background: rgba(107,203,119,0.16); color: var(--good); }
.status-pill.shipped { background: rgba(104,217,255,0.16); color: #68d9ff; }
.status-pill.cancelled, .status-pill.refunded { background: rgba(228,88,76,0.16); color: #ff9b91; }

.order-card .line {
  font-size: 12.5px;
  color: rgba(255,255,255,0.75);
  padding: 2px 0;
}

/* ---------- toast ---------- */

#toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 90;
  background: var(--lift);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  max-width: 480px;
  margin: 0 auto;
  transform: translateY(120%);
  transition: transform 0.25s ease;
}

#toast.show { transform: translateY(0); }
#toast.error { border-color: rgba(228,88,76,0.4); color: #ff9b91; }

/* ---------- misc ---------- */

.loading-row {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 30px 0;
  grid-column: 1 / -1;
}

@media (min-width: 560px) {
  .grid { grid-template-columns: 1fr 1fr 1fr; }
}
