/* shop.css — Vardagsnuet Butik */

/* ─── Tokens ──────────────────────────────────────────────── */
:root {
  --brand:        #534AB7;
  --brand-dark:   #3C3489;
  --brand-light:  #EEEDFE;

  --badge-new:        #3C3489;
  --badge-new-bg:     #EEEDFE;
  --badge-sale:       #993C1D;
  --badge-sale-bg:    #FAECE7;
  --badge-used:       #5F5E5A;
  --badge-used-bg:    #EEEDE9;
  --badge-handmade:   #3B6D11;
  --badge-handmade-bg:#EAF3DE;

  --wish:         #D4537E;
  --wish-light:   #FBEAF0;

  --bg:           #F5F4F1;
  --surface:      #FFFFFF;
  --border:       rgba(0,0,0,0.08);
  --border-md:    rgba(0,0,0,0.13);

  --text:         #1A1A18;
  --text-2:       #5A5955;
  --text-3:       #9A9890;

  --topbar-h:     56px;
  --sidebar-w:    220px;
  --card-radius:  12px;
  --radius:       6px;
  --radius-sm:    4px;

  --font-serif:   'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

button { font-family: inherit; cursor: pointer; }
a { text-decoration: none; color: inherit; }

/* ─── Top bar ─────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 0.5px solid var(--border-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  gap: 16px;
}

.brand {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: -0.2px;
}
.brand span { color: var(--text-3); font-weight: 400; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Search */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius);
  padding: 0 12px;
  height: 34px;
  width: 220px;
  transition: border-color 0.15s;
}
.search-bar:focus-within { border-color: var(--brand); }
.search-icon { width: 14px; height: 14px; color: var(--text-3); flex-shrink: 0; }
.search-bar input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--text);
  width: 100%;
  font-family: inherit;
}
.search-bar input::placeholder { color: var(--text-3); }

/* View toggle */
.view-toggle {
  display: flex;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius);
  overflow: hidden;
}
.view-btn {
  padding: 5px 9px;
  background: var(--surface);
  border: none;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
}
.view-btn.active { background: var(--bg); color: var(--text); }
.view-btn:hover:not(.active) { background: var(--bg); }

/* Icon button (cart) */
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  border: 0.5px solid var(--border-md);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  position: relative;
  transition: background 0.12s;
}
.icon-btn:hover { background: var(--bg); }

.cart-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 15px;
  height: 15px;
  background: var(--brand);
  border-radius: 50%;
  font-size: 9px;
  font-weight: 500;
  color: var(--brand-light);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}
.cart-badge.visible { display: flex; }

/* ─── Filter toggle button (mobile only, hidden on desktop) ── */
.filter-toggle-btn {
  display: none;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.12s;
}
.filter-toggle-btn:hover { background: var(--bg); }
.filter-toggle-btn svg { flex-shrink: 0; }

/* ─── Layout ──────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--topbar-h));
}

/* ─── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  background: var(--surface);
  border-right: 0.5px solid var(--border-md);
  padding: 24px 0;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}

.sidebar-section { margin-bottom: 28px; }

.sidebar-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-3);
  padding: 0 20px;
  margin-bottom: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 20px;
  font-size: 13px;
  color: var(--text-2);
  background: transparent;
  border: none;
  border-left: 2px solid transparent;
  text-align: left;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.sidebar-link:hover  { background: var(--bg); color: var(--text); }
.sidebar-link.active { background: var(--bg); color: var(--text); border-left-color: var(--brand); }

.sidebar-count {
  font-size: 11px;
  color: var(--text-3);
  background: var(--bg);
  border-radius: 3px;
  padding: 1px 5px;
}

.sort-select {
  display: block;
  width: calc(100% - 40px);
  margin: 0 20px;
  font-size: 12px;
  padding: 7px 8px;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  font-family: inherit;
}
.sort-select:focus { border-color: var(--brand); }

.price-range { padding: 0 20px; }
.price-range input[type="range"] { width: 100%; accent-color: var(--brand); }
.price-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
}

/* ─── Main ────────────────────────────────────────────────── */
.main { padding: 24px 28px; }

.breadcrumb { font-size: 12px; color: var(--text-3); margin-bottom: 16px; }

.main-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
}

.page-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.2px;
}

.result-count { font-size: 12px; color: var(--text-3); }

/* Filter pills */
.filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.pill {
  font-size: 12px;
  padding: 5px 13px;
  border: 0.5px solid var(--border-md);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-2);
  transition: all 0.15s;
}
.pill:hover { border-color: var(--brand); color: var(--brand); }
.pill.active { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }

/* ─── Product grid ────────────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 60px 20px;
  text-align: center;
  font-size: 14px;
  color: var(--text-3);
}

/* ─── Product card ────────────────────────────────────────── */
.product-card {
  background: var(--surface);
  border-radius: var(--card-radius);
  overflow: hidden;
  border: 0.5px solid var(--border);
  transition: box-shadow 0.2s, transform 0.2s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  box-shadow: 0 8px 28px rgba(0,0,0,0.09);
  transform: translateY(-2px);
}

.product-card:hover .add-btn {
  opacity: 1;
  transform: translateY(0);
}

/* Image area */
.product-img {
  aspect-ratio: 1;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.product-card:hover .product-img img {
  transform: scale(1.04);
}

/* Badge cluster */
.badge-cluster {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 2;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.04em;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: filter 0.12s;
  white-space: nowrap;
}
.badge:hover { filter: brightness(0.92); }

.badge.new      { background: var(--badge-new-bg);      color: var(--badge-new); }
.badge.sale     { background: var(--badge-sale-bg);     color: var(--badge-sale); }
.badge.used     { background: var(--badge-used-bg);     color: var(--badge-used); }
.badge.handmade { background: var(--badge-handmade-bg); color: var(--badge-handmade); }

/* Add to cart button */
.add-btn {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(83, 74, 183, 0.93);
  backdrop-filter: blur(4px);
  color: #fff;
  border: none;
  padding: 10px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s, transform 0.2s, background 0.12s;
  font-family: inherit;
}
.add-btn:hover { background: rgba(60, 52, 137, 0.97); }

/* Wishlist */
.wishlist-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 0.5px solid var(--border-md);
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-3);
  transition: all 0.15s;
  z-index: 2;
}
.wishlist-btn:hover, .wishlist-btn.active {
  border-color: var(--wish);
  color: var(--wish);
  background: rgba(251, 234, 240, 0.95);
}

/* Out of stock overlay */
.out-of-stock-overlay {
  position: absolute;
  inset: 0;
  background: rgba(245,244,241,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  z-index: 3;
}

/* Info section */
.product-info {
  padding: 14px 14px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-name {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 3px;
  color: var(--text);
}

.product-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 10px;
  line-height: 1.4;
}

.product-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.price-group { display: flex; align-items: baseline; gap: 6px; }
.price       { font-size: 15px; font-weight: 500; }
.price-old   { font-size: 11px; color: var(--text-3); text-decoration: line-through; }

/* Low stock nudge */
.stock-nudge {
  font-size: 10px;
  color: #BA7517;
  font-weight: 500;
  margin-top: 6px;
}

/* ─── List view ───────────────────────────────────────────── */
.product-grid.list-view {
  grid-template-columns: 1fr;
  gap: 10px;
}

.product-grid.list-view .product-card {
  flex-direction: row;
  align-items: stretch;
  border-radius: var(--radius);
}

.product-grid.list-view .product-img {
  width: 100px;
  aspect-ratio: 1;
  flex-shrink: 0;
  border-radius: var(--radius) 0 0 var(--radius);
}

.product-grid.list-view .product-info {
  flex: 1;
  padding: 14px 16px;
  flex-direction: row;
  align-items: center;
  gap: 16px;
}

.product-grid.list-view .product-name { font-size: 14px; margin-bottom: 2px; }
.product-grid.list-view .product-sub  { margin-bottom: 0; }
.product-grid.list-view .product-bottom { flex-direction: row; gap: 10px; margin-top: 0; }
.product-grid.list-view .stock-nudge { display: none; }

.product-grid.list-view .add-btn {
  position: static;
  opacity: 1;
  transform: none;
  background: var(--brand);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 11px;
  white-space: nowrap;
}
.product-grid.list-view .add-btn:hover { background: var(--brand-dark); }

.product-grid.list-view .wishlist-btn {
  position: static;
  background: transparent;
  border-radius: var(--radius-sm);
  backdrop-filter: none;
}

/* ─── Cart drawer ─────────────────────────────────────────── */
.cart-drawer {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  bottom: 0;
  width: 320px;
  background: var(--surface);
  border-left: 0.5px solid var(--border-md);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  z-index: 300;
}
.cart-drawer.open { transform: translateX(0); }

.cart-head {
  padding: 16px 20px;
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.cart-head h3 { font-size: 14px; font-weight: 500; }

.close-btn {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--text-3);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
}
.close-btn:hover { background: var(--bg); color: var(--text); }

.cart-items { flex: 1; overflow-y: auto; padding: 12px 20px; }

.cart-empty {
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
  padding: 40px 0;
}

.cart-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 0.5px solid var(--border);
  align-items: flex-start;
}

.cart-item-img {
  width: 52px;
  height: 52px;
  background: var(--bg);
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
}
.cart-item-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.cart-item-body { flex: 1; min-width: 0; }

.cart-item-name {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  line-height: 1.3;
}

.qty-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.qty-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: background 0.1s;
}
.qty-btn:hover { background: var(--bg); }
.qty-num { font-size: 12px; min-width: 16px; text-align: center; }

.cart-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.cart-item-price { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.cart-remove {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--text-3);
  padding: 2px;
  border-radius: 3px;
  transition: color 0.12s;
}
.cart-remove:hover { color: #E24B4A; }

.cart-foot {
  padding: 16px 20px;
  border-top: 0.5px solid var(--border-md);
  flex-shrink: 0;
  display: none;
}
.cart-foot.visible { display: block; }

.cart-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 6px;
}
.cart-total-row.main {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 14px;
}

.checkout-btn {
  width: 100%;
  padding: 11px;
  background: var(--brand);
  color: var(--brand-light);
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  font-family: inherit;
  transition: background 0.12s;
}
.checkout-btn:hover { background: var(--brand-dark); }

/* ─── Badge info modal ────────────────────────────────────── */
.badge-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.badge-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.badge-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(245, 244, 241, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.badge-modal {
  position: relative;
  background: var(--surface);
  border-radius: 16px;
  border: 0.5px solid var(--border-md);
  padding: 36px 32px 32px;
  max-width: 340px;
  width: 90%;
  text-align: center;
  transform: translateY(12px) scale(0.97);
  transition: transform 0.22s ease;
  box-shadow: 0 20px 60px rgba(0,0,0,0.12);
}
.badge-overlay.open .badge-modal {
  transform: translateY(0) scale(1);
}

.badge-modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 16px;
  color: var(--text-3);
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
  line-height: 1;
}
.badge-modal-close:hover { background: var(--bg); color: var(--text); }

.badge-modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 26px;
}

.badge-modal-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 12px;
  color: var(--text);
}

.badge-modal-desc {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-2);
}

/* ─── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: #26215C;
  color: var(--brand-light);
  font-size: 12px;
  padding: 9px 20px;
  border-radius: var(--radius);
  white-space: nowrap;
  z-index: 999;
  pointer-events: none;
  transition: transform 0.22s ease;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ─── Sidebar overlay (mobile) ────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 24, 0.35);
  z-index: 149;
  opacity: 0;
  transition: opacity 0.22s ease;
}
.sidebar-overlay.open {
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════
   MOBILE — 768px and below
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Topbar ── */
  .topbar {
    padding: 0 16px;
    gap: 10px;
  }

  /* Hide the search bar in the topbar — replaced by mobile search row */
  .topbar .search-bar {
    display: none;
  }

  /* Hide view toggle on mobile — always grid */
  .view-toggle {
    display: none;
  }

  /* Show the filter toggle button */
  .filter-toggle-btn {
    display: flex;
  }

  /* ── Layout: single column ── */
  .layout {
    display: block;
  }

  /* ── Sidebar: off-canvas drawer ── */
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    height: auto;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    border-right: 0.5px solid var(--border-md);
    box-shadow: 4px 0 24px rgba(0,0,0,0.08);
    overflow-y: auto;
    padding-top: 20px;
    padding-bottom: 40px; /* extra bottom breathing room */
  }

  .sidebar.open {
    transform: translateX(0);
  }

  /* Show overlay when sidebar is open */
  .sidebar-overlay {
    display: block;
  }

  /* ── Main area ── */
  .main {
    padding: 16px 16px 32px;
  }

  /* Mobile search row below topbar */
  .mobile-search-row {
    padding: 10px 16px;
    background: var(--surface);
    border-bottom: 0.5px solid var(--border);
  }

  .mobile-search-row .search-bar {
    width: 100%;
  }

  /* ── Breadcrumb ── */
  .breadcrumb {
    display: none; /* saves precious vertical space */
  }

  /* ── Main header ── */
  .main-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    margin-bottom: 12px;
  }

  .page-title {
    font-size: 20px;
  }

  /* ── Filter pills: horizontal scroll ── */
  .filter-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: 16px;
    padding-bottom: 4px;
    /* Extend pills slightly past padding */
    margin-left: -2px;
    padding-left: 2px;
  }
  .filter-pills::-webkit-scrollbar { display: none; }

  .pill {
    flex-shrink: 0;
  }

  /* ── Product grid: 2-column on mobile ── */
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  /* Slightly tighten card internals */
  .product-info {
    padding: 10px 10px 8px;
  }

  .product-name {
    font-size: 13px;
  }

  .price {
    font-size: 14px;
  }

  /* Always show the add-to-cart button on touch (no hover) */
  .add-btn {
    opacity: 1;
    transform: translateY(0);
  }

  /* ── List view on mobile: simpler, tighter ── */
  .product-grid.list-view {
    grid-template-columns: 1fr;
  }

  .product-grid.list-view .product-img {
    width: 80px;
  }

  .product-grid.list-view .product-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 10px 12px;
  }

  .product-grid.list-view .product-bottom {
    width: 100%;
    justify-content: space-between;
  }

  /* ── Cart drawer: full-width on mobile ── */
  .cart-drawer {
    width: 100%;
    border-left: none;
    border-top: 0.5px solid var(--border-md);
    /* Slide up from bottom on mobile */
    top: auto;
    bottom: 0;
    height: 85vh;
    transform: translateY(100%);
    transition: transform 0.25s ease;
    border-radius: 16px 16px 0 0;
  }

  .cart-drawer.open {
    transform: translateY(0);
  }

  /* ── Badge modal: safe on small screens ── */
  .badge-modal {
    padding: 28px 20px 24px;
    border-radius: 12px;
  }

  /* ── Toast: above potential bottom nav ── */
  .toast {
    bottom: 16px;
    font-size: 11px;
    padding: 8px 16px;
    max-width: calc(100vw - 32px);
    white-space: normal;
    text-align: center;
  }
}

/* ── Narrow phones (≤ 380px): single column grid ── */
@media (max-width: 380px) {
  .product-grid {
    grid-template-columns: 1fr;
  }
}