/* =============================================================
   SHOP.CSS  –  Shop / Product Listing Page
   ============================================================= */

/* ── Page Layout ─────────────────────────────────────────── */
.shop-page { min-height: 70vh; padding: 0 0 60px; }

.shop-hero {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 30px 0 20px;
}
.shop-hero h1 { font-size: 1.6rem; margin-bottom: 4px; }
.shop-hero p  { font-size: 0.9rem; color: var(--text-secondary); }

.shop-body {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
  align-items: start;
  margin-top: 28px;
}

/* ── Sidebar Filters ─────────────────────────────────────── */
.shop-sidebar {
  position: sticky;
  top: 130px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
}
.sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-elevated);
}
.sidebar-header h3 { font-size: 0.9rem; font-weight: 700; color: var(--text-primary); margin: 0; }
.sidebar-clear-btn {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 0.78rem;
  cursor: pointer;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 5px;
  transition: background 0.15s;
}
.sidebar-clear-btn:hover { background: var(--danger-bg); }

.sidebar-section {
  padding: 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.sidebar-section:last-child { border-bottom: none; }
.sidebar-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Category search input */
.sidebar-cat-search-wrap {
  position: relative;
  margin-bottom: 10px;
}
.sidebar-cat-search-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.75rem;
  pointer-events: none;
}
.sidebar-cat-search {
  width: 100%;
  padding: 7px 10px 7px 30px;
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}
.sidebar-cat-search:focus { border-color: var(--accent); }
.sidebar-cat-search::placeholder { color: var(--text-muted); }

/* Category checkbox list */
.sidebar-cat-list { list-style: none; display: flex; flex-direction: column; gap: 1px; max-height: 260px; overflow-y: auto; padding-left: 0;}
.sidebar-cat-list::-webkit-scrollbar { width: 4px; }
.sidebar-cat-list::-webkit-scrollbar-track { background: transparent; }
.sidebar-cat-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.sidebar-cat-item { display: block; }
.cat-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.cat-checkbox-label:hover { background: var(--accent-muted); color: var(--accent); }

/* Hidden native checkbox */
.cat-checkbox { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }

/* Custom checkbox box */
.cat-checkbox-custom {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.cat-checkbox-custom::after {
  content: '';
  width: 8px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) scale(0);
  transition: transform 0.12s ease;
  margin-top: -2px;
}
.cat-checkbox:checked ~ .cat-checkbox-custom {
  background: var(--accent);
  border-color: var(--accent);
}
.cat-checkbox:checked ~ .cat-checkbox-custom::after { transform: rotate(-45deg) scale(1); }
.cat-checkbox:checked ~ .cat-name { color: var(--accent); font-weight: 600; }

.cat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-cat-badge {
  flex-shrink: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
}
.cat-checkbox:checked ~ .sidebar-cat-badge {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Dual Price Range Slider ─────────────────────────────── */
.prs-wrap { margin-top: 12px; }

/* Value labels row */
.prs-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 6px;
}
.prs-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-muted);
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  padding: 3px 10px;
  border-radius: 6px;
  min-width: 60px;
  text-align: center;
  transition: background 0.15s;
}
.prs-dash { color: var(--text-muted); font-size: 0.78rem; flex-shrink: 0; }

/* Track */
.prs-track-wrap {
  position: relative;
  height: 38px;
  display: flex;
  align-items: center;
}
.prs-track {
  position: absolute;
  left: 0; right: 0;
  height: 5px;
  background: var(--border-color);
  border-radius: 999px;
  overflow: hidden;
}
.prs-fill {
  position: absolute;
  top: 0; bottom: 0;
  background: var(--accent);
  border-radius: 999px;
}

/* Range inputs */
.prs-input {
  position: absolute;
  width: 100%;
  height: 5px;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  pointer-events: none;
  margin: 0;
  padding: 0;
}

/* Thumb – Webkit */
.prs-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 2.5px solid var(--bg-surface);
  box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.45);
  cursor: grab;
  pointer-events: auto;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.prs-input::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 14px rgba(var(--accent-rgb), 0.65);
}
.prs-input:active::-webkit-slider-thumb {
  cursor: grabbing;
  transform: scale(1.15);
}

/* Thumb – Firefox */
.prs-input::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 2.5px solid var(--bg-surface);
  box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.45);
  cursor: grab;
  pointer-events: auto;
  transition: transform 0.15s ease;
}
.prs-input::-moz-range-thumb:hover { transform: scale(1.2); }

/* z-index so max handle sits on top when both at extremes */
.prs-input-min { z-index: 2; }
.prs-input-max { z-index: 3; }

/* Rating filter */
.rating-filter { display: flex; flex-direction: column; gap: 4px; }
.rating-filter label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 0.84rem;
  color: var(--text-secondary);
  transition: background 0.15s;
}
.rating-filter label:hover { background: var(--accent-muted); }
.rating-filter input[type="radio"] { accent-color: var(--accent); }
.rating-filter .stars { color: var(--warning); font-size: 0.78rem; }

/* Stock toggle */
.stock-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
}
.toggle-switch {
  position: relative;
  width: 38px;
  height: 21px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border-color);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-track::before {
  content: '';
  position: absolute;
  width: 15px; height: 15px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-track { background: var(--accent); }
.toggle-switch input:checked + .toggle-track::before { transform: translateX(17px); }


/* ── Main Content ─────────────────────────────────────────── */
.shop-main {}

/* Toolbar */
.shop-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.shop-result-count { font-size: 0.86rem; color: var(--text-secondary); }
.shop-result-count strong { color: var(--text-primary); }

.shop-sort-wrap { display: flex; align-items: center; gap: 8px; }
.shop-sort-wrap label { font-size: 0.82rem; color: var(--text-muted); white-space: nowrap; }
.shop-sort-select {
  padding: 7px 12px !important;
  font-size: 0.84rem !important;
  border-radius: 7px !important;
  min-width: 160px;
}

.shop-view-btns { display: flex; gap: 4px; }
.shop-view-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 32px; height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.shop-view-btn.active, .shop-view-btn:hover {
  background: var(--accent-muted);
  border-color: var(--accent);
  color: var(--accent);
}

/* Active filters chips */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--accent-muted);
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  color: var(--accent);
  border-radius: 999px;
  padding: 3px 10px 3px 12px;
  font-size: 0.78rem;
  font-weight: 500;
}
.filter-chip button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
  padding: 0;
  opacity: 0.7;
}
.filter-chip button:hover { opacity: 1; }

/* ── Product Grid ────────────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* fe-btn-buynow — styled globally in theme.css (gradient orange→red) */

/* ── List View ───────────────────────────────────────────── */
.product-grid.list-view {
  grid-template-columns: 1fr;
  gap: 12px;
}
.product-grid.list-view .fe-product-card {
  display: grid;
  grid-template-columns: 220px 1fr;
  align-items: stretch;
  height: auto;
}

/*
  Cancel aspect-ratio on the image in list view so it fills
  the fixed 220px column without overflowing.
*/
.product-grid.list-view .fe-product-img {
  aspect-ratio: unset;
  width: 220px;
  min-height: 200px;
  height: 100%;
}

/*
  Body: single flex column — category → name → rating → price → actions.
  No right-side actions column; everything flows vertically.
*/
.product-grid.list-view .fe-product-body {
  display: flex;
  flex-direction: column;
  padding: 18px 20px;
  min-width: 0;
}

/* Reset grid-column overrides (left over from old 2-col layout) */
.product-grid.list-view .fe-product-category,
.product-grid.list-view .fe-product-name,
.product-grid.list-view .fe-product-rating,
.product-grid.list-view .fe-price-stock-row {
  grid-column: unset;
  padding-left: 0;
}
.product-grid.list-view .fe-product-category { padding-top: 0; }
.product-grid.list-view .fe-price-stock-row  {
  padding-bottom: 0;
  margin-top: auto;   /* push price + actions to bottom when card is tall */
  margin-bottom: 0;
}

/* ── Actions: horizontal row below price ─────────────────── */
.product-grid.list-view .fe-product-actions {
  grid-column: unset;
  grid-row: unset;
  flex-direction: row;
  align-items: center;
  align-self: auto;
  border-left: none;
  padding: 14px 0 0;
  gap: 8px;
  /* subtle separator between price and buttons */
  border-top: 1px solid var(--border-subtle);
  margin-top: 12px;
}

/* Cart + Buy Now: equal-width with full text + icon */
.product-grid.list-view .fe-btn-cart,
.product-grid.list-view .fe-btn-buynow {
  flex: 1;
  max-width: 170px;
  width: auto;
  padding: 10px 16px;
  font-size: 0.72rem;
  gap: 6px;
  justify-content: center;
}

/* Force button text visible in list view on tablet+ (mobile uses theme.css ≤767px icon-only rule) */
@media (min-width: 768px) {
  .product-grid.list-view .fe-btn-cart span,
  .product-grid.list-view .fe-btn-buynow span {
    display: inline;
  }
}

/* Wishlist: compact icon-only square */
.product-grid.list-view .fe-btn-wishlist {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 10px;
}
.product-grid.list-view .fe-btn-wishlist::after { content: none; }

/* Product card styles live in theme.css (loaded globally) */

/* ── Empty State ─────────────────────────────────────────── */
.shop-empty {
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
}
.shop-empty-icon { font-size: 3.5rem; margin-bottom: 16px; color: var(--text-muted); }
.shop-empty h3 { font-size: 1.2rem; margin-bottom: 8px; }
.shop-empty p { color: var(--text-secondary); margin-bottom: 20px; }

/* ── Pagination ──────────────────────────────────────────── */
.fe-pagination { display: flex; justify-content: center; gap: 4px; margin-top: 32px; }
.fe-pagination a, .fe-pagination span {
  display: flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s;
  padding: 0 10px;
  background: var(--bg-surface);
}
.fe-pagination a:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-muted); }
.fe-pagination .active { background: var(--accent); border-color: var(--accent); color: #fff; }
.fe-pagination .disabled { opacity: 0.4; pointer-events: none; }

/* ── Mobile Filters ──────────────────────────────────────── */
.shop-filter-toggle {
  display: none;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  gap: 7px;
  align-items: center;
}
.shop-filter-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ── Skeleton Cards ──────────────────────────────────────── */
.product-skeleton {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
}
.product-skeleton-img  { height: 200px; }
.product-skeleton-body { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.product-skeleton-line { height: 12px; border-radius: 4px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1100px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .shop-body { grid-template-columns: 1fr; }
  .shop-sidebar { position: static; display: none; }
  .shop-sidebar.mobile-open { display: block; position: fixed; inset: 0; z-index: 1500; border-radius: 0; overflow-y: auto; }
  .shop-filter-toggle { display: flex; }
}
@media (max-width: 600px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
@media (max-width: 380px) {
  .product-grid { grid-template-columns: 1fr; }
}

/* Collapse list-view to normal card layout on mobile (≤767px) */
@media (max-width: 767px) {
  .product-grid.list-view .fe-product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
  }
  .product-grid.list-view .fe-product-img {
    aspect-ratio: 4 / 3;
    width: 100%;
    min-height: unset;
    height: auto;
  }
  .product-grid.list-view .fe-product-body {
    padding: 12px;
  }
  .product-grid.list-view .fe-product-actions {
    padding-top: 10px;
    margin-top: 8px;
  }
  .product-grid.list-view .fe-btn-cart,
  .product-grid.list-view .fe-btn-buynow {
    flex: 1;
    max-width: none;
  }
}
