.gallery-filter {
  position: relative;
  color: #fff;
  flex-shrink: 0;
  margin: 0 0 0.5rem;
  margin-left: auto;
  max-width: 100%;
  width: min(22rem, 100%);
  z-index: 2147483000;
}

.gallery-filter > summary {
  align-items: center;
  background: #101820;
  border: 1px solid var(--gallery-accent, #6bb8d4);
  border-radius: 4px;
  color: var(--gallery-accent, #6bb8d4);
  cursor: pointer;
  display: flex;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  gap: 0.5rem;
  justify-content: space-between;
  list-style: none;
  box-sizing: border-box;
  overflow: hidden;
  padding: 0.45rem 0.65rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-filter > summary::-webkit-details-marker {
  display: none;
}

.gallery-filter > summary::after {
  content: '+';
  flex: 0 0 auto;
  font-size: 1.2rem;
}

.gallery-filter[open] > summary::after {
  content: '\2212';
}

.gallery-filter-panel {
  background: #101820;
  border: 1px solid var(--gallery-accent, #6bb8d4);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  display: grid;
  gap: 0.4rem;
  box-sizing: border-box;
  max-width: calc(100vw - 2rem);
  min-width: min(18rem, calc(100vw - 2rem));
  max-height: calc(100vh - 1rem);
  overflow-y: auto;
  padding: 0.75rem;
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 2147483000;
}

.gallery-filter-panel[popover] {
  inset: auto;
  margin: 0;
  position: fixed;
}

.gallery-filter-panel[popover]:not(:popover-open) {
  display: none;
}

.gallery-filter label {
  color: var(--gallery-accent, #6bb8d4);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
}

.gallery-filter select {
  background: #080d12;
  border: 1px solid var(--gallery-accent, #6bb8d4);
  box-sizing: border-box;
  border-radius: 4px;
  color: #fff;
  font: inherit;
  max-width: 100%;
  padding: 0.4rem 2rem 0.4rem 0.5rem;
  width: 100%;
}

.gallery-filter select:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.gallery-filter-reset {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  font: inherit;
  justify-self: start;
  margin-top: 0.25rem;
  padding: 0.35rem 0.6rem;
}

.gallery-filter-reset:hover {
  border-color: var(--gallery-accent, #6bb8d4);
  color: var(--gallery-accent, #6bb8d4);
}

.gallery-filter-empty {
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  box-sizing: border-box;
  color: #ddd;
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  grid-column: 1 / -1;
  justify-content: center;
  min-height: 8rem;
  padding: 1.25rem;
  text-align: center;
}

.gallery-filter-empty-reset {
  background: transparent;
  border: 1px solid var(--gallery-accent, #6bb8d4);
  border-radius: 4px;
  color: var(--gallery-accent, #6bb8d4);
  cursor: pointer;
  font: inherit;
  padding: 0.35rem 0.6rem;
}

@media (max-width: 480px) {
  .gallery-filter label {
    font-size: 0.9rem;
  }
}
