/**
 * Product Filters CSS
 * LevelSevin Theme
 */

/* Shop Layout */
.shop-layout-container {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  margin-top: 1rem;
}

.shop-filter-sidebar {
  width: 20rem;
  position: relative;
  background-color: #f8f6f4;
}

.form-container {
  border-bottom: 1px solid #c9c9c9;
  padding: 0 30px;
  top: 20px;
}

.products-container {
  flex: 1;
  min-width: 0;
}

/* Filter Mobile Toggle */
.filter-mobile-toggle {
  display: none;
  margin-bottom: 1.5rem;
  width: 100%;
}

#filter-toggle-button {
  display: none; /* Hide by default, show only on mobile */
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  width: auto;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 15px;
  font-weight: 500;
  justify-content: center;
}

.filter-icon svg {
  width: 18px;
  height: 18px;
}

/* Filter Sidebar Header */
.filter-sidebar-header {
  justify-content: space-between;
  align-items: start;
  margin-bottom: 1.5rem;
  padding: 15px 0;
}

.filter-sidebar-header-wrapper {
  display: flex;
  flex-direction: column;
}

.filter-heading {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.close-filter-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #333;
}

/* Filter Sections */
.filter-section {
  margin-bottom: 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.filter-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.filter-section-title {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1rem;
  font-weight: 600;
}

.filter-items-container {
  max-height: 240px;
  padding-right: 10px; /* Space for scrollbar */
}

/* RTL support */
html[dir="rtl"] .filter-items-container {
  padding-right: 0;
  padding-left: 10px;
}

/* Checkboxes */
.filter-checkbox-item {
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
}

.filter-checkbox-item:last-child {
  margin-bottom: 0;
}

.filter-checkbox-item input[type="checkbox"] {
  margin-right: 0.5rem;
  width: 18px;
  height: 18px;
}

html[dir="rtl"] .filter-checkbox-item input[type="checkbox"] {
  margin-right: 0;
  margin-left: 0.5rem;
}

.filter-checkbox-item label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 0.9rem;
}

.filter-checkbox-item .count {
  margin-left: 0.25rem;
  color: #666;
  font-size: 0.85rem;
}

html[dir="rtl"] .filter-checkbox-item .count {
  margin-left: 0;
  margin-right: 0.25rem;
}

/* Sort Dropdown */
.orderby-select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0.25rem;
  font-size: 0.9rem;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23333' stroke-width='2' class='bi bi-chevron-down'%3E%3Cpath d='M2 5l6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 16px 12px;
}

html[dir="rtl"] .orderby-select {
  background-position: left 0.75rem center;
}

/* Price Slider */
.price-slider-container {
  padding: 0.5rem 0.25rem;
}

#price-slider {
  height: 6px;
  margin: 1.5rem 0;
}

.noUi-connect {
  background: #333;
}

.noUi-handle {
  border: 1px solid #333;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: none;
  width: 18px !important;
  height: 18px !important;
  right: 10px !important;
}

.noUi-handle:before,
.noUi-handle:after {
  display: none;
}

.price-inputs {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.price-range-text {
  padding: 8px 0;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  color: #333;
}

#price-min-display,
#price-max-display {
  font-weight: 500;
}

/* Filter Actions */
.filter-actions {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
}

#reset-filters {
  width: 100%;
  max-width: 200px;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  border: 1px solid rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.2s ease;
}

#reset-filters:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Products Header */
.products-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.woocommerce-result-count-wrapper {
  font-size: 0.9rem;
  color: #666;
}

/* Products Grid */
.products-container .product_list {
  display: grid;
  /*grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));*/
  gap: 1rem;
}

/* Pagination */
.pagination-container {
  margin-top: 3rem;
  text-align: center;
}

.pagination-container .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0 0.25rem;
  border-radius: 50%;
  text-decoration: none;
  font-size: 0.9rem;
  color: #333;
  transition: all 0.2s ease;
}

.pagination-container .page-numbers.current {
  background-color: #333;
  color: #fff;
}

.pagination-container .page-numbers:not(.current):hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.pagination-container .prev,
.pagination-container .next {
  width: auto;
  padding: 0 1rem;
  border-radius: 20px;
}

/* Loading Overlay */
.products-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: #333;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Product Badges */
.product-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 0.25rem 0.75rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 2;
}

html[dir="rtl"] .product-badge {
  right: auto;
  left: 10px;
}

.product-badge.sale {
  background-color: #e74c3c;
  color: #fff;
}

.product-badge.featured {
  background-color: #3498db;
  color: #fff;
}

.product-badge.out-of-stock {
  background-color: #7f8c8d;
  color: #fff;
}

/* No Products Found */
.no-products-found {
  padding: 3rem;
  text-align: center;
  background-color: rgba(0, 0, 0, 0.02);
  border-radius: 5px;
  width: 100%;
}

.no-products-found p {
  margin: 0;
  font-size: 1rem;
  color: #666;
}

/* Checked filter styling */
.filter-checkbox-item input[type="checkbox"]:checked + label {
  font-weight: 600;
  color: #000;
}

.filter-checkbox-item input[type="checkbox"]:checked + label::before {
  background-color: #000;
  border-color: #000;
}

/* Style for the checkboxes themselves */
.filter-checkbox-item input[type="checkbox"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(0, 0, 0, 0.3);
  border-radius: 3px;
  margin-right: 8px;
  position: relative;
  cursor: pointer;
  vertical-align: middle;
}

.filter-checkbox-item input[type="checkbox"]:checked {
  background-color: #000;
  border-color: #000;
}

.filter-checkbox-item input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

html[dir="rtl"] .filter-checkbox-item input[type="checkbox"] {
  margin-right: 0;
  margin-left: 8px;
}

/* Hide the original noUiSlider tooltips and use our own display */
.noUi-tooltip {
  display: none;
}

/* Enhanced Mobile Filter Experience */
@media (max-width: 767px) {
  /* Basic layout changes */
  .shop-layout-container {
    flex-direction: column;
  }

  /* Filter button visibility */
  #filter-toggle-button {
    display: flex;
    margin-bottom: 15px;
  }

  /* Mobile filter sidebar */
  .shop-filter-sidebar {
    width: 100%;
    position: fixed;
    top: 0;
    right: -100%; /* Start off-screen for RTL layout */
    left: auto;
    height: 100vh;
    z-index: 9999;
    transition: right 0.3s ease;
    display: block;
    transform: none;
    overflow-y: hidden;
  }

  /* RTL support for mobile sidebar */
  html[dir="rtl"] .shop-filter-sidebar {
    left: -100%;
    right: auto;
    transform: none;
    transition: left 0.3s ease;
  }

  /* Open state */
  .shop-filter-sidebar.open {
    right: 0;
    transform: none;
  }

  html[dir="rtl"] .shop-filter-sidebar.open {
    left: 0;
    right: auto;
  }

  /* Filter sidebar structure */
  .shop-filter-sidebar {
    padding: 0;
    display: flex;
    flex-direction: column;
  }

  /* Filter header for mobile */
  .filter-sidebar-header {
    padding: 15px;
    margin-bottom: 0;
    position: sticky;
    top: 0;
    z-index: 10;
  }

  /* Show close button on mobile */
  .close-filter-btn {
    display: block;
  }

  /* Form container adjustments */
  .form-container {
    flex: 1;
    max-height: none;
    height: calc(100vh - 60px); /* Adjust for header height */
    border-bottom: none;
    position: relative;
    top: 0;
    padding: 15px;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  }

  /* Apply button for mobile */
  .apply-filters-btn {
    width: 100%;
    padding: 12px;
    background-color: #000;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
  }

  /* Filter actions positioning */
  .filter-actions {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    margin-top: auto;
  }

  /* Reset filters button adjustments */
  #reset-filters {
    max-width: none;
    margin-bottom: 10px;
  }

  /* Prevent body scrolling when filter is open */
  body.filter-sidebar-open {
    overflow: hidden;
  }
}

/* Smaller mobile adjustments */
@media (max-width: 479px) {
  .filter-sidebar-header {
    padding: 12px;
  }

  .form-container {
    padding: 12px;
  }

  .filter-section {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
  }

  /* Ensure the filter takes the full height */
  .shop-filter-sidebar,
  .form-container {
    height: 100%;
  }
}

/* Mobile Filter Button Styles - Add to your style.css */

/* Mobile Filter Button Wrapper */
.mobile-filter-button-wrapper {
  display: none; /* Hide on desktop */
}

/* Filter Toggle Button */
.filter-toggle-button {
  width: 100%;
  padding: 12px 15px;
  margin-bottom: 20px;
  background-color: #f8f8f8;
  color: #333;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-weight: 500;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s;
}

.filter-toggle-button:hover {
  background-color: #e8e8e8;
}

.filter-icon {
  margin-right: 8px;
  font-size: 20px;
}

/* Filter Sidebar Header */
.filter-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.filter-heading {
  margin: 0;
  font-size: 18px;
}

.close-filter-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
}

/* Mobile styles */
@media (max-width: 767px) {
  /* Show the mobile filter button */
  .mobile-filter-button-wrapper {
    display: block;
  }

  /* Enhance the button appearance on mobile */
  .filter-toggle-button {
    background-color: #1d1d1d; /* Or your brand color */
    color: white;
    border: none;
    font-weight: bold;
  }

  /* Fix for multiple button issue */
  .filter-mobile-toggle {
    display: none !important;
  }

  /* Mobile Filter Sidebar */
  .shop-filter-sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: -100%;
    width: 85%;
    max-width: 350px;
    height: 100vh;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    transition: left 0.3s ease;
    padding: 15px;
  }

  /* Show sidebar when open class is added */
  .shop-filter-sidebar.open {
    display: block;
    left: 0;
  }

  /* Body overlay when filter is open */
  body.filter-sidebar-open:after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9990;
  }

  /* Apply filters button on mobile */
  .apply-filters-btn {
    background-color: #2b2b2b;
    color: white;
    border: none;
    padding: 12px 15px;
    border-radius: 4px;
    margin-top: 15px;
    width: 100%;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
  }
}

/* Loading overlay */
.products-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: #3498db;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Color Swatches Styling */
.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.color-swatch-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 10px;
}

.color-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid #ddd;
  cursor: pointer;
  display: inline-block;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.color-swatch.selected {
  border: 2px solid #333;
  transform: scale(1.1);
}

.color-swatch:hover {
  transform: scale(1.1);
}

.swatch-label {
  font-size: 12px;
  margin-top: 5px;
  text-align: center;
}

/* Add this JavaScript to toggle the 'selected' class when clicked */
