/* controls bar (Filters button + dropdown panel) and the year dropdowns */

.controls-bar {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--content-width);
}

/* during a text search the backend ignores sort + filters, so disable them.
   buttons are pointer-events:none so the hover lands on the wrapper's tooltip. */
.controls-bar--searching .filter-btn,
.controls-bar--searching .sort-custom-btn {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
.controls-bar--searching .sort-label {
  opacity: 0.4;
}
.controls-bar--searching .filter-wrapper,
.controls-bar--searching .sort-custom-wrapper {
  cursor: not-allowed;
}

/* "Unavailable while searching" tooltip on the disabled controls */
.controls-bar--searching .filter-wrapper::after,
.controls-bar--searching .sort-custom-wrapper::after {
  content: "Unavailable while searching";
  position: absolute;
  top: calc(100% + 8px);
  z-index: 300;
  padding: 6px 12px;
  border-radius: 8px;
  background-color: rgba(20, 20, 20, 0.95);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
}
.controls-bar--searching .filter-wrapper::after {
  left: 0;
}
.controls-bar--searching .sort-custom-wrapper::after {
  right: 0;
}
.controls-bar--searching .filter-wrapper:hover::after,
.controls-bar--searching .sort-custom-wrapper:hover::after {
  opacity: 1;
  visibility: visible;
}

.filter-btn {
  position: relative; /* anchors the count badge */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 97.78px;
  height: 45.3px;
  background-color: rgba(var(--pink), 0.13);
  border-radius: 12px;
  border: none;
  text-align: center;
  color: var(--text-soft);
  font-size: 15px;
  transition:
    background-color var(--t-base) ease,
    transform var(--t-fast) var(--ease-snap);
}

/* count of active filters; [hidden] when none */
.filter-count-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  box-sizing: border-box;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background-color: rgb(var(--pink));
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 2px rgb(var(--wine)); /* dark ring to lift it off the bar */
}
.filter-count-badge[hidden] {
  display: none;
}

.filter-btn img {
  width: 19.67px;
  height: 18.69px;
}

.filter-btn:hover {
  cursor: pointer;
  background: rgba(var(--pink), 0.3);
}

.filter-btn:active {
  transform: scale(0.96);
}

.filter-wrapper {
  position: relative;
}

.filter-dropdown {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition:
    opacity 0.3s ease,
    transform 0.3s var(--ease-snap),
    visibility 0.3s;

  position: absolute;
  top: 50px;
  left: 0;
  z-index: 200;
  background-color: rgba(var(--maroon-light), 0.85);
  border-radius: 12px;
  padding: 25px;
  width: 500px;
  flex-direction: column;
  gap: 15px;
  box-shadow: 0px 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
}

.filter-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 4px;
}

.filter-clear-btn,
.filter-apply-btn {
  margin-top: 0;
  padding: 9px 28px;
  background: rgba(var(--maroon), 0.6);
  color: var(--text);
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--t-base) ease,
    transform var(--t-fast) var(--ease-snap);
}
.filter-clear-btn {
  margin-right: auto; /* keeps Apply pinned right whether or not Clear shows */
}
.filter-clear-btn:hover,
.filter-apply-btn:hover {
  background: rgba(var(--maroon), 0.9);
}
.filter-clear-btn:active,
.filter-apply-btn:active {
  transform: scale(0.96);
}

.year-filter {
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.year-custom-btn {
  text-align: center;
  height: 25px;
  width: 65px;
  background-color: rgba(var(--maroon), 0.7);
  color: white;
  border: none;
  border-radius: 3px;
  font-size: 13px;
  cursor: pointer;
  padding-left: 8px;
  padding-right: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  transition: background-color var(--t-fast) ease;
}

.year-custom-btn:hover {
  background-color: rgba(var(--maroon), 0.95);
}

.year-custom-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--pink), 0.8);
}

.year-dropdown-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.year-label {
  font-size: 14px;
  opacity: 1;
}

.year-dropdown-menu {
  max-height: 180px;
  width: 85px;
}

.till-label {
  margin-left: 30px;
}

.year-dropdown-menu::-webkit-scrollbar,
.pill-dropdown::-webkit-scrollbar,
.sort-custom-menu::-webkit-scrollbar {
  width: 6px;
}
.year-dropdown-menu::-webkit-scrollbar-track,
.pill-dropdown::-webkit-scrollbar-track,
.sort-custom-menu::-webkit-scrollbar-track {
  background: transparent;
  margin: 8px 0;
}
.year-dropdown-menu::-webkit-scrollbar-thumb,
.pill-dropdown::-webkit-scrollbar-thumb,
.sort-custom-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 10px;
}
.year-dropdown-menu::-webkit-scrollbar-thumb:hover,
.pill-dropdown::-webkit-scrollbar-thumb:hover,
.sort-custom-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}
