/**
 * K12 Filter Modal - LoveForm Style
 * Redesigned filter modal with quick picks, styled chips, and dynamic counter
 */

/* ==========================================================================
   MODAL CONTAINER OVERRIDES - LoveForm Measurements (Dec 2025)
   ========================================================================== */

/* Modal width: 568px to match LoveForm */
#filtersModal .modal-dialog {
  max-width: 568px;
}

#filtersModal [hidden] {
  display: none !important;
}

#filtersModal .modal-content {
  border: none;
  border-radius: 24px;
  background: #fff;
  max-height: 90vh;
  overflow: hidden;
  font-size: 14px; /* LoveForm base: 14px (was 16px) */
}

/* Header: 64px height, 0px top/bottom padding - LoveForm style */
#filtersModal .modal-header {
  padding: 0 24px; /* LoveForm: 0px 24px (was 16px 24px) */
  height: 64px; /* LoveForm: 64px (was ~81px) */
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-bottom: 1px solid #ebebeb;
}

#filtersModal .modal-header .btn-close {
  position: absolute;
  right: 24px;
  margin: 0;
}

#filtersModal .modal-title {
  font-size: 16px;
  font-weight: 600; /* LoveForm: 600 (was 800) */
  color: #222222;
}

#filtersModal .modal-body {
  padding: 0;
  overflow-y: auto;
  max-height: calc(90vh - 144px - env(safe-area-inset-bottom, 0px)); /* 64px header + 80px footer (+ iOS safe-area) */
  font-size: 14px; /* LoveForm base font */
  flex: 0 1 auto;
}

/* ==========================================================================
   SCHOOL TYPE TABS - LoveForm "Type of place" Style
   ========================================================================== */
.filter-type-tabs-section {
  padding: 24px 24px 28px 24px;
  border-bottom: 1px solid #ebebeb;
}

.filter-type-tabs-section .filter-section-title {
  margin-bottom: 18px;
}

.filter-type-tabs {
  display: flex;
  background: #ffffff;
  border: 1px solid #d7d7d7;
  border-radius: 18px;
  padding: 4px;
  gap: 0;
  overflow: hidden;
}

.filter-type-tab {
  flex: 1;
  position: relative;
  padding: 14px 8px;
  background: transparent;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 500;
  color: #6b6b6b;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  white-space: nowrap;
  z-index: 0;
}

.filter-type-tab + .filter-type-tab::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 28px;
  background: #e1e1e1;
  transition: opacity 0.2s ease;
}

.filter-type-tabs > .filter-type-tab:first-child::before {
  display: none;
}

.filter-type-tab.active::before,
.filter-type-tab.active + .filter-type-tab::before {
  opacity: 0;
}

.filter-type-tab:hover {
  color: #222222;
}

.filter-type-tab.active {
  background: #ffffff;
  color: #222222;
  font-weight: 600;
  box-shadow: inset 0 0 0 2px #222222;
  z-index: 1;
}

/* Public options (Charter/Magnet) shown under Public tab */
.filter-public-options {
  margin-top: 12px;
}

.filter-public-options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.filter-public-options-row .filter-checkbox-heading {
  margin-top: 0;
}

.filter-tuition-options-row .filter-price-range {
  margin-bottom: 0;
}

.filter-tuition-options-row {
  align-items: flex-end;
}

.filter-tuition-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

.filter-tuition-heading .filter-checkbox-heading {
  margin-top: 0;
}

.filter-tuition-value {
  font-size: 12px;
  font-weight: 500;
  color: #717171;
}

.filter-public-toggles {
  display: flex;
  align-items: center;
  gap: 16px;
}

.filter-public-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #222222;
  cursor: pointer;
  user-select: none;
}

.filter-public-toggle-label {
  white-space: nowrap;
}

.filter-public-toggle:has(input:disabled) {
  cursor: default;
  opacity: 0.55;
}

.filter-checkbox-list--single-column {
  grid-template-columns: 1fr;
}

/* ==========================================================================
   ACADEMICS SECTION - Dynamic Content Based on School Type
   ========================================================================== */
.filter-academics-section {
  padding-top: 16px;
}

.academics-public-content,
.academics-shared-content,
.academics-private-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.academics-private-content {
  margin-top: 24px;
}

.filter-academics-section.is-public .academics-public-content,
.filter-academics-section.is-public .academics-shared-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.filter-academics-section.is-public .academics-shared-content {
  margin-top: 24px;
}

.filter-academics-section.is-private #metricGradRate {
  order: -1;
}

.filter-academics-section.is-private #metricApEnrollment {
  display: none;
}

.academic-metric {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.academic-metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.academic-metric-label {
  font-size: 14px;
  font-weight: 500;
  color: #222222;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.academic-metric-value {
  font-size: 14px;
  font-weight: 600;
  color: #222222;
  flex: 0 0 auto;
  min-width: 60px;
  text-align: right;
}

/* Custom Range Slider - LoveForm Style */
.academic-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: linear-gradient(
    to right,
    #222222 0%,
    #222222 var(--value-percent, 0%),
    #dddddd var(--value-percent, 0%),
    #dddddd 100%
  );
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.academic-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  background: #ffffff;
  border: 1px solid #b0b0b0;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.academic-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.academic-slider::-webkit-slider-thumb:active {
  transform: scale(1.15);
  border-color: #222222;
}

.academic-slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  background: #ffffff;
  border: 1px solid #b0b0b0;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.academic-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #717171;
  margin-top: -4px;
}

/* ==========================================================================
   QUICK PICKS - "Recommended for you" Section (LoveForm Style)
   Large vertical cards with big icons - exactly like LoveForm filter modal
   ========================================================================== */
.filter-quick-section {
  padding: 32px 24px; /* LoveForm: 32px top/bottom (was 24px) */
  border-bottom: 1px solid #ebebeb;
}

.filter-quick-section h6 {
  font-size: 18px; /* LoveForm section titles: 18px (was 16px) */
  font-weight: 500; /* LoveForm: 500 (was 600) */
  color: #222222;
  margin-bottom: 16px;
  line-height: 24px;
}

.filter-quick-picks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

/* Airbnb-style: icon card + label underneath (label sits outside the bordered card) */
.filter-quick-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 0;
  background: transparent;
  border: none;
  font-size: 13px;
  font-weight: 400;
  color: #222222;
  cursor: pointer;
  transition: color 0.15s ease;
  text-align: center;
}

.filter-quick-chip:focus {
  outline: none;
}

.filter-quick-chip:focus-visible .filter-quick-chip__card {
  outline: 2px solid #222222;
  outline-offset: 2px;
}

.filter-quick-chip__card {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 92px;
  padding: 14px 10px;
  background: #ffffff;
  border: 1px solid #dddddd;
  border-radius: 14px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.filter-quick-chip:hover .filter-quick-chip__card {
  border-color: #222222;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
}

.filter-quick-chip.active .filter-quick-chip__card {
  border-color: #222222;
  border-width: 2px;
}

.filter-quick-chip__label {
  font-size: 13px;
  font-weight: 400;
  color: #222222;
  line-height: 16px;
  white-space: nowrap;
}

.filter-quick-chip__card img,
.filter-quick-chip__card svg {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex-shrink: 0;
}

/* ============================================
   Selected Filters (Airbnb-style summary)
   ============================================ */

.filter-selected-section {
  padding: 24px 24px 20px 24px;
  border-bottom: 1px solid #ebebeb;
}

.filter-selected-section .filter-section-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 20px;
  margin: 0 0 12px 0;
}

.filter-selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 7px 12px;
  border: 1px solid #dddddd;
  border-radius: 999px;
  background: #ffffff;
  font-size: 14px;
  font-weight: 500;
  color: #222222;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    opacity 0.15s ease;
}

.filter-selected-chip:hover {
  border-color: #222222;
}

.filter-selected-chip:focus-visible {
  outline: 2px solid #222222;
  outline-offset: 2px;
}

.filter-selected-chip.is-disabled {
  opacity: 0.55;
  background: #f7f7f7;
}

.filter-selected-chip .chip-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 0;
  font-size: 18px;
  line-height: 1;
  color: #222222;
}

.filter-selected-chip.is-disabled .chip-action {
  color: #717171;
}

/* ==========================================================================
   FILTER SECTIONS
   ========================================================================== */
.filter-section-wrapper {
  padding: 32px 24px; /* LoveForm: 32px top/bottom creates ~56px gap between sections (was 24px all) */
  border-bottom: 1px solid #ebebeb;
}

.filter-section-wrapper:last-child {
  border-bottom: none;
}

.filter-section-title {
  font-size: 18px;
  font-weight: 500; /* LoveForm: 500 (was 600) */
  color: #222222;
  margin-bottom: 6px;
  line-height: 24px; /* LoveForm: 24px */
}

.filter-section-subtitle {
  font-size: 14px;
  color: #6f6f6f;
  font-weight: 500;
  margin-bottom: 18px;
}

/* ==========================================================================
   FILTER SUBSECTIONS - LoveForm multi-group pattern within a section
   ========================================================================== */
.filter-subsection {
  margin-bottom: 20px;
}

.filter-subsection:last-child {
  margin-bottom: 0;
}

.filter-subsection-title {
  font-size: 14px;
  font-weight: 600;
  color: #222222;
  margin-bottom: 12px;
  margin-top: 0;
}

/* First subsection needs spacing from main title */
.filter-section-title + .filter-subsection {
  margin-top: 16px;
}

/* ==========================================================================
   COLLAPSIBLE SECTIONS - LoveForm accordion pattern
   ========================================================================== */
.filter-collapsible-section {
  padding: 0;
}

.filter-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 28px 24px; /* LoveForm: ~28px top/bottom for section separation (was 24px) */
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
}

.filter-section-header:hover {
  background: #f7f7f7;
}

.filter-section-header .filter-section-title {
  margin: 0;
}

.filter-section-arrow {
  width: 16px;
  height: 16px;
  color: #222222;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

/* Expanded state - arrow points up */
.filter-collapsible-section.expanded .filter-section-arrow {
  transform: rotate(180deg);
}

/* Content hidden by default */
.filter-section-content {
  max-height: 0;
  overflow: hidden;
  transition:
    max-height 0.3s ease,
    padding 0.3s ease;
  padding: 0 24px;
}

/* Content visible when expanded */
.filter-collapsible-section.expanded .filter-section-content {
  max-height: 1600px; /* BUG-148: Increased for 70 languages in 2-column grid */
  padding: 0 24px 16px 24px; /* BUG-148: Reduced bottom padding from 24px to 16px */
}

/* Align languages section with footer spacing (LoveForm-style) */
#filtersModal .filter-section-languages.expanded .filter-section-content {
  padding-bottom: 0;
}

/* ==========================================================================
   TWO-COLUMN CHECKBOX LIST - LoveForm Language Style
   ========================================================================== */
.filter-checkbox-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 24px; /* row gap, column gap */
}

.filter-checkbox-item {
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  user-select: none;
  margin: 0;
}

.filter-checkbox-item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* Custom checkbox styling - LoveForm style */
.filter-checkbox-custom {
  width: 24px;
  height: 24px;
  border: 2px solid #b0b0b0;
  border-radius: 4px;
  background: #ffffff;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.filter-checkbox-item:hover .filter-checkbox-custom {
  border-color: #222222;
}

/* Checked state */
.filter-checkbox-item input[type="checkbox"]:checked + .filter-checkbox-custom {
  background: #222222;
  border-color: #222222;
}

/* Checkmark */
.filter-checkbox-item
  input[type="checkbox"]:checked
  + .filter-checkbox-custom::after {
  content: "";
  width: 6px;
  height: 10px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.filter-checkbox-label {
  font-size: 14px; /* LoveForm: 14px (was 16px) */
  color: #222222;
  flex: 1;
  min-width: 0;
}

.filter-checkbox-count {
  font-size: 12px;
  color: #717171;
  margin-left: auto;
}

.filter-checkbox-heading {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 600;
  color: #717171;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 8px;
}

/* ==========================================================================
   PRICE RANGE - Dual Input Style
   ========================================================================== */
.filter-price-range {
  margin-bottom: 8px;
}

.price-range-inputs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.price-input-group {
  flex: 1;
}

.price-input-group label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: #6f6f6f;
  margin-bottom: 7px;
  text-align: center;
}

.airbnb-price-range .price-range-inputs {
  gap: 12px;
}

.airbnb-price-range .price-input-group {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
}

.airbnb-price-range .price-input-group:last-child {
  align-items: flex-end;
}

.airbnb-price-range .price-input-group label {
  margin-bottom: 6px;
}

.airbnb-price-range .price-separator {
  display: none;
}

.price-input-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  isolation: isolate;
  column-gap: 2px;
  padding: 14px 18px;
  border: 1px solid #b0b0b0;
  border-radius: 12px;
  background: #ffffff;
  transition: border-color 0.15s ease;
}

.airbnb-price-range .price-input-wrapper {
  border-radius: 999px;
  width: 116px;
  height: 46px;
  padding: 0 14px;
  column-gap: 3px;
  border-color: #cfcfcf;
}

.price-input-wrapper:focus-within {
  border-color: #222222;
  box-shadow: 0 0 0 1px #222222;
}

.price-currency {
  font-size: 16px;
  color: #222222;
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  margin-right: 0;
}

.airbnb-price-range .price-currency {
  font-size: 15px;
  font-weight: 500;
}

.price-input-wrapper input {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: none;
  outline: none;
  font-size: 16px;
  width: 100%;
  color: #222222;
  background: transparent;
  line-height: 1.15;
  text-align: center;
  position: relative;
  z-index: 2;
  font-variant-numeric: tabular-nums;
}

.airbnb-price-range .price-input-wrapper input {
  width: auto;
  flex: 0 0 auto;
  font-size: 15px;
  font-weight: 500;
}

/* Hide number input spinners (Airbnb-style clean fields) */
.price-input-wrapper input[type="number"]::-webkit-outer-spin-button,
.price-input-wrapper input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.price-input-wrapper input[type="number"] {
  -webkit-appearance: none;
  -moz-appearance: textfield;
  appearance: textfield;
}

.price-plus {
  display: none;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 3;
  width: 1ch;
  margin-left: 4px;
  font-size: 16px;
  font-weight: 600;
  color: #222222;
  line-height: 1;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.airbnb-price-range .price-plus {
  margin-left: 0;
  font-size: 16px;
}

.price-plus:disabled {
  cursor: default;
  opacity: 1;
}

.price-input-wrapper.show-plus .price-plus {
  display: inline-flex;
}

.price-input-wrapper.show-reset .price-plus {
  display: inline-flex;
}

.price-separator {
  font-size: 16px;
  color: #717171;
  font-weight: 300;
}

/* Price histogram placeholder */
.price-histogram {
  height: 64px;
  margin: 8px 0 0;
  position: relative;
  overflow: hidden;
}

.price-histogram-bars {
  height: 100%;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: 0 28px;
  position: relative;
  overflow: hidden;
}

/* ==========================================================================
   TUITION SPECIFIC STYLES - Pill Shape
   ========================================================================== */
.tuition-price-range .price-range-inputs {
  flex-direction: row;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: nowrap;
}

.tuition-price-range .price-input-group {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.tuition-price-range .price-input-group:last-child {
  align-items: flex-start;
}

.tuition-price-range .price-input-group label {
  margin-bottom: 4px;
  font-size: 11px;
}

.tuition-price-range .price-input-wrapper {
  border-radius: 999px !important; /* Pill shape */
  display: inline-flex;
  width: fit-content;
  min-height: 46px;
  padding: 0 14px;
  justify-content: center;
  column-gap: 3px;
  border-color: #cfcfcf;
}

.tuition-price-range .price-input-wrapper:focus-within {
  border-color: #222222;
  box-shadow: 0 0 0 1px #222222;
}

.tuition-price-range .price-input-wrapper input {
  font-weight: 500;
  flex: 0 0 auto;
  width: 6ch;
  font-size: 15px;
  text-align: center;
}

.tuition-price-range .price-currency {
  font-weight: 500;
  font-size: 15px;
}

/* Reserve space for suffix (+ / ×) so the pill width doesn't jump */
.tuition-price-range .price-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 0;
  min-height: 0;
  height: auto;
  flex: 0 0 auto;
  margin-left: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  padding: 0;
  border: 0;
  background: transparent;
  color: #222222;
  cursor: pointer;
}

.tuition-price-range .price-plus:disabled {
  cursor: default;
  opacity: 1;
}

.price-histogram-bar {
  flex: 1 1 0;
  background: #289a96;
  border-radius: 2px 2px 0 0;
  transition:
    background 0.15s ease,
    height 0.15s ease;
  opacity: 0.9;
}

.price-histogram-bar.active {
  background: #289a96;
}

#filtersModal .price-range-slider {
  position: relative;
  height: 40px;
  margin-top: -20px;
  margin-bottom: 12px;
  background: transparent;
}

#filtersModal .price-range-track {
  position: absolute;
  left: 20px;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  height: 2px;
  background: #4caaa7;
  border-radius: 999px;
}

#filtersModal .price-range-fill {
  display: none;
}

#filtersModal .price-range-slider input[type="range"] {
  position: absolute;
  left: 20px;
  top: 0;
  width: calc(100% - 40px);
  height: 40px;
  margin: 0;
  background: transparent;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}

#filtersModal .price-range-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: transparent;
  border: 0;
}

#filtersModal .price-range-slider input[type="range"]::-moz-range-track {
  height: 2px;
  background: transparent;
  border: 0;
}

#filtersModal .price-range-slider input[type="range"]::-moz-range-progress {
  background: transparent;
}

#priceRangeMin {
  z-index: 2;
}

#priceRangeMax {
  z-index: 3;
}

#filtersModal .price-range-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  pointer-events: auto;
  width: 34px;
  height: 34px;
  margin-top: -16px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.14);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.16);
}

#filtersModal .price-range-slider input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.14);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.16);
}

/* ==========================================================================
   STYLED CHIPS - Feature Selection
   ========================================================================== */
.filter-chips-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (max-width: 768px) {
  .filter-chips-grid {
    grid-template-columns: 1fr;
  }
}

.filter-chip {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #dddddd;
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.filter-chip:hover {
  border-color: #222222;
}

.filter-chip.active {
  border-color: #222222;
  border-width: 2px;
  padding: 15px; /* Compensate for thicker border */
}

.filter-chip-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.filter-chip-icon svg {
  width: 24px;
  height: 24px;
  color: #222222;
}

.filter-chip-content {
  flex: 1;
}

.filter-chip-label {
  display: block;
  font-size: 16px;
  font-weight: 500;
  color: #222222;
  margin-bottom: 2px;
}

.filter-chip-desc {
  font-size: 14px;
  color: #717171;
}

/* ==========================================================================
   INLINE TOGGLE CHIPS (for Grade, Type, Distance)
   ========================================================================== */
.filter-toggle-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-toggle-chip {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  background: #ffffff;
  border: 1px solid #b0b0b0;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 500;
  color: #222222;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-toggle-label {
  display: inline-flex;
  align-items: center;
}

.filter-toggle-count {
  font-size: 12px;
  color: #717171;
  margin-left: 8px;
}

.filter-toggle-chip:hover {
  border-color: #222222;
}

.filter-toggle-chip.active {
  background: #f7f7f7;
  border-color: #222222;
  border-width: 2px;
  padding: 9px 19px; /* Compensate for thicker border */
}

/* Hidden input for toggle chips */
.filter-toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.filter-toggle-input:checked + .filter-toggle-chip {
  background: #f7f7f7;
  border-color: #222222;
  border-width: 2px;
  padding: 9px 19px;
}

/* ==========================================================================
   TRUESCORE SLIDER - School Quality Metric
   ========================================================================== */
.truescore-slider-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.truescore-metric {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.truescore-metric-header {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* TrueScore badge preview - shows current value */
.truescore-badge-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #222222 0%, #444444 100%);
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.truescore-badge-preview.score-excellent {
  background: linear-gradient(
    135deg,
    #289a96 0%,
    #2ac8c8 100%
  ); /* Brand teal */
}

.truescore-badge-preview.score-good {
  background: linear-gradient(
    135deg,
    #289a96 0%,
    #2ac8c8 100%
  ); /* Brand teal */
}

.truescore-badge-preview.score-average {
  background: linear-gradient(
    135deg,
    #d97706 0%,
    #f59e0b 100%
  ); /* Orange for average */
}

/* TrueScore 💯 in badge preview - match numeric badge size */
.truescore-badge-preview.truescore-100 {
  background: linear-gradient(135deg, #289a96 0%, #2ac8c8 100%);
  color: #ffffff;
}

.truescore-badge-preview.truescore-100 svg {
  width: 32px;
  height: 32px;
}

/* TrueScore Slider - LoveForm Style */
.truescore-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: linear-gradient(
    to right,
    #222222 0%,
    #222222 var(--truescore-percent, 0%),
    #dddddd var(--truescore-percent, 0%),
    #dddddd 100%
  );
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.truescore-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  background: #ffffff;
  border: 1px solid #b0b0b0;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.truescore-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.truescore-slider::-webkit-slider-thumb:active {
  transform: scale(1.15);
  border-color: #222222;
}

.truescore-slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  background: #ffffff;
  border: 1px solid #b0b0b0;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.truescore-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #717171;
  margin-top: -4px;
}

/* Quick pick chips for TrueScore */
.truescore-quick-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.truescore-quick-chip {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  background: #ffffff;
  border: 1px solid #b0b0b0;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 500;
  color: #222222;
  cursor: pointer;
  transition: all 0.15s ease;
}

.truescore-quick-chip:hover {
  border-color: #222222;
}

.truescore-quick-chip.active {
  background: #222222;
  color: #ffffff;
  border-color: #222222;
}

/* Brand teal highlight for 80+, 85+, and 100 quick chips */
.truescore-quick-chip[data-score="80"].active,
.truescore-quick-chip[data-score="85"].active,
.truescore-quick-chip[data-score="100"].active {
  background: linear-gradient(135deg, #289a96 0%, #2ac8c8 100%);
  border-color: #2ac8c8;
}

/* TrueScore 💯 quick chip styling */
.truescore-quick-chip.truescore-100 {
  padding: 10px 16px;
}

.truescore-quick-chip.truescore-100 svg {
  width: 18px;
  height: 18px;
}

.truescore-quick-chip.truescore-100.active {
  color: #ffffff;
}

/* ==========================================================================
   RATING SELECTOR
   ========================================================================== */
.filter-rating-options {
  display: flex;
  gap: 8px;
}

.filter-rating-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 16px;
  background: #ffffff;
  border: 1px solid #b0b0b0;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 500;
  color: #222222;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-rating-chip:hover {
  border-color: #222222;
}

.filter-rating-chip.active {
  background: #222222;
  color: #ffffff;
  border-color: #222222;
}

.filter-rating-chip svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* ==========================================================================
   MODAL FOOTER - LoveForm Style (Dec 2025)
   ========================================================================== */
#filtersModal .modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px calc(16px + env(safe-area-inset-bottom, 0px)); /* Keep controls visible above iOS safe-area */
  height: calc(80px + env(safe-area-inset-bottom, 0px)); /* Preserve LoveForm baseline + iOS safe-area */
  min-height: calc(80px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #ebebeb;
  background: #ffffff;
}

/* Clear button: LoveForm uses padding + border-radius for hover target */
.btn-clear-filters {
  background: none;
  border: none;
  font-size: 16px;
  font-weight: 500; /* LoveForm: 500 (was 600) */
  color: #222222;
  text-decoration: underline;
  cursor: pointer;
  padding: 10px; /* LoveForm: 10px padding for hover target (was 0) */
  margin: 0 -10px; /* LoveForm: negative margin to align text */
  border-radius: 8px; /* LoveForm: 8px (was none) */
  transition: background-color 0.15s ease;
}

.btn-clear-filters:hover {
  color: #000000;
  background-color: #f7f7f7; /* Subtle hover background */
}

/* Show results button: LoveForm style */
.btn-show-results {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  min-width: 140px;
  background: #222222;
  color: #ffffff;
  border: none;
  border-radius: 8px; /* LoveForm: 8px (keeping same - their button is actually similar) */
  font-size: 16px;
  font-weight: 500; /* LoveForm: 500 (was 600) */
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    transform 0.1s ease;
  white-space: nowrap; /* Keep all text on one line */
}

.btn-show-results:hover {
  background: #000000;
}

.btn-show-results:active {
  transform: scale(0.98);
}

/* Loading state for results button */
.btn-show-results.loading {
  opacity: 0.7;
  pointer-events: none;
}

.btn-show-results.loading::after {
  content: "";
  width: 16px;
  height: 16px;
  margin-left: 8px;
  border: 2px solid #ffffff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================================== */
@media (max-width: 992px) {
  #filtersModal .modal-dialog {
    max-width: 100%;
    margin: 0;
  }

  #filtersModal .modal-content {
    border-radius: 24px 24px 0 0;
    max-height: 95vh;
  }

  .filter-quick-picks {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-chips-grid {
    grid-template-columns: 1fr;
  }

  .price-range-inputs {
    flex-direction: column;
    gap: 12px;
  }

  .filter-tuition-options-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .filter-tuition-heading {
    width: 100%;
    justify-content: space-between;
  }

  .airbnb-price-range .price-range-inputs,
  .tuition-price-range .price-range-inputs {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 16px;
  }

  .airbnb-price-range .price-input-group,
  .airbnb-price-range .price-input-group:last-child,
  .tuition-price-range .price-input-group,
  .tuition-price-range .price-input-group:last-child {
    flex: 0 0 auto;
    align-items: center;
  }

  .airbnb-price-range,
  .filter-tuition-options-row .filter-price-range,
  .tuition-price-range {
    width: 100%;
    min-width: 0;
  }

  .airbnb-price-range .price-input-wrapper,
  .tuition-price-range .price-input-wrapper {
    width: auto;
    min-width: 0;
    padding: 6px 8px;
    column-gap: 2px;
  }

  .airbnb-price-range .price-input-group:first-child .price-input-wrapper input,
  .airbnb-price-range .price-input-group:last-child .price-input-wrapper input,
  .tuition-price-range .price-input-group:first-child .price-input-wrapper input,
  .tuition-price-range .price-input-group:last-child .price-input-wrapper input {
    width: var(--price-input-width-px, var(--price-input-width, 3ch));
    min-width: var(--price-input-width-px, var(--price-input-width, 3ch));
    flex: 0 0 auto;
    font-size: 14px;
  }

  .airbnb-price-range .price-input-group label,
  .tuition-price-range .price-input-group label {
    margin-bottom: 3px;
    width: 100%;
    text-align: center;
  }

  .airbnb-price-range .price-plus,
  .tuition-price-range .price-plus {
    min-width: 0;
    min-height: 0;
    width: auto;
    height: auto;
  }

  .price-separator {
    display: none;
  }
}

/* ==========================================================================
   COLLAPSIBLE SECTIONS (Show more/less)
   ========================================================================== */
.filter-show-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
  padding: 0;
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: #222222;
  text-decoration: underline;
  cursor: pointer;
}

.filter-show-more:hover {
  color: #000000;
}

.filter-show-more svg {
  width: 12px;
  height: 12px;
  transition: transform 0.2s ease;
}

.filter-show-more.expanded svg {
  transform: rotate(180deg);
}

.filter-collapsible {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.filter-collapsible.expanded {
  max-height: 500px;
}

/* ==========================================================================
   ORGANIZATION TOGGLE SWITCHES (iOS-style)
   ========================================================================== */
.filter-organization-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.filter-toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0; /* LoveForm: ~12px for ~48px row height (was 16px) */
  border-bottom: 1px solid #ebebeb;
  cursor: pointer;
}

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

.filter-toggle-label-text {
  font-size: 14px; /* LoveForm: 14px (was 16px) */
  color: #222222;
  line-height: 1.4;
  padding-right: 16px;
  flex: 1;
}

/* iOS-style Toggle Switch */
.filter-toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.filter-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.filter-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #b0b0b0;
  transition: 0.3s ease;
  border-radius: 28px;
}

.filter-toggle-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s ease;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.filter-toggle-switch input:checked + .filter-toggle-slider {
  background-color: #222222;
}

.filter-toggle-switch input:checked + .filter-toggle-slider:before {
  transform: translateX(20px);
}

.filter-toggle-switch input:focus + .filter-toggle-slider {
  box-shadow: 0 0 0 2px rgba(34, 34, 34, 0.2);
}

/* Hover state */
.filter-toggle-item:hover .filter-toggle-slider {
  background-color: #909090;
}

.filter-toggle-item:hover
  .filter-toggle-switch
  input:checked
  + .filter-toggle-slider {
  background-color: #000000;
}

/* ==========================================================================
   STANDOUT SCHOOLS - LoveForm "Standout stays" Pattern
   Horizontal cards with icons on left, text on right
   ========================================================================== */
.filter-standout-section {
  padding: 32px 24px;
  border-bottom: 1px solid #ebebeb;
}

.filter-standout-section .filter-section-title {
  font-size: 18px;
  font-weight: 500;
  color: #222222;
  margin-bottom: 16px;
  line-height: 24px;
}

.filter-standout-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.filter-standout-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #dddddd;
  border-radius: 12px;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
  text-align: left;
}

.filter-standout-card:hover {
  border-color: #222222;
}

.filter-standout-card.active {
  border-color: #222222;
  border-width: 2px;
  padding: 15px; /* Compensate for thicker border */
}

/* Card icon container */
.filter-standout-card .standout-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.filter-standout-card .standout-icon svg {
  width: 32px;
  height: 32px;
  color: #222222;
}

.filter-standout-card .standout-icon img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.filter-standout-card .standout-icon i {
  font-size: 24px;
  color: #222222;
}

/* Card content (text side) */
.filter-standout-card .standout-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.filter-standout-card .standout-title {
  font-size: 14px;
  font-weight: 600;
  color: #222222;
  line-height: 1.3;
}

.filter-standout-card .standout-desc {
  font-size: 12px;
  color: #717171;
  line-height: 1.4;
}

/* Active state - subtle background tint */
.filter-standout-card.active .standout-icon svg {
  color: #000000;
}

/* Responsive: Stack to single column on mobile */
@media (max-width: 576px) {
  .filter-standout-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767.98px) {
  #filtersModal {
    padding: 0 !important;
    overflow: hidden;
  }

  #filtersModal .modal-dialog,
  #filtersModal .modal-dialog.modal-dialog-centered {
    width: 100%;
    max-width: 100%;
    margin: 8px 0 0;
    min-height: calc(100dvh - 8px);
    height: calc(100dvh - 8px);
    display: flex;
    align-items: flex-start;
  }

  #filtersModal .modal-content {
    width: 100%;
    min-height: calc(100dvh - 8px);
    height: calc(100dvh - 8px);
    max-height: calc(100dvh - 8px);
    border-radius: 24px 24px 0 0;
  }

  #filtersModal .modal-header {
    height: 56px;
    min-height: 56px;
    padding: 0 16px;
  }

  #filtersModal .modal-title {
    font-size: 16px;
    line-height: 20px;
  }

  #filtersModal .modal-header .btn-close {
    top: 8px;
    right: 10px;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    border-radius: 50%;
    background-color: #f7f7f7;
    background-position: center;
    background-size: 12px 12px;
    opacity: 1;
    box-shadow: none;
  }

  #filtersModal .modal-header .btn-close:hover,
  #filtersModal .modal-header .btn-close:active {
    background-color: #ebebeb;
  }

  #filtersModal .modal-header .btn-close:focus,
  #filtersModal .modal-header .btn-close:focus-visible {
    outline: none;
    box-shadow: none;
  }

  #filtersModal .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
  }
}
