/* =========================================================
   AniLog — секция коллекции, вкладки и сортировка
   ========================================================= */

/* ---------- Коллекция ---------- */

.collection {
  padding-bottom: clamp(78px, 9vw, 120px);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 25px;
}

.section-head .eyebrow {
  margin-bottom: 11px;
}

.section-head__title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.1;
}

.count-badge {
  display: inline-flex;
  min-width: 31px;
  height: 25px;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  border: 1px solid rgba(139, 92, 246, 0.22);
  border-radius: 9px;
  background: rgba(139, 92, 246, 0.11);
  color: var(--violet-light);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
}

.sort-control {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted-2);
  font-size: 11.5px;
}

.sort-control__label {
  white-space: nowrap;
}

/* ---------- Кастомный дропдаун сортировки (стиль панели жанров) ---------- */

.sort-dropdown {
  position: relative;
}

.sort-dropdown__toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted-2);
  font-size: 11.5px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.sort-dropdown__toggle:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.06);
}

.sort-dropdown__toggle:focus-visible {
  border-color: rgba(167, 139, 250, 0.6);
}

.sort-dropdown__toggle[aria-expanded="true"] .icon {
  transform: rotate(180deg);
}

.sort-dropdown__toggle .icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--muted-2);
  transition: transform 0.2s ease;
}

.sort-dropdown__value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 190px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 500;
}

.sort-dropdown__panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: max-content;
  min-width: 100%;
  max-width: min(300px, calc(100vw - 48px));
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background:
    radial-gradient(ellipse 90% 55% at 90% 0%, rgba(139, 92, 246, 0.12), transparent 58%),
    linear-gradient(155deg, rgba(23, 24, 38, 0.98), rgba(10, 11, 19, 0.995));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}

.sort-dropdown__option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.sort-dropdown__option:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.sort-dropdown__option:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: -2px;
}

.sort-dropdown__option[aria-selected="true"] {
  background: rgba(139, 92, 246, 0.18);
  color: var(--violet-light);
  font-weight: 700;
}

.filter-tabs {
  display: flex;
  width: fit-content;
  max-width: 100%;
  gap: 5px;
  overflow-x: auto;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
  scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar {
  display: none;
}

.filter-tab {
  display: inline-flex;
  height: 37px;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.25s ease;
}

.filter-tab:hover {
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-soft);
}

.filter-tab.is-active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.96), rgba(99, 102, 241, 0.92));
  color: #fff;
  box-shadow:
    0 7px 20px rgba(116, 85, 246, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.filter-tab__count {
  display: inline-flex;
  min-width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.065);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s ease, background 0.2s ease;
}

.filter-tab.is-active .filter-tab__count {
  background: rgba(255, 255, 255, 0.17);
  color: #fff;
}

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--status-color, currentColor);
  box-shadow: 0 0 8px var(--status-color, currentColor);
}

[data-status-dot="watching"],
.status-pill.is-watching { --status-color: var(--status-watching); }

[data-status-dot="completed"],
.status-pill.is-completed { --status-color: var(--status-completed); }

[data-status-dot="planned"],
.status-pill.is-planned { --status-color: var(--status-planned); }

[data-status-dot="dropped"],
.status-pill.is-dropped { --status-color: var(--status-dropped); }

[data-status-dot="onhold"],
.status-pill.is-onhold { --status-color: var(--status-onhold); }

/* «Без статуса» (MAL-импорт): нейтральный серый — тайтл ждёт раскладки */
[data-status-dot="unassigned"],
.status-pill.is-unassigned { --status-color: var(--muted); }

/* Звезда избранного в табе фильтра и на карточке */
.filter-tab__star {
  width: 12px;
  height: 12px;
  color: var(--muted);
}

.filter-tab .filter-tab__star {
  margin-right: 1px;
}

.fav-button .icon {
  transition: color 0.15s ease, fill 0.15s ease;
}

.fav-button:hover .icon {
  color: #fbbf24;
}

.fav-button.is-fav .icon {
  color: #fbbf24;
  fill: #fbbf24;
}

.results-note {
  min-height: 17px;
  margin: 20px 1px 20px;
  color: var(--muted-2);
  font-size: 11px;
  letter-spacing: 0.01em;
}

/* Кнопка «Показать ещё» под сеткой: карточки за окном рендера не в DOM.
   [hidden] обязан побеждать display:flex, иначе скрытие не сработает. */
.show-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}

.show-more-wrap[hidden] {
  display: none;
}
