/**
 * Countertop Filter Styles
 * Custom filter styling for the new JSON-based filter system
 */

/* Filter sidebar container */
.filters_filters-wrapper {
  background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
  border-radius: 16px;
  padding: 16px 12px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.05);
  overflow: visible;
  min-width: 200px !important;
}

/* Filter header */
.filters2_filter-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  margin-bottom: 16px !important;
  padding: 0 4px !important;
}

/* Results badge */
.filters_results-wrapper {
  background: linear-gradient(135deg, #f9cb00 0%, #d9b400 100%);
  padding: 10px 16px !important;
  border-radius: 30px;
  color: #fff;
  font-weight: 600;
  display: inline-block;
  margin: 12px 0 !important;
}

.filters_results-text {
  color: #fff;
}

/* Filter group */
.filters2_filter-group {
  overflow: visible;
  padding: 0 !important;
  margin-bottom: 8px !important;
}

/* Filter group heading */
.filters2_filter-group-heading {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  font-weight: 600;
  color: #1a1a1a;
  padding: 12px 4px !important;
  border-bottom: 2px solid #f9cb00;
  margin-bottom: 12px !important;
}

.filters2_filter-group-heading .heading-style-h6 {
  margin: 0 !important;
  font-size: 14px !important;
}

/* Clear button */
.filters2_clear-button,
[fs-cmsfilter-element="clear"] {
  font-size: 12px !important;
  color: #666 !important;
  text-decoration: none !important;
  padding: 4px 8px !important;
  border-radius: 4px !important;
  transition: all 0.2s ease !important;
  margin-left: auto !important;
  cursor: pointer;
}

.filters2_clear-button:hover,
[fs-cmsfilter-element="clear"]:hover {
  background: rgba(0,0,0,0.05) !important;
  color: #333 !important;
}

/* Checkbox grid - single column */
.filters_checkbox-grid {
  overflow: visible !important;
  padding: 4px 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
}

/* Checkbox wrapper */
.filters_filters-wrapper .w-checkbox.filters_form-checkbox1,
label.w-checkbox.filters_form-checkbox1,
.w-checkbox.filters_form-checkbox1 {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  padding: 4px 2px !important;
  margin: 0 !important;
  border-radius: 3px !important;
  transition: background 0.2s ease !important;
  cursor: pointer !important;
  text-align: left !important;
  width: 100% !important;
  gap: 0 !important;
}

.filters_filters-wrapper .w-checkbox.filters_form-checkbox1:hover,
label.w-checkbox.filters_form-checkbox1:hover {
  background: rgba(255, 185, 70, 0.12) !important;
}

/* Checkbox input */
.filters_filters-wrapper .w-checkbox-input.filters_form-checkbox1-icon,
.w-checkbox-input.w-checkbox-input--inputType-custom.filters_form-checkbox1-icon,
.filters_form-checkbox1-icon,
.filters_form-checkbox1 input[type="checkbox"] {
  width: 14px !important;
  height: 14px !important;
  min-width: 14px !important;
  min-height: 14px !important;
  flex: 0 0 14px !important;
  margin: 0 5px 0 0 !important;
  border: 2px solid #ccc !important;
  border-radius: 3px !important;
  background: #fff !important;
  position: relative !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  cursor: pointer !important;
}

/* Checkbox checked state */
.filters_form-checkbox1 input[type="checkbox"]:checked,
.w-checkbox-input.filters_form-checkbox1-icon:checked {
  background: #f9cb00 !important;
  border-color: #f9cb00 !important;
}

.filters_form-checkbox1 input[type="checkbox"]:checked::after {
  content: '✓' !important;
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  font-size: 10px !important;
  font-weight: bold !important;
  color: #1a1a2e !important;
  line-height: 1 !important;
}

/* Checkbox label */
.filters_filters-wrapper .filters_form-checkbox1-label.w-form-label,
.filters_filters-wrapper .filters_form-checkbox1-label,
.filters_filters-wrapper .w-form-label,
span.filters_form-checkbox1-label.w-form-label,
.filters_form-checkbox1-label.w-form-label,
.filters_form-checkbox1 .w-form-label,
.filters_form-checkbox1 span {
  font-size: 13px !important;
  color: #333 !important;
  line-height: 1.2 !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: left !important;
  flex: 1 1 auto !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  word-break: break-word !important;
}

/* Checked label highlight */
.filters_form-checkbox1.sg-label-checked .filters_form-checkbox1-label,
.filters_form-checkbox1.sg-label-checked .w-form-label,
.filters_form-checkbox1.sg-label-checked span {
  color: #d9b400 !important;
  font-weight: 600 !important;
}

/* Search input */
.filters2_search-wrapper {
  margin-bottom: 16px !important;
  padding: 0 4px !important;
}

.filters2_search-wrapper input {
  width: 100% !important;
  padding: 10px 12px 10px 36px !important;
  border: 1px solid #e0e0e0 !important;
  border-radius: 8px !important;
  font-size: 14px !important;
}

/* Accordion icon */
.filters_accordion-icon {
  width: 20px !important;
  height: 20px !important;
  flex-shrink: 0 !important;
}

/* Infinite scroll sentinel */
.infinite-scroll-sentinel {
  width: 100%;
  height: 1px;
}

/* Loading indicator */
.filter-loading {
  text-align: center;
  padding: 20px;
  color: #666;
}

/* No results */
.filter-no-results {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.filter-no-results h3 {
  margin-bottom: 10px;
  color: #333;
}

/* Hide header category buttons */
.section_header54 .slider-list_outer-wrapper {
  display: none !important;
}

/* ================================================================
   MOBILE RESPONSIVE FIXES - Countertops Filter Page
   Fixes the issue where filters break the page on portrait mobile
   ================================================================ */

/* Mobile Filter Toggle Button (hidden on desktop) */
.mobile-filter-toggle {
  display: none;
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, #1a1a2e 0%, #2d2d3d 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.mobile-filter-toggle:hover {
  background: linear-gradient(135deg, #2d2d3d 0%, #3d3d4d 100%);
  transform: translateY(-2px);
}

.mobile-filter-toggle svg {
  width: 20px;
  height: 20px;
}

.mobile-filter-toggle .filter-count {
  background: #f9cb00;
  color: #1a1a2e;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
}

/* ===== TABLET BREAKPOINT (991px and below) ===== */
@media (max-width: 991px) {
  /* Adjust filter layout for tablet */
  .filters_layout {
    flex-direction: column !important;
    display: flex !important;
  }

  .filters_filters-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    position: relative !important;
    border-right: none !important;
    border-radius: 16px !important;
    margin-bottom: 20px !important;
  }

  .filters_content-wrapper {
    width: 100% !important;
  }

  /* Product grid - 3 columns on tablet */
  .materials_list {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 16px !important;
  }
}

/* ===== MOBILE LANDSCAPE BREAKPOINT (767px and below) ===== */
@media (max-width: 767px) {
  /* SIMPLE FIX: Hide filters entirely on mobile */
  .filters_filters-wrapper,
  .filters_filters-wrapper[data-w-id],
  [data-w-id="90e7635a-343f-5afd-1314-efe078517166"] {
    display: none !important;
  }

  /* Hide mobile filter toggle button too */
  .mobile-filter-toggle {
    display: none !important;
  }

  /* Hide the non-functional Filters and Sort by buttons on mobile */
  .filters_tablet-filters-button,
  .filters_sort-dropdown,
  .filters_feed-header-top {
    display: none !important;
  }

  /* Also hide the entire filter feed header bar */
  .filters_feed-header {
    display: none !important;
  }

  /* Stack layout vertically */
  .filters_layout {
    flex-direction: column !important;
    display: flex !important;
  }

  /* FIX: Ensure section has proper spacing from header */
  .section_filters1 {
    position: relative !important;
    z-index: 1 !important;
    margin-top: 0 !important;
    padding-top: 20px !important;
  }

  /* FIX: Ensure header doesn't overlap content */
  .section_header54 {
    position: relative !important;
    z-index: 0 !important;
  }

  /* FIX: Ensure materials feed takes full width and proper position */
  .filters_feed {
    width: 100% !important;
    position: relative !important;
  }

  /* FIX: Ensure product list has proper top margin */
  .materials_collection-list-wrapper {
    margin-top: 0 !important;
    padding-top: 10px !important;
  }

  /* Full width content area */
  .filters_content-wrapper {
    width: 100% !important;
  }

  /* Product grid - 2 columns on mobile landscape */
  .materials_list {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  /* Reduce section padding */
  .section_materials2 {
    padding: 16px !important;
  }

  /* Remove negative margins that cause overflow */
  .filters_component {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* Fix filter component container */
  .section_filters1 {
    overflow-x: hidden !important;
  }

  .section_filters1 .padding-global {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
}

/* ===== MOBILE PORTRAIT BREAKPOINT (479px and below) ===== */
@media (max-width: 479px) {
  /* Ensure no horizontal overflow */
  .filters_component,
  .filters_layout,
  .section_filters1,
  .section_materials2 {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  /* Single column product grid on small phones */
  .materials_list {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Smaller product cards */
  .product-thumb_item {
    padding: 8px !important;
  }

  /* Compact filter toggle */
  .mobile-filter-toggle {
    padding: 12px 16px;
    font-size: 15px;
  }

  /* Reduce filter wrapper padding */
  .filters_filters-wrapper.mobile-expanded {
    padding: 12px 10px !important;
  }

  /* Smaller filter headings */
  .filters2_filter-group-heading {
    padding: 10px 4px !important;
  }

  .filters2_filter-group-heading .heading-style-h6 {
    font-size: 13px !important;
  }

  /* Compact checkboxes */
  .filters_form-checkbox1 {
    padding: 6px 4px !important;
  }

  /* Results badge - full width */
  .filters_results-wrapper {
    display: block !important;
    text-align: center !important;
    margin: 8px 0 !important;
  }

  /* Section padding */
  .section_materials2 {
    padding: 12px !important;
  }

  .section_filters1 .padding-global {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  /* Product details - smaller text */
  .product1_details-header .text-weight-bold {
    font-size: 14px !important;
  }

  .product1_details-body .text-color-grey {
    font-size: 12px !important;
  }
}

/* ===== PREVENT HORIZONTAL SCROLL GLOBALLY ===== */
@media (max-width: 767px) {
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  .page-wrapper,
  .main-wrapper,
  main {
    overflow-x: hidden !important;
    max-width: 100% !important;
  }
}

/* ===== ACTIVE FILTER INDICATOR ===== */
.filters_filters-wrapper.has-active-filters .filters_heading::after {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #f9cb00;
  border-radius: 50%;
  margin-left: 8px;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}
