/* DiscoveryToolbar — shared archive discovery control (Design System) */

.DiscoveryToolbar {
  margin-bottom: 24px;
}

.DiscoveryToolbar__panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.DiscoveryToolbar__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

.DiscoveryToolbar__row--primary {
  min-height: 56px;
}

.DiscoveryToolbar__search {
  position: relative;
  flex: 1 1 280px;
  min-width: 0;
}

.DiscoveryToolbar__searchLabel {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.DiscoveryToolbar__searchField {
  position: relative;
  display: flex;
  align-items: center;
}

.DiscoveryToolbar__searchIcon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  fill: #666;
  pointer-events: none;
  transition: fill 220ms ease;
}

.DiscoveryToolbar__searchInput {
  width: 100%;
  box-sizing: border-box;
  height: 56px;
  padding: 0 44px 0 48px;
  font-family: 'Noto Sans Thai', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  color: #111;
  background: #fff;
  border: 1px solid #d8d8d8;
  border-radius: 12px;
  outline: none;
  transition: border-color 220ms ease, background 220ms ease;
}

.DiscoveryToolbar__searchInput::placeholder {
  color: #999;
}

.DiscoveryToolbar__searchInput:hover {
  border-color: #bbb;
}

.DiscoveryToolbar__searchInput:focus {
  border-color: #111;
  background: #fff;
}

.DiscoveryToolbar__searchField:focus-within .DiscoveryToolbar__searchIcon {
  fill: #111;
}

.DiscoveryToolbar__searchClear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: #666;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, color 220ms ease, background 220ms ease, transform 220ms ease;
}

.DiscoveryToolbar__searchClear.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.DiscoveryToolbar__searchClear svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.DiscoveryToolbar__searchClear:hover {
  color: #111;
  background: #f3f3f3;
}

.DiscoveryToolbar__searchClear:active {
  transform: translateY(-50%) scale(0.94);
}

.DiscoveryToolbar__searchClear:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.DiscoveryToolbar__sortWrap {
  flex: 0 0 auto;
}

.DiscoveryToolbar__sort {
  display: flex;
  align-items: center;
  gap: 10px;
}

.DiscoveryToolbar__sortLabel {
  font-size: 13px;
  font-weight: 600;
  color: #111;
  white-space: nowrap;
}

.DiscoveryToolbar__sortSelect {
  min-height: 44px;
  min-width: 148px;
  padding: 8px 36px 8px 12px;
  font-family: 'Noto Sans Thai', system-ui, sans-serif;
  font-size: 13px;
  color: #111;
  background: #fff;
  border: 1px solid #d4d4d4;
  border-radius: 10px;
  cursor: pointer;
  outline: none;
  transition: border-color 220ms ease;
}

.DiscoveryToolbar__sortSelect:focus {
  border-color: #111;
}

.DiscoveryToolbar__chips {
  margin: 0;
}

.DiscoveryToolbar__chipsScroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.DiscoveryToolbar__chipsScroll::-webkit-scrollbar {
  display: none;
}

.DiscoveryToolbar__chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 18px;
  font-family: 'Noto Sans Thai', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: #111;
  background: #fff;
  border: 1px solid #d4d4d4;
  border-radius: 999px;
  white-space: nowrap;
  transition: background 220ms ease, color 220ms ease, border-color 220ms ease, transform 220ms ease;
}

.DiscoveryToolbar__chip:hover {
  background: #f5f5f5;
  border-color: #bbb;
}

.DiscoveryToolbar__chip.is-active {
  color: #fff;
  background: #000;
  border-color: #000;
}

.DiscoveryToolbar__chip:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.DiscoveryToolbar__count {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #666;
  letter-spacing: 0.01em;
}

/* Sticky behavior */
.DiscoveryToolbar--sticky {
  position: sticky;
  top: 0;
  z-index: 900;
  transition: background 240ms ease, border-color 240ms ease, box-shadow 240ms ease;
}

.DiscoveryToolbar--sticky.is-pinned {
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
}

.DiscoveryToolbar--sticky.is-pinned .DiscoveryToolbar__panel {
  padding-top: 8px;
  padding-bottom: 8px;
}

.DiscoveryToolbar--sticky.is-pinned .DiscoveryToolbar__searchInput {
  height: 48px;
}

.DiscoveryToolbar--sticky.is-pinned .DiscoveryToolbar__row--primary {
  min-height: 48px;
}

/* Tablet */
@media (min-width: 768px) and (max-width: 1023px) {
  .DiscoveryToolbar__row--primary {
    flex-direction: column;
    align-items: stretch;
  }

  .DiscoveryToolbar__search {
    flex: 1 1 auto;
    width: 100%;
  }

  .DiscoveryToolbar__sortWrap {
    width: 100%;
  }

  .DiscoveryToolbar__sort {
    justify-content: flex-end;
    width: 100%;
  }
}

/* Mobile */
@media (max-width: 767px) {
  .DiscoveryToolbar {
    margin-bottom: 20px;
  }

  .DiscoveryToolbar__row--primary {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .DiscoveryToolbar__search {
    width: 100%;
  }

  .DiscoveryToolbar__sortWrap {
    width: 100%;
  }

  .DiscoveryToolbar__sort {
    justify-content: space-between;
    width: 100%;
  }

  .DiscoveryToolbar__sortSelect {
    flex: 1;
    max-width: 220px;
  }
}

/* Desktop — compact horizontal primary row */
@media (min-width: 1024px) {
  .DiscoveryToolbar__sortWrap {
    margin-left: auto;
  }
}
