/* История продаж (решение владельца 2026-10-18): одна панель (VIN | ползунок «Годы», чипы марка → модель) + сетка.
   Всё — под классами .sales-history-*: главную и остальные страницы не задевает. */

.sales-history-page {
  min-height: 60vh;
  background: var(--bg);
}

/* Кнопки сайта (.site-text-btn) и flex-ряды задают display — скрытое должно оставаться скрытым. */
.sales-history-results-section [hidden] {
  display: none !important;
}

/* ---------- панель поиска: VIN | ползунок «Годы», ниже чипы ---------- */

.sales-history-h1 {
  margin: 0 0 12px;
  font-size: 1.35rem;
  line-height: 1.25;
}

.sales-history-panel {
  margin: 0 0 16px;
  padding: 14px 16px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.sales-history-panel__top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.sales-history-panel__label {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sales-history-vin {
  flex: 0 1 auto;
  margin: 0;
}

.sales-history-vin__row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sales-history-vin__input {
  width: 260px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 6px;
  background: #f4f6f8;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  box-sizing: border-box;
}

.sales-history-vin__input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}

.sales-history-years {
  flex: 0 1 420px;
  min-width: 0;
}

.sales-history-years__row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sales-history-years__num {
  width: 4.2em;
  height: 34px;
  padding: 0 4px;
  border: 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.22);
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  -moz-appearance: textfield;
}

.sales-history-years__num::-webkit-outer-spin-button,
.sales-history-years__num::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.sales-history-years__num:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

.sales-history-years__track {
  position: relative;
  flex: 1 1 auto;
  height: 34px;
}

.sales-history-years__track::before,
.sales-history-years__fill {
  content: "";
  position: absolute;
  top: 50%;
  height: 4px;
  margin-top: -2px;
  border-radius: 2px;
}

.sales-history-years__track::before {
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.12);
}

.sales-history-years__fill {
  left: 0;
  right: 0;
  background: var(--accent);
}

/* Две ручки одного ряда: дорожка общая, сами input прозрачные, ловят касание только ручкой. */
.sales-history-years__range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  outline: none;
  background: transparent;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}

.sales-history-years__range:focus,
.sales-history-years__range:focus-visible {
  outline: none;
  box-shadow: none;
}

.sales-history-years__range.is-top {
  z-index: 2;
}

.sales-history-years__range::-webkit-slider-runnable-track {
  height: 100%;
  background: transparent;
}

.sales-history-years__range::-moz-range-track {
  background: transparent;
}

.sales-history-years__range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: 6px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(13, 27, 42, 0.18);
  cursor: pointer;
  pointer-events: auto;
}

.sales-history-years__range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  pointer-events: auto;
}

.sales-history-years__range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(28, 61, 120, 0.2);
}

@media (max-width: 900px) {
  .sales-history-h1 {
    font-size: 1.15rem;
  }
  .sales-history-panel {
    padding: 12px;
  }
  .sales-history-panel__top {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .sales-history-vin__input {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    height: 44px;
    font-size: 16px; /* iOS не увеличивает страницу при вводе */
  }
  .sales-history-years {
    flex: 0 0 auto;
  }
  .sales-history-years__track {
    height: 44px;
  }
  .sales-history-years__num {
    height: 44px;
    font-size: 16px;
  }
  .sales-history-years__range::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
    margin-top: 8px;
  }
  .sales-history-years__range::-moz-range-thumb {
    width: 24px;
    height: 24px;
  }
}

/* ---------- выбор и чипы ---------- */

.sales-history-results-section {
  padding-top: 18px;
}

/* Пояснение для поиска — внизу страницы, под списком. */
.sales-history-about {
  margin: 36px 0 8px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.sales-history-about h2 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 1rem;
}

.sales-history-about p {
  margin: 0 0 8px;
}

.sales-history-picked {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.sales-history-pick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 4px 10px 4px 12px;
  border: 1px solid #3b82c4;
  border-radius: 999px;
  background: #e8f1fb;
  color: #1e3a5f;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
}

.sales-history-pick__x {
  font-size: 1.1rem;
  line-height: 1;
  color: #3b82c4;
}

.sales-history-pick:hover .sales-history-pick__x {
  color: var(--accent);
}

.sales-history-chips {
  margin: 0;
}

.sales-history-chips__row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sales-history-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 4px 11px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  background: #f4f6f8;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  box-sizing: border-box;
}

.sales-history-chip:hover {
  border-color: rgba(59, 130, 196, 0.6);
}

.sales-history-chip.is-active {
  background: #e8f1fb;
  border-color: #3b82c4;
  color: #1e3a5f;
}

.sales-history-chip__count {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sales-history-chips__toggle {
  margin-top: 12px;
  font-size: 0.82rem;
}

/* ---------- сводка и список ---------- */

.sales-history-summary {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: #fff;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
}

.sales-history-subtitle {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

.sales-history-results-section.is-loading .sales-history-grid,
.sales-history-results-section.is-loading .sales-history-chips {
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

.sales-history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.sales-history-empty {
  margin: 28px 0;
  color: var(--muted);
  text-align: center;
}

.sales-history-more-wrap {
  display: flex;
  justify-content: center;
  margin: 22px 0 8px;
}

@media (max-width: 900px) {
  .sales-history-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
  }
  .sales-history-summary {
    font-size: 0.94rem;
  }
}
