/* ── Topic filter bar ─────────────────────────────────────────── */

.topic-filter-bar {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
  margin-bottom: 12px;
  padding: 14px 20px;
  position: relative;
}

.topic-filter-edit-view {
  position: absolute;
  top: 10px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #9ca3af;
  text-decoration: none;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.topic-filter-edit-view:hover {
  opacity: 1;
  color: #3b5bdb;
}

.topic-filter-bar__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
  align-items: center;
}

.topic-filter-section {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topic-filter-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #aaa;
  white-space: nowrap;
}

/* ── Sort toggles ────────────────────────────────────────────── */

.topic-filter-toggles {
  display: flex;
  gap: 5px;
}

.topic-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 14px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
  color: #555;
  background: #f3f4f6;
  text-decoration: none;
  border: 2px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  line-height: 1.4;
  white-space: nowrap;
}

.topic-filter-toggle:hover {
  background: #e9eaec;
  color: #222;
  text-decoration: none;
}

.topic-filter-toggle.is-active {
  background: #eef2ff;
  color: #3b5bdb;
  border-color: #3b5bdb;
  font-weight: 600;
}

.topic-filter-arrow {
  font-size: 13px;
}

/* ── Tag dropdown ────────────────────────────────────────────── */

.topic-filter-section--tags {
  gap: 8px;
}

.topic-filter-dropdown {
  position: relative;
}

.topic-filter-dropdown__trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
  color: #555;
  background: #f3f4f6;
  border: 2px solid transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
  line-height: 1.4;
}

.topic-filter-dropdown__trigger:hover {
  background: #e9eaec;
  color: #222;
}

.topic-filter-dropdown__trigger.has-selection {
  background: #eef2ff;
  color: #3b5bdb;
  border-color: #3b5bdb;
  font-weight: 600;
}

.topic-filter-dropdown__chevron {
  transition: transform 0.2s;
  flex-shrink: 0;
}

.topic-filter-dropdown.is-open .topic-filter-dropdown__chevron {
  transform: rotate(180deg);
}

/* Panel */
.topic-filter-dropdown__panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.11);
  z-index: 400;
  overflow: hidden;
}

.topic-filter-dropdown.is-open .topic-filter-dropdown__panel {
  display: block;
}

/* Search inside dropdown */
.topic-filter-dropdown__search-wrap {
  position: relative;
  padding: 10px 10px 8px;
  border-bottom: 1px solid #f0f0f0;
}

.topic-filter-dropdown__search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-55%);
  width: 13px;
  height: 13px;
  color: #bbb;
  pointer-events: none;
}

.topic-filter-dropdown__search {
  width: 100%;
  padding: 6px 10px 6px 30px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  color: #333;
  background: #fafafa;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}

.topic-filter-dropdown__search:focus {
  border-color: #3b5bdb;
  background: #fff;
}

.topic-filter-dropdown__search::placeholder {
  color: #bbb;
}

/* List */
.topic-filter-dropdown__list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  max-height: 260px;
  overflow-y: auto;
}

.topic-filter-dropdown__list li {
  margin: 0;
  padding: 0;
}

.topic-filter-dropdown__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  font-size: 13px;
  color: #333;
  text-decoration: none;
  transition: background 0.1s;
  gap: 10px;
}

.topic-filter-dropdown__item:hover {
  background: #f3f4f6;
  text-decoration: none;
  color: #111;
}

.topic-filter-dropdown__item.is-active {
  color: #3b5bdb;
  font-weight: 600;
  background: #f0f4ff;
}

.topic-filter-dropdown__item.is-active::before {
  content: '✓';
  font-size: 11px;
  margin-right: -4px;
  color: #3b5bdb;
}

.topic-filter-dropdown__count {
  font-size: 11px;
  color: #aaa;
  flex-shrink: 0;
}

.topic-filter-dropdown__empty {
  padding: 10px 14px;
  font-size: 13px;
  color: #aaa;
}

/* ── Clear button ────────────────────────────────────────────── */

.topic-filter-clear {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  color: #999;
  background: #fafafa;
  text-decoration: none;
  border: 1.5px solid #e5e7eb;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
}

.topic-filter-clear:hover {
  color: #c92a2a;
  border-color: #c92a2a;
  background: #fff5f5;
  text-decoration: none;
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 600px) {
  .topic-filter-bar {
    padding: 12px 14px;
  }

  .topic-filter-dropdown__panel {
    right: 0;
    left: auto;
  }
}
