/* FILTER MODAL */
@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

.modal-overlay {
  display: none; /* Hidden by default */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backdrop-filter: blur(30px);
  background-color: #00000030;
  z-index: 2000;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  font-size: 13px;
  &.active {
    display: flex;
    animation: fadeIn forwards 0.15s ease;
  }
}

@keyframes filterTransition {
  0% {
    transform: translateY(100vh);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-content {
  transform: translateY(100vh);
  padding: 25px;
  border-radius: 20px;
  pointer-events: all;
  opacity: 0;

  .modal-overlay.active & {
    animation: filterTransition forwards 0.25s ease-out 0.15s;
  }

  &:has(.style-chip.active) {
    .modal-btns .btn {
      visibility: visible;
      opacity: 1;
    }
  }
}

.modal-header {
  justify-content: space-between;
  align-items: center;
  padding-inline: 5px;
  font-size: 16px;
  h2 {
    font-size: 1em;
  }
}

#filter-title {
  font-size: 13px;
  text-transform: uppercase;
}

.modal-btns {
  gap: 8px;
  align-items: center;

  .btn {
    font-size: 14px;
    transition: opacity var(--duration-fast);
    padding-inline: 1em;
  }
}

#apply-count {
  font-weight: normal;
}

#clear-filters {
  opacity: 0;
  visibility: hidden;
  &.active {
    visibility: visible;
    opacity: 1;
  }
}

#close-filters {
  margin-left: 5px;
}

#style-chip-container {
  list-style: none;
  padding: 22px 5px 5px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  max-height: 50vh;
  overflow-y: auto;
  scrollbar-width: thin;

  @media (min-width: 550px) {
    grid-template-columns: repeat(3, 1fr);
  }

  @media (min-width: 800px) {
    grid-template-columns: repeat(4, 1fr);
  }

  @media (min-width: 1000px) {
    grid-template-columns: repeat(5, 1fr);
  }
}

.style-chip {
  cursor: pointer;
  width: 100%;
  position: relative;
  display: inline-flex;
  justify-content: space-between;
  gap: 5px;
  background: transparent;
  border-radius: 10em;
  color: white;
  border: 1px solid #ffffff20;
  font-size: 13px;
  padding: 0.5em 1em;
  text-align: left;
  font-weight: bold;
  &:focus-within {
    border-color: white;
  }
  &.active {
    background-color: #ffffff40;
    border-color: transparent;
    &:hover,
    &:focus-visible {
      border-color: #ffffff50;
    }
    .chip-close {
      opacity: 1;
    }
    .chip-count {
      opacity: 0;
    }
  }
  &:not(.active) {
    &:hover,
    &:focus-within {
      background-color: #ffffff10;
    }
  }
}

.chip-count {
  font-weight: normal;
  opacity: 0.6;
  transition: opacity var(--duration-fast);
}

.chip-close {
  opacity: 0;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 5px;
  padding: 0;
  height: 80%;
  aspect-ratio: 1;
  background: transparent url(./icn-x--white.svg) center no-repeat;
  background-size: 70%;
  border: none;
  transition: opacity var(--duration-fast);
}

#about-modal {
  .modal-content {
    width: 100%;
    max-width: 600px;
  }
}

#about-modal--text {
  padding: 10px 5px;
  p {
    margin-bottom: 1em;
  }
  a {
    text-decoration: underline;
    font-weight: bold;
  }
  ul {
    padding-left: 2em;
  }
  li {
    margin-bottom: 1em;
  }
}
