/* Shared filter controls: the same surfaces and typography as the inspiration library. */
.filter-panel {
  position: relative;
  margin: 17px 0 19px;
  padding: 17px 18px 15px;
  background: var(--surface, #fff);
  border: 1px solid #e6eaf3;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgb(37 55 87 / 2%);
}

.filter-panel-heading {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  margin-bottom: 13px;
  min-height: 30px;
  color: #5b6a85;
  font-size: 13px;
  font-weight: 550;
}

.filter-panel-heading > :first-child {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.filter-panel-heading small {
  color: #9aa5b8;
  font-size: 11px;
  font-weight: 400;
}

.filter-panel-heading .icon {
  width: 15px;
  height: 15px;
  color: #8a98b0;
}

.filter-panel-heading .btn {
  margin: -6px -6px -6px 0;
  min-height: 40px;
  padding: 6px 9px;
  border-color: transparent;
  background: transparent;
  font-size: 12px;
  font-weight: 400;
  color: #8895aa;
}

.filter-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 10px;
  align-items: center;
}

.filter-controls .filter-search {
  flex: 0 1 300px;
  width: 300px;
  min-width: 0;
  min-height: 57px;
  padding: 8px 11px;
  background: #f8f9fc;
  border-color: #e8ecf4;
  border-radius: 6px;
  transition: border-color 140ms, box-shadow 140ms;
}

.filter-search input { min-height: 39px; font-size: 12px; }
.filter-search input::placeholder { color: #8592aa; }
.filter-search:focus-within { border-color: #bbc5f3; box-shadow: 0 0 0 2px rgb(82 97 232 / 5%); }


.filter-control {
  position: relative;
  flex: 0 1 164px;
  width: 164px;
  min-width: 0;
}

.filter-control:has(.filter-trigger[aria-expanded="true"]),
.filter-control.is-open {
  z-index: 31;
}

.filter-trigger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 14px;
  grid-template-rows: auto auto;
  column-gap: 9px;
  row-gap: 2px;
  align-items: center;
  width: 100%;
  min-height: 57px;
  padding: 8px 11px;
  background: #f8f9fc;
  border: 1px solid #e8ecf4;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms, border-color 140ms, box-shadow 140ms;
}

.filter-label {
  grid-column: 1;
  grid-row: 1;
  overflow: hidden;
  color: #8c98ad;
  font-size: 10px;
  line-height: 1.5;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.filter-value {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  overflow: hidden;
  color: #5e6e89;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.65;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.filter-chevron {
  grid-column: 2;
  grid-row: 1 / 3;
  width: 14px;
  height: 14px;
  color: #9aa5b9;
  transition: transform 140ms, color 140ms;
}

.filter-trigger[aria-expanded="true"] {
  background: #f4f6ff;
  border-color: #bbc5f3;
  box-shadow: 0 0 0 2px rgb(82 97 232 / 5%);
}

.filter-trigger[aria-expanded="true"] .filter-chevron {
  color: var(--brand, #5261e8);
  transform: rotate(180deg);
}

.filter-trigger.has-value,
.filter-trigger.is-filtered,
.filter-control.is-filtered .filter-trigger {
  background: #f3f5ff;
  border-color: #dce2fa;
}

.filter-trigger.has-value .filter-value,
.filter-trigger.is-filtered .filter-value,
.filter-control.is-filtered .filter-value {
  color: #5266c8;
}

.filter-menu {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  z-index: 32;
  display: flex;
  flex-direction: column;
  width: max(100%, 240px);
  max-width: min(280px, calc(100vw - 40px));
  max-height: 260px;
  padding: 5px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e5eaf4;
  border-radius: 9px;
  box-shadow: 0 4px 10px rgb(35 50 80 / 3%), 0 14px 36px rgb(35 50 80 / 11%);
}

.filter-menu[hidden] {
  display: none;
}


.filter-menu-search {
  flex-shrink: 0;
  padding: 4px 4px 8px;
  margin-bottom: 3px;
  border-bottom: 1px solid #edf0f6;
}

.filter-menu-search input {
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  background: #f6f8fc;
  border: 1px solid #e7ecf5;
  border-radius: 5px;
  color: #61718d;
  font-size: 12px;
}

.filter-menu-search input::placeholder {
  color: #a0aabb;
}

.filter-options {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #d8deeb transparent;
}

.filter-options::-webkit-scrollbar {
  width: 5px;
}

.filter-options::-webkit-scrollbar-thumb {
  background: #d8deeb;
  border: 1px solid white;
  border-radius: 5px;
}

.filter-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  background: transparent;
  border: 0;
  border-radius: 5px;
  color: #6b7a94;
  font-size: 12px;
  line-height: 1.65;
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms, color 140ms;
}

.filter-option > span {
  overflow-wrap: anywhere;
}

.filter-option svg.check {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  color: #6375d8;
  opacity: 0;
}

.filter-option[aria-selected="true"] {
  background: #eef1fd;
  color: #5266c8;
  font-weight: 550;
}

.filter-option[aria-selected="true"] svg.check {
  opacity: 1;
}

.filter-option-empty {
  padding: 14px 10px;
  color: #9aa5b8;
  font-size: 12px;
}

.active-filters {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  padding-top: 13px;
  margin-top: 13px;
  border-top: 1px solid #eef1f7;
}

.active-filters:empty {
  display: none;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  max-width: 100%;
  padding: 5px 10px;
  background: #f0f3fd;
  border: 1px solid #e0e6f9;
  border-radius: 6px;
  color: #687bc0;
  font-size: 11px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: background-color 140ms, border-color 140ms;
}

.filter-chip svg,
.filter-chip .icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  opacity: .75;
}

.filter-panel-hint {
  display: block;
  margin-top: 11px;
  color: #98a3b7;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.6;
}

.filter-dates {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 12px;
  color: #95a0b4;
  font-size: 12px;
}

.filter-dates[hidden],
.active-filters[hidden] {
  display: none;
}

.filter-dates input[type="date"] {
  width: 164px;
  max-width: 100%;
  min-height: 40px;
  padding: 7px 10px;
  background: #f8f9fc;
  border: 1px solid #e7ecf4;
  border-radius: 6px;
  color: #697a96;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.filter-dates input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: .45;
  cursor: pointer;
}

.filter-dates input[aria-invalid="true"] {
  border-color: #d7a5a3;
  background: #fdf8f8;
}

.filter-date-error {
  margin-top: 8px;
  color: #ad7471;
  font-size: 12px;
  line-height: 1.7;
}

.filter-date-error:empty {
  display: none;
}

.filter-trigger:focus-visible,
.filter-option:focus-visible,
.filter-chip:focus-visible,
.filter-menu-search input:focus-visible,
.filter-dates input:focus-visible {
  outline: 2px solid #8290df;
  outline-offset: 2px;
}

.filter-option:focus-visible {
  position: relative;
  z-index: 1;
  outline-offset: -2px;
  background: #f1f4ff;
}

@media (hover: hover) and (pointer: fine) {
  .filter-trigger:hover {
    background: #f3f5fa;
    border-color: #d6deec;
  }

  .filter-trigger[aria-expanded="true"]:hover {
    background: #f0f3ff;
    border-color: #b5c0f0;
  }

  .filter-option:hover {
    background: #f4f6fc;
    color: #5266a8;
  }

  .filter-option[aria-selected="true"]:hover {
    background: #e8edfc;
  }

  .filter-chip:hover {
    background: #e8edfc;
    border-color: #d1dbf5;
  }

  .filter-panel-heading .btn:hover {
    background: #f3f5fb;
    color: #6579b6;
  }
}

@media (max-width: 760px) {
  .filter-panel {
    padding: 14px;
    margin-top: 14px;
  }

  .filter-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .filter-controls .filter-search { grid-column: 1 / -1; width: 100%; }
  .filter-control { width: auto; }
  .filter-control:nth-child(odd) .filter-menu { right: 0; left: auto; }
  .filter-control:nth-child(even) .filter-menu { right: auto; left: 0; }

  .filter-dates input[type="date"] {
    flex: 1 1 120px;
    min-width: 0;
    width: 0;
  }
}

@media (max-width: 360px) {
  .filter-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .filter-controls .filter-control .filter-menu {
    left: 0;
    right: auto;
    width: 100%;
    max-width: 100%;
  }

  .filter-dates {
    gap: 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .filter-trigger,
  .filter-chevron,
  .filter-option,
  .filter-chip {
    transition: none;
  }
}

.filter-option[hidden],
.filter-option-empty[hidden],
.filter-panel-hint[hidden] { display:none; }
.filter-menu-search { display:flex; align-items:center; gap:7px; }
.filter-menu-search > .icon { width:14px; height:14px; color:#9aa5b8; }
.filter-dates input[aria-invalid="true"] { border-color:#d7a5a3; background:#fdf8f8; }
.inspiration-result-meta { font-variant-numeric:tabular-nums; }
