/* ============================================================
   СтройХоз — дополнения: корзина, хиты, витрина, аренда, статусы
   ============================================================ */

/* ---------- Кнопка корзины в шапке ---------- */
.head-cart {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--line, #e6e2da); background: #fff; color: inherit;
  cursor: pointer; transition: transform .2s, border-color .2s;
}
.head-cart:hover { border-color: var(--accent, #ff5a1f); transform: translateY(-1px); }
.head-cart svg { width: 20px; height: 20px; }
.cart-badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 10px; background: var(--accent, #ff5a1f); color: #fff;
  font-size: 11.5px; font-weight: 500; line-height: 19px; text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ---------- Диалог корзины ---------- */
.cart-dlg, .shop-dlg {
  border: none; border-radius: 20px; padding: 0;
  max-width: 560px; width: calc(100% - 24px); max-height: min(86vh, 780px);
  box-shadow: 0 30px 80px rgba(20, 16, 10, .25);
}
.cart-dlg::backdrop, .shop-dlg::backdrop, .pd::backdrop { background: rgba(15, 12, 8, .55); }
.cart-in, .shop-in { display: flex; flex-direction: column; max-height: min(86vh, 780px); overflow: hidden; }
.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 12px; border-bottom: 1px solid #eee9e0; }
.cart-head h3 { margin: 0; font-size: 21px; }
.pd-close { width: 34px; height: 34px; border-radius: 10px; border: 1px solid #e8e3da; background: #fff; cursor: pointer; display: grid; place-items: center; }
.pd-close svg { width: 16px; height: 16px; }
.pd-close:hover { border-color: var(--accent, #ff5a1f); }
.cart-body { overflow: auto; padding: 10px 20px; flex: 1; }
.cart-row { display: grid; grid-template-columns: 54px 1fr auto auto auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed #eee9e0; }
.cr-img { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; background: #f3efe8; display: block; }
.cr-noimg { background: #f3efe8 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b9b2a6' stroke-width='1.4'%3E%3Crect x='4' y='5' width='16' height='14' rx='2'/%3E%3C/svg%3E") center/24px no-repeat; }
.cr-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cr-info b { font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cr-info .mono { font-size: 12px; }
.qty { display: inline-flex; align-items: center; border: 1px solid #e4dfd6; border-radius: 10px; overflow: hidden; }
.qty button { width: 28px; height: 34px; border: none; background: #faf7f2; cursor: pointer; font-size: 16px; color: #56504a; }
.qty button:hover { background: #f1ece3; }
.qty input { width: 40px; height: 34px; border: none; text-align: center; font: inherit; font-weight: 500; -moz-appearance: textfield; appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cr-sum { font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cr-del { width: 30px; height: 30px; border: none; background: none; color: #a09a90; cursor: pointer; border-radius: 8px; display: grid; place-items: center; }
.cr-del:hover { color: #c33; background: #fbeeea; }
.cr-del svg { width: 14px; height: 14px; }
.cart-form { padding: 12px 20px 18px; border-top: 1px solid #eee9e0; display: flex; flex-direction: column; gap: 10px; }
.cart-total { font-size: 17px; display: flex; justify-content: space-between; align-items: baseline; }
.cart-total b { font-size: 22px; color: var(--accent, #ff5a1f); }
.cart-form .inp { width: 100%; border: 1px solid #e4dfd6; border-radius: 12px; padding: 11px 14px; font: inherit; background: #fff; }
.cart-form .inp:focus { outline: none; border-color: var(--accent, #ff5a1f); box-shadow: 0 0 0 3px rgba(255, 90, 31, .12); }
.trap { position: absolute; left: -9999px; height: 0; width: 0; opacity: 0; }
.cart-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.cart-note { margin: 2px 0 0; font-size: 12.5px; color: #8b857b; line-height: 1.45; }
.cart-msg { border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.45; }
.cart-msg.ok { background: #eef8ee; border: 1px solid #cdeccd; color: #1e6320; }
.cart-msg.err { background: #fdf0ec; border: 1px solid #f3d2c8; color: #8c3312; }

/* ---------- Карточка товара в каталоге ---------- */
.prod { position: relative; display: flex; flex-direction: column; gap: 8px; }
.prod-hit { all: unset; cursor: pointer; display: block; }
.prod-hit:focus-visible { outline: 2px solid var(--accent, #ff5a1f); outline-offset: 3px; border-radius: 12px; }
.p-media { display: block; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: #f5f1ea; }
.p-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.prod:hover .p-media img { transform: scale(1.045); }
.p-noimg { display: grid; place-items: center; color: #c9c2b6; }
.p-noimg svg { width: 42px; height: 42px; }
.p-hs, .p-vid { display: inline-block; font-size: 10px; font-weight: 500; letter-spacing: .04em; border-radius: 6px; padding: 1px 5px; vertical-align: middle; }
.p-hs { background: #1f7a33; color: #fff; }
.p-vid { background: #f0e9df; color: #6b645a; font-style: normal; }
.p-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.p-price { font-weight: 500; font-variant-numeric: tabular-nums; }
.p-unit { font-weight: 500; color: #8b857b; font-size: 12.5px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: #1e7a35; font-weight: 500; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: #2fa04a; }
.status.order { color: #a06d13; }
.status.order i { background: #e0a52a; }
.status.out { color: #9b948a; }
.status.out i { background: #c4beb4; }

/* ---------- Фильтр наличия ---------- */
.sel { min-height: 42px; }

/* ---------- Хиты на главной ---------- */
.hot-nav { display: flex; gap: 8px; }
.hot-nav button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid #e4dfd6; background: #fff; cursor: pointer; display: grid; place-items: center; }
.hot-nav button:hover { border-color: var(--accent, #ff5a1f); }
.hot-scroll { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 260px); gap: 16px; overflow-x: auto; padding: 4px 4px 14px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.hot-card { scroll-snap-align: start; display: flex; flex-direction: column; gap: 7px; text-align: left; background: #fff; border: 1px solid #eee9e0; border-radius: 18px; padding: 14px; cursor: pointer; font: inherit; transition: transform .25s, box-shadow .25s; }
.hot-card:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(35, 28, 18, .1); }
.hot-card.rent { cursor: default; }
.hc-media { display: block; aspect-ratio: 1.25; border-radius: 12px; overflow: hidden; background: #f5f1ea; }
.hc-media img { width: 100%; height: 100%; object-fit: cover; }
.hc-noimg { background: #f5f1ea url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c9c2b6' stroke-width='1.4'%3E%3Crect x='4' y='5' width='16' height='14' rx='2'/%3E%3C/svg%3E") center/30px no-repeat; }
.hc-sub { font-size: 11.5px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; color: #a29a8e; }
.hot-card b { font-size: 14.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hc-price { font-weight: 500; color: var(--accent, #ff5a1f); }
.hot-card .btn { align-self: flex-start; }

/* ---------- Витрина (dialog) ---------- */
.shop-dlg { max-width: 640px; }
.shop-tabs { display: flex; gap: 8px; padding: 12px 20px 0; }
.shop-body { overflow: auto; padding: 14px 20px 20px; flex: 1; }
.shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 640px) { .shop-grid { grid-template-columns: 1fr; } }
.shop-item { display: flex; flex-direction: column; gap: 4px; border: 1px solid #eee9e0; border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.shop-item b { font-size: 14px; line-height: 1.3; }
.shop-item .muted { font-size: 12px; }
.shop-price { font-weight: 500; color: var(--accent, #ff5a1f); }

/* ---------- Витрина-кнопка (fab) ---------- */
.shop-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--accent, #ff5a1f); color: #fff; border: none; cursor: pointer;
  padding: 12px 18px; border-radius: 999px; font: inherit; font-weight: 500; font-size: 14px;
  box-shadow: 0 12px 30px rgba(255, 90, 31, .35);
  transition: transform .2s;
}
.shop-fab:hover { transform: translateY(-2px); }
@media (max-width: 720px) { .shop-fab span { display: none; } .shop-fab { padding: 13px; } }

/* ---------- Hero видео ---------- */
.hero-videos { position: absolute; inset: 0; overflow: hidden; }
.hero-videos video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .9s ease; }
.hero-videos video.on { opacity: 1; }

/* ---------- Аренда ---------- */
.rent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.rent-card { display: flex; flex-direction: column; gap: 8px; background: #fff; border: 1px solid #eee9e0; border-radius: 18px; padding: 18px; }
.rent-card h3 { margin: 0; font-size: 17px; line-height: 1.3; }
.rent-card p { margin: 0; font-size: 13.5px; color: #6f6960; line-height: 1.45; flex: 1; }
.rent-prices { display: flex; gap: 8px; flex-wrap: wrap; }
.rent-tag { background: #f5f1ea; border-radius: 10px; padding: 7px 11px; font-size: 13px; }
.rent-tag b { font-variant-numeric: tabular-nums; }
.rent-dep { font-size: 12.5px; color: #8b857b; }
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.step-card { background: #fff; border: 1px solid #eee9e0; border-radius: 16px; padding: 16px; }
.step-card .num { font-size: 24px; font-weight: 500; color: var(--accent, #ff5a1f); }
.step-card b { display: block; margin: 6px 0 4px; }
.step-card p { margin: 0; font-size: 13.5px; color: #6f6960; line-height: 1.5; }

@media (max-width: 720px) {
  .cart-row { grid-template-columns: 44px 1fr auto; grid-template-rows: auto auto; }
  .cr-sum { grid-column: 2; }
  .cr-del { grid-row: 1; }
}

/* ============================================================
   v2.3 — единые размеры карточек, медиа на карточках,
   тайлы разделов с фото/видео, мобильная сетка
   ============================================================ */

/* ---------- Карточки каталога: цена и кнопка не пересекаются ---------- */
.prod .p-bottom { flex-wrap: nowrap; gap: 8px; }
.prod .p-price { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
.prod .p-cart { flex: none; }
.prod .p-media img, .prod .p-media video { aspect-ratio: 4 / 3; width: 100%; height: auto; object-fit: cover; display: block; }
/* видео в карточке без фото: заполнить квадратный контейнер целиком (без серой полосы) */
.prod .p-media video { height: 100%; }

/* ---------- Хиты продаж и аренды: карточки одного размера ---------- */
.hot-scroll { align-items: stretch; }
.hot-card { width: 100%; height: 100%; }
.hc-media { aspect-ratio: 1 / 1; width: 100%; position: relative; }
.hc-media img, .hc-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.hc-noimg { display: grid; place-items: center; color: #b9b1a4; }
.hc-noimg::after { content: "нет фото"; font-size: 12px; }
.hot-card b { flex: 1 0 auto; min-height: 2.7em; }
.hot-card .hc-price { margin-top: auto; white-space: nowrap; }
.hot-card.rent .btn { margin-top: 8px; }

/* ---------- Аренда: фото/видео в карточке ---------- */
.rent-media { aspect-ratio: 4 / 3; border-radius: 12px 12px 0 0; overflow: hidden; background: #f5f1ea; margin: -18px -18px 0; border-bottom: 1px solid #eee9e0; position: relative; }
.rent-media img, .rent-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.rent-noimg { display: grid; place-items: center; color: #b9b1a4; }
.rent-noimg svg { width: 42px; height: 42px; }

/* ---------- Тайлы «Что продаём» с фото/видео и плашкой ---------- */
.cat-card { position: relative; }
.cat-card.has-media { padding: 0; min-height: 240px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
.cat-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .45s var(--ease); }
.cat-card:hover .cat-media { transform: scale(1.05); }
.cat-card.has-media::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20,14,8,0) 30%, rgba(20,14,8,.45) 100%); }
.cat-plate { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 6px; margin: 16px; padding: 14px 16px; background: rgba(255,255,255,.94); border-radius: 12px; box-shadow: 0 10px 28px rgba(35,28,18,.16); }
.cat-plate h3 { margin: 0; }
.cat-plate .cat-n { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.cat-plate .cat-count { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }

/* ---------- «О магазине»: видео вместо фото ---------- */
.img-band video { width: 100%; height: clamp(280px, 44vw, 520px); object-fit: cover; display: block; }

/* ---------- Мобильная версия: всё ровно ---------- */
@media (max-width: 640px) {
  .prod-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .prod { padding: 12px 12px 12px; min-height: 0; gap: 9px; }
  .prod .p-media { margin: -12px -12px 0; border-radius: 0; }
  .prod .p-media img, .prod .p-media video { aspect-ratio: 1 / 1; }
  .prod h3 { font-size: 14px; -webkit-line-clamp: 2; }
  .prod .p-price { font-size: 14.5px; }
  .prod .p-bottom { flex-direction: column; align-items: stretch; gap: 6px; }
  .prod .p-cart { width: 100%; min-width: 0; height: 40px; }
  .hot-scroll { grid-auto-columns: minmax(210px, 1fr); gap: 12px; }
  .hot-card { padding: 12px; min-height: 0; }
  .rent-grid { grid-template-columns: 1fr; gap: 14px; }
  .rent-card { padding: 14px; }
  .rent-media { margin: -14px -14px 0; aspect-ratio: 4 / 3; }
  .cat-card.has-media { min-height: 210px; }
  .cat-plate { margin: 12px; padding: 12px 14px; }
  .cat-plate h3 { font-size: 17px; }
  .img-band img, .img-band video { height: clamp(220px, 52vw, 320px); }
}
@media (min-width: 641px) and (max-width: 1080px) {
  .rent-grid { grid-template-columns: 1fr 1fr; }
}
