/**
 * AE Product Filter Plugin – Filter Bar Styles
 */

/* -- Filter Bar -- */
.ae-product-filter {
  background: var(--ae-color-bg-alt, #f5f5f5);
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--ae-color-border, #e0e0e0);
}

.ae-product-filter__inner {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.ae-product-filter__label {
  font-family: 'Nunito Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #2c2c2c;
  margin-right: 0.25rem;
  white-space: nowrap;
}

/* -- Dropdown -- */
.ae-filter-dropdown {
  position: relative;
}

.ae-filter-dropdown__toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 0.85rem;
  color: #555;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  min-width: 130px;
  justify-content: space-between;
}

.ae-filter-dropdown__toggle:hover {
  border-color: #bbb;
}

.ae-filter-dropdown.is-active .ae-filter-dropdown__toggle {
  border-color: #2c2c2c;
  color: #2c2c2c;
  font-weight: 600;
}

.ae-filter-dropdown__toggle[aria-expanded="true"] {
  border-color: #2c2c2c;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ae-filter-dropdown__chevron {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.ae-filter-dropdown__toggle[aria-expanded="true"] .ae-filter-dropdown__chevron {
  transform: rotate(180deg);
}

/* -- Dropdown Panel -- */
.ae-filter-dropdown__panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 100;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  padding: 0.5rem;
  min-width: 200px;
  max-height: 280px;
  overflow-y: auto;
}

.ae-filter-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #444;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.ae-filter-option:hover {
  background: #f5f5f5;
}

.ae-filter-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #2c2c2c;
  cursor: pointer;
  flex-shrink: 0;
}

/* -- Reset Button -- */
.ae-product-filter__reset {
  padding: 0.55rem 1.25rem;
  background: transparent;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.ae-product-filter__reset:hover:not(:disabled) {
  border-color: #c00;
  color: #c00;
}

.ae-product-filter__reset:disabled {
  opacity: 0.4;
  cursor: default;
}

/* -- Price Range -- */
.ae-filter-price {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.ae-filter-price__label {
  font-family: 'Nunito Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: #2c2c2c;
  white-space: nowrap;
  min-width: 90px;
}

.ae-filter-price__slider {
  -webkit-appearance: none;
  appearance: none;
  width: 140px;
  height: 4px;
  background: #ddd;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.ae-filter-price__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #c0392b;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.ae-filter-price__slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #c0392b;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

/* Slider track fill */
.ae-filter-price__slider {
  background: linear-gradient(
    to right,
    #c0392b 0%,
    #c0392b var(--ae-slider-pct, 100%),
    #ddd var(--ae-slider-pct, 100%),
    #ddd 100%
  );
}

/* -- No Results -- */
.ae-no-results {
  grid-column: 1 / -1;
  list-style: none;
  text-align: center;
  padding: 3rem 1rem;
  font-size: 1rem;
  color: #777;
}

/* -- Loading State -- */
.products.ae-loading {
  opacity: 0.4;
  pointer-events: none;
  transition: opacity 0.2s ease;
  min-height: 200px;
}

/* -- Responsive -- */
@media (max-width: 1024px) {
  .ae-product-filter__inner {
    gap: 0.5rem;
  }

  .ae-filter-dropdown__toggle {
    min-width: auto;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }

  .ae-filter-price {
    margin-left: 0;
    width: 100%;
    order: 10;
  }

  .ae-filter-price__slider {
    flex: 1;
  }
}

@media (max-width: 767px) {
  .ae-product-filter__inner {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .ae-product-filter__label {
    width: 100%;
  }

  .ae-filter-dropdown {
    flex: 1 1 calc(50% - 0.5rem);
  }

  .ae-filter-dropdown__toggle {
    width: 100%;
  }

  .ae-filter-dropdown__panel {
    position: fixed;
    left: 1rem;
    right: 1rem;
    top: auto;
    bottom: 0;
    border-radius: 12px 12px 0 0;
    max-height: 50vh;
    min-width: auto;
    width: auto;
  }

  .ae-product-filter__reset {
    flex: 1 1 calc(50% - 0.5rem);
  }
}
