@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Nunito+Sans:wght@400;500;700&display=swap');

:root {
  --red-50:#FEF3F2; --red-100:#FDE6E4; --red-500:#E4180E; --red-600:#C21309; --red-700:#9F0F07;
  --blue-50:#F1F4FD; --blue-100:#E4E9FA; --blue-500:#1A40BD; --blue-600:#142F8F; --blue-700:#0F2469;
  --yellow-50:#FFFBEE; --yellow-100:#FFF6D6; --yellow-500:#F7C600; --yellow-600:#DDAF00;
  --green-100:#E3F0DD; --green-500:#2E6B1E; --green-600:#245517;
  --graphite-50:#F7F4F0; --graphite-150:#E6E1DA; --graphite-300:#C9C3BC; --graphite-500:#6B6560; --graphite-700:#3A3633; --graphite-900:#151312;
  --wood-100:#F3E6D8; --wood-500:#C99A6E;
  --white:#FFFFFF;
  --error:#C2185B; --error-bg:#FCE8EF;
  --radius-sm:8px; --radius-md:12px; --radius-lg:16px; --radius-xl:24px; --radius-full:999px;
  --shadow-sm:0 1px 2px rgba(21,19,18,.08);
  --shadow-md:0 4px 12px rgba(21,19,18,.12);
  --shadow-lg:0 8px 24px rgba(21,19,18,.16);
  --font-heading:'Fredoka', system-ui, sans-serif;
  --font-body:'Nunito Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--graphite-50);
  color: var(--graphite-900);
  padding-bottom: 88px;
}
h1,h2,h3,h4 { font-family: var(--font-heading); margin: 0; color: var(--graphite-900); }
p { margin: 0; }
button { font-family: var(--font-body); cursor: pointer; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

/* Header */
.app-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--white); box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
}
.app-header .logo { font-family: var(--font-heading); font-weight: 700; font-size: 20px; color: var(--red-500); }
.app-header .logo-img { height: 40px; width: auto; display: block; }
.cart-icon-btn { position: relative; background: none; border: none; font-size: 22px; }
.cart-badge {
  position: absolute; top: -6px; right: -8px; background: var(--red-500); color: var(--white);
  font-size: 11px; font-weight: 700; border-radius: var(--radius-full); min-width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

main { max-width: 480px; margin: 0 auto; padding: 16px; }

/* Botões */
.btn {
  border: none; border-radius: var(--radius-md); padding: 14px 20px;
  font-weight: 700; font-size: 16px; font-family: var(--font-body);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
}
.btn-primary { background: var(--red-500); color: var(--white); }
.btn-primary:hover { background: var(--red-600); }
.btn-primary:disabled { background: var(--graphite-150); color: var(--graphite-500); cursor: not-allowed; }
.btn-secondary { background: transparent; color: var(--blue-500); border: 2px solid var(--blue-500); }
.btn-secondary:hover { background: var(--blue-50); }
.btn-block { width: 100%; }

/* Seletor de modalidade */
.segmented { display: flex; gap: 8px; background: var(--graphite-50); padding: 4px; border-radius: var(--radius-md); }
.segmented button {
  flex: 1; border: none; background: transparent; padding: 12px; border-radius: var(--radius-sm);
  font-weight: 700; color: var(--graphite-500);
}
.segmented button.active { background: var(--yellow-500); color: var(--graphite-900); }

/* Input */
.field { width: 100%; border: 1px solid var(--graphite-300); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 15px; background: var(--white); font-family: var(--font-body); }
.field:focus { outline: 2px solid var(--blue-500); outline-offset: 2px; border-color: var(--blue-500); }
.field.error { border-color: var(--error); }

/* Categoria grid (home) */
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0; }
.cat-card {
  background: var(--yellow-100); border-radius: var(--radius-md); padding: 16px 8px; text-align: center;
  font-family: var(--font-heading); font-weight: 600; font-size: 13px; border: none;
}
.cat-card:hover { background: var(--yellow-500); }

.promo-banner {
  background: var(--yellow-500); border-radius: var(--radius-xl); padding: 20px; margin-top: 16px;
}
.promo-banner h3 { font-size: 18px; margin-bottom: 4px; }
.promo-banner p { font-size: 13px; color: var(--graphite-700); }

/* Busca e tabs */
.search-bar {
  display: flex; align-items: center; gap: 8px; background: var(--graphite-50);
  border-radius: var(--radius-full); padding: 10px 16px; margin-bottom: 12px;
}
.search-bar input { border: none; background: transparent; flex: 1; font-size: 14px; font-family: var(--font-body); }
.search-bar input:focus { outline: none; }
.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px; }
.tabs button {
  border: none; background: var(--white); border: 1px solid var(--graphite-150); padding: 8px 16px;
  border-radius: var(--radius-full); font-weight: 700; font-size: 13px; white-space: nowrap; color: var(--graphite-700);
}
.tabs button.active { background: var(--red-500); color: var(--white); border-color: var(--red-500); }

/* Card de produto */
.product-card {
  background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
  margin-bottom: 12px; overflow: hidden; display: flex; cursor: pointer; border: none; text-align: left; width: 100%;
}
.product-card:hover { box-shadow: var(--shadow-md); }
.product-thumb { width: 96px; height: 96px; background: var(--wood-100); flex-shrink: 0; display:flex; align-items:center; justify-content:center; font-size:28px; }
.product-info { padding: 12px; flex: 1; }
.product-info h4 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.product-info .desc { font-size: 12px; color: var(--graphite-500); margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price { font-family: var(--font-heading); font-weight: 700; color: var(--red-500); font-size: 16px; }
.badge { display: inline-block; font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: var(--radius-full); margin-right: 4px; }
.badge-novo { background: var(--yellow-100); color: var(--graphite-900); }
.badge-picante { background: var(--red-100); color: var(--red-700); }
.badge-promocao { background: var(--red-500); color: var(--white); }
.badge-kids { background: var(--blue-100); color: var(--blue-700); }
.badge-mais-pedido { background: var(--green-100); color: var(--green-600); }

/* Bottom sheet */
.sheet-overlay {
  position: fixed; inset: 0; background: rgba(21,19,18,.5); z-index: 40;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: var(--white); width: 100%; max-width: 480px; border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  max-height: 90vh; overflow-y: auto; padding: 20px; animation: sheet-in .24s ease-out;
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.sheet-handle { width: 40px; height: 4px; background: var(--graphite-300); border-radius: var(--radius-full); margin: 0 auto 16px; }
.sheet-close { position: absolute; top: 16px; right: 16px; background: var(--graphite-50); border: none; width: 32px; height: 32px; border-radius: var(--radius-full); font-size: 16px; }
.option-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--graphite-150); }
.option-row label { font-size: 14px; }
.option-row .extra-price { font-size: 13px; color: var(--graphite-500); }

/* Stepper */
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button {
  width: 32px; height: 32px; border-radius: var(--radius-full); border: none; background: var(--graphite-50);
  font-size: 16px; font-weight: 700; color: var(--graphite-900);
}
.stepper button:disabled { color: var(--graphite-300); }
.stepper .qty { font-weight: 700; min-width: 20px; text-align: center; }

/* Carrinho */
.cart-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--graphite-150); align-items: center; }
.cart-item .thumb { width: 56px; height: 56px; background: var(--wood-100); border-radius: var(--radius-sm); flex-shrink:0; display:flex; align-items:center; justify-content:center; font-size:20px; }
.cart-item .details { flex: 1; }
.cart-item h4 { font-size: 14px; margin-bottom: 2px; }
.cart-item .extras-list { font-size: 11px; color: var(--graphite-500); }
.remove-btn { background: none; border: none; color: var(--graphite-500); font-size: 18px; }
.summary-row { display: flex; justify-content: space-between; font-size: 14px; padding: 6px 0; color: var(--graphite-700); }
.summary-row.total { font-family: var(--font-heading); font-size: 20px; font-weight: 700; color: var(--graphite-900); padding-top: 12px; border-top: 1px solid var(--graphite-150); margin-top: 8px; }

/* Rodapé fixo (FAB carrinho / CTA) */
.footer-bar {
  position: fixed; bottom: 0; left: 0; right: 0; background: var(--white);
  box-shadow: 0 -2px 12px rgba(21,19,18,.1); padding: 12px 16px; z-index: 15;
}
.footer-bar-inner { max-width: 480px; margin: 0 auto; }

/* Estados */
.empty-state, .error-state { text-align: center; padding: 48px 16px; color: var(--graphite-500); }
.empty-state .icon, .error-state .icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h3 { font-size: 17px; margin-bottom: 6px; color: var(--graphite-900); }
.alert { border-radius: var(--radius-md); padding: 12px 14px; font-size: 13px; margin-bottom: 12px; display:flex; gap:8px; align-items:flex-start; }
.alert-error { background: var(--error-bg); color: var(--error); }
.alert-info { background: var(--blue-50); color: var(--blue-700); }

.skeleton { background: linear-gradient(90deg, var(--graphite-150) 25%, var(--graphite-50) 50%, var(--graphite-150) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-md); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.4); border-top-color: var(--white); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Confirmação */
.confirm-icon { width: 72px; height: 72px; border-radius: 50%; background: var(--green-100); color: var(--green-500); font-size: 36px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.center { text-align: center; }

/* Progress stepper */
.progress-stepper { display: flex; flex-direction: column; gap: 0; margin: 20px 0; }
.progress-step { display: flex; gap: 12px; align-items: flex-start; }
.progress-dot { width: 24px; height: 24px; border-radius: 50%; background: var(--graphite-150); flex-shrink: 0; display:flex; align-items:center; justify-content:center; font-size:12px; color: var(--white); }
.progress-step.done .progress-dot { background: var(--green-500); }
.progress-step.current .progress-dot { background: var(--red-500); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(228,24,14,.4); } 50% { box-shadow: 0 0 0 6px rgba(228,24,14,0); } }
.progress-line { width: 2px; height: 28px; background: var(--graphite-150); margin-left: 11px; }
.progress-step.done + .progress-line { background: var(--green-500); }
.progress-label { font-weight: 600; font-size: 14px; padding-top: 2px; }

footer.site-footer { background: var(--graphite-900); color: var(--graphite-150); text-align: center; padding: 24px 16px; margin-top: 40px; }
footer.site-footer .brand { font-family: var(--font-heading); color: var(--yellow-500); font-weight: 700; }
