/* Amazzing Filter - Optima theme specific styles (PS 1.7)
   Prevent initial flash of the "View products" button on desktop by default,
   and only show on mobile breakpoint. Loaded early by addCustomMedia(). */

/* Default (desktop/tablet): hide */
.af .btn-holder,
.af .viewFilteredProducts {
  display: none;
}

#amazzing_filter .selectedFilters {
  margin: 7px 0 9px;
  padding: 5px 0;
}

#amazzing_filter .selectedFilters .clearAll {
	margin-bottom: 10px;
}

/* Mobile canvas integration (Option 2):
   When the theme's filters canvas is open, ensure Amazzing Filter content is visible
   and scrollable inside the holder. This keeps styling within the module. */
@media (max-width: 991.98px) {

  .filters-canvas.filter-open #_mobile_search_filters {
    overflow: visible;
  }

  .filters-canvas.filter-open #_mobile_search_filters #amazzing_filter .block_content,
  .filters-canvas.filter-open #_mobile_search_filters #amazzing_filter .af_filter_content {
    display: block;
    visibility: visible;
    opacity: 1;
    height: auto;
    overflow: visible;
  }
  
  #af_form {
    overflow: visible;
    max-height: none;
  }

  /* Optional UX polish */
  #_mobile_search_filters #amazzing_filter .title_block {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    margin-right: 20px;
  }

}

/* Collapsible behavior (restore toggle) inside theme canvas on mobile) */
@media (max-width: 991.98px) {
  .filters-canvas.filter-open #_mobile_search_filters #amazzing_filter .af_subtitle.toggle-content {
    cursor: pointer;
  }

  /* When a block is folded, hide its content despite general visibility overrides above */
  .filters-canvas.filter-open #_mobile_search_filters #amazzing_filter .af_filter.foldered .af_filter_content,
  .filters-canvas.filter-open #_mobile_search_filters #amazzing_filter .af_filter.closed .af_filter_content {
    display: none !important;
    height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    visibility: hidden !important;
  }
}
