/* AffShop frontend - "price tag" visual identity: warm paper background,
   vivid orange accent for actions/prices, rose for discounts, perforated
   ticket-notch on product cards tying back to the price-tag subject. */

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

:root {
  --bg: #FAFAF7;
  --surface: #FFFFFF;
  --ink: #15171C;
  --ink-muted: #5B6068;
  --border: #E5E2DA;
  --accent: #FF6B35;
  --accent-deep: #C2410C;
  --save: #1B998B;
  --discount: #E11D48;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(21,23,28,.04), 0 8px 24px -12px rgba(21,23,28,.12);
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 64px;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(250,250,247,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header-inner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.logo { font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: -.02em; white-space: nowrap; }
.logo span { color: var(--accent); }
.search-form { flex: 1; display: flex; position: relative; }
.search-form input {
  width: 100%; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font-size: 15px;
}
.search-form input:focus { border-color: var(--accent); }
.search-form button { position: absolute; right: 4px; top: 4px; bottom: 4px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 600; }

.categories-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px; scrollbar-width: none; border-bottom: 1px solid var(--border); }
.categories-scroll::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  font-size: 13.5px; font-weight: 500; color: var(--ink-muted); white-space: nowrap;
}
.chip.active, .chip:hover { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Hero ---------- */
.hero { padding: 28px 0 8px; }
.hero h1 { font-family: var(--font-display); font-size: clamp(22px, 5vw, 32px); margin: 0 0 4px; letter-spacing: -.01em; }
.hero p { color: var(--ink-muted); margin: 0; font-size: 14.5px; }

/* ---------- Product grid ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 16px 0; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; position: relative; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .15s ease;
}
.card:hover { transform: translateY(-2px); }
.card-img { aspect-ratio: 1/1; background: #fff; display: flex; align-items: center; justify-content: center; padding: 14px; border-bottom: 1px dashed var(--border); }
.card-img img { max-height: 100%; object-fit: contain; }
.badge-discount {
  position: absolute; top: 10px; left: 10px; background: var(--discount); color: #fff;
  font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; z-index: 2;
}
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-brand { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-muted); font-weight: 600; }
.card-title { font-size: 13.5px; line-height: 1.35; font-weight: 500; flex: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-prices { display: flex; align-items: baseline; gap: 6px; margin-top: 2px; }
.price-now { font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--ink); }
.price-old { font-size: 12.5px; color: var(--ink-muted); text-decoration: line-through; }
.card-shop { font-size: 11px; color: var(--ink-muted); }

/* ---------- Filter bar (mobile) ---------- */
.filter-bar { display: flex; gap: 8px; align-items: center; padding: 8px 0 4px; }
.filter-btn { display: flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-size: 13.5px; font-weight: 600; }
.result-count { color: var(--ink-muted); font-size: 13px; margin-left: auto; }

.drawer-overlay { position: fixed; inset: 0; background: rgba(21,23,28,.45); z-index: 60; display: none; }
.drawer-overlay.open { display: block; }
.drawer { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-radius: 18px 18px 0 0; z-index: 61; padding: 18px 18px 28px; transform: translateY(100%); transition: transform .25s ease; max-height: 80vh; overflow-y: auto; }
.drawer.open { transform: translateY(0); }
.drawer h3 { font-family: var(--font-display); margin: 0 0 14px; }
.drawer label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
.drawer select, .drawer input[type=number] { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; }
.drawer-actions { display: flex; gap: 10px; margin-top: 18px; }
.btn { padding: 11px 18px; border-radius: 10px; border: 0; font-weight: 600; font-size: 14px; }
.btn-primary { background: var(--accent); color: #fff; flex: 1; text-align: center; }
.btn-ghost { background: var(--bg); border: 1px solid var(--border); color: var(--ink); }

/* ---------- Pagination ---------- */
.pagination { display: flex; justify-content: center; gap: 6px; padding: 24px 0; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 8px 13px; border-radius: 8px; border: 1px solid var(--border); font-size: 13.5px; font-weight: 600; background: var(--surface); }
.pagination .current { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Product page ---------- */
.breadcrumbs { font-size: 12.5px; color: var(--ink-muted); padding: 14px 0; display: flex; gap: 6px; flex-wrap: wrap; }
.product-detail { display: grid; gap: 24px; padding: 8px 0 32px; }
@media (min-width: 800px) { .product-detail { grid-template-columns: 1fr 1fr; align-items: start; } }
.product-image-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; display: flex; align-items: center; justify-content: center; }
.product-info h1 { font-family: var(--font-display); font-size: clamp(20px,4vw,28px); margin: 0 0 8px; }
.product-meta { display: flex; gap: 10px; font-size: 13px; color: var(--ink-muted); margin-bottom: 14px; flex-wrap: wrap; }
.product-meta span { background: var(--surface); border: 1px solid var(--border); padding: 4px 10px; border-radius: 999px; }
.price-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin: 16px 0; }
.price-row { display: flex; align-items: baseline; gap: 10px; }
.price-row .price-now { font-size: 28px; }
.save-line { color: var(--save); font-weight: 600; font-size: 13.5px; margin-top: 4px; }
.btn-buy { display: block; width: 100%; text-align: center; background: var(--accent); color: #fff; padding: 15px; border-radius: 12px; font-weight: 700; font-size: 16px; margin-top: 14px; }
.btn-buy:hover { background: var(--accent-deep); }
.product-description { line-height: 1.65; color: var(--ink); font-size: 14.5px; white-space: pre-line; }
.similar-section { padding: 20px 0 40px; }
.similar-section h2 { font-family: var(--font-display); font-size: 19px; margin-bottom: 12px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 40px; padding: 28px 0 90px; color: var(--ink-muted); font-size: 13px; }
.site-footer a { text-decoration: underline; }

/* ---------- GDPR banner ---------- */
.gdpr-banner {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 80;
  background: var(--ink); color: #fff; border-radius: var(--radius); padding: 16px;
  box-shadow: 0 12px 32px rgba(0,0,0,.25); display: none;
}
.gdpr-banner.show { display: block; }
.gdpr-banner p { margin: 0 0 12px; font-size: 13px; line-height: 1.5; color: #E5E2DA; }
.gdpr-banner a { text-decoration: underline; color: #fff; }
.gdpr-actions { display: flex; gap: 8px; }
.gdpr-actions button { flex: 1; padding: 10px; border-radius: 9px; border: 0; font-weight: 600; font-size: 13.5px; }
.gdpr-accept { background: var(--accent); color: #fff; }
.gdpr-reject { background: rgba(255,255,255,.12); color: #fff; }

/* ---------- PWA install banner ---------- */
.pwa-banner {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 79;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow); display: none; align-items: center; gap: 12px;
}
.pwa-banner.show { display: flex; }
.pwa-banner img { width: 40px; height: 40px; border-radius: 10px; }
.pwa-banner .pwa-text { flex: 1; }
.pwa-banner .pwa-text strong { display: block; font-size: 13.5px; }
.pwa-banner .pwa-text span { font-size: 12px; color: var(--ink-muted); }
.pwa-banner button { border: 0; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 13px; }
.pwa-banner .pwa-close { background: transparent; color: var(--ink-muted); font-size: 18px; padding: 4px 8px; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-muted); }
.empty-state h2 { font-family: var(--font-display); color: var(--ink); }

/* ---------- Skip link ---------- */
.skip-link { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: 10px 16px; z-index: 100; }
.skip-link:focus { left: 12px; top: 12px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
