/* ============================================================
   shop.css — Mobile-first white label storefront
   Font: DM Serif Display (headings) + DM Sans (body)
   ============================================================ */

:root {
  --accent:       #2563eb;
  --accent-dark:  #1d4ed8;
  --bg:           #f8f7f4;
  --surface:      #ffffff;
  --border:       #e5e2db;
  --text:         #1a1917;
  --muted:        #6b6660;
  --success:      #16a34a;
  --error:        #dc2626;
  --radius:       10px;
  --shadow:       0 2px 12px rgba(0,0,0,.07);
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── Typography ───────────────────────────────────────────── */
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.2; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); font-size: .9rem; }
code { background: var(--border); padding: .1em .4em; border-radius: 4px; font-size: .85em; }

/* ── Header ───────────────────────────────────────────────── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.site-logo {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--text);
  text-decoration: none;
}
.site-logo img { height: 36px; width: auto; }
.header-nav { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.nav-link { color: var(--muted); font-size: .9rem; font-weight: 500; }
.nav-link:hover { color: var(--accent); text-decoration: none; }

/* Currency switcher */
.currency-switcher { display: flex; gap: .25rem; }
.currency-btn {
  font-size: .75rem;
  font-weight: 600;
  padding: .25rem .5rem;
  border-radius: 5px;
  color: var(--muted);
  border: 1px solid transparent;
  transition: all .15s;
}
.currency-btn:hover, .currency-btn.active {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-color: var(--accent);
}

/* Cart button */
.cart-btn {
  position: relative;
  color: var(--text);
  display: flex;
  align-items: center;
}
.cart-badge {
  position: absolute;
  top: -6px; right: -8px;
  background: var(--accent);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  border-radius: 999px;
  min-width: 18px;
  height: 18px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

/* ── Main ─────────────────────────────────────────────────── */
.main-content { flex: 1; padding: 1.5rem 1rem 3rem; }

/* ── Product Grid ─────────────────────────────────────────── */
.shop-grid-wrap { max-width: 1200px; margin: 0 auto; }
.shop-heading { font-size: 2rem; margin-bottom: 1.5rem; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.product-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  color: var(--text);
  transition: transform .15s, box-shadow .15s;
  text-decoration: none;
  display: flex;
  flex-direction: column;
}
.product-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.1); }
.product-card:target {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  animation: target-fade 2s ease-out;
}
@keyframes target-fade {
  from { box-shadow: 0 0 0 6px rgba(37, 99, 235, .25); }
  to { box-shadow: none; }
}

.product-img-wrap { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--border); }
.product-img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.product-card:hover .product-img-wrap img { transform: scale(1.04); }
.out-of-stock-badge {
  position: absolute; bottom: 8px; left: 8px;
  background: rgba(0,0,0,.65); color: #fff;
  font-size: .7rem; font-weight: 600; padding: .2rem .5rem; border-radius: 4px;
}

.product-info { padding: .75rem; flex: 1; display: flex; flex-direction: column; gap: .2rem; }
.product-sku { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.product-name { font-size: .95rem; font-weight: 600; line-height: 1.3; }
.product-price { font-size: 1.05rem; font-weight: 700; color: var(--accent); margin-top: auto; padding-top: .4rem; }

/* ── Intro / Search / Specials ───────────────────────────────── */
.intro-section {
  max-width: 800px; margin: 2rem auto 2.5rem; text-align: center;
}
.intro-section p { color: var(--muted); line-height: 1.6; margin: 1rem 0 1.5rem; }

.search-bar-wrap { max-width: 1200px; margin: 0 auto 2rem; }
.search-filter-row { display: flex; gap: .75rem; flex-wrap: wrap; }
.search-input {
  flex: 1; min-width: 200px; padding: .75rem 1rem; font-size: 1rem;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.search-input:focus { outline: none; border-color: var(--accent); }
.search-select {
  padding: .75rem 1rem; font-size: 1rem;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.search-select:focus { outline: none; border-color: var(--accent); }

.specials-wrap { max-width: 1200px; margin: 0 auto 3rem; }

.sale-badge {
  position: absolute; top: 8px; left: 8px;
  background: var(--error); color: #fff;
  font-size: .7rem; font-weight: 600; padding: .2rem .5rem; border-radius: 4px;
}
.price-original {
  color: var(--muted); text-decoration: line-through; font-weight: 400; font-size: .85em; margin-right: .35em;
}
.price-sale { color: var(--error); }

/* ── Product Detail ───────────────────────────────────────── */
.product-detail-wrap {
  max-width: 1000px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr;
  gap: 2rem;
}
@media (min-width: 640px) {
  .product-detail-wrap { grid-template-columns: 1fr 1fr; }
}

.gallery-main { border-radius: var(--radius); overflow: hidden; background: var(--border); }
.gallery-main img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.gallery-thumbs { display: flex; gap: .5rem; margin-top: .5rem; flex-wrap: wrap; }
.gallery-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; cursor: pointer;
  border: 2px solid transparent; transition: border-color .15s; }
.gallery-thumb.active { border-color: var(--accent); }
.gallery-thumb:hover { border-color: var(--accent); }

.product-detail-info { display: flex; flex-direction: column; gap: .75rem; }
.product-sku-detail { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.product-detail-name { font-size: 1.8rem; }
.product-detail-price { font-size: 1.6rem; font-weight: 700; color: var(--accent); }
.product-description { color: var(--muted); font-size: .95rem; line-height: 1.7; }
.out-of-stock-msg { color: var(--error); font-weight: 600; }
.back-link { color: var(--muted); font-size: .9rem; }

/* ── Cart ─────────────────────────────────────────────────── */
.cart-wrap { max-width: 900px; margin: 0 auto; }
.cart-table-wrap { overflow-x: auto; }
.cart-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.cart-table th { text-align: left; padding: .6rem .75rem; border-bottom: 2px solid var(--border); font-weight: 600; }
.cart-table td { padding: .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.qty-input { width: 64px; padding: .3rem .4rem; border: 1px solid var(--border); border-radius: 6px; font-size: .9rem; text-align: center; }
.btn-remove { background: none; border: none; color: var(--muted); font-size: 1.3rem; cursor: pointer; padding: .2rem .5rem; }
.btn-remove:hover { color: var(--error); }
.cart-actions { margin-top: .75rem; text-align: right; }

.cart-totals {
  margin-top: 2rem;
  margin-left: auto;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex; flex-direction: column; gap: .6rem;
}
.totals-row { display: flex; justify-content: space-between; font-size: .95rem; }
.totals-total { font-weight: 700; font-size: 1.1rem; padding-top: .5rem; border-top: 1px solid var(--border); }
.free-ship-note { font-size: .8rem; color: var(--muted); }

/* ── Checkout ─────────────────────────────────────────────── */
.checkout-wrap { max-width: 1000px; margin: 0 auto; }
.checkout-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; margin-top: 1rem; }
@media (min-width: 700px) { .checkout-grid { grid-template-columns: 1.4fr 1fr; } }
.checkout-section { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.checkout-section h2 { font-size: 1.1rem; margin-bottom: 1rem; }
.order-summary { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; position: sticky; top: 80px; }
.order-summary h2 { font-size: 1.1rem; margin-bottom: 1rem; }
.summary-item { display: flex; justify-content: space-between; font-size: .9rem; padding: .35rem 0; }
.summary-total { font-weight: 700; font-size: 1rem; }
hr { border: none; border-top: 1px solid var(--border); margin: .5rem 0; }

/* ── Account ──────────────────────────────────────────────── */
.account-wrap { max-width: 1000px; margin: 0 auto; }
.account-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 700px) { .account-grid { grid-template-columns: 1fr 1fr; } }
.account-section { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; }
.account-section h2 { font-size: 1.2rem; margin-bottom: 1rem; }
.order-card { border: 1px solid var(--border); border-radius: 8px; padding: .75rem; margin-bottom: .75rem; }
.order-card-header { display: flex; justify-content: space-between; align-items: center; }
.order-card-meta { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); margin-top: .25rem; }
.order-items-list { margin-top: .5rem; padding-left: 1.2rem; font-size: .85rem; color: var(--muted); }
.status-badge { font-size: .72rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.status-paid     { background: #dcfce7; color: #166534; }
.status-pending  { background: #fef9c3; color: #854d0e; }
.status-shipped  { background: #dbeafe; color: #1e40af; }
.status-cancelled{ background: #fee2e2; color: #991b1b; }

/* ── Auth ─────────────────────────────────────────────────── */
.auth-wrap { display: flex; justify-content: center; padding: 2rem 1rem; }
.auth-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem; width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 1.6rem; margin-bottom: .5rem; }
.auth-form { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }

/* ── Confirm ──────────────────────────────────────────────── */
.confirm-wrap { display: flex; justify-content: center; padding: 2rem 1rem; }
.confirm-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2.5rem; max-width: 520px; width: 100%; text-align: center; }
.confirm-icon { font-size: 3rem; color: var(--success); margin-bottom: 1rem; }
.confirm-card h1 { font-size: 1.8rem; }
.confirm-order-num { font-size: 1rem; color: var(--muted); margin: .4rem 0 1rem; }
.confirm-items { text-align: left; margin: 1.5rem 0; background: var(--bg);
  border-radius: 8px; padding: 1rem; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.form-group input,
.form-group select,
.form-group textarea {
  padding: .55rem .75rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: .95rem;
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s;
  width: 100%;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-group input:disabled { background: var(--bg); color: var(--muted); }

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .75rem; }
@media (max-width: 480px) {
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
}

.qty-row { display: flex; align-items: center; gap: .75rem; }
.qty-row label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.qty-row input { width: 80px; padding: .5rem .6rem; border: 1px solid var(--border);
  border-radius: 7px; font-size: 1rem; text-align: center; }

.checkbox-label { display: flex; align-items: center; gap: .5rem; font-size: .9rem; cursor: pointer; }
.checkbox-label input { width: auto; }
fieldset legend { font-weight: 600; font-size: .9rem; padding: 0 .4rem; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .7rem 1.4rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  text-align: center;
  transition: background .15s, transform .1s;
  text-decoration: none;
}
.btn-primary:hover { background: var(--accent-dark); text-decoration: none; color: #fff; }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-secondary {
  display: inline-block;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .65rem 1.3rem;
  font-size: .95rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  text-align: center;
  transition: background .15s;
  text-decoration: none;
}
.btn-secondary:hover { background: var(--bg); text-decoration: none; }
.btn-full { width: 100%; }
.btn-checkout { margin-top: 1rem; }

/* ── Alerts ───────────────────────────────────────────────── */
.alert { padding: .75rem 1rem; border-radius: 7px; font-size: .9rem; margin-bottom: 1rem; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-error   { background: #fee2e2; color: #991b1b; }

/* ── Empty state ──────────────────────────────────────────── */
.empty-state { color: var(--muted); padding: 3rem 0; text-align: center; font-size: 1.05rem; }

/* ── Footer ───────────────────────────────────────────────── */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 1.25rem 1rem; }
.footer-inner { max-width: 1200px; margin: 0 auto; text-align: center; color: var(--muted); font-size: .85rem; }

/* ── Responsive tweaks ────────────────────────────────────── */
@media (min-width: 480px) {
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
@media (min-width: 768px) {
  .main-content { padding: 2rem 2rem 4rem; }
  .shop-heading { font-size: 2.4rem; }
}
