:root {
  --red: #d62828;
  --red-dark: #a81f1f;
  --orange: #f77f00;
  --yellow: #fcbf49;
  --dark: #241c15;
  --bg: #fff8f0;
  --bg-soft: #ffffff;
  --text: #241c15;
  --text-soft: #6b6255;
  --border: rgba(36, 28, 21, 0.12);
  --shadow: 0 10px 30px rgba(36, 28, 21, 0.1);
  --radius: 16px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

h1, h2, h3, .brand-name { font-family: 'Poppins', system-ui, sans-serif; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

button { font-family: inherit; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--dark);
  border-bottom: 3px solid var(--red);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
}

.brand { margin-right: auto; display: flex; align-items: center; gap: 8px; }

.brand-emoji { font-size: 20px; line-height: 1; }
.brand-mark { display: flex; align-items: center; flex: 0 0 auto; }
.brand-mark svg { display: block; border-radius: 8px; }

.brand-logo-img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: cover;
  background: #fff;
}

.brand-name {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.header-order-status-link {
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  white-space: nowrap;
}
.header-order-status-link:hover { color: #fff; }

.cart-btn {
  position: relative;
  background: var(--red);
  border: none;
  border-radius: 999px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.cart-btn .icon { width: 22px; height: 22px; fill: #fff; }

.cart-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--yellow);
  color: var(--dark);
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.store-closed-banner {
  background: var(--red);
  color: #fff;
  text-align: center;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--red-dark); }

.btn-outline { background: transparent; border-color: var(--dark); color: var(--dark); }
.btn-outline:hover { background: var(--dark); color: #fff; }

.btn-sm { padding: 8px 16px; font-size: 12px; }
.btn-block { width: 100%; }

/* ---------- Hero ---------- */

.hero { padding: 40px 0 20px; text-align: center; }
.hero h1 { font-size: clamp(26px, 5vw, 38px); margin: 0 0 8px; }
.hero p { color: var(--text-soft); margin: 0; }

/* ---------- Category filters ---------- */

.category-filters {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 20px 0;
}

.filter-btn {
  flex: 0 0 auto;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
}

.filter-btn.active { background: var(--dark); color: var(--yellow); border-color: var(--dark); }

/* ---------- Menu ---------- */

.category-group { margin-bottom: 40px; }
.category-heading { font-size: 20px; margin: 0 0 16px; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.product-card {
  background: var(--bg-soft);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease;
}

.product-card:hover { transform: translateY(-3px); }

.product-media {
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, var(--yellow), var(--orange));
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-media img { width: 100%; height: 100%; object-fit: cover; }
.product-media-placeholder { font-size: 48px; }

.product-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-name { font-size: 16px; margin: 0; }
.product-desc { font-size: 13px; color: var(--text-soft); margin: 0; flex: 1; }

.product-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.product-price { font-weight: 700; color: var(--red-dark); }

.catalog-empty { text-align: center; color: var(--text-soft); padding: 40px 0; }

/* ---------- Cart drawer ---------- */

.cart-drawer { position: fixed; inset: 0; z-index: 100; }
.cart-drawer-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }

.cart-drawer-panel {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: min(420px, 100%);
  background: var(--bg-soft);
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 30px rgba(0,0,0,0.2);
}

.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.cart-drawer-header h2 { margin: 0; font-size: 18px; }

.icon-btn {
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-soft);
}

.cart-items { flex: 1; overflow-y: auto; padding: 12px 20px; }
.cart-empty { color: var(--text-soft); text-align: center; padding: 40px 0; }

.cart-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.cart-item-info { display: flex; flex-direction: column; gap: 2px; }
.cart-item-name { font-weight: 600; font-size: 14px; }
.cart-item-options { font-size: 12px; color: var(--text-soft); }
.cart-item-price { font-size: 12px; color: var(--text-soft); }

.cart-item-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.cart-item-remove { background: none; border: none; color: var(--red); font-size: 12px; cursor: pointer; }

.qty-stepper {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
}

.qty-stepper-sm { padding: 2px 8px; gap: 8px; }

.qty-btn {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  width: 20px;
  height: 20px;
  color: var(--text);
}

.cart-drawer-footer { padding: 16px 20px 20px; border-top: 1px solid var(--border); }
.cart-subtotal-row { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 12px; }

/* ---------- Modal (produto) ---------- */

.modal { position: fixed; inset: 0; z-index: 110; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }

.modal-panel {
  position: relative;
  max-width: 480px;
  margin: 5vh auto;
  background: var(--bg-soft);
  border-radius: var(--radius);
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
}

.modal-close { position: absolute; top: 10px; right: 14px; }

.modal-product-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 12px; margin-bottom: 12px; }
.modal-product h2 { margin: 0 0 6px; font-size: 20px; }
.modal-product-desc { color: var(--text-soft); font-size: 14px; margin: 0 0 16px; }

.option-group { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.option-group legend { font-weight: 600; font-size: 13px; padding: 0 4px; }
.required-tag { color: var(--red); font-size: 11px; font-weight: 500; }

.option-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; }
.option-row input { flex: 0 0 auto; }
.option-name { flex: 1; }
.option-delta { color: var(--text-soft); font-size: 13px; }

.modal-quantity-row { display: flex; align-items: center; justify-content: space-between; margin: 16px 0; }
.modal-error { color: var(--red); font-size: 13px; margin: 8px 0; }

/* ---------- Checkout ---------- */

.checkout-main { padding: 30px 0 60px; }
.section-title { font-size: 26px; margin: 0 0 20px; }

.checkout-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: start; }

.checkout-card {
  background: var(--bg-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 20px;
}

.checkout-card h2 { font-size: 16px; margin: 0 0 14px; }
.checkout-hint { font-size: 13px; color: var(--text-soft); margin: 0 0 12px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-size: 13px; }
.field span { font-weight: 600; }
.field input, .field textarea, select, .admin-form input, .admin-form textarea, .admin-form select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field-with-toggle { display: flex; flex-direction: column; }
.checkbox-row-sm {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-soft);
  margin: 2px 0 12px;
  cursor: pointer;
}
.checkbox-row-sm input { margin: 0; }
.field input:disabled { background: rgba(36, 28, 21, 0.05); color: var(--text-soft); }

.fulfillment-options, .payment-options { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }

.radio-card {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  flex: 1 1 160px;
}

.radio-card:has(input:checked) { border-color: var(--red); background: rgba(214,40,40,0.06); }

.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 10px; }

.address-fields { margin-top: 12px; }

.address-field-wrap { position: relative; }
.address-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 4px;
  box-shadow: var(--shadow);
  max-height: 220px;
  overflow-y: auto;
}
.address-suggestion {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.address-suggestion:last-child { border-bottom: none; }
.address-suggestion:hover, .address-suggestion.active { background: rgba(214, 40, 40, 0.06); }
.address-suggestion-loading { padding: 10px 12px; font-size: 13px; color: var(--text-soft); }
.fulfillment-info:empty { display: none; }

.cash-fields { margin-top: 6px; }

.checkout-summary { position: sticky; top: 90px; }
.summary-items { margin-bottom: 12px; }
.summary-item { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 6px 0; }
.summary-item small { color: var(--text-soft); }

.summary-row { display: flex; justify-content: space-between; font-size: 14px; padding: 6px 0; border-top: 1px solid var(--border); }
.summary-total { font-weight: 700; font-size: 17px; border-top: 2px solid var(--dark); margin-top: 4px; padding-top: 10px; }

/* ---------- Confirmation ---------- */

.confirmation-main { padding: 60px 0; display: flex; justify-content: center; }
.confirmation-card { max-width: 440px; width: 100%; text-align: center; }
.confirmation-check {
  width: 56px; height: 56px; border-radius: 50%;
  background: #1a7a3c; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; margin: 0 auto 16px;
}
.confirmation-details { margin: 20px 0; text-align: left; }

.order-lookup-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  text-align: left;
}
.order-lookup-item:hover { border-color: var(--red); }

.order-progress {
  list-style: none;
  padding: 0;
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.order-progress-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-soft);
}

.order-progress-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--border);
  flex: 0 0 auto;
}

.order-progress-step.done { color: var(--text); }
.order-progress-step.done .order-progress-dot { background: #1a7a3c; }

.order-progress-step.current { color: var(--red-dark); font-weight: 700; }
.order-progress-step.current .order-progress-dot { background: var(--red); box-shadow: 0 0 0 4px rgba(214,40,40,0.15); }

.order-cancelled-badge {
  display: inline-block;
  background: rgba(214,40,40,0.1);
  color: var(--red-dark);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  margin: 16px 0;
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--dark);
  color: rgba(255,255,255,0.6);
  padding: 20px 0;
  font-size: 13px;
}

.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.footer-admin-link { opacity: 0.6; }
.footer-admin-link:hover { opacity: 1; }

.footer-right { display: flex; align-items: center; gap: 16px; }

.footer-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  opacity: 0.7;
}
.footer-brand-badge svg { display: block; border-radius: 4px; flex: 0 0 auto; }
.footer-brand-badge strong { color: var(--yellow); font-weight: 700; }

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
  .checkout-grid { grid-template-columns: 1fr; }
  .checkout-summary { position: static; }
  .field-row { grid-template-columns: 1fr; }
}
