/* Topic filter pills for discover page */
.topic-filter {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: #f5f5f5;
  color: #333;
  transition: all 0.15s ease;
  user-select: none;
}
.topic-filter:hover {
  border-color: #1890ff;
}
.topic-filter.selected {
  background: #1890ff;
  border-color: #1890ff;
  color: #fff;
}

/* "+" add button pill */
.topic-filter-add {
  padding: 6px 10px;
  font-size: 15px;
  line-height: 1;
  background: #fff;
}
.topic-filter-add:hover {
  border-color: rgba(0, 0, 0, 0.15) !important;
  background: #f7f7f7;
}
.topic-filter-add i {
  display: block;
}
body[data-theme="dark"] .topic-filter-add {
  background: #2d2d2d;
}
body[data-theme="dark"] .topic-filter-add:hover {
  border-color: rgba(255, 255, 255, 0.15) !important;
  background: #3a3a3a;
}

/* Selected topic pills with remove icon */
.topic-filter-selected {
  background: #1890ff;
  border-color: #1890ff;
  color: #fff;
  gap: 4px;
}
.topic-filter-selected:hover {
  border-color: #1890ff;
}
.topic-filter-remove {
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
}
.topic-filter-remove:hover {
  opacity: 1;
}

/* Dropdown wrapper and menu */
.discover-add-wrapper {
  position: relative;
}
.discover-topic-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  width: 250px;
  margin-top: 6px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
.discover-topic-dropdown.dropdown-flip {
  left: auto;
  right: 0;
}
.discover-topic-search-wrap {
  padding: 6px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.discover-topic-search {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 5px;
  padding: 5px 8px;
  font-size: 13px;
  outline: none;
  background: transparent;
  color: inherit;
}
.discover-topic-search:focus {
  border-color: #1890ff;
}
.discover-topic-list {
  max-height: 180px;
  overflow-y: auto;
}
.discover-topic-dropdown-item {
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  color: #333;
  transition: background 0.1s ease;
  display: flex;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.discover-topic-dropdown-item:last-child {
  border-radius: 0 0 8px 8px;
}
.discover-topic-dropdown-item.hidden {
  display: none;
}
.discover-topic-dropdown-item:hover,
.discover-topic-dropdown-item.highlighted {
  background: #f0f5ff;
}
.discover-topic-dropdown-item.active {
  background: #e6f0ff;
  color: #1890ff;
  font-weight: 600;
}
.discover-topic-dropdown-item.active.highlighted {
  background: #d6e8ff;
}

/* Blog filter favicons (used in dropdown items and selected pills) */
.blog-filter-favicon {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  object-fit: cover;
  vertical-align: middle;
  margin-right: 6px;
  flex-shrink: 0;
}
.blog-filter-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.blog-filter-unfollow {
  margin-left: 8px;
  font-size: 16px;
  line-height: 1;
  opacity: 0;
  flex-shrink: 0;
  border-radius: 3px;
  transition: opacity 0.1s ease, color 0.1s ease;
}
.discover-topic-dropdown-item:hover .blog-filter-unfollow {
  opacity: 0.5;
}
.blog-filter-unfollow:hover {
  opacity: 1 !important;
  color: #ff4d4f;
}

/* Dark mode */
body[data-theme="dark"] .topic-filter {
  border-color: rgba(255, 255, 255, 0.15);
  background: #2d2d2d;
  color: #e0e0e0;
}
body[data-theme="dark"] .topic-filter:hover {
  border-color: #1890ff;
}
body[data-theme="dark"] .topic-filter.selected {
  background: #1890ff;
  border-color: #1890ff;
  color: #fff;
}
body[data-theme="dark"] .topic-filter-selected {
  background: #1890ff;
  border-color: #1890ff;
  color: #fff;
}
body[data-theme="dark"] .discover-topic-search-wrap {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
body[data-theme="dark"] .discover-topic-search {
  border-color: rgba(255, 255, 255, 0.15);
  color: #e0e0e0;
}
body[data-theme="dark"] .discover-topic-search:focus {
  border-color: #1890ff;
}
body[data-theme="dark"] .discover-topic-dropdown {
  background: #1e1e1e;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
body[data-theme="dark"] .discover-topic-dropdown-item {
  color: #e0e0e0;
}
body[data-theme="dark"] .discover-topic-dropdown-item:hover,
body[data-theme="dark"] .discover-topic-dropdown-item.highlighted {
  background: #2a2a2a;
}
body[data-theme="dark"] .discover-topic-dropdown-item.active {
  background: #1a2a3d;
  color: #4da6ff;
}
body[data-theme="dark"] .discover-topic-dropdown-item.active.highlighted {
  background: #1f3450;
}
