:root {
  --primary: #e91e8c;
  --primary-dark: #c2185b;
  --primary-light: #ff6eb4;
  --bg: #fff0f6;
  --card: #ffffff;
  --text: #1a1a2e;
  --muted: #666;
  --border: #f8d7e8;
  --success: #28a745;
  --shadow: 0 2px 12px rgba(233,30,140,0.1);
  --radius: 12px;
  --hh: 60px;
  --ch: 52px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ─── HEADER ─── */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--hh);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.header-brand { display: flex; align-items: center; gap: 10px; color: white; }
.header-logo { font-size: 26px; }
.header-logo img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; display: block; }
.header-brand h1 { font-size: 17px; font-weight: 700; line-height: 1.2; }
.header-brand small { font-size: 11px; opacity: 0.9; display: block; font-weight: 400; }

.btn-cart {
  background: white;
  color: var(--primary);
  border: none;
  border-radius: 24px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.2s;
}
.btn-cart:hover { transform: scale(1.05); }
.btn-cart.pulse { animation: pulse 0.5s ease; }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.15)} }

.cart-badge {
  background: var(--primary);
  color: white;
  border-radius: 50%;
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
}

/* ─── STATUS BANNER ─── */
.status-banner {
  position: fixed;
  top: var(--hh);
  left: 0; right: 0;
  background: #ff9800;
  color: white;
  text-align: center;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  z-index: 99;
}

/* ─── CATEGORY NAV ─── */
.cat-nav {
  position: fixed;
  top: var(--hh);
  left: 0; right: 0;
  height: var(--ch);
  background: white;
  display: flex;
  align-items: center;
  overflow-x: auto;
  gap: 8px;
  padding: 0 12px;
  z-index: 99;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  scrollbar-width: none;
}
.cat-nav::-webkit-scrollbar { display: none; }

.cat-btn {
  flex-shrink: 0;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  color: var(--text);
}
.cat-btn.active, .cat-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ─── CATALOG ─── */
.catalog {
  padding: 16px;
  padding-top: calc(var(--hh) + var(--ch) + 16px);
  max-width: 1200px;
  margin: 0 auto;
}

/* ─── HERO SECTION ─── */
.hero-section {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  text-align: center;
}
.hero-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 12px;
}
.hero-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.hero-wpp {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #25d366;
  color: white;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s;
}
.hero-wpp:hover { opacity: 0.85; }

/* ─── CATEGORY HEADER BAR ─── */
.cat-header-bar { margin-bottom: 10px; }
.cat-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.cat-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
}

/* ─── PRODUCTS GRID ─── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 480px) { .products-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px) { .products-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; } }
@media (min-width: 1024px) { .products-grid { grid-template-columns: repeat(5, 1fr); } }

/* ─── PRODUCT CARD ─── */
.product-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 0 0 10px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(233,30,140,0.18);
}

/* Product image (from DB) */
.product-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: var(--bg);
}

/* Emoji fallback when no image */
.product-emoji-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  aspect-ratio: 1 / 1;
  background: var(--bg);
}

.product-card > .product-name,
.product-card > .product-desc,
.product-card > .product-price,
.product-card > .product-min,
.product-card > div[id^="pBtn_"] {
  padding: 0 10px;
}

.product-name { font-size: 13px; font-weight: 700; color: var(--text); line-height: 1.3; padding-top: 8px; }
.product-desc { font-size: 11px; color: var(--muted); line-height: 1.4; flex: 1; }
.product-price { font-size: 14px; font-weight: 700; color: var(--primary); }
.product-min {
  font-size: 11px;
  color: var(--muted);
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  margin: 0 10px;
}

.btn-add {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 11px 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  width: calc(100% - 20px);
  margin: 4px 10px 0;
  transition: background 0.2s;
  display: block;
}
.btn-add:hover { background: var(--primary-dark); }

.qty-control {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 4px 10px 0;
}
.qty-btn {
  background: var(--bg);
  border: 2px solid var(--primary);
  color: var(--primary);
  border-radius: 6px;
  width: 36px; height: 36px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  transition: all 0.15s;
}
.qty-btn:hover { background: var(--primary); color: white; }

.qty-display {
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  flex: 1;
  line-height: 1.3;
  color: var(--text);
}
.qty-display small { color: var(--primary); font-size: 11px; }

/* ─── FOOTER ─── */
.site-footer {
  margin-top: 32px;
  padding: 20px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 2;
  border-top: 2px solid var(--border);
}
.site-footer a { color: var(--primary); text-decoration: none; }

/* ─── CART SIDEBAR ─── */
.cart-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: none;
}
.cart-overlay.visible { display: block; }

.cart-sidebar {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(380px, 100vw);
  background: white;
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  box-shadow: -4px 0 24px rgba(0,0,0,0.2);
}
.cart-sidebar.open { transform: translateX(0); }

.cart-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.cart-header h2 { font-size: 17px; }

.btn-close {
  background: none;
  border: none;
  color: white;
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.cart-items { flex: 1; overflow-y: auto; padding: 12px; }

.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}
.cart-empty-icon { font-size: 48px; margin-bottom: 10px; }

.cart-item {
  display: flex;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-qty { font-size: 11px; color: var(--muted); margin-top: 2px; }
.cart-item-price { font-size: 13px; font-weight: 700; color: var(--primary); white-space: nowrap; }
.cart-item-remove {
  background: none; border: none; color: #bbb;
  cursor: pointer; font-size: 18px; padding: 10px;
  margin: -10px;
  flex-shrink: 0;
  transition: color 0.2s;
}
.cart-item-remove:hover { color: #e53935; }

.cart-footer {
  border-top: 2px solid var(--border);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.cart-totals {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  font-size: 14px;
}
.cart-totals .tr { font-weight: 700; font-size: 15px; color: var(--primary); }

.btn-checkout {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
}
.btn-checkout:hover { background: var(--primary-dark); }
.btn-checkout:disabled { background: #ddd; color: #999; cursor: not-allowed; }

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 300;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.modal-overlay.open { display: flex; }

.modal {
  background: white;
  border-radius: var(--radius);
  width: 100%;
  max-width: 500px;
  margin: auto;
  overflow: hidden;
}

.modal-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 { font-size: 17px; }

.modal-body { padding: 20px; }

/* Tipo de pedido toggle */
.tipo-pedido-group {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.tipo-btn {
  flex: 1;
  padding: 10px 8px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  color: var(--muted);
  transition: all 0.2s;
  line-height: 1.4;
}
.tipo-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}
.tipo-btn span { display: block; font-size: 20px; margin-bottom: 2px; }

/* Info box */
.info-box {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: #856404;
  margin-bottom: 14px;
  display: none;
}
.info-box.visible { display: block; }

.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.2s;
  background: white;
  color: var(--text);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

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

.order-summary {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: var(--muted);
}
.order-summary strong { color: var(--primary); font-size: 17px; }

.btn-submit {
  background: var(--success);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
}
.btn-submit:hover { background: #218838; }
.btn-submit:disabled { background: #ccc; cursor: not-allowed; }

/* ─── SUCCESS ─── */
.success-modal {
  padding: 36px 28px;
  text-align: center;
}
.success-icon { font-size: 64px; display: block; margin-bottom: 12px; }
.success-modal h2 { color: var(--success); font-size: 22px; margin-bottom: 10px; }
.success-modal p { color: var(--muted); font-size: 14px; line-height: 1.7; }
.order-num { font-size: 28px; font-weight: 700; color: var(--primary); display: block; margin: 6px 0; }

.btn-new-order {
  background: var(--bg);
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: 10px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-top: 20px;
  transition: all 0.2s;
}
.btn-new-order:hover { background: var(--primary); color: white; }

/* ─── LOADING ─── */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--muted);
  gap: 14px;
}
.spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 768px) {
  .catalog { padding: 20px 28px; padding-top: calc(var(--hh) + var(--ch) + 20px); }
}
