:root {
  --wi-card-radius: 14px;
  --wi-card-border: #eef0ef;
  --wi-card-shadow: 0 2px 8px rgba(20, 30, 25, 0.06);
  --wi-card-shadow-hover: 0 16px 32px rgba(20, 30, 25, 0.12);
  --wi-brand: #1f7a4d;
  --wi-brand-dark: #145c39;
  --wi-price: #16311f;
  --wi-muted: #7c8a83;
  --wi-danger: #d64545;
  --wi-sale: #d64545;
  --wi-new: #1f7a4d;
}

/* --------------------------------------------------------------------
   Grid
   Auto-fill instead of a fixed column count: the row always fills the
   available width and reflows based on how many products there
   actually are, so a partial last row (e.g. 13 items on a 5-column
   grid) never leaves empty column tracks / a visible gap. minmax(220px)
   naturally lands at ~5 columns on wide desktop, ~4 on laptop, ~3 on
   tablet, and 1-2 on small screens — without needing separate
   column-count breakpoints.
   -------------------------------------------------------------------- */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
}

@media (max-width: 767px) {
  .products-grid {
    gap: 16px;
  }
}

@media (max-width: 400px) {
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }
}

/* --------------------------------------------------------------------
   Product Card
   -------------------------------------------------------------------- */
.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--wi-card-border);
  border-radius: var(--wi-card-radius);
  overflow: hidden;
  box-shadow: var(--wi-card-shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  height: 100%;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--wi-card-shadow-hover);
  border-color: transparent;
}

/* --------------------------------------------------------------------
   Image area
   -------------------------------------------------------------------- */
.product-img {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f4f6f5;
}

.product-img img,
.product-card > img.card-img-top {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
  background: #f4f6f5;
}

.product-card > img.card-img-top {
  aspect-ratio: 1 / 1;
}

.product-card:hover .product-img img,
.product-card:hover > img.card-img-top {
  transform: scale(1.06);
}

.product-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #fff;
  background: #333;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.product-badge.sale { background: var(--wi-sale); }
.product-badge.new { background: var(--wi-new); }

.out-of-stock {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #fff;
  background: #6c757d;
}

/* --------------------------------------------------------------------
   Info area
   -------------------------------------------------------------------- */
.product-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 16px 18px;
}

.product-category {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--wi-brand);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-title {
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.35;
  color: #1a1f1c;
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}

.product-title:hover {
  color: var(--wi-brand-dark);
}

.product-price {
  margin-top: 2px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.product-price .current-price {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--wi-price);
}

.product-price .original-price {
  font-size: 0.85rem;
  color: var(--wi-muted);
  text-decoration: line-through;
}

/* --------------------------------------------------------------------
   Add to cart button
   -------------------------------------------------------------------- */
.btn-add-cart {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  background: var(--wi-brand);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.btn-add-cart:hover {
  background: var(--wi-brand-dark);
  color: #fff;
  transform: translateY(-1px);
}

.btn-add-cart:disabled {
  cursor: not-allowed;
  transform: none;
}

/* --------------------------------------------------------------------
   Empty / no-results state
   -------------------------------------------------------------------- */
.no-products {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 16px;
  color: var(--wi-muted);
  font-size: 1rem;
}

/* --------------------------------------------------------------------
   Shop container fixes
   -------------------------------------------------------------------- */
.shop-container {
  padding: 20px 0;
}

.shop-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 30px;
}

/* For tablet and below, filters collapse */
@media (max-width: 991px) {
  .shop-layout {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------- */
.pagination-container {
  display: flex;
  justify-content: center;
  margin-top: 30px;
}

.pagination {
  display: flex;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.pagination .page-item .page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--wi-card-border);
  border-radius: 8px;
  color: var(--wi-price);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.pagination .page-item .page-link:hover {
  background: var(--wi-brand);
  color: #fff;
  border-color: var(--wi-brand);
}

.pagination .page-item.active .page-link {
  background: var(--wi-brand);
  color: #fff;
  border-color: var(--wi-brand);
}

.pagination .page-item.disabled .page-link {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* --------------------------------------------------------------------
   Results info
   -------------------------------------------------------------------- */
.results-info {
  text-align: center;
  margin-top: 20px;
  color: var(--wi-muted);
  font-size: 0.9rem;
}

/* --------------------------------------------------------------------
   Mobile filter toggle
   -------------------------------------------------------------------- */
.mobile-filter-toggle {
  display: none;
  width: 100%;
  padding: 12px;
  margin-bottom: 16px;
  background: var(--wi-brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

@media (max-width: 991px) {
  .mobile-filter-toggle {
    display: block;
  }
}

/* --------------------------------------------------------------------
   Filters sidebar mobile
   -------------------------------------------------------------------- */
.filters-sidebar {
  transition: transform 0.3s ease;
}

@media (max-width: 991px) {
  .filters-sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 300px;
    height: 100vh;
    background: #fff;
    z-index: 1050;
    padding: 20px;
    overflow-y: auto;
    box-shadow: 0 0 30px rgba(0,0,0,0.15);
    transition: left 0.3s ease;
  }
  
  .filters-sidebar.active {
    left: 0;
  }
  
  .overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
  }
  
  .overlay.active {
    display: block;
  }
}

/* --------------------------------------------------------------------
   Shop controls
   -------------------------------------------------------------------- */
.shop-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.results-count {
  color: var(--wi-muted);
  font-size: 0.9rem;
}

.shop-sort {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.shop-sort select {
  padding: 8px 12px;
  border: 1px solid var(--wi-card-border);
  border-radius: 8px;
  background: #fff;
  font-size: 0.85rem;
  cursor: pointer;
}

.view-options {
  display: flex;
  gap: 4px;
}

.view-btn {
  padding: 8px 12px;
  border: 1px solid var(--wi-card-border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-btn.active {
  background: var(--wi-brand);
  color: #fff;
  border-color: var(--wi-brand);
}

.view-btn:hover:not(.active) {
  background: #f4f6f5;
}

/* --------------------------------------------------------------------
   Filter sections
   -------------------------------------------------------------------- */
.filter-section {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--wi-card-border);
  padding-bottom: 16px;
}

.filter-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}

.filter-title i {
  transition: transform 0.3s ease;
}

.filter-section.active .filter-title i {
  transform: rotate(180deg);
}

.filter-options {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 0.9rem;
}

.filter-option input[type="checkbox"] {
  accent-color: var(--wi-brand);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.option-count {
  color: var(--wi-muted);
  font-size: 0.8rem;
}

.price-range {
  margin-top: 10px;
}

.price-range .form-range {
  width: 100%;
  accent-color: var(--wi-brand);
}

.price-inputs {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.price-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--wi-card-border);
  border-radius: 6px;
  font-size: 0.85rem;
}

.filter-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn-apply,
.btn-reset {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-apply {
  background: var(--wi-brand);
  color: #fff;
}

.btn-apply:hover {
  background: var(--wi-brand-dark);
}

.btn-reset {
  background: #f4f6f5;
  color: var(--wi-price);
}

.btn-reset:hover {
  background: #e8eaeb;
}

/* --------------------------------------------------------------------
   Page hero
   -------------------------------------------------------------------- */
.page-hero {
  background: var(--wi-brand);
  padding: 40px 0 30px;
  color: #fff;
}

.page-hero h1 {
  font-weight: 700;
  margin-bottom: 8px;
}

.page-hero .breadcrumb {
  background: transparent;
  padding: 0;
  margin: 10px 0 0;
}

.page-hero .breadcrumb-item a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
}

.page-hero .breadcrumb-item a:hover {
  color: #fff;
}

.page-hero .breadcrumb-item.active {
  color: #ffc107;
}