/* static/css/catalog.css */
/* Общие стили каталога: переопределения + модалка подкатегорий */

/* ── Catalog page-specific overrides ── */
.sidebar-back {
  padding: 0.3rem 0.75rem;
}
/* Active tag in filter bar */
.tag-link--active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}
/* No top margin when filtered */
.product-listing--filtered {
  margin-top: 1.5rem;
}
/* Reset filter button */
.listing-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .8rem;
  font-weight: 500;
  color: var(--color-text-tertiary);
  text-decoration: none;
  padding: .3rem .7rem;
  border: 1px solid var(--color-border);
  border-radius: 100px;
  background: var(--color-bg);
  transition: all .2s;
  white-space: nowrap;
}
.listing-reset-btn:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* ── Subcategory modal ── */
.subcat-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: subcatFadeIn 0.2s ease;
}
@keyframes subcatFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.subcat-modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  animation: subcatSlideUp 0.25s ease;
}
@keyframes subcatSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.subcat-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid #f0f2f5;
}
.subcat-modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  color: var(--color-text, #1a1a2e);
}
.subcat-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 8px;
  color: #9ca3af;
  transition: background 0.15s, color 0.15s;
}
.subcat-modal-close:hover {
  background: #f0f2f5;
  color: #374151;
}
.subcat-modal-body {
  padding: 0.5rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}
.subcat-modal-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid #f7f8fa;
  text-decoration: none;
  color: var(--color-text, #1a1a2e);
  transition: color 0.15s;
}
.subcat-modal-item:last-child {
  border-bottom: none;
}
.subcat-modal-item:hover {
  color: var(--color-accent, #2563eb);
}
.subcat-modal-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
  background: #f7f8fa;
  flex-shrink: 0;
}
.subcat-modal-item-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #f0f2f5;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.85rem;
}
.subcat-modal-item-name {
  font-size: 0.95rem;
  flex: 1;
  min-width: 0;
}
.subcat-modal-item-count {
  font-size: 0.8rem;
  color: #9ca3af;
  background: #f0f2f5;
  padding: 0.15rem 0.55rem;
  border-radius: 10px;
  min-width: 28px;
  text-align: center;
  flex-shrink: 0;
}
.subcat-modal-all-btn {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  background: #d1181f;
  text-decoration: none;
  padding: 0.4rem 1rem;
  border-radius: 8px;
  transition: background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.subcat-modal-all-btn:hover {
  background: #b01419;
}

/* ── Mobile: модалка как bottom-sheet ── */
@media (max-width: 767px) {
  .subcat-modal {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 12px 12px 0 0;
    margin-top: auto;
  }
  .subcat-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
}


/* ── Фильтры каталога по характеристикам ─────────────────────────── */
.catalog-filters-form { position: relative; margin: 0 0 1.5rem; }
/* «Сбросить» в правом верхнем углу шапки (поверх summary, не сворачивает панель) */
.filters-reset--top {
  position: absolute;
  top: 0.95rem;
  right: 1.4rem;
  z-index: 2;
}
.catalog-filters {
  background: #eef3fa;
  border: 1px solid #dde6f2;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(18, 34, 60, 0.04);
}
.filters-summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.filters-summary::-webkit-details-marker { display: none; }
.filters-summary:hover .filters-head-title { color: #185FA5; }
.filters-chevron {
  color: #9aa0ad;
  flex-shrink: 0;
  transition: transform 0.18s ease;
}
.catalog-filters[open] .filters-chevron { transform: rotate(90deg); }
.filters-head-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #1a1f2e;
  transition: color 0.13s;
}
.filters-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 0.4rem;
  background: #185FA5;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 999px;
}
.filters-body {
  padding: 0.25rem 1.5rem 1.25rem;
  border-top: 1px solid #dde6f2;
}
.catalog-filters-row {
  column-width: 340px;
  column-gap: 2.5rem;
  padding-top: 0.4rem;
}

.filter-block {
  display: block;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  padding: 0.35rem 0 0.85rem;
  min-width: 0;
}
.filter-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #8a93a3;
  margin-bottom: 0.45rem;
}

/* Чипы выбора */
.filter-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.filter-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.8rem;
  background: #fff;
  border: 1px solid #d7e0ed;
  border-radius: 999px;
  font-size: 0.875rem;
  line-height: 1;
  color: #2a2f3a;
  cursor: pointer;
  transition: all 0.13s ease;
  user-select: none;
}
.filter-chip input {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
  pointer-events: none;
}
.filter-chip:hover { border-color: #185FA5; background: #fff; }
.filter-chip .chip-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: #aab0bd;
}
.filter-chip.is-checked {
  background: #185FA5;
  border-color: #185FA5;
  color: #fff;
  box-shadow: 0 2px 6px rgba(24, 95, 165, 0.25);
}
.filter-chip.is-checked .chip-count { color: rgba(255, 255, 255, 0.72); }
.filter-chip.is-empty {
  opacity: 0.4;
  pointer-events: none;
  background: #f7f8fa;
}

/* Диапазон */
.filter-range { display: flex; align-items: center; gap: 0.5rem; }
.filter-num {
  width: 110px;
  padding: 0.45rem 0.6rem;
  border: 1px solid #d4dae3;
  border-radius: 8px;
  font-size: 0.875rem;
  color: #2a2f3a;
  transition: border-color 0.13s;
}
.filter-num::placeholder { color: #b6bcc8; }
.filter-num:focus { outline: none; border-color: #185FA5; box-shadow: 0 0 0 3px rgba(24, 95, 165, 0.1); }
.filter-range-dash { color: #b6bcc8; }

/* Низ панели */
.catalog-filters-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid #eef1f5;
}
.filters-apply {
  background: #185FA5;
  color: #fff;
  border: none;
  border-radius: 9px;
  padding: 0.55rem 1.6rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.filters-apply:hover { background: #134e87; }
.filters-reset {
  font-size: 0.85rem;
  font-weight: 500;
  color: #d1181f;
  text-decoration: none;
  white-space: nowrap;
}
.filters-reset:hover { text-decoration: underline; }

@media (max-width: 720px) {
  .catalog-filters-row { column-width: auto; column-count: 1; }
  .filter-num { width: 100%; }
  .filter-range { width: 100%; }
}

/* Шеврон раскрытия скрытых значений */
.chips-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: #e3edf9;
  border: 1px solid #c4d8ef;
  border-radius: 999px;
  color: #185FA5;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.chips-more[hidden] { display: none; }
.chips-more svg { width: 18px; height: 18px; transition: transform 0.18s ease; }
.chips-more:hover { background: #185FA5; border-color: #185FA5; color: #fff; }
.filter-chips.is-open .chips-more svg { transform: rotate(180deg); }
