:root {
  --brand: #ff6b00;
  --brand-strong: #e85f00;
  --brand-soft: #fff0e5;
  --surface: #ffffff;
  --background: #f6f7fb;
  --text: #172033;
  --muted: #6b7280;
  --line: #e5e7eb;
  --success: #16a34a;
  --danger: #dc2626;
  --shadow: 0 10px 30px rgba(23, 32, 51, 0.09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: 105px;
  color: var(--text);
  background: var(--background);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.shop-header {
  position: relative;
  overflow: hidden;
  padding: 24px 18px 30px;
  color: #fff;
  text-align: center;
  background: linear-gradient(135deg, var(--brand), #ff9b52);
  border-radius: 0 0 28px 28px;
  box-shadow: 0 8px 28px color-mix(in srgb, var(--brand) 30%, transparent);
}

.shop-header::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -70px;
  top: -100px;
  border: 35px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}

.shop-header__back {
  position: absolute;
  top: 18px;
  left: 18px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  z-index: 1;
}

.shop-header h1 { margin: 8px 0 6px; font-size: clamp(1.65rem, 6vw, 2.3rem); }
.shop-header p { margin: 0; opacity: 0.9; }

.catalog-shell { width: min(1100px, 100%); margin: 0 auto; padding: 18px 14px; }
.catalog-toolbar { display: flex; gap: 10px; margin-bottom: 16px; }

.search-input {
  width: 100%;
  padding: 13px 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  box-shadow: 0 4px 18px rgba(23, 32, 51, 0.04);
}
.search-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.product-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(229, 231, 235, 0.8);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.product-card__image {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #fff;
}
.product-card__image img { width: 100%; height: 100%; padding: 10px; object-fit: contain; }
.food-theme .product-card__image img { padding: 0; object-fit: cover; }
.product-card__body { padding: 12px; }
.product-card__name { margin: 0; font-size: 1rem; line-height: 1.3; }
.product-card__description { margin: 5px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.4; }
.product-card__price { margin: 8px 0; color: var(--brand); font-size: 0.96rem; font-weight: 800; }

.featured-badge {
  position: absolute;
  top: 9px;
  left: 9px;
  z-index: 1;
  padding: 5px 8px;
  color: #fff;
  background: #ef4444;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
}

.field-label { display: block; margin-top: 8px; color: var(--muted); font-size: 0.72rem; font-weight: 700; }
.product-select {
  width: 100%;
  margin-top: 5px;
  padding: 9px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.qty-control {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  align-items: center;
  gap: 5px;
  margin-top: 11px;
  padding: 5px;
  background: #f7f8fa;
  border-radius: 11px;
}
.qty-control button {
  height: 32px;
  color: #fff;
  background: var(--brand);
  border: 0;
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 800;
}
.qty-control span { text-align: center; font-weight: 800; }

.cart-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: min(680px, 100%);
  margin: auto;
  padding: 13px 16px calc(13px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -7px 28px rgba(23, 32, 51, 0.14);
  backdrop-filter: blur(12px);
}
.cart-bar__summary small { display: block; color: var(--muted); }
.cart-bar__summary strong { color: var(--brand); font-size: 1.05rem; }

.primary-button {
  padding: 12px 18px;
  color: #fff;
  background: var(--brand);
  border: 0;
  border-radius: 12px;
  font-weight: 800;
}
.primary-button:hover { background: var(--brand-strong); }
.primary-button:disabled { cursor: not-allowed; opacity: 0.55; }
.primary-button--success { background: var(--success); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.62);
}
.modal.is-open { display: flex; }
.modal__content {
  width: min(560px, 100%);
  max-height: 82vh;
  overflow-y: auto;
  padding: 20px;
  background: #fff;
  border-radius: 22px;
}
.modal__header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal__header h2 { margin: 0; }
.icon-button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: #eef1f5; }
.cart-item { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cart-item small { display: block; margin-top: 4px; color: var(--muted); line-height: 1.4; }
.cart-item__price { margin-top: 5px; color: var(--brand); font-weight: 800; }
.danger-link { align-self: center; padding: 7px 9px; color: var(--danger); background: #fff0f0; border: 0; border-radius: 8px; }
.modal__total { display: flex; justify-content: space-between; padding: 16px 0; font-size: 1.1rem; font-weight: 800; }
.modal__actions { display: grid; gap: 9px; }
.secondary-button { padding: 11px; color: var(--muted); background: transparent; border: 0; font-weight: 700; }

.state-card {
  grid-column: 1 / -1;
  width: min(560px, 100%);
  margin: 35px auto;
  padding: 24px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.state-card h2 { margin-top: 0; }
.state-card p { color: var(--muted); line-height: 1.6; }
.state-card--error { border-color: #fecaca; }
.empty-state { padding: 25px 0; color: var(--muted); text-align: center; }

@media (min-width: 700px) {
  .catalog-shell { padding: 26px 20px; }
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
  .modal { align-items: center; }
}

@media (min-width: 1000px) {
  .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.apps-theme {
  --brand: #2563eb;
  --brand-strong: #1d4ed8;
  --brand-soft: #dbeafe;
}
.apps-theme .shop-header { background: linear-gradient(135deg, #172554, #2563eb 65%, #38bdf8); }
