:root {
  --accent:        #8424e3;
  --accent-dark:   #6b1ab5;
  --bg-page:       #fdfaf5;
  --card:          #ffffff;
  --text-main:     #1f1f1f;
  --text-muted:    #6b7280;
  --border:        #e5e7eb;
  --gold:          #b45309;
  --radius:        10px;
  --shadow-sm:     0 2px 10px rgba(0,0,0,0.06);
  --shadow-hover:  0 8px 24px rgba(132,36,227,0.10);
}

* { 
  margin:0; 
  padding:0; 
  box-sizing:border-box; 
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
}

body.filter-open {
  overflow: hidden;
}

.container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 24px 20px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
}

/* Desktop Sidebar */
.desktop-sidebar {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  height: fit-content;
  position: sticky;
  top: 24px;
}

.desktop-sidebar h3 { 
  margin: 0 0 16px; 
  font-size: 1.15rem; 
}

.desktop-sidebar ul { 
  list-style: none; 
}

.desktop-sidebar li { 
  margin: 10px 0; 
}

.desktop-sidebar a, 
.desktop-sidebar label {
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  cursor: pointer;
}

.desktop-sidebar a:hover, 
.desktop-sidebar label:hover { 
  color: var(--accent); 
}

.price-slider { 
  margin: 16px 0 24px; 
}

input[type="range"] { 
  width: 100%; 
  accent-color: var(--accent); 
}

.filter-group {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.filter-group:last-child { 
  border-bottom: none; 
}

/* Mobile Filter Header */
.mobile-filter-header {
  display: none;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  background: var(--card);
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.mobile-filter-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--accent);
  border: none;
  border-radius: 30px;
  color: white;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.mobile-filter-btn i {
  font-size: 1.2rem;
}

.mobile-filter-btn:hover {
  background: var(--accent-dark);
}

.mobile-showing {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Filter Drawer */
.filter-drawer {
  position: fixed;
  top: 0;
  left: -100%;
  width: 85%;
  max-width: 340px;
  height: 100vh;
  background: var(--card);
  z-index: 1000;
  overflow-y: auto;
  transition: left 0.3s ease;
  box-shadow: var(--shadow-hover);
}

.filter-drawer.active {
  left: 0;
}

.filter-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 1;
}

.filter-drawer-header h3 {
  font-size: 1.3rem;
  color: var(--accent);
}

.close-drawer {
  background: none;
  border: none;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0 8px;
}

.close-drawer:hover {
  color: var(--accent);
}

.filter-drawer-content {
  padding: 20px;
  padding-bottom: 40px;
}

.filter-section {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.filter-section:last-child {
  border-bottom: none;
}

.filter-section h4 {
  margin-bottom: 16px;
  font-size: 1.1rem;
  color: var(--text-main);
}

.filter-section ul {
  list-style: none;
}

.filter-section li {
  margin: 12px 0;
}

.filter-section a,
.filter-section label {
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  font-size: 0.95rem;
  cursor: pointer;
}

.filter-section a:hover,
.filter-section label:hover {
  color: var(--accent);
}

.filter-section input[type="checkbox"] {
  margin-right: 10px;
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.price-slider-mobile {
  margin: 16px 0;
}

/* Apply Filters Button */
.apply-filters-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 20px;
}

.apply-filters-btn:hover {
  background: var(--accent-dark);
}

/* Filter Overlay */
.filter-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s;
}

.filter-overlay.active {
  display: block;
  opacity: 1;
}

/* Main Content */
main { 
  display: flex; 
  flex-direction: column; 
  gap: 24px; 
}

.desktop-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

#showingText {
  color: var(--text-muted);
  font-size: 0.95rem;
}

#sortSelect {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  font-size: 0.95rem;
  cursor: pointer;
}

/* Products Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 20px;
  min-height: 400px;
}

@media (min-width: 1600px) {
  .products-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* Loader */
.loader-container {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 100px 20px;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 5px solid #e5e7eb;
  border-top: 5px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Product Card */
.product-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.22s ease;
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.image-wrapper {
  height: 230px;
  background: #f9f5f2;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.image-wrapper img {
  max-height: 92%;
  max-width: 92%;
  object-fit: contain;
}

.badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--accent);
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 20px;
  z-index: 2;
}

.wishlist-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: white;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  cursor: pointer;
  z-index: 2;
}

.product-info {
  padding: 14px 12px;
  text-align: center;
}

.product-name {
  font-weight: 600;
  margin-bottom: 6px;
  min-height: 2.4em;
  line-height: 1.3;
  font-size: 0.98rem;
}

.stars {
  color: var(--gold);
  font-size: 0.88rem;
  margin: 6px 0 4px;
}

.price-row {
  font-weight: 600;
  font-size: 1.05rem;
  margin: 8px 0 10px;
}

.old-price {
  color: var(--text-muted);
  text-decoration: line-through;
  margin-left: 10px;
  font-size: 0.92rem;
}

.add-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 9px 0;
  width: 100%;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 0.94rem;
}

.add-btn:hover { 
  background: var(--accent-dark); 
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 40px 0 20px;
}

.pagination a {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 500;
}

.pagination a.active,
.pagination a:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.no-products {
  grid-column: 1 / -1;
  text-align: center;
  padding: 100px 20px;
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* Mobile Styles */
@media (max-width: 980px) {
  .container {
    grid-template-columns: 1fr;
  }

  .desktop-sidebar {
    display: none;
  }

  .desktop-controls {
    display: none;
  }

  .mobile-filter-header {
    display: flex;
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  /* Categories in drawer look good as list */
  .filter-section ul {
    display: block;
  }
  
  .filter-section li {
    margin: 12px 0;
  }
}

@media (max-width: 600px) {
  .mobile-filter-header {
    flex-direction: column;
    align-items: stretch;
  }

  .mobile-filter-btn {
    width: 100%;
    justify-content: center;
  }

  .mobile-showing {
    text-align: center;
  }

  .products-grid {
    gap: 12px;
  }

  .image-wrapper {
    height: 150px;
  }

  .product-info {
    padding: 10px 8px;
  }

  .product-name {
    font-size: 0.85rem;
    min-height: 2.2em;
  }

  .stars {
    font-size: 0.75rem;
  }

  .price-row {
    font-size: 0.9rem;
  }

  .add-btn {
    padding: 6px 0;
    font-size: 0.8rem;
  }

  .badge {
    font-size: 0.7rem;
    padding: 3px 8px;
    top: 8px;
    left: 8px;
  }

  .wishlist-btn {
    width: 30px;
    height: 30px;
    top: 8px;
    right: 8px;
  }

  .filter-drawer {
    width: 90%;
  }
}

@media (max-width: 400px) {
  .products-grid {
    gap: 8px;
  }

  .image-wrapper {
    height: 130px;
  }

  .product-info {
    padding: 6px 4px;
  }

  .product-name {
    font-size: 0.8rem;
    min-height: 2em;
  }

  .price-row {
    font-size: 0.85rem;
    margin: 4px 0 6px;
  }

  .add-btn {
    padding: 5px 0;
    font-size: 0.75rem;
    border-radius: 6px;
  }
}