/* @req FR-CATALOG-001, FR-PRODUCT-001, FR-CART-001, FR-CHECKOUT-001, FR-ADMIN-001
   Стили магазинных страниц: каталог, товар, корзина, оформление, админка. */

/* ===== Hero страницы (общий заголовок) ===== */
.page-hero {
  margin: 22px; background: var(--paper); border: 1px solid var(--line-soft);
  border-radius: 24px; padding: 40px 48px;
}
.crumbs { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-faint); margin-bottom: 12px; }
.crumbs a { color: var(--ink-faint); text-decoration: none; }
.crumbs a:hover { color: var(--brand); }
.page-h1 {
  font-family: var(--sans); font-weight: 800; font-size: clamp(34px, 5vw, 56px);
  line-height: 0.98; letter-spacing: -0.025em; text-transform: uppercase; margin: 0 0 10px;
}
.page-sub { color: var(--ink-soft); font-size: 16px; line-height: 1.55; margin: 0; max-width: 560px; }

/* ===== Панель фильтров ===== */
.filter-bar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 16px 22px;
  background: var(--page-bg);
  border-bottom: 1px solid var(--line-soft);
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: transparent; border: 1.5px solid var(--line); color: var(--ink);
  padding: 9px 16px; border-radius: 999px; font-family: var(--sans); font-weight: 600;
  font-size: 14px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: var(--ink); }
.chip.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.sort-select {
  background: #fff; border: 1.5px solid var(--line); border-radius: 999px;
  padding: 10px 16px; font-family: var(--sans); font-weight: 600; font-size: 14px;
  color: var(--ink); cursor: pointer;
}
.filter-count { margin-left: auto; color: var(--ink-soft); font-size: 13px; font-weight: 500; }

/* ===== Фильтр по цвету ===== */
.color-filter { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 0 22px 6px; }
.color-fl {
  display: inline-flex; align-items: center; gap: 7px;
  background: #fff; border: 1.5px solid var(--line); color: var(--ink);
  padding: 7px 13px; border-radius: 999px; cursor: pointer;
  font-family: var(--sans); font-weight: 600; font-size: 13px; white-space: nowrap;
  transition: border-color .15s, background .15s;
}
.color-fl:hover { border-color: var(--ink); }
.color-fl.is-active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-deep); }
.color-fl .dot { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.08); }

/* ===== Сетка товаров ===== */
.grid { display: grid; gap: 18px; padding: 18px 22px 80px; grid-template-columns: repeat(4, 1fr); }

/* ===== Карточка товара ===== */
.card {
  background: #fff; border-radius: 22px; overflow: hidden; border: 1px solid var(--line-soft);
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -20px rgba(20,20,28,0.20); border-color: var(--line); }
.card-photo { aspect-ratio: 4 / 5; overflow: hidden; position: relative; background: var(--soft-cream); }
.card-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .card-photo img { transform: scale(1.04); }
.card-photo-ph {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--ink-faint); font-size: 13px; font-weight: 600; text-align: center; padding: 12px;
  background: repeating-linear-gradient(135deg, transparent 0 14px, rgba(26,22,38,0.04) 14px 15px);
}
.card-badge {
  position: absolute; top: 14px; left: 14px; background: var(--brand); color: #fff;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 6px 12px; border-radius: 999px; z-index: 2;
}
.card-body { padding: 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card-name { font-family: var(--sans); font-weight: 700; font-size: 16px; line-height: 1.2; margin: 0; }
.card-material { color: var(--ink-soft); font-weight: 500; font-size: 13.5px; }
.card-colors { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.color-dot { width: 18px; height: 18px; border: 1.5px solid rgba(0,0,0,0.08); border-radius: 50%; }
.color-more { color: var(--ink-faint); font-size: 11.5px; font-weight: 700; margin-left: 2px; }
.card-bottom { display: flex; align-items: flex-end; gap: 8px; margin-top: auto; padding-top: 4px; }
.card-price { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.price-from { color: var(--ink-faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.price-value { font-family: var(--sans); font-weight: 800; font-size: 18px; color: var(--ink); line-height: 1.1; }
.card-cta {
  width: 42px; height: 42px; border-radius: 999px; background: var(--telegram); color: #fff;
  border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .15s, transform .15s;
}
.card-cta:hover { background: var(--telegram-deep); transform: scale(1.05); }
.card-cta svg { width: 20px; height: 20px; }

/* ===== Страница товара ===== */
.product { display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; padding: 22px; align-items: start; }
.product-gallery { display: flex; flex-direction: column; gap: 12px; }
.product-photo {
  aspect-ratio: 4 / 5; border-radius: 24px; overflow: hidden; background: var(--soft-cream);
  display: flex; align-items: center; justify-content: center;
}
.product-photo img { width: 100%; height: 100%; object-fit: cover; }
.product-thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.product-thumb { width: 72px; height: 72px; border-radius: 14px; overflow: hidden; border: 2px solid transparent; cursor: pointer; background: var(--soft-cream); }
.product-thumb.is-active { border-color: var(--brand); }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-info { display: flex; flex-direction: column; gap: 18px; }
.product-title { font-family: var(--sans); font-weight: 800; font-size: clamp(26px, 3vw, 38px); line-height: 1; letter-spacing: -0.02em; text-transform: uppercase; margin: 0; }
.product-material { color: var(--ink-soft); font-size: 15px; }
.product-desc { color: var(--ink-soft); font-size: 15px; line-height: 1.55; margin: 0; }
.product-section h4 { font-family: var(--sans); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); margin: 0 0 10px; }
.color-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.color-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px;
  background: #fff; border: 1.5px solid var(--line); border-radius: 999px; cursor: pointer;
  font-family: var(--sans); font-weight: 500; font-size: 13.5px; transition: border-color .15s, background .15s;
}
.color-chip:hover { border-color: var(--ink); }
.color-chip.is-active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-deep); font-weight: 700; }
.color-chip-dot { width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.08); }
.specs { margin: 0; padding: 0; border-top: 1px solid var(--line-soft); }
.spec-row { display: grid; grid-template-columns: 140px 1fr; padding: 10px 0; border-bottom: 1px solid var(--line-soft); margin: 0; }
.spec-row dt { color: var(--ink-faint); font-size: 13px; font-weight: 600; }
.spec-row dd { color: var(--ink); font-size: 14px; margin: 0; font-weight: 500; }
.product-price-block { background: var(--soft-cream); border-radius: 16px; padding: 18px 20px; }
.product-price { font-family: var(--sans); font-weight: 800; font-size: 30px; line-height: 1.05; color: var(--ink); }
.product-cta-row { display: flex; gap: 10px; flex-wrap: wrap; }
.product-cta-row .btn { flex: 1; min-width: 180px; }

/* ===== Корзина ===== */
.cart-wrap { display: grid; grid-template-columns: 1.6fr 1fr; gap: 22px; padding: 22px; align-items: start; }
.cart-list { display: flex; flex-direction: column; gap: 12px; }
.cart-item {
  display: grid; grid-template-columns: 88px 1fr auto; gap: 16px; align-items: center;
  background: #fff; border: 1px solid var(--line-soft); border-radius: 18px; padding: 14px;
}
.cart-item-photo { width: 88px; height: 88px; border-radius: 12px; overflow: hidden; background: var(--soft-cream); }
.cart-item-photo img { width: 100%; height: 100%; object-fit: cover; }
.cart-item-name { font-weight: 700; font-size: 15px; margin: 0 0 2px; }
.cart-item-color { color: var(--ink-soft); font-size: 13px; }
.cart-item-price { font-weight: 800; font-size: 16px; margin-top: 4px; }
.qty { display: inline-flex; align-items: center; gap: 6px; }
.qty button {
  width: 32px; height: 32px; border-radius: 999px; border: 1.5px solid var(--line);
  background: #fff; cursor: pointer; font-size: 18px; line-height: 1; color: var(--ink);
}
.qty button:hover { border-color: var(--ink); }
.qty span { min-width: 28px; text-align: center; font-weight: 700; }
.cart-remove { background: none; border: 0; color: var(--ink-faint); cursor: pointer; font-size: 13px; margin-top: 6px; }
.cart-remove:hover { color: #C7141E; }
.cart-summary { background: var(--paper); border: 1px solid var(--line-soft); border-radius: 20px; padding: 24px; position: sticky; top: 90px; }
.cart-summary h3 { margin: 0 0 16px; font-size: 20px; }
.summary-row { display: flex; justify-content: space-between; padding: 8px 0; color: var(--ink-soft); font-size: 14px; }
.summary-total { display: flex; justify-content: space-between; padding: 14px 0 18px; font-weight: 800; font-size: 22px; border-top: 1px solid var(--line); margin-top: 8px; }

/* ===== Формы (оформление / админка / вход) ===== */
.form-card { background: #fff; border: 1px solid var(--line-soft); border-radius: 20px; padding: 28px; }
.form-grid { display: grid; gap: 14px; }
.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-group label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.input, .textarea, .select {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px;
  font-family: var(--sans); font-size: 15px; color: var(--ink); background: #fff;
  transition: border-color .15s;
}
.input:focus, .textarea:focus, .select:focus { outline: 0; border-color: var(--brand); }
.textarea { min-height: 90px; resize: vertical; }
.field-error { color: #C7141E; font-size: 12.5px; font-weight: 600; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ===== Оформление ===== */
.checkout-wrap { display: grid; grid-template-columns: 1.2fr 1fr; gap: 22px; padding: 22px; align-items: start; }
.thanks { text-align: center; padding: 60px 24px; }
.thanks .emoji { font-size: 64px; margin-bottom: 12px; }

/* ===== Админка ===== */
.admin-wrap { padding: 22px; max-width: 1100px; margin: 0 auto; }
.admin-login { max-width: 380px; margin: 60px auto; }
.admin-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; flex-wrap: wrap; gap: 12px; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.admin-list { display: flex; flex-direction: column; gap: 10px; }
.admin-row.is-hidden { opacity: 0.55; }
.hidden-tag { font-size: 11px; font-weight: 700; color: var(--ink-faint); background: var(--soft-cream); padding: 2px 8px; border-radius: 999px; margin-left: 6px; }
.admin-row {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center;
  background: #fff; border: 1px solid var(--line-soft); border-radius: 14px; padding: 10px 12px;
}
.admin-row-photo { width: 56px; height: 56px; border-radius: 10px; overflow: hidden; background: var(--soft-cream); }
.admin-row-photo img { width: 100%; height: 100%; object-fit: cover; }
.admin-row-actions { display: flex; gap: 6px; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-danger { background: #C7141E; color: #fff; }
.btn-danger:hover { background: #a30f17; }
.upload-area { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.thumbs-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.thumb-box { position: relative; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: var(--soft-cream); }
.thumb-box img { width: 100%; height: 100%; object-fit: cover; }
.thumb-box button { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 999px; border: 0; background: rgba(0,0,0,0.6); color: #fff; cursor: pointer; font-size: 12px; line-height: 1; }
.thumb-box--lg { width: 120px; height: 120px; border-radius: 14px; }
.color-photo-card { border: 1px solid var(--line-soft); border-radius: 14px; padding: 12px; margin-bottom: 10px; background: #fff; }
.color-photo-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.color-photo-head b { font-size: 14px; }
.color-photo-rm { margin-left: auto; border: 0; background: none; cursor: pointer; color: var(--ink-faint); font-size: 14px; }
.thumb-add {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  width: 64px; height: 64px; border-radius: 10px; border: 1.5px dashed var(--line);
  color: var(--ink-soft); font-size: 12px; font-weight: 600; cursor: pointer;
  background: var(--soft-cream); transition: border-color .15s, color .15s;
}
.thumb-add:hover { border-color: var(--brand); color: var(--brand); }
.color-builder { display: flex; gap: 8px; flex-wrap: wrap; }
.color-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.preset-swatch {
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); padding: 0;
  transition: transform .12s;
}
.preset-swatch:hover { transform: scale(1.18); }
.order-card { background: #fff; border: 1px solid var(--line-soft); border-radius: 16px; padding: 16px; margin-bottom: 12px; }
.order-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.order-status { background: var(--brand-soft); color: var(--brand-deep); font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; text-transform: uppercase; }
.order-items { font-size: 14px; color: var(--ink-soft); }
.badges-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ===== Инструкция (вкладка админки) ===== */
.guide { max-width: 760px; }
.guide-hero {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, var(--brand-soft), var(--brand-tint));
  border: 1px solid var(--line-soft); border-radius: 20px; padding: 22px 24px; margin-bottom: 18px;
}
.guide-hero-emoji { font-size: 40px; line-height: 1; }
.guide-steps { display: flex; flex-direction: column; gap: 12px; }
.guide-step {
  display: grid; grid-template-columns: 40px 44px 1fr; gap: 14px; align-items: start;
  background: #fff; border: 1px solid var(--line-soft); border-radius: 16px; padding: 18px 20px;
  transition: border-color .15s, transform .15s;
}
.guide-step:hover { border-color: var(--brand); transform: translateX(2px); }
.guide-step-num {
  width: 36px; height: 36px; border-radius: 999px; background: var(--brand); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px;
}
.guide-step-icon { font-size: 30px; line-height: 1; text-align: center; }
.guide-step-title { margin: 4px 0 6px; font-size: 17px; font-weight: 700; }
.guide-step-body { margin: 0; color: var(--ink-soft); font-size: 14.5px; line-height: 1.55; }
.guide-tip {
  margin-top: 18px; padding: 16px 20px; border-radius: 14px;
  background: var(--soft-cream); border: 1px solid var(--line-soft); font-size: 14.5px; line-height: 1.5;
}
.guide-tip a { color: var(--brand); font-weight: 600; }
@media (max-width: 720px) {
  .guide-step { grid-template-columns: 34px 1fr; }
  .guide-step-icon { display: none; }
}

/* ===== Адаптив ===== */
@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .product { grid-template-columns: 1fr; }
  .cart-wrap, .checkout-wrap, .admin-grid { grid-template-columns: 1fr; }
  .cart-summary { position: static; }
}
@media (max-width: 720px) {
  .page-hero { margin: 12px; padding: 28px 22px; }
  .filter-bar { top: 60px; padding: 12px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 12px 80px; }
  .card-body { padding: 12px; gap: 8px; }
  .form-row-2 { grid-template-columns: 1fr; }
  .cart-item { grid-template-columns: 64px 1fr; }
  .cart-item-actions { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; }
}

/* @req FR-CATALOG-001 — новый дизайн каталога: hero-статы, скидки, избранное, RU/UZ, TG FAB */

/* ===== Hero со статистикой ===== */
.cat-hero { display: grid; grid-template-columns: 1.5fr 1fr; gap: 36px; align-items: center; }
.cat-hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.hstat {
  background: var(--soft-cream); border: 1px solid var(--line-soft); border-radius: 18px;
  padding: 20px 16px; display: flex; flex-direction: column; gap: 4px;
}
.hstat-num { font-family: var(--sans); font-weight: 800; font-size: 32px; line-height: 1; color: var(--brand); letter-spacing: -0.03em; }
.hstat-num small { font-size: 14px; opacity: 0.8; margin-left: 3px; }
.hstat-l { font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }

/* ===== Скидки на карточке ===== */
.card-badge.sale { background: var(--sale); }
.price-sale { display: flex; flex-direction: column; gap: 2px; }
.price-old-row { display: flex; align-items: center; gap: 7px; }
.price-old { color: var(--ink-faint); text-decoration: line-through; font-size: 12.5px; font-weight: 600; }
.price-pct { color: var(--sale); font-weight: 800; font-size: 11px; background: var(--sale-soft); padding: 1px 6px; border-radius: 999px; }
.price-new { font-family: var(--sans); font-weight: 800; font-size: 18px; color: var(--sale); line-height: 1.1; }

/* ===== Сердечко избранного ===== */
.card-fav {
  position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border-radius: 999px;
  background: rgba(255,255,255,0.92); color: var(--ink); border: 0; cursor: pointer; z-index: 2;
  display: inline-flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px); transition: background .15s, color .15s, transform .15s;
}
.card-fav:hover { background: #fff; transform: scale(1.05); }
.card-fav.is-active { background: var(--sale); color: #fff; }
.card-fav.is-active svg { fill: currentColor; }
.card-fav svg { width: 18px; height: 18px; }

/* ===== «Назад»-плашка в шапке (видна всегда, как на b2b) — FR-CATALOG-001 ===== */
.back-pill { display: inline-flex; }
.back-pill svg { width: 20px; height: 14px; }

/* ===== Бейдж избранного в шапке ===== */
.icon-pill { position: relative; }
.nav-badge {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px;
  background: var(--sale); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--header-bg);
}
.nav-badge[hidden] { display: none; }

/* ===== Переключатель языка RU/UZ ===== */
.lang-switch { display: inline-flex; align-items: center; background: #fff; border: 1.5px solid var(--line); border-radius: 999px; height: 52px; padding: 4px; gap: 2px; }
.lang-opt { border: 0; background: transparent; cursor: pointer; font-family: var(--sans); font-weight: 700; font-size: 13.5px; color: var(--ink-soft); height: 100%; padding: 0 14px; border-radius: 999px; display: inline-flex; align-items: center; transition: background .15s, color .15s; }
.lang-opt.is-active { background: var(--brand); color: #fff; }

/* ===== Плавающая кнопка Telegram ===== */
.tg-fab {
  position: fixed; right: 24px; bottom: 24px; width: 60px; height: 60px; border-radius: 999px;
  background: var(--telegram); color: #fff; display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 30px -8px rgba(34,158,217,0.6); z-index: 80; text-decoration: none; transition: transform .18s;
}
.tg-fab svg { width: 28px; height: 28px; }
.tg-fab:hover { transform: translateY(-2px) scale(1.04); }
.tg-fab::after { content: ""; position: absolute; inset: 0; border-radius: 999px; border: 2px solid var(--telegram); opacity: 0.5; animation: tg-fab-pulse 2.4s ease-out infinite; }
@keyframes tg-fab-pulse { 0% { transform: scale(1); opacity: 0.5; } 70% { transform: scale(1.5); opacity: 0; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tg-fab::after { display: none; } }

@media (max-width: 1100px) {
  .cat-hero { grid-template-columns: 1fr; gap: 24px; }
}
@media (max-width: 720px) {
  .cat-hero-stats { gap: 8px; }
  .hstat { padding: 14px 12px; border-radius: 14px; }
  .hstat-num { font-size: 24px; }
  .hstat-l { font-size: 10.5px; }
  .lang-switch { height: 42px; padding: 3px; }
  .lang-opt { font-size: 12px; padding: 0 9px; }
  .card-fav { width: 32px; height: 32px; top: 8px; right: 8px; }
  .tg-fab { right: 16px; bottom: 16px; width: 52px; height: 52px; }
}
