/* Mobile-first base styles. Deliberately plain — the visual design pass (colors, typography,
   layout polish) is a separate follow-up task; this gets the functional site working end to
   end on phones first, since that's where most visitors are. */

:root {
  --primary: var(--brand-primary, #8b1a1a);
  --accent: var(--brand-accent, #d4a017);
  --text: #222;
  --muted: #666;
  --bg: #fff;
  --bg-alt: #f7f5f2;
  --border: #e5e0d8;
  --radius: 8px;
  --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: var(--font-body);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
a { color: inherit; }

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

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--primary); color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.site-header .container { display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.site-header .logo { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.site-header .brand { font-weight: 700; flex: 1; min-width: 0; }
.site-header nav { display: flex; gap: 14px; font-size: 14px; }
.site-header nav a { text-decoration: none; opacity: 0.9; }
.cart-button {
  position: relative; background: var(--accent); color: #2c1810; border: none;
  border-radius: var(--radius); padding: 8px 12px; font-weight: 700; cursor: pointer;
}
.cart-badge {
  position: absolute; top: -6px; right: -6px; background: #fff; color: var(--primary);
  border-radius: 50%; width: 18px; height: 18px; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* Hero */
.hero { background: var(--bg-alt); padding: 32px 16px; text-align: center; }
.hero h1 { font-size: clamp(24px, 6vw, 40px); margin: 0 0 8px; color: var(--primary); }
.hero p { color: var(--muted); max-width: 480px; margin: 0 auto 16px; }
.btn {
  display: inline-block; padding: 12px 22px; border-radius: var(--radius);
  text-decoration: none; font-weight: 700; cursor: pointer; border: none; font-size: 15px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-accent { background: var(--accent); color: #2c1810; }
.btn-whatsapp { background: #25d366; color: #fff; }

/* Product grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; padding: 20px 0; }
.card {
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; background: #fff;
}
.card-media { background: var(--bg-alt); height: 100px; display: flex; align-items: center; justify-content: center; font-size: 36px; }
.card-body { padding: 10px 12px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.card-body h3 { font-size: 14px; margin: 0; }
.card-body .price { font-weight: 700; color: var(--primary); }
.card-body .add-btn { margin-top: auto; }

/* Category filters */
.chips { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 0; }
.chip {
  border: 1px solid var(--border); border-radius: 20px; padding: 6px 14px; font-size: 13px;
  background: #fff; cursor: pointer; text-decoration: none; color: var(--text);
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Cart drawer */
.cart-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 100; }
.cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 100vw);
  background: #fff; z-index: 101; display: flex; flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,0.2);
}
.cart-drawer-header { padding: 16px; background: var(--primary); color: #fff; display: flex; justify-content: space-between; align-items: center; }
.cart-drawer-body { flex: 1; overflow-y: auto; padding: 12px 16px; }
.cart-item { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.cart-item .name { flex: 1; font-size: 14px; }
.cart-drawer-footer { padding: 16px; border-top: 1px solid var(--border); }
.qty-btn { width: 26px; height: 26px; border-radius: 50%; border: none; background: var(--primary); color: #fff; cursor: pointer; }

/* Chat widget */
.chat-fab {
  position: fixed; bottom: 20px; right: 20px; width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary); color: #fff; border: none; font-size: 24px; cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25); z-index: 90;
}
.chat-window {
  position: fixed; bottom: 88px; right: 20px; width: min(340px, 90vw); height: min(460px, 70vh);
  background: #fff; border-radius: var(--radius); box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  z-index: 91; display: flex; flex-direction: column; overflow: hidden;
}
.chat-header { background: var(--primary); color: #fff; padding: 12px; font-weight: 700; }
.chat-body { flex: 1; overflow-y: auto; padding: 10px; font-size: 14px; }
.chat-msg { margin-bottom: 10px; max-width: 85%; }
.chat-msg.user { margin-left: auto; text-align: right; }
.chat-msg .bubble { display: inline-block; padding: 8px 12px; border-radius: 12px; background: var(--bg-alt); }
.chat-msg.user .bubble { background: var(--primary); color: #fff; }
.chat-input { display: flex; border-top: 1px solid var(--border); }
.chat-input input { flex: 1; border: none; padding: 10px; font-size: 14px; }
.chat-input button { border: none; background: var(--primary); color: #fff; padding: 0 16px; cursor: pointer; }

/* Footer */
.site-footer { background: #2c1810; color: #c8a87a; padding: 24px 16px; margin-top: 32px; font-size: 13px; }
.site-footer .social a { color: #c8a87a; margin-right: 12px; font-size: 20px; text-decoration: none; }

/* Admin */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar { width: 200px; background: #1a2030; color: #fff; padding: 16px; flex-shrink: 0; }
.admin-sidebar a { display: block; color: #cdd3e0; text-decoration: none; padding: 8px 0; font-size: 14px; }
.admin-main { flex: 1; padding: 20px; background: var(--bg-alt); min-height: 100vh; }
.admin-card { background: #fff; border-radius: var(--radius); padding: 16px; margin-bottom: 16px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
table th, table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); }
.form-field { margin-bottom: 12px; display: flex; flex-direction: column; gap: 4px; }
.form-field label { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.form-field input, .form-field textarea, .form-field select {
  padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 15px; font-family: inherit;
}

@media (max-width: 640px) {
  .admin-shell { flex-direction: column; }
  .admin-sidebar { width: 100%; display: flex; overflow-x: auto; gap: 12px; }
  .admin-sidebar a { padding: 8px 4px; white-space: nowrap; }
}
