/* ===== Тема. Меняйте --accent, чтобы перекрасить весь магазин ===== */
:root {
  --accent: #10b981;        /* изумрудно-зелёный */
  --accent-dark: #059669;
  --accent-soft: #d1fae5;
  --bg: #f6f8f7;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e6ebe8;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(16, 185, 129, 0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 40px;
}

/* ===== Топбар ===== */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: 1px; }
.brand-mark { color: var(--accent); font-size: 18px; }
.brand-name { font-size: 16px; }
.cart-btn {
  position: relative; border: none; background: var(--accent-soft);
  width: 42px; height: 42px; border-radius: 12px; font-size: 18px; cursor: pointer;
}
.cart-count {
  position: absolute; top: -6px; right: -6px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* ===== Hero ===== */
.hero {
  margin: 16px; padding: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: var(--radius); color: #fff;
  box-shadow: var(--shadow);
}
.hero h1 { font-size: 26px; }
.hero h1 span { background: #fff; color: var(--accent-dark); padding: 0 8px; border-radius: 8px; }
.hero p { margin-top: 6px; opacity: 0.9; font-size: 14px; }

/* ===== Чипсы категорий ===== */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 12px; }
.chip {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--card);
  padding: 8px 14px; border-radius: 999px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* ===== Сетка товаров ===== */
.grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; padding: 0 16px;
}
.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04); cursor: pointer;
  display: flex; flex-direction: column;
}
.card-img { position: relative; aspect-ratio: 1; background: #eee; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.badge {
  position: absolute; top: 8px; left: 8px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 8px;
}
.card-body { padding: 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.card-price-row { margin-top: auto; display: flex; align-items: baseline; gap: 6px; }
.card-price { font-size: 15px; font-weight: 800; color: var(--accent-dark); }
.card-old { font-size: 12px; color: var(--muted); text-decoration: line-through; }

/* ===== Sheet (модалки) ===== */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet.hidden { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.4); }
.sheet-body {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--card); border-radius: 22px 22px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  max-height: 90vh; overflow-y: auto;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-close {
  position: absolute; top: 14px; right: 14px; border: none; background: #f1f5f4;
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 14px;
}

.p-image { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); }
.p-desc { color: var(--muted); font-size: 14px; margin: 10px 0; line-height: 1.5; }
.p-price-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.p-price { font-size: 24px; font-weight: 800; color: var(--accent-dark); }
.p-old { font-size: 15px; color: var(--muted); text-decoration: line-through; }
.p-sizes-label { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.sizes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.size {
  min-width: 46px; padding: 10px 0; text-align: center; border: 1px solid var(--line);
  border-radius: 10px; cursor: pointer; font-size: 14px;
}
.size.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; }

/* ===== Кнопки ===== */
.btn-primary {
  width: 100%; border: none; background: var(--accent); color: #fff;
  padding: 15px; border-radius: 14px; font-size: 15px; font-weight: 700; cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:active { background: var(--accent-dark); }

/* ===== Корзина ===== */
.cart-items { display: flex; flex-direction: column; gap: 12px; margin: 14px 0; }
.cart-item { display: flex; gap: 12px; align-items: center; }
.cart-item img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; }
.cart-item-info { flex: 1; }
.cart-item-name { font-size: 13px; font-weight: 600; }
.cart-item-meta { font-size: 12px; color: var(--muted); }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-size: 16px;
}
.cart-empty { text-align: center; color: var(--muted); padding: 24px 0; }
.cart-total-row {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 800; font-size: 18px; margin: 8px 0 16px;
}
.cart-total-row #cartTotal { color: var(--accent-dark); }

/* ===== Форма ===== */
.form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.form input, .form textarea {
  border: 1px solid var(--line); border-radius: 12px; padding: 13px;
  font-size: 14px; font-family: inherit; outline: none;
}
.form input:focus, .form textarea:focus { border-color: var(--accent); }
.form textarea { resize: vertical; min-height: 64px; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 12px 20px; border-radius: 12px;
  font-size: 14px; z-index: 100; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}
.toast.hidden { display: none; }

.hidden { display: none; }
