/* === Layout Basics === */
.shop-container {
  display: flex;
  align-items: flex-start;
  padding: 2rem;
  gap: 2rem;
  flex-wrap: nowrap;
  box-sizing: border-box;
}

/* === Updated & Improved Fixed Sidebar (desktop/laptop) === */
.filter-sidebar {
  top: 100px;
  height: calc(100vh - 120px);
  width: 350px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #ddd;
  padding: 1.5rem 1.2rem;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  font-family: 'Segoe UI', sans-serif;
}
.filter-sidebar h4 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #222;
  margin-bottom: 1rem;
  border-bottom: 1px solid #ccc;
  padding-bottom: 0.4rem;
  text-align: center;
  margin-top: 0;
}

/* Category links (desktop/laptop) */
.filter-sidebar ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.filter-sidebar ul li a {
  display: block;
  background-color: #f5f5f5;
  color: #333;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #ddd;
  transition: all 0.25s ease-in-out;
}
.filter-sidebar ul li a:hover {
  background-color: #7209b7;
  color: #fff;
  border-color: #7209b7;
  box-shadow: 0 2px 8px rgba(114, 9, 183, 0.15);
}

/* Sidebar scrollbars */
.filter-sidebar::-webkit-scrollbar { width: 6px; }
.filter-sidebar::-webkit-scrollbar-thumb { background-color: #ccc; border-radius: 4px; }

.filter-sidebar .filter-section { margin-bottom: 1.5rem; }
.filter-sidebar label {
  font-weight: 600;
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.95rem;
  color: #333;
}
.filter-sidebar input[type="number"],
.filter-sidebar select {
  width: 100%;
  padding: 8px 10px;
  font-size: 0.9rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background-color: #fff;
  margin-bottom: 1rem;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.filter-sidebar input:focus,
.filter-sidebar select:focus { outline: none; border-color: #5e3bee; }
.filter-sidebar input[type="checkbox"],
.filter-sidebar input[type="radio"] { margin-right: 6px; }

/* Apply button */
.filter-sidebar .btn {
  background-color: #7209b7;
  color: #fff;
  padding: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  width: 100%;
  cursor: pointer;
  transition: background 0.3s ease;
}
.filter-sidebar .btn:hover { background-color: #520a85; }

.filter-section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #222;
  margin-bottom: 1rem;
  margin-top: 15px;
  border-bottom: 1px solid #ccc;
  padding-bottom: 0.4rem;
}
.form-group { margin-bottom: 5px; }

/* === Product Grid (desktop/laptop) === */
.product-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  font-family: 'Segoe UI', sans-serif;
}

/* === Product Card === */
.product-card {
  background: white;
  border: 1px solid #ddd;
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  transition: box-shadow 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}
.product-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.product-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  margin-bottom: 1rem;
  border-radius: 4px;
}
.product-card h5 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 10px;
  color: #222;
  text-align: left;
  padding-left: 4px;
}
.product-card .price {
  font-weight: bold;
  color: #7209b7;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  margin-top: 0px;
}

/* CTA */
.add-to-cart-btn {
  background-color: #7209b7;
  color: white;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  text-decoration: none;
  display: inline-block;
  transition: background-color 0.3s;
}
.add-to-cart-btn:hover { background-color: #560bad; }

/* Color swatches (optional) */
.color-filter-bar { display: flex; gap: 8px; margin-top: 5px; }
.color-circle {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid #ccc; cursor: pointer;
}
.color-circle:hover { border: 2px solid #333; }

/* =========================
   MOBILE ONLY (≤768px)
   ========================= */
@media (max-width: 768px) {
  /* Stack layout & products full width */
  .shop-container { flex-direction: column; gap: 0; padding: 12px 12px 84px; }
  .product-container { width: 100%; }

  /* Smaller product grid — 2 per row */
  .product-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  /* Tighter cards for mobile */
  .product-card { padding: 0.75rem; border-radius: 10px; }
  .product-card img { height: 160px; border-radius: 8px; }
  .product-card h5 { font-size: 1rem; }
  .product-card .price { font-size: .95rem; }

  /* Hide sidebar in normal flow on mobile */
  .filter-sidebar { display: none; }

  /* Bottom-sheet open (via :target) */
  #filters:target {
    display: block;
    position: fixed !important;
    left: 0; right: 0; bottom: 0;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    max-height: 72vh;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -10px 24px rgba(0,0,0,.18);
    overflow: auto;
    z-index: 1001;
    padding: 16px;
  }

  /* Backdrop only when sheet open */
  .filter-backdrop { display: none; }
  #filters:target + .filter-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    backdrop-filter: blur(1px);
    z-index: 1000;
  }

  /* Floating Filter button at TOP-RIGHT */
  .floating-filter-btn {
    position: fixed;
    top: 72px;              /* adjust under your navbar */
    right: 16px;
    bottom: auto;
    width: 52px;
    height: 52px;
    border-radius: 999px;
    background: #6a0dad;
    color: #fff;
    display: none;          /* toggled below */
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(0,0,0,.22);
    z-index: 1002;
  }

  /* TOGGLE THE FAB (tap to open/close) */
  /* Closed: show OPEN; hide CLOSE */
  #filters:not(:target) ~ .floating-filter-btn--open { display: inline-flex; }
  #filters:not(:target) ~ .floating-filter-btn--close { display: none; }

  /* Open: hide OPEN; show CLOSE (tap to close) */
  #filters:target ~ .floating-filter-btn--open { display: none; }
  #filters:target ~ .floating-filter-btn--close { display: inline-flex; }
}

/* Desktop/laptop: keep mobile-only controls hidden */
.floating-filter-btn,
.filter-backdrop { display: none; }
