.filter-search {
  padding: 0.375rem;
  margin-bottom: 0.5rem;

  background-color: var(--white-clr-850);
  border: 1px solid var(--white-clr-700);

  .course-search {
    padding: 0;
  }

  input {
    text-indent: 1.5ch;
  }

  .search-btn {
    padding: 0.75rem;
  }

  &:focus-within {
    outline-offset: var(--_filter-focus-outline-offset);
  }
}

.filter-item-notfound {
  /* padding: 1.125rem 1.5rem; */
  padding: 1.125rem;
  line-height: 1.1;
  color: var(--secondary-clr-900);
  background-color: #fcfcff;
  border: 1px solid var(--white-clr-700);
}

.courses-filters-dialog {
  --_sidebar-width: 400px;
  padding: 1.125rem;

  background-color: #ebebf2;

  @media (width > 1024px) {
    display: contents;
  }
}

.courses-filters-header {
  padding-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;

  @media (width > 1024px) {
    display: none;
  }
}

.courses-filters-dialog {
  .filter-back-btn,
  .filter-close-btn {
    color: var(--text-clr-700);
    background-color: var(--white-clr);

    &:hover,
    &:focus-visible {
      color: var(--white-clr);
      background-color: var(--text-clr-700);
    }
  }

  .filter-back-btn {
    cursor: pointer;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-weight: var(--fw-500);
    line-height: 0.97;
    border-radius: 100vw;
    border: var(--border-clr-900);
  }

  .filter-close-btn {
    /* all: revert; */
    flex-shrink: 0;
    cursor: pointer;
    padding: 1rem;
    border-radius: 50%;
    background-color: var(--white-clr);
    border: var(--white-clr-700);

    svg {
      width: 0.625rem;
      height: 0.625rem;
    }
  }
}

/* contain: paint; */
/* overflow: hidden; */
.courses-filters {
  --_filter-focus-outline-offset: -2px;
  /* position: sticky; */
  /* top: 0; */
  /* height: 100vh; */
  /* height: 100svh; */
  /* overflow-y: auto; */
}

.courses-active-filters-wrapper {
  margin-bottom: 0.5rem;
}

.courses-filters-wrapper,
.courses-active-filters-wrapper {
  padding: 1.5rem;
  background-color: var(--white-clr);
  border-color: 1px solid var(--white-clr-800);
  border-radius: 1.5rem;

  .btn-pill:is(:hover, :focus-visible) {
    outline-offset: var(--_filter-focus-outline-offset);
  }
}

.courses-filters-wrapper {
  display: grid;
  .or-text {
    --_s: 1px;
    /* the thickness */
    --_c: var(--border-clr-800);
    /* the color */
    --_w: calc(var(--_filter-sidebar-width) - 224px);
    /* --_w: 120px;256  */
    --_g: 1.5rem;
    /* the gap */

    margin: 1.125rem auto;
    font-weight: var(--fw-500);
    font-size: 0.875rem;
    text-align: center;
    width: fit-content;

    border-image: linear-gradient(
        #0000 calc(50% - var(--_s) / 2),
        var(--_c) 0 calc(50% + var(--_s) / 2),
        #0000 0
      )
      0 1 / 0 var(--_w) / 0 calc(var(--_w) + var(--_g));
  }

  .location-search-wrapper {
    margin-bottom: 0.75rem;
    max-height: 56px;
    padding: 1rem 1.125rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.625rem;

    border: 1px solid var(--border-clr-900);
    border-radius: 100vw;
    transition: 600ms ease-in;

    &:focus-within {
      outline: 1px solid var(--secondary-clr);
      outline-offset: var(--_filter-focus-outline-offset);
    }

    input {
      flex: 1 0 0;
      background-color: transparent;
      border: none;
      min-width: 0;

      &:focus-visible {
        outline: none;
      }
    }
  }
}

.courses-filter-wrapper {
  contain: paint;
  scroll-behavior: smooth;
  /* overflow: clip; */
  /* scroll-margin-top: 0; */
  &:not(:first-of-type) {
    margin-top: 2.25rem;
  }

  &[open] {
    .filter-header {
      padding-bottom: 1.125rem;
      border-bottom: 1px solid var(--white-clr-900);
      margin-bottom: 1.125rem;
    }

    .dropdown-btn {
      rotate: 180deg;
    }
  }
}

.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  line-height: 0.98;

  /* &.active {
    padding-bottom: 1.125rem;
    border-bottom: 1px solid var(--white-clr-900);
    margin-bottom: 1.125rem;
  } */

  h2 {
    font-weight: var(--fw-700);
    font-size: 1.25rem;
  }

  .clear-all-btn {
    padding: 0.625rem 1rem;
    font-weight: var(--fw-500);
    color: var(--text-clr-700);
    border-radius: 100vw;
    background-color: var(--white-clr-850);
    border: none;
    transition: 180ms ease;

    &:hover {
      background-color: var(--white-clr-800);
    }
  }

  .dropdown-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    aspect-ratio: 1;
    border-radius: 50%;
    background-color: var(--white-clr-850);
    border: none;
    transition: 180ms ease;

    &:hover {
      background-color: var(--white-clr-800);
    }
  }
}

.filter-checkbox-group {
  padding: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 100vw;
  background-color: var(--_filter-bg-clr, var(--white-clr-850));
  transition: all 300ms ease;

  &:has(input[type="checkbox"]:checked),
  &:has(input[type="radio"]:checked) {
    --_filter-title-clr: var(--white-clr-900);
    --_filter-bg-clr: var(--secondary-clr-900);
  }

  .filter-checkbox {
    position: relative;
    flex-shrink: 0;
  }

  input[type="checkbox"],
  input[type="radio"] {
    position: absolute;
    width: 1.5rem;
    height: 1.5rem;
    opacity: 0;

    &:not(checked) + .filter-icon > path {
      opacity: 0;
      transition: 300ms ease;
    }

    &:checked + .filter-icon > path {
      opacity: 1;
    }

    &:checked + .filter-icon > .ring {
      transition: 300ms ease;
      opacity: 1;
      stroke: var(--white-clr-850);
    }

    /* &:not(:checked) + .filter-icon > circle {
      transition: 300ms ease;
    } */
  }

  .filter-title {
    --_line-clamp: 1;

    font-weight: var(--fw-500);
    color: var(--_filter-title-clr, var(--text-clr-700));
  }

  .filter-count {
    margin-inline: auto 0.5rem;
    color: var(--_filter-count-clr, #acacc8);
    font-family: var(--ff-roboto);
    font-weight: var(--fw-700);
  }
}

.filter-list {
  display: grid;
  gap: 0.5rem;
  max-height: 280px;

  &:has(:not(.range-slider-wrapper)) {
    overflow-y: auto;
  }

  &:not(:empty).active {
    padding-top: 1.125rem;
    border-top: 1px solid var(--white-clr-900);
    margin-top: 1.125rem;
  }
}

.filter-price-inputs {
  display: flex;
  align-items: center;
  gap: 0.5rem;

  .input-wrapper {
    display: flex;
    gap: 0.25rem;
    align-items: center;

    width: 100%;
    padding: var(--_input-wrapper-padding);
    line-height: 22px;
    letter-spacing: -2%;
    background-color: var(--white-clr);
    border-radius: 0.5rem;
    border: 1px solid #9ba5b7;

    &:focus-within {
      outline-offset: -1px;
      outline: 2px solid var(--secondary-clr-900);
    }

    input[type="number"]::-webkit-outer-spin-button,
    input[type="number"]::-webkit-inner-spin-button {
      -webkit-appearance: none;
      margin: 0;
    }

    /* Firefox */
    input[type="number"] {
      -moz-appearance: textfield;
      padding: 0;
      border: none;

      &:focus-visible {
        outline: none;
      }
    }
  }
}

/* For city */

.city-dropdown {
  max-height: 280px;
  overflow-y: scroll;
}
.city-dropdown:has(.city-options:not(:empty)) {
  margin-bottom: 0.75rem;
}
