* { box-sizing: border-box; }
:root {
  --dark: #0d0d0d;
  --dark-2: #171717;
  --line: #2a2a2a;
  --muted: #a0a0a0;
}
body {
  font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  margin: 0;
  background: #f6f7f9;
  color: #1a1a1a;
}

/* ---------- Шапка (тёмная, на всех страницах) ---------- */
.site-header {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  padding: 18px 40px;
  background: var(--dark);
  color: #fff;
}
.header-left { order: 1; display: flex; align-items: center; }
.category-menu { order: 2; }
.header-right { order: 3; margin-left: auto; display: flex; align-items: center; gap: 26px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.logo-mark {
  width: 34px; height: 34px;
  border: 1.5px solid #fff; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.logo-text { font-weight: 700; letter-spacing: 2px; font-size: 14px; text-transform: uppercase; }

.category-menu { position: relative; }
.category-menu-button {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: #fff;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  max-width: 220px;
  cursor: pointer;
  font-family: inherit;
}
.category-menu-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.category-menu-button svg { flex-shrink: 0; }

.category-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 260px;
  max-width: 320px;
  max-height: 70vh;
  overflow-y: auto;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 6px;
  z-index: 40;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.category-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 11px 12px;
  background: none;
  border: none;
  border-radius: 6px;
  color: #eee;
  font-size: 13px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}
.category-menu-item:hover { background: #2a2a2a; }
.category-menu-item-parent svg { color: #999; flex-shrink: 0; }
.category-menu-view-all { color: #9ec1ff; font-size: 12px; }

.category-menu-back {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 11px 12px;
  margin-bottom: 4px;
  background: none;
  border: none;
  border-bottom: 1px solid #333;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.category-menu-back:hover { color: #9ec1ff; }

.delivery-badge {
  display: flex; align-items: center; gap: 10px;
  color: #cfcfcf; font-size: 11px; line-height: 1.35;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.cart-link {
  text-decoration: none; color: #fff; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}

/* ---------- Обложка (главная страница) ---------- */
.hero {
  background: linear-gradient(180deg, var(--dark) 0%, var(--dark-2) 100%);
  color: #fff;
  padding: 90px 40px 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  flex-wrap: wrap;
}
.hero-content { max-width: 560px; }
.hero-title {
  font-size: 64px; line-height: 0.95; font-weight: 800;
  text-transform: uppercase; letter-spacing: 1px; margin: 0 0 24px;
}
.hero-title .line2 { color: #8a8a8a; }
.hero-subtitle {
  font-size: 14px; color: #c7c7c7; letter-spacing: 1px;
  text-transform: uppercase; margin-bottom: 36px;
}
.hero-cta {
  display: inline-flex; align-items: center; gap: 12px;
  border: 1px solid #fff; border-radius: 999px;
  padding: 16px 28px; color: #fff; text-decoration: none;
  font-size: 12px; letter-spacing: 1px; text-transform: uppercase; font-weight: 600;
  transition: background .2s, color .2s;
}
.hero-cta:hover { background: #fff; color: #000; }
.hero-visual {
  width: 320px; height: 320px; border-radius: 16px; flex-shrink: 0;
  background: radial-gradient(circle at 30% 20%, #2a2a2a, #0a0a0a 70%);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.hero-visual::before {
  content: 'SS';
  font-size: 140px;
  font-weight: 800;
  letter-spacing: 4px;
  color: rgba(255, 255, 255, 0.06);
}

.features {
  background: var(--dark-2);
  color: #fff;
  padding: 36px 40px;
  display: flex;
  gap: 48px;
  flex-wrap: wrap;
}
.feature { display: flex; align-items: center; gap: 14px; }
.feature-text {
  font-size: 11px; letter-spacing: 0.5px; text-transform: uppercase;
  color: #d5d5d5; line-height: 1.5;
}

.delivery-section {
  background: var(--dark);
  color: #fff;
  padding: 36px 40px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}
.delivery-text {
  font-size: 12px; text-transform: uppercase; letter-spacing: 1px; text-align: right;
}

@media (max-width: 700px) {
  .site-header { padding: 14px 20px; row-gap: 10px; }
  .header-left { gap: 14px; }

  .category-menu { order: 3; flex-basis: 100%; }
  .category-menu-button { max-width: none; width: 100%; justify-content: space-between; }

  .header-right { order: 2; }
  .delivery-badge { display: none; }

  .category-menu-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    min-width: 0;
    max-width: none;
    width: 100%;
  }
  .category-menu-item, .category-menu-back { padding: 14px 12px; font-size: 14px; }

  .hero { padding: 50px 20px; }
  .hero-title { font-size: 40px; }
  .hero-visual { display: none; }
  .features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px 16px;
    padding: 28px 20px;
  }
  .delivery-section { padding: 28px 20px; justify-content: center; text-align: center; }
  .feature { flex-direction: column; gap: 8px; text-align: center; }

  /* Строке корзины на узком экране не хватает места на всё в один ряд —
     переносим количество и "Удалить" единым блоком на новую строку,
     чтобы кнопка не вылезала за пределы экрана */
  .cart-row { flex-wrap: wrap; }
  .cart-row-actions { flex: 1 1 100%; justify-content: space-between; margin-top: 4px; }
}

.container { max-width: 960px; margin: 0 auto; padding: 24px; }

.subcategory-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.chip {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #ddd;
  color: #1a1a1a;
  text-decoration: none;
  font-size: 13px;
}
.chip:hover { border-color: #999; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}
.card {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}
.card img { width: 100%; height: 160px; object-fit: cover; border-radius: 8px; }
.card h3 { margin: 12px 0 4px; font-size: 16px; }
.card .desc { font-size: 13px; color: #666; min-height: 32px; }
.card .price { font-weight: 700; margin: 8px 0; }
.card .stock { font-size: 12px; color: #2e7d32; margin: 0 0 8px; }
.card .stock.out { color: #c0392b; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.qty-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.btn {
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  background: #eee;
  font-size: 15px;
}
.btn.plus, .btn.minus { padding: 6px 12px; }
.btn.primary { background: #2563eb; color: #fff; font-weight: 600; }
.btn.remove { background: #fdecea; color: #c0392b; font-size: 13px; }

.cart-items { display: flex; flex-direction: column; gap: 12px; }
.cart-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 12px;
}
.cart-row img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.cart-row-info { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.cart-row-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.remove-form { margin: 0; }

.total { font-size: 18px; font-weight: 700; text-align: right; margin: 16px 0; }

.receipt-preview {
  margin: 20px 0;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.receipt-preview iframe {
  display: block;
  width: 100%;
  height: 75vh;
  min-height: 420px;
  border: none;
}
@media (max-width: 700px) {
  /* На телефонах предпросмотр PDF в iframe часто не работает — не занимаем
     место пустым блоком, показываем только кнопку "Открыть документ" выше */
  .receipt-preview { display: none; }
}

.order-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 420px;
  background: #fff;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid #e5e5e5;
}
.order-form label { display: flex; flex-direction: column; font-size: 14px; gap: 4px; }
.order-form input, .order-form textarea {
  padding: 10px;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}
.error { color: #c0392b; font-weight: 600; }

.min-order-warning {
  background: #fff6e5;
  border: 1px solid #f0c987;
  color: #8a5a00;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  margin: 0 0 16px;
}
.btn.primary:disabled { background: #a8bde8; cursor: not-allowed; }

/* ---------- Тост-уведомления (замена стандартному alert()) ---------- */
.toast-container {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
  width: 100%;
  padding: 0 16px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
  background: #1a1a1a;
  color: #fff;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast svg { flex-shrink: 0; color: #f5a623; }
.toast-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 700px) {
  .toast-container { bottom: 16px; }
  .toast { max-width: none; }
}
