/* ─── Токены ─────────────────────────────────────────────────────────── */
:root {
  --ink: #14120F;
  --surface: #1E1A16;
  --surface-2: #262019;
  --line: #33291F;
  --flame: #FF4D2E;
  --flame-dim: #7A2A1B;
  --zest: #FFC53D;
  --fresh: #7A9B57;
  --text: #F7F1E8;
  --text-muted: #A79E92;
  --radius: 18px;
  --radius-sm: 12px;
  --font-display: 'Unbounded', sans-serif;
  --font-body: 'Manrope', sans-serif;
  --font-mono: 'Space Mono', monospace;
}

* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  padding-bottom: 130px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ─── Header ─────────────────────────────────────────────────────────── */
.app-header {
  padding: 18px 16px 12px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--ink) 100%);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.brand { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.brand-dot { color: var(--flame); }
.brand-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.eta-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
}
.eta-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--fresh);
  box-shadow: 0 0 0 0 rgba(122,155,87,0.6);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(122,155,87,0.5); }
  70% { box-shadow: 0 0 0 5px rgba(122,155,87,0); }
  100% { box-shadow: 0 0 0 0 rgba(122,155,87,0); }
}

.search-container { position: relative; }
.search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-muted);
}
.search-bar {
  width: 100%;
  padding: 13px 14px 13px 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  outline: none;
}
.search-bar::placeholder { color: var(--text-muted); }
.search-bar:focus { border-color: var(--flame); }

/* ─── Categories ─────────────────────────────────────────────────────── */
.categories-container {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px;
  scrollbar-width: none;
  position: sticky;
  top: 116px;
  z-index: 19;
  background: var(--ink);
}
.categories-container::-webkit-scrollbar { display: none; }
.category-btn {
  flex: 0 0 auto;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.category-btn.active {
  background: var(--flame);
  border-color: var(--flame);
  color: #1B0C07;
}

/* ─── Grid / Product cards ───────────────────────────────────────────── */
.container { padding: 4px 16px 24px; }
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.product {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.product-img-container {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--surface-2);
  overflow: hidden;
}
.product-img-container img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-weight {
  position: absolute; top: 8px; left: 8px;
  background: rgba(20,18,15,0.75);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
}
.product-content { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-name { font-size: 14px; font-weight: 600; line-height: 1.3; }
.product-price {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--zest);
  margin-top: auto;
}
.button-container { margin-top: 2px; }
.btn-add {
  width: 100%;
  padding: 9px 0;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--flame);
  color: var(--flame);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-add:hover { background: var(--flame); color: #1B0C07; }

.qty-controls-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--flame);
  border-radius: var(--radius-sm);
  padding: 4px;
}
.qty-controls-inline button {
  width: 28px; height: 28px;
  border: none;
  border-radius: 8px;
  background: rgba(0,0,0,0.15);
  color: #1B0C07;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.qty-display { color: #1B0C07; font-family: var(--font-mono); font-weight: 700; }

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.no-results span { font-size: 32px; }

/* ─── Skeleton ────────────────────────────────────────────────────────── */
.product-skeleton { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.skeleton-img { aspect-ratio: 1/1; }
.skeleton-content { padding: 10px 12px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; }
.skeleton-line { height: 12px; margin-bottom: 6px; }
.skeleton-line.medium { width: 80%; }
.skeleton-line.short { width: 50%; }
.skeleton-price { height: 14px; width: 40%; margin: 8px 0; }
.skeleton-btn { height: 30px; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ─── Floating cart / delivery progress (signature element) ─────────── */
.floating-cart {
  position: fixed;
  left: 12px; right: 12px; bottom: 12px;
  z-index: 30;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  overflow: hidden;
  transition: transform 0.25s ease;
}
.floating-cart.hidden { transform: translateY(140%); }

.delivery-progress { padding: 12px 14px 8px; }
.progress-track {
  position: relative;
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  margin-bottom: 8px;
}
.progress-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--flame-dim), var(--flame));
  border-radius: 999px;
  transition: width 0.35s ease;
}
.progress-rider {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  font-size: 16px;
  transition: left 0.35s ease;
}
.progress-label { font-size: 11.5px; color: var(--text-muted); font-family: var(--font-body); }
.progress-label.done { color: var(--fresh); font-weight: 700; }

.cart-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--flame);
  cursor: pointer;
}
.cart-bar-left { display: flex; align-items: center; gap: 10px; color: #1B0C07; font-weight: 700; font-size: 15px; }
.cart-badge {
  background: #1B0C07;
  color: var(--flame);
  font-family: var(--font-mono);
  font-weight: 700;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px;
}
.cart-bar-right { font-family: var(--font-mono); font-weight: 700; color: #1B0C07; font-size: 15px; }

/* ─── Checkout modal ──────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: flex-end;
  z-index: 50;
  transition: opacity 0.2s;
}
.modal.hidden { display: none; }
.modal-content {
  width: 100%;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  padding: 10px 20px 28px;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-handle { width: 40px; height: 4px; background: var(--line); border-radius: 999px; margin: 6px auto 14px; }
.modal-close {
  position: absolute; top: 14px; right: 16px;
  background: var(--surface-2); border: none; color: var(--text);
  width: 30px; height: 30px; border-radius: 50%; font-size: 15px; cursor: pointer;
}
.modal h2 { font-family: var(--font-display); font-size: 18px; margin: 0 0 14px; }

.checkout-items { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.checkout-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  font-size: 13.5px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.checkout-item-qty { color: var(--text-muted); font-family: var(--font-mono); }
.checkout-item-price { font-family: var(--font-mono); color: var(--zest); }

.checkout-total {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--line); margin-bottom: 14px;
}
.checkout-total-label { color: var(--text-muted); font-size: 14px; }
.checkout-total-amount { font-family: var(--font-mono); font-size: 20px; font-weight: 700; color: var(--zest); }

#checkout-form { display: flex; flex-direction: column; gap: 10px; }
#checkout-form input {
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14.5px;
  outline: none;
}
#checkout-form input:focus { border-color: var(--flame); }
.btn-submit {
  margin-top: 6px;
  padding: 15px 0;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--flame);
  color: #1B0C07;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
}
.btn-submit:disabled { opacity: 0.6; }

/* ─── Success screen ──────────────────────────────────────────────────── */
.success-screen {
  position: fixed; inset: 0; z-index: 60;
  background: var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.success-content { text-align: center; padding: 20px; }
.success-icon {
  width: 64px; height: 64px; margin: 0 auto 18px;
  background: var(--fresh); color: var(--ink);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700;
}
.success-content h2 { font-family: var(--font-display); margin: 0 0 8px; }
.success-content p { color: var(--text-muted); margin: 0 0 22px; }
.btn-done {
  padding: 13px 32px; border: none; border-radius: var(--radius-sm);
  background: var(--flame); color: #1B0C07; font-weight: 700; font-size: 14.5px; cursor: pointer;
}

@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .modal { align-items: center; justify-content: center; }
  .modal-content { max-width: 420px; border-radius: 22px; }
}
