/* FILE: index.css | Стили витрины (index.html): баннер, сетка товаров, карточка товара, нижняя кнопка покупки,
   корзина, профиль, заявки, экран чата. Общие токены и компоненты — common.css. Логика — index.js.
   Брейкпоинты: @media (max-width:1024px) — планшет, @media (max-width:768px) — телефон. */

/* ---------- Главная ---------- */
.banner{display:flex;align-items:center;gap:14px;padding:20px 22px;border-radius:var(--radius);background:var(--accent);color:var(--on-accent);margin-bottom:16px;cursor:pointer;transition:transform .15s}
.banner:active{transform:scale(.99)}
.banner-title{font-size:20px;font-weight:800;line-height:1.2}
.banner-sub{opacity:.75;font-size:14px;margin-top:4px}
.home-search{margin-bottom:14px}
.home-chips{margin-bottom:10px}
.sub-chips{margin-bottom:14px}
.cat-title{font-size:20px;font-weight:800;margin:22px 0 4px;grid-column:1/-1}
.cat-title:first-child{margin-top:4px}
.sec-title{grid-column:1/-1;margin:12px 0 0}
.sync-note{grid-column:1/-1;margin-top:-2px}

/* ---------- Сетка товаров: 4–5 колонок (ПК), 3 (планшет), 2 (телефон) ---------- */
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:16px}
.pcard{display:flex;flex-direction:column;border:1px solid var(--border);border-radius:var(--radius);overflow:hidden;background:var(--card);cursor:pointer;transition:transform .2s var(--ease),box-shadow .2s}
.pcard:hover{box-shadow:var(--shadow)}
.pcard:active{transform:scale(.98)}
.pcard-img{aspect-ratio:1/1;background:#fff;display:grid;place-items:center;overflow:hidden;position:relative}
.pcard-img img{width:100%;height:100%;object-fit:contain;opacity:0;transition:opacity .35s}
.pcard-img img.loaded{opacity:1}
.ph{width:100%;height:100%;display:grid;place-items:center;background:var(--surface);color:var(--muted)}
.ph svg{width:42%;height:42%;opacity:.35;stroke-width:1.2}
:root[data-theme=dark] .pcard-img{background:#fff}
.pcard-body{padding:12px 14px 14px;display:flex;flex-direction:column;gap:6px;flex:1}
.pcard-name{font-size:15px;line-height:1.3;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;min-height:2.6em}
.pcard-foot{display:flex;align-items:center;justify-content:space-between;margin-top:auto}
.pcard-price{font-size:18px;font-weight:800;letter-spacing:-.01em}
.pcard .icon-btn{width:40px;height:40px;margin:-6px -8px -6px 0;color:var(--muted)}
.pcard .icon-btn.on{color:var(--danger)}
.more-sentinel{grid-column:1/-1;height:40px}

/* ---------- Карточка товара ---------- */
.item-page{max-width:880px;margin:0 auto;display:grid;grid-template-columns:1fr 1fr;gap:28px;align-items:start}
.item-photo{border-radius:var(--radius);overflow:hidden;background:#fff;aspect-ratio:1/1;display:grid;place-items:center;cursor:zoom-in;border:1px solid var(--border)}
.item-photo img{width:100%;height:100%;object-fit:contain}
.item-name{font-size:24px;font-weight:800;line-height:1.25}
.item-price-row{display:flex;align-items:center;gap:6px;margin:12px 0 4px}
.item-price{font-size:30px;font-weight:800;flex:1;letter-spacing:-.01em}
.item-desc{white-space:pre-line;line-height:1.55}
.item-actions{display:flex;flex-direction:column;gap:10px;margin-top:20px}
.stepper{display:inline-flex;align-items:center;gap:4px;padding:4px;border-radius:12px;background:var(--surface)}
.stepper button{width:40px;height:40px;border-radius:10px;display:grid;place-items:center}
.stepper button:active{background:var(--bg)}
.stepper b{min-width:28px;text-align:center}
.buybar{position:fixed;left:0;right:0;bottom:0;z-index:30;padding:12px 16px calc(12px + var(--safe-b));background:var(--bg);border-top:1px solid var(--border);display:none}

/* ---------- Корзина ---------- */
.cart-row{display:grid;grid-template-columns:84px 1fr auto;gap:14px;padding:16px 0;border-bottom:1px solid var(--border);align-items:start}
.cart-thumb{width:84px;height:84px;border-radius:14px;overflow:hidden;background:#fff;border:1px solid var(--border)}
.cart-thumb img{width:100%;height:100%;object-fit:contain}
.cart-row.missing{opacity:.5}
.cart-sum{margin-top:18px;padding-top:14px;border-top:3px solid var(--surface)}
.cart-sum .row{min-height:34px}
.cart-total{font-size:22px;font-weight:800}

/* ---------- Профиль, заявки ---------- */
.profile-head{display:flex;align-items:center;gap:16px;margin-bottom:20px}
.profile-head .avatar{width:64px;height:64px;font-size:24px}
.tiles{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:16px}
.order-card{margin-bottom:12px;cursor:pointer}
.order-items{margin-top:10px;font-size:14px}
.footer-note{margin-top:28px;text-align:center;font-size:13px;color:var(--muted)}

/* ---------- Экран чата: на всю высоту ---------- */
body.chat-open .app-view{max-width:none;padding:0;height:100vh;display:flex;flex-direction:column;flex:none}
body.chat-open .app-view>.chat-wrap{flex:1;min-height:0;display:flex;flex-direction:column;max-width:900px;width:100%;margin:0 auto;border-left:1px solid var(--border);border-right:1px solid var(--border)}
.chat-wrap>.chat{flex:1;min-height:0}

/* ---------- Планшет ---------- */
@media (max-width:1024px){
  .grid{grid-template-columns:repeat(3,1fr);gap:14px}
  .item-page{gap:20px}
}

/* ---------- Телефон ---------- */
@media (max-width:768px){
  .grid{grid-template-columns:repeat(2,1fr);gap:10px}
  .pcard-body{padding:10px 12px 12px}
  .pcard-name{font-size:14px}
  .pcard-price{font-size:16px}
  .item-page{grid-template-columns:1fr;gap:14px}
  .item-name{font-size:21px}
  .item-price{font-size:26px}
  .buybar.on{display:block}
  body.has-buybar .app-nav{display:none}
  body.has-buybar .app-view{padding-bottom:calc(96px + var(--safe-b))}
  .item-actions.desktop-only{display:none}
  .cart-row{grid-template-columns:72px 1fr auto;gap:12px}
  .cart-thumb{width:72px;height:72px}
  body.chat-open .app-view{height:100dvh}
  body.chat-open .app-view>.chat-wrap{border:0}
}
