/* ------------------------------------------------------------------
   PhoneShop — публичный сайт
   Палитра: приглушённая, "аптечно-спокойная", один акцент (ель),
   кирпичный зарезервирован только для скидок/предупреждений.
------------------------------------------------------------------- */

:root {
  --canvas: #eceeee;
  --surface: #ffffff;
  --surface-2: #f4f5f5;
  --ink: #1d2930;
  --ink-soft: #5b6b71;
  --line: #d9dedd;
  --accent: #3b6664;
  --accent-ink: #ffffff;
  --accent-soft: #e2ece9;
  --sale: #973f38;
  --sale-soft: #f6e6e3;
  --warn: #96731f;
  --warn-soft: #f4ecd7;
  --ok: #3b6664;
  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 20px;
  --shadow: 0 1px 2px rgba(29,41,48,.06), 0 8px 24px -12px rgba(29,41,48,.18);
  --font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0 0 .5em; font-weight: 700; letter-spacing: -0.01em; }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

.muted { color: var(--ink-soft); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* --- Кнопки ---------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-s);
  font-weight: 600;
  font-size: 15px;
  border: 1px solid transparent;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--ink); color: #fff; }
.btn--primary:hover { background: #0f171b; }
.btn--accent { background: var(--accent); color: var(--accent-ink); }
.btn--accent:hover { background: #2f5250; }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink); }
.btn--danger { background: var(--sale); color: #fff; }
.btn--danger-ghost { background: transparent; border: 1px solid var(--sale); color: var(--sale); }
.btn--whatsapp { background: #2e6b5e; color: #fff; }
.btn--telegram { background: #2b6a8f; color: #fff; }
.btn--small { padding: 7px 14px; font-size: 13px; }
.btn--block { width: 100%; }

.link-button {
  background: none; border: none; padding: 0; color: var(--accent);
  font-weight: 600; font-size: 14px; text-decoration: underline;
}

/* --- Header ------------------------------------------------------ */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.site-header__row {
  display: flex; align-items: center; gap: 24px;
  padding-top: 16px; padding-bottom: 16px;
  /* Горизонтальные отступы намеренно не задаём здесь — ими управляет .wrap,
     у которого разные значения под разную ширину экрана. Если продублировать
     их тут, на мобильном это правило (более позднее в каскаде) перебивало
     бы .wrap и заодно обнуляло вертикальный паддинг шапки. */
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; flex-shrink: 0; }
.brand__mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800;
}
.brand--footer { font-size: 17px; margin-bottom: 10px; }

.header-search {
  flex: 1; max-width: 480px; display: flex; align-items: center;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-s); padding: 2px 4px 2px 14px;
}
.header-search input {
  flex: 1; border: none; background: transparent; padding: 9px 4px;
  font-family: inherit; font-size: 14px; color: var(--ink); outline: none;
}
.header-search button {
  border: none; background: var(--ink); color: #fff; border-radius: 6px;
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
}

.header-contacts { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.header-contacts__phone { font-weight: 700; font-size: 14px; }

/* --- Footer -------------------------------------------------------- */
.site-footer { margin-top: 64px; padding: 40px 0; border-top: 1px solid var(--line); }
.site-footer__row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 24px; }
.site-footer__row p { margin: 2px 0; font-size: 14px; }
.footer-contacts { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; font-weight: 600; }

/* --- Alerts --------------------------------------------------------- */
.alert {
  padding: 12px 16px; border-radius: var(--radius-s); margin: 16px 0;
  font-size: 14px; font-weight: 500; border: 1px solid transparent;
}
.alert--success { background: var(--accent-soft); color: var(--accent); border-color: #c3d8d3; }
.alert--error { background: var(--sale-soft); color: var(--sale); border-color: #e6c3bd; }
.alert--warning { background: var(--warn-soft); color: var(--warn); border-color: #e6d6a4; }
.alert--info, .alert--debug { background: var(--surface-2); color: var(--ink-soft); border-color: var(--line); }

/* --- Каталог: сетка с фильтрами -------------------------------- */
.catalog {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 32px;
  padding-top: 28px;
  align-items: start;
}
.filters-toggle { display: none; }

.filters {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 20px;
  position: sticky;
  top: 84px;
}
.filters__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.filters__head h2 { font-size: 16px; margin: 0; }
.filters__head-actions { display: flex; align-items: center; gap: 14px; }
.filters__reset { font-size: 13px; color: var(--ink-soft); text-decoration: underline; }
.filters__close {
  display: none; width: 32px; height: 32px; border-radius: 50%; border: none;
  background: var(--surface-2); color: var(--ink); font-size: 20px; line-height: 1;
  align-items: center; justify-content: center;
}

.filter-group { margin-bottom: 20px; }
.filter-group h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); margin: 0 0 10px; font-weight: 700; }

.select-native {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-s);
  border: 1px solid var(--line); background: var(--surface); font-family: inherit;
  font-size: 14px; color: var(--ink);
}

.price-row { display: flex; align-items: center; gap: 8px; }
.price-row input {
  width: 100%; padding: 9px 10px; border-radius: var(--radius-s);
  border: 1px solid var(--line); font-family: inherit; font-size: 14px;
}
.price-row__sep { color: var(--ink-soft); }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line);
  font-size: 13px; cursor: pointer; user-select: none; background: var(--surface);
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.pill input { position: absolute; opacity: 0; width: 0; height: 0; }
.pill em { font-style: normal; opacity: .6; }
.pill:has(input:checked) { background: var(--ink); color: #fff; border-color: var(--ink); }
.pill:has(input:checked) em { opacity: .75; }

.radio-list { display: flex; flex-direction: column; gap: 6px; }
.radio-list--inline { flex-direction: row; flex-wrap: wrap; gap: 8px; }
.radio-list__item { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.radio-list--inline .radio-list__item {
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); gap: 6px;
}
.radio-list--inline .radio-list__item:has(input:checked) { background: var(--ink); color: #fff; border-color: var(--ink); }
.radio-list__item em { font-style: normal; opacity: .6; }

.checkbox-row { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--accent); }

.filters-apply { display: none; margin-top: 6px; }

/* --- Каталог: основная колонка ----------------------------------- */
.catalog__toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}
.catalog__count { margin: 0; font-size: 14px; color: var(--ink-soft); }
.sort-form { display: flex; align-items: center; gap: 8px; }
.sort-form__label { font-size: 13px; color: var(--ink-soft); }
.sort-form select {
  padding: 8px 10px; border-radius: var(--radius-s); border: 1px solid var(--line);
  font-family: inherit; font-size: 13px; background: var(--surface);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line);
  padding: 6px 8px 6px 12px; border-radius: 999px; font-size: 13px;
}
.chip__remove {
  width: 18px; height: 18px; border-radius: 50%; background: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px; line-height: 1;
}
.chip--clear { color: var(--ink-soft); text-decoration: underline; border-style: dashed; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.card {
  background: var(--surface); border-radius: var(--radius-m); overflow: hidden;
  border: 1px solid var(--line);
  transition: box-shadow .18s ease, transform .18s ease;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card__photo {
  display: block; position: relative; aspect-ratio: 1 / 1; background: var(--surface-2);
}
.card__photo img { width: 100%; height: 100%; object-fit: cover; }
.card__noimg {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft); font-size: 13px;
}
.badge {
  position: absolute; top: 10px; padding: 4px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
}
.badge--sale { left: 10px; background: var(--sale); color: #fff; }
.badge--status { right: 10px; background: rgba(29,41,48,.85); color: #fff; }

.card__body { padding: 14px; }
.card__title { font-size: 15px; margin: 0 0 4px; }
.card__title a:hover { text-decoration: underline; }
.card__meta { font-size: 13px; color: var(--ink-soft); margin: 0 0 10px; }

.gauge {
  position: relative; height: 8px; border-radius: 6px; background: var(--surface-2);
  margin-bottom: 10px; overflow: hidden;
  background-image: repeating-linear-gradient(90deg, transparent 0 8%, var(--surface) 8% 9%);
}
.gauge__fill { height: 100%; border-radius: 6px; background: var(--ok); }
.gauge--mid .gauge__fill { background: var(--warn); }
.gauge--low .gauge__fill { background: var(--sale); }
.gauge__label { display: none; }
.gauge--big { height: 14px; margin-bottom: 0; }

.card__price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.price-old { color: var(--ink-soft); text-decoration: line-through; font-size: 13px; }
.price-final { font-weight: 800; font-size: 17px; }
.price-old--big { font-size: 16px; }
.price-final--big { font-size: 26px; }

/* --- Пагинация ------------------------------------------------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 32px 0; }
.pagination__btn {
  padding: 9px 16px; border-radius: var(--radius-s); border: 1px solid var(--line);
  font-size: 14px; font-weight: 600; background: var(--surface);
}
.pagination__btn--disabled { opacity: .4; pointer-events: none; }
.pagination__info { font-size: 13px; color: var(--ink-soft); }

.empty-state { text-align: center; padding: 64px 20px; color: var(--ink-soft); }
.empty-state .btn { margin-top: 12px; }

/* --- Карточка товара -------------------------------------------- */
.back-link { display: inline-block; margin: 20px 0 12px; font-size: 14px; color: var(--ink-soft); }
.back-link:hover { text-decoration: underline; }

.detail__grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; margin-bottom: 48px; }

.gallery__main {
  position: relative; aspect-ratio: 1/1; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden;
}
.gallery__image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .2s ease; }
.gallery__image.is-active { opacity: 1; }
.gallery__placeholder { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--ink-soft); }
.gallery__thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.gallery__thumb {
  width: 64px; height: 64px; border-radius: var(--radius-s); overflow: hidden;
  border: 2px solid transparent; padding: 0; background: var(--surface-2);
}
.gallery__thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery__thumb.is-active { border-color: var(--ink); }

.detail__title { font-size: 26px; margin-bottom: 4px; }
.detail__subtitle { color: var(--ink-soft); margin: 0 0 16px; }
.detail__price { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }

.battery-block { margin-bottom: 20px; }
.battery-block__row { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 8px; }

.specs { margin: 0 0 16px; }
.specs__row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.specs__row dt { color: var(--ink-soft); }
.specs__row dd { margin: 0; font-weight: 600; }

.detail__description { margin-bottom: 24px; }
.detail__description h2 { font-size: 16px; }
.detail__description p { color: var(--ink-soft); }

.contact-box {
  background: var(--surface-2); border-radius: var(--radius-m); padding: 20px;
}
.contact-box h2 { font-size: 15px; margin-bottom: 12px; }
.contact-box__buttons { display: flex; flex-wrap: wrap; gap: 10px; }

.similar h2 { font-size: 18px; margin-bottom: 16px; }

/* --- Responsive -------------------------------------------------- */

/* Пока открыта мобильная шторка фильтров — фон не скроллится. */
body.no-scroll { overflow: hidden; }

@media (max-width: 960px) {
  .catalog { grid-template-columns: 1fr; }
  .filters-toggle {
    display: inline-flex; align-items: center; gap: 8px;
    margin-top: 16px; padding: 10px 16px; border-radius: var(--radius-s);
    border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px;
  }
  .filters {
    position: fixed; inset: 0; z-index: 60; border-radius: 0;
    overflow-y: auto; transform: translateX(-100%); transition: transform .2s ease;
    padding-bottom: 24px;
  }
  .filters.is-open { transform: translateX(0); }
  .filters__close { display: inline-flex; }
  .filters-apply {
    display: inline-flex; position: sticky; bottom: 0;
    box-shadow: 0 -8px 16px -8px rgba(29,41,48,.15);
  }
  .detail__grid { grid-template-columns: 1fr; gap: 24px; }
}

@media (max-width: 720px) {
  .site-header__row { flex-wrap: wrap; row-gap: 10px; }
  .header-search { order: 3; max-width: none; width: 100%; }
  .header-contacts__phone { font-size: 13px; }
  .site-footer__row { flex-direction: column; }
  .footer-contacts { align-items: flex-start; }
  .wrap { padding: 0 16px; }
  .pagination { flex-wrap: wrap; row-gap: 8px; }
}

/* Телефон: две карточки в ряд — привычная плотная сетка для листания
   большого каталога с одной рукой. */
@media (max-width: 560px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card__body { padding: 10px; }
  .card__title { font-size: 13px; }
  .card__meta { font-size: 11px; margin-bottom: 6px; }
  .price-final { font-size: 15px; }
  .price-old { font-size: 11px; }
  .gauge { height: 6px; margin-bottom: 6px; }
  .badge { font-size: 10px; padding: 3px 7px; }
  .catalog__toolbar { flex-direction: column; align-items: flex-start; }
  .sort-form { width: 100%; }
  .sort-form select { flex: 1; }
}
