.news-filter {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.news-filter__search {
  position: relative;
  display: flex;
  flex-shrink: 0;
  align-items: center;
  width: min(100%, 320px);
  height: 50px;
  border-radius: 8px;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(206deg, rgba(41, 48, 127, 0.63), rgba(204, 19, 119, 0.63)) border-box;
  border: 1px solid transparent;
}

.news-filter__search-toggle {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  display: none;
  top: 50%;
  right: 14px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transform: translateY(-50%);
}

.news-filter__search-toggle:focus-visible {
  outline: 2px solid #303030;
  outline-offset: 2px;
}

.news-filter__search-panel {
  width: 100%;
}

.news-filter__search.is-align-right .news-filter__search-panel {
  right: 0;
  left: auto;
}

.news-filter__search.is-align-left .news-filter__search-panel {
  right: auto;
  left: 0;
}

.news-filter__search-field {
  position: relative;
  width: 100%;
  height: 50px;
}

.news-filter__search-panel[hidden] {
  display: block;
}

.news-filter__search-input {
  display: block;
  height: 100%;
  min-width: 0px;
  flex: 1 1 0%;
  background-color: transparent;
  padding: 0 88px 0 22px;
  border: 0;
  color: #303030;
  font-size: 18px;
  line-height: 50px;
  outline: none;
}

.news-filter__search-input::-moz-placeholder {
  color: rgba(48, 48, 48, 0.72);
}

.news-filter__search-input::placeholder {
  color: rgba(48, 48, 48, 0.72);
}

.news-filter__search-clear {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  top: 50%;
  right: 58px;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transform: translateY(-50%);
}

.news-filter__search-clear[hidden] {
  display: none;
}

.news-filter__search-clear-icon {
  width: 16px;
  height: 16px;
  -o-object-fit: contain;
     object-fit: contain;
}

.news-filter__search-submit {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  top: 50%;
  right: 14px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transform: translateY(-50%);
}

.news-filter__search-submit-icon {
  width: 32px;
  height: 32px;
  -o-object-fit: contain;
     object-fit: contain;
}

.news-filter__search-icon {
  width: 32px;
  height: 32px;
  -o-object-fit: contain;
     object-fit: contain;
}

.news-filter__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  gap: 20px;
}

.news-filter__select {
  position: relative;
  flex: 0 0 auto;
}

.news-filter__select-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  width: 180px;
  height: 50px;
  padding: 0 14px;
  background: #ffffff;
  border: 1px solid #8a8a8a;
  border-radius: 8px;
  color: rgba(0, 0, 0, 0.85);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.news-filter__select-button:hover,
.news-filter__select.is-open .news-filter__select-button {
  background: #f5f5f5;
  border-color: #8a8a8a;
  color: #1f1f1f;
}

.news-filter__select-label {
  display: block;
  min-width: 0px;
  flex: 1 1 0%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  line-height: 1.2;
}

.news-filter__select[data-filter-key='category'] .news-filter__select-button {
  width: 200px;
}

.news-filter__select[data-filter-key='pageSize'] .news-filter__select-button {
  width: 180px;
}

.news-filter__select-icon {
  display: block;
  flex-shrink: 0;
  margin-left: auto;
  width: 12px;
  height: 8px;
  background: url('../../../images/qvl/arrow-down.png') center / 12px 8px no-repeat;
  transition: transform 160ms ease;
}

.news-filter__select.is-open .news-filter__select-icon {
  transform: rotate(180deg);
}

.news-filter__sort {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  min-width: 150px;
  height: 50px;
  padding: 0 14px;
  background: #ffffff;
  border: 1px solid #8a8a8a;
  border-radius: 8px;
  color: rgba(0, 0, 0, 0.85);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.news-filter__sort:hover {
  background: #f5f5f5;
  border-color: #8a8a8a;
  color: #1f1f1f;
}

.news-filter__sort-indicator {
  display: grid;
  flex-shrink: 0;
  margin-left: auto;
  gap: 3px;
}

.news-filter__sort-arrow {
  display: block;
  width: 10px;
  height: 6px;
  -o-object-fit: contain;
     object-fit: contain;
  opacity: 0.5;
  transition: opacity 160ms ease;
}

.news-filter__sort-arrow.is-active {
  opacity: 1;
}

.news-filter__select-menu {
  position: absolute;
  left: 0px;
  top: 100%;
  z-index: 40;
  margin-top: 0.5rem;
  display: none;
  width: -moz-max-content;
  width: max-content;
  min-width: 100%;
  padding: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px) saturate(140%);
  border: 1px solid #dcdcdc;
  border-radius: 4px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.news-filter__select.is-open .news-filter__select-menu {
  display: block;
}

.news-filter__select-option {
  display: block;
  width: 100%;
  white-space: nowrap;
  text-align: left;
  height: 24px;
  padding: 0 14px;
  background: transparent;
  border: 0;
  color: rgba(0, 0, 0, 0.78);
  font-size: 12px;
  line-height: 24px;
  cursor: pointer;
  transition:
    background-color 140ms ease,
    box-shadow 140ms ease,
    color 140ms ease;
}

.news-filter__select-option.is-selected {
  background: linear-gradient(210deg, #4d4d5b 0%, #9798a9 53.98%, #585768 100%);
  box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.5);
  color: #ffffff;
}

.news-filter__select-option:hover {
  background: #f5f5f5;
}

.news-filter__select-option.is-selected:hover {
  background: linear-gradient(210deg, #4d4d5b 0%, #9798a9 53.98%, #585768 100%);
}

@media (max-width: 639px) {
  .news-filter {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px;
    align-items: start;
    -moz-column-gap: 10px;
         column-gap: 10px;
    row-gap: 10px;
  }

  .news-filter__search,
  .news-filter__select-button,
  .news-filter__sort {
    height: 40px;
  }

  .news-filter__search {
    grid-column: 3;
    grid-row: 2;
    width: 40px;
    border: 0;
    background: transparent;
  }

  .news-filter__search-toggle {
    display: inline-flex;
    top: 0;
    right: 0;
    width: 40px;
    height: 40px;
    transform: none;
  }

  .news-filter__search-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    left: auto;
    z-index: 40;
    width: 250px;
    max-width: calc(100vw - 32px);
    height: 44px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #dcdcdc;
    border-radius: 4px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(10px) saturate(140%);
  }

  .news-filter__search-panel[hidden] {
    display: none;
  }

  .news-filter__search-field {
    height: 24px;
  }

  .news-filter__search-input {
    width: 100%;
    height: 24px;
    padding: 0 56px 0 10px;
    line-height: 24px;
  }

  .news-filter__search-clear {
    right: 24px;
    width: 20px;
    height: 20px;
  }

  .news-filter__search-submit {
    right: 2px;
    width: 20px;
    height: 20px;
  }

  .news-filter__search-clear-icon {
    width: 14px;
    height: 14px;
  }

  .news-filter__search-submit-icon {
    width: 100%;
    height: 100%;
  }

  .news-filter__controls {
    display: contents;
  }

  .news-filter__select[data-filter-key='category'] {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .news-filter__select[data-filter-key='pageSize'] {
    grid-column: 1;
    grid-row: 2;
  }

  .news-filter__select,
  .news-filter__select-button,
  .news-filter__sort {
    width: 100%;
    min-width: 0;
  }

  .news-filter__select[data-filter-key='category'] .news-filter__select-button,
  .news-filter__select[data-filter-key='pageSize'] .news-filter__select-button {
    width: 100%;
  }

  .news-filter__sort {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
  }
}

@media (min-width: 960px) {
  .news-filter {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .news-filter__controls {
    justify-content: flex-end;
  }

  .news-filter__search-toggle {
    display: none;
  }

  .news-filter__search-panel[hidden] {
    display: block;
  }
}
