/* ============================================================
   FILTERS.CSS — Mediterranean Brutalism Filter Styling
   Shopping Mare Fano Italy
   ============================================================ */

/* ============================================================
   SHOP LAYOUT — Sidebar + Main Content
   ============================================================ */
.shop-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* ============================================================
   FILTER SIDEBAR (Desktop)
   ============================================================ */
.filter-sidebar {
  position: sticky;
  top: 80px; /* Below fixed header */
  height: fit-content;
  background: var(--butter);
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.filter-heading {
  font-size: 1.5rem;
  color: var(--ink);
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--coral);
  padding-bottom: 0.5rem;
  font-family: 'Fraunces', serif;
  font-weight: 700;
}

.filter-section {
  /* Container for all filter groups */
}

.filter-group {
  margin-bottom: 2rem;
}

.filter-group h4 {
  font-size: 1.1rem;
  color: var(--ink);
  margin-bottom: 1rem;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
}

/* Badge Checkboxes */
.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s;
}

.filter-checkbox:hover {
  background: var(--cream);
}

.filter-checkbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--coral);
}

.filter-checkbox span {
  font-size: 1rem;
  color: var(--ink);
  font-weight: 500;
}

/* Price Slider (noUiSlider overrides) */
#price-slider,
#price-slider-mobile {
  margin: 1.5rem 0;
  height: 8px;
}

.noUi-connect {
  background: var(--coral);
}

.noUi-handle {
  border: 3px solid var(--ink);
  background: var(--teal);
  box-shadow: 3px 3px 0 var(--ink);
  border-radius: 50%;
  cursor: grab;
  width: 24px;
  height: 24px;
}

.noUi-handle:active {
  cursor: grabbing;
}

.noUi-handle::before,
.noUi-handle::after {
  display: none; /* Remove default handle lines */
}

.noUi-target {
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: none;
}

.noUi-horizontal {
  height: 8px;
}

.noUi-horizontal .noUi-handle {
  width: 24px;
  height: 24px;
  right: -12px;
  top: -8px;
}

.price-display {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  margin-top: 1rem;
}

/* Clear Filters Button */
.btn-clear-filters {
  width: 100%;
  padding: 0.75rem;
  background: var(--hot-pink);
  color: white;
  border: 2px solid var(--ink);
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: all 0.2s;
  margin-top: 1rem;
  font-family: 'DM Sans', sans-serif;
}

.btn-clear-filters:hover {
  box-shadow: var(--shadow-btn-hover);
  transform: translate(-2px, -2px);
}

.btn-clear-filters:active {
  box-shadow: 2px 2px 0 var(--ink);
  transform: translate(0, 0);
}

/* ============================================================
   SHOP MAIN CONTENT AREA
   ============================================================ */
.shop-main {
  min-width: 0; /* Prevent grid blowout */
}

.shop-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Sort Dropdown */
.sort-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sort-control label {
  font-weight: 600;
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
}

.sort-select {
  padding: 0.5rem 1rem;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: all 0.2s;
  font-family: 'DM Sans', sans-serif;
}

.sort-select:hover {
  box-shadow: 5px 5px 0 var(--ink);
  transform: translate(-2px, -2px);
}

.sort-select:focus {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

/* Mobile Filter Toggle Button */
.btn-toggle-filters {
  display: none; /* Hidden on desktop */
  padding: 0.6rem 1.2rem;
  background: var(--teal);
  color: white;
  border: 2px solid var(--ink);
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: all 0.2s;
  font-family: 'DM Sans', sans-serif;
}

.btn-toggle-filters:hover {
  box-shadow: var(--shadow-btn-hover);
  transform: translate(-2px, -2px);
}

.btn-toggle-filters:active {
  box-shadow: 2px 2px 0 var(--ink);
  transform: translate(0, 0);
}

/* ============================================================
   FILTER DRAWER (Mobile)
   ============================================================ */
.filter-drawer {
  display: none; /* Hidden by default */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 80vh;
  background: var(--butter);
  border-top: 4px solid var(--ink);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); /* Spring animation */
  overflow-y: auto;
}

.filter-drawer.active {
  display: block;
  transform: translateY(0);
}

.filter-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 2px solid var(--coral);
  position: sticky;
  top: 0;
  background: var(--butter);
  z-index: 10;
}

.filter-drawer-header h3 {
  font-size: 1.3rem;
  color: var(--ink);
  font-family: 'Fraunces', serif;
  font-weight: 700;
}

.btn-close-drawer {
  width: 36px;
  height: 36px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--hot-pink);
  color: white;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 3px 3px 0 var(--ink);
  transition: all 0.2s;
}

.btn-close-drawer:hover {
  box-shadow: 5px 5px 0 var(--ink);
  transform: translate(-2px, -2px);
}

.btn-close-drawer:active {
  box-shadow: 1px 1px 0 var(--ink);
  transform: translate(0, 0);
}

.filter-drawer-content {
  padding: 1.5rem;
}

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .shop-layout {
    grid-template-columns: 1fr;
    padding: 1rem;
    gap: 0;
  }

  .filter-sidebar {
    display: none; /* Hide sidebar on mobile, use drawer instead */
  }

  .btn-toggle-filters {
    display: block;
  }

  .shop-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .sort-control {
    width: 100%;
    justify-content: space-between;
  }

  .sort-select {
    flex: 1;
    max-width: 200px;
  }
}

@media (max-width: 480px) {
  .shop-layout {
    padding: 0.5rem;
  }

  .sort-select {
    max-width: none;
    width: 100%;
  }

  .shop-controls {
    gap: 0.5rem;
  }

  .filter-drawer {
    max-height: 85vh;
  }

  .filter-drawer-header {
    padding: 1rem;
  }

  .filter-drawer-content {
    padding: 1rem;
  }
}

/* ============================================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================================ */
.filter-checkbox input[type="checkbox"]:focus {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

.btn-clear-filters:focus,
.btn-toggle-filters:focus,
.btn-close-drawer:focus {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .filter-sidebar,
  .filter-drawer {
    border-width: 4px;
  }

  .noUi-handle {
    border-width: 4px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .filter-drawer {
    transition: none;
  }

  .btn-clear-filters,
  .btn-toggle-filters,
  .btn-close-drawer,
  .sort-select {
    transition: none;
  }
}
