/**
 * Faceted Search Styles for Furni Theme
 * Custom styles for filter modal and components
 */

/* Modal Overlay */
.frn-modal__content-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 999;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.frn-modal__content-overlay.active,
.frn-modal__content-overlay.frn-modal__content-overlay--active {
  display: block;
  opacity: 0.7;
}

/* Filter Modal */
.frn-filter.frn-modal__content,
#filter1 {
  position: fixed;
  right: -100%;
  width: 100%;
  max-width: 700px;
  background-color: #fff;
  z-index: 9004;
  /* Higher than overlay (9003 from --zHigh3) */
  overflow: hidden;
  transition: right 0.3s ease;
  display: none;
  visibility: hidden;
  flex-direction: column;
  padding: 10px;
}

.frn-filter.frn-modal__content.active,
.frn-filter.frn-modal__content.frn-modal__content--active,
#filter1.frn-modal__content--active {
  right: 0 !important;
  display: flex !important;
  visibility: visible !important;
  z-index: 9004 !important;
  /* Ensure it's above overlay (9003) */
}

/* Filter Header */
.frn-filter__content-top {
  padding: 20px;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.frn-filter__content-top-title {
  flex: 1;
}

.frn-modal__heading-action {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.frn-modal__heading-action img {
  width: 16px;
  height: 16px;
}

/* Filter Content */
.frn-filter__content-data {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* Desktop Layout */
#filter1 .frn-filter__content-data--desctop {
  display: none !important;
}

#filter1 .frn-filter__content-data--mobile {
  display: block !important;
}

@media (min-width: 577px) {
  #filter1 .frn-filter__content-data--desctop {
    display: flex !important;
    flex-direction: column !important;
  }

  #filter1 .frn-filter__content-data--mobile {
    display: none !important;
  }
}

/* Filter List Item */
.frn-filter__data-filter-list-item {
  margin-bottom: 20px;
  border-bottom: 1px solid #e5e5e5;
  padding-bottom: 20px;
}

.frn-filter__data-filter-list-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  cursor: pointer;
}

.frn-filter__data-filter-list-text {
  font-weight: 600;
  font-size: var(--fz-16);
  color: #333;
}

.frn-filter__data-filter-list-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Collapse Icons */
.frn-filter__collapse-icon {
  width: 16px;
  height: 16px;
  display: none;
}

.frn-filter__data-filter-list-top[aria-expanded="true"] .frn-filter__collapse-icon--open,
.frn-filter__data-filter-list-top[aria-expanded="false"] .frn-filter__collapse-icon--close {
  display: none;
}

.frn-filter__data-filter-list-top[aria-expanded="true"] .frn-filter__collapse-icon--close,
.frn-filter__data-filter-list-top[aria-expanded="false"] .frn-filter__collapse-icon--open {
  display: inline-block;
}

/* Collapsible Content */
.frn-filter__data-filter-list-data {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.frn-filter__data-filter-list-data.in {
  max-height: 1000px;
}

/* Filter Radios/Checkboxes */
.frn-filter__data-radios {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.frn-filter__data-radios--scroll {
  max-height: 300px;
  overflow-y: auto;
}

.frn-filter__data-radios-item {
  margin-bottom: 0;
}

/* Magnitude (count) */
.frn-filter__magnitude {
  color: #999;
  font-size: var(--fz-14);
  margin-left: 5px;
}

/* Active Filters */
.frn-active-filters {
  padding: 15px 20px;
  background-color: #f8f8f8;
  border-bottom: 1px solid #e5e5e5;
}

.frn-active-filters__title {
  font-weight: 600;
  margin-bottom: 10px;
}

.frn-active-filters__list {
  list-style: none;
  padding: 0;
  margin: 0 0 10px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Price Range Slider Specific Styles */
.frn-price-from-to {
  padding: 10px 0;
}

.frn-price-from-to__top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.frn-price-from-to__top span {
  color: #666;
  font-size: var(--fz-14);
}

.frn-price-from-to__bottom-line {
  height: 4px;
  background-color: #e5e5e5;
  border-radius: 2px;
  position: relative;
}

.frn-price-from-to__bottom-line-filler {
  height: 100%;
  background-color: var(--color-danger, #e74c3c);
  border-radius: 2px;
  position: relative;
}

.frn-price-from-to__bottom-line-dragger {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  background-color: #fff;
  border: 2px solid var(--color-danger, #e74c3c);
  border-radius: 50%;
  cursor: pointer;
  z-index: 2;
}

.frn-price-from-to__bottom-line-dragger--right {
  left: auto;
  right: 0;
  transform: translate(50%, -50%);
}

/* Dropdown Styles */
.frn-filter__data-dropdown select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: var(--fz-14);
  background-color: #fff;
  cursor: pointer;
}

/* Body Modal Open */
body.modal-open {
  overflow: hidden;
}

/* Responsive adjustments */
@media (max-width: 991px) {
  .frn-filter.frn-modal__content {
    max-width: 100%;
  }

  .frn-filter__content-data-columns {
    flex-direction: column;
  }

  .frn-filter__content-data-right {
    width: 100%;
    border-left: none;
    padding-left: 0;
    border-top: 1px solid #e5e5e5;
    padding-top: 20px;
  }
}

/* Search Input Modifier */
.frn-input--search {
  margin-bottom: 10px;
}

/* ====================================================================
   MOBILE DRILL-DOWN FILTER NAVIGATION
   ==================================================================== */

/* Fix mobile section to use flex layout for proper button positioning */
#filter1 .frn-filter__content-data--mobile {
  display: none !important;
}

@media (max-width: 576px) {
  #filter1 .frn-filter__content-data--mobile {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
  }
}

/* Back button in modal header (hidden by default) */
.frn-filter-mobile__back-btn {
  display: none;
  background: none;
  border: none;
  padding: 0;
  margin-right: 12px;
  cursor: pointer;
  flex-shrink: 0;
}

.frn-filter-mobile__back-btn img {
  width: 20px;
  height: 20px;
}

/* Hide back button on desktop */
@media (min-width: 577px) {
  #filterMobileBackBtn {
    display: none !important;
  }
}

/* Category list (Level 1) */
.frn-filter-mobile__category-list {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
}

.frn-filter-mobile__category-list--active {
  display: flex;
}

/* Category item */
.frn-filter-mobile__category-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--bdcPrimaryLight, #e5e5e5);
  cursor: pointer;
  color: var(--cText, #333);
  font-size: var(--fz-16);
  transition: background-color 0.15s ease;
}

.frn-filter-mobile__category-item:active {
  background-color: var(--bgcLight, #f8f8f8);
}

.frn-filter-mobile__category-item:last-child {
  border-bottom: none;
}

.frn-filter-mobile__category-item-title {
  flex: 1;
}

.frn-filter-mobile__category-item > img {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Options panel (Level 2) */
.frn-filter-mobile__options-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  padding: 0 20px;
}

.frn-filter-mobile__options-panel--active {
  display: flex;
}

/* Options block title */
.frn-filter-mobile__options-title {
  display: none;
  font-weight: 700;
  font-size: var(--fz-18);
  margin-bottom: 16px;
  padding-top: 16px;
}

/* Bottom actions inside mobile section */
.frn-filter__content-data--mobile .frn-filter__popup-actions {
  flex-shrink: 0;
  padding: 16px 20px;
  border-top: 1px solid var(--bdcPrimaryLight, #e5e5e5);
  gap: 10px;
}
/* Colour-family palette for the Main Colour facet (furni_products_sync).
   Margins rather than flex gap: old Chromium on customers' devices lacks it. */
.frn-colour-palette__swatches {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -2px;
}

.frn-colour-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 64px;
  min-height: 44px;
  margin: 0 2px 6px;
  padding: 6px 2px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--cText);
  font-size: var(--fz-small);
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}

.frn-colour-swatch__dot {
  position: relative;
  width: 28px;
  height: 28px;
  margin-bottom: 6px;
  border-radius: 50%;
  /* Inset hairline: keeps white and transparent swatches visible on white. */
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.frn-colour-swatch:hover .frn-colour-swatch__dot {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15), 0 0 0 2px #fff, 0 0 0 3px var(--bdcPrimaryLight, #e5e5e5);
}

/* A dark tick drawn over a white outline, so it reads on black swatches too. */
.frn-colour-swatch.is-active .frn-colour-swatch__dot::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 10.5l3 3 7-7' stroke='%23fff' stroke-width='4.5'/%3E%3Cpath d='M5 10.5l3 3 7-7' stroke='%23222' stroke-width='2.2'/%3E%3C/svg%3E") center / 20px 20px no-repeat;
}

.frn-colour-swatch.is-active .frn-colour-swatch__label {
  font-weight: 600;
}

.frn-colour-swatch:focus-visible {
  outline: 2px solid var(--cText);
  outline-offset: 2px;
}

/* Desktop: dots only; faceted-search.js shows the name (with count) in a
   .frn-colour-tip on hover. The label stays in the accessibility tree. Touch
   screens and the mobile drill-down keep visible names. */
@media (hover: hover) {
  .frn-filter__content-data--desctop .frn-colour-swatch,
  .frn-product-item-list__content-side-options .frn-colour-swatch {
    width: 40px;
    min-height: 40px;
  }

  .frn-filter__content-data--desctop .frn-colour-swatch__dot,
  .frn-product-item-list__content-side-options .frn-colour-swatch__dot {
    margin-bottom: 0;
  }

  .frn-filter__content-data--desctop .frn-colour-swatch__label,
  .frn-product-item-list__content-side-options .frn-colour-swatch__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* Above the filter popup (#filter1, z-index 9004). */
.frn-colour-tip {
  position: fixed;
  z-index: 9010;
  padding: 4px 8px;
  border-radius: 4px;
  background: #222;
  color: #fff;
  font-size: var(--fz-small);
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  visibility: hidden;
}

.frn-colour-tip.is-visible {
  visibility: visible;
}

.frn-colour-palette__unmapped {
  margin-top: 12px;
}
