/* ============================================
   80/20 Integral — Design tokens
   Extraídos del catálogo original en PDF
   ============================================ */
:root {
  --color-bg: #F3ECDC;
  --color-bg-card: #EFE7D4;
  --color-maroon: #7A2B2B;
  --color-maroon-dark: #5E1F1F;
  --color-green: #3E5A3A;
  --color-green-dark: #2E4429;
  --color-mayorista-bg: #C9DAB0;
  --color-mayorista-text: #2E4429;
  --color-cafeterias-bg: #D9C7A8;
  --color-cafeterias-text: #5C3D1E;
  --color-minorista-bg: #E4DBC4;
  --color-minorista-text: #5C5342;
  --color-text: #2B2620;
  --color-text-muted: #7A7264;
  --color-whatsapp: #2FA85A;
  --color-danger: #B23A3A;
  --color-border: rgba(43, 38, 32, 0.10);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  --shadow-card: 0 2px 10px rgba(43, 38, 32, 0.06);
  --shadow-float: 0 8px 24px rgba(43, 38, 32, 0.18);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

button, input, select { font-family: inherit; }

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

.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius-pill);
  border: none;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--color-maroon); color: #fff; }
.btn-primary:hover { background: var(--color-maroon-dark); }
.btn-wholesale {
  background: var(--color-green);
  color: #fff;
}
.btn-wholesale:hover { background: var(--color-green-dark); }
.btn-whatsapp { background: var(--color-whatsapp); color: #fff; }
.btn-whatsapp:hover { filter: brightness(0.95); }
.btn-mp { background: #009EE3; color: #fff; margin-bottom: 10px; }
.btn-mp:hover { filter: brightness(0.95); }
.btn-ghost { background: transparent; color: var(--color-text); border: 1px solid var(--color-border); }
.btn-danger { background: transparent; color: var(--color-danger); border: 1px solid var(--color-danger); }
.full-width { width: 100%; }
.link-btn {
  background: none; border: none; text-decoration: underline;
  color: inherit; font-weight: 600; cursor: pointer; padding: 0;
}
.icon-btn {
  background: none; border: none; font-size: 1.2rem; cursor: pointer;
  color: var(--color-text); line-height: 1;
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(180deg, #F7F1E4 0%, var(--color-bg) 100%);
  padding: 40px 20px 24px;
}
.hero-inner {
  max-width: 1080px;
  margin: 0 auto;
  background: #F8F2E6;
  border-radius: var(--radius-lg);
  padding: 36px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 32px;
  align-items: center;
  box-shadow: var(--shadow-card);
}
.store-name {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  color: var(--color-green-dark);
  margin: 0 0 6px;
  font-weight: 600;
  cursor: default;
  user-select: none;
}
.tagline {
  font-style: italic;
  color: var(--color-text-muted);
  font-size: 1.15rem;
  margin: 0 0 20px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.hero-note { color: var(--color-text-muted); font-size: 0.9rem; margin: 0; }
.hero-image img {
  border-radius: var(--radius-md);
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
}

/* ---------- Wholesale banner ---------- */
.wholesale-banner {
  background: var(--color-mayorista-bg);
  color: var(--color-mayorista-text);
  text-align: center;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 500;
}

/* ---------- Category nav ---------- */
.category-nav {
  max-width: 1080px;
  margin: 24px auto 0;
  padding: 0 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.pill {
  border: none;
  background: var(--color-green);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s ease;
}
.pill.active { opacity: 1; }
.pill[data-cat="Todos"] { background: var(--color-maroon); }

/* ---------- Catalog ---------- */
.catalog-section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}
.catalog-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
}
.catalog-header h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--color-text);
  margin: 0;
}
.catalog-note { color: var(--color-text-muted); font-size: 0.85rem; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.empty-state {
  text-align: center;
  color: var(--color-text-muted);
  padding: 40px 0;
}

.product-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  position: relative;
}
.product-card .img-wrap { aspect-ratio: 4/3; overflow: hidden; position: relative; }
.product-card img { width: 100%; height: 100%; object-fit: cover; }
.badge-oferta {
  position: absolute; top: 10px; left: 10px;
  background: var(--color-maroon); color: #fff;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.03em;
  padding: 4px 10px; border-radius: var(--radius-pill);
}
.product-body { padding: 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-eyebrow {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em;
  color: var(--color-maroon); text-transform: uppercase;
}
.product-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0;
  color: var(--color-text);
}
.product-desc { color: var(--color-text-muted); font-size: 0.88rem; margin: 0 0 8px; }
.price-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; }
.price-badge {
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.8rem;
  flex: 1;
  min-width: 100px;
}
.price-badge .price-label { display: block; font-size: 0.72rem; opacity: 0.75; margin-bottom: 2px; }
.price-badge .price-value { font-size: 1.05rem; font-weight: 700; }
.price-badge .price-unit { font-size: 0.72rem; font-weight: 500; opacity: 0.75; }
.price-badge.minorista { background: var(--color-minorista-bg); color: var(--color-minorista-text); }
.price-badge.mayorista { background: var(--color-mayorista-bg); color: var(--color-mayorista-text); }
.price-badge.cafeterias { background: var(--color-cafeterias-bg); color: var(--color-cafeterias-text); }

.add-to-cart {
  margin-top: 10px;
  background: var(--color-maroon);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 10px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
}
.add-to-cart:hover { background: var(--color-maroon-dark); }

.cart-control { margin-top: 10px; }
.qty-control.card-qty {
  justify-content: space-between;
  background: var(--color-maroon);
  border-radius: var(--radius-pill);
  padding: 6px 8px;
}
.qty-control.card-qty .qty-value {
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 20px;
  text-align: center;
}
.qty-control.card-qty button {
  width: 28px; height: 28px;
  border: none;
  background: rgba(255,255,255,0.18);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
}
.qty-control.card-qty button:hover { background: rgba(255,255,255,0.3); }

/* ---------- Business CTA ---------- */
.business-cta {
  max-width: 1080px;
  margin: 0 auto 30px;
  padding: 0 20px;
}
.business-cta p {
  background: var(--color-mayorista-bg);
  color: var(--color-mayorista-text);
  border: 1px dashed var(--color-green);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin: 0;
  font-size: 0.95rem;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-maroon);
  color: #fff;
  text-align: center;
  padding: 40px 20px 50px;
}
.footer-store { font-family: var(--font-display); font-size: 1.4rem; margin: 0 0 6px; }
.footer-sub { opacity: 0.85; margin: 0 0 18px; font-size: 0.9rem; }

/* ---------- Cart ---------- */
.cart-fab {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--color-maroon);
  color: #fff;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: var(--shadow-float);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cart-count {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--color-green);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}
.overlay {
  position: fixed; inset: 0;
  background: rgba(43, 38, 32, 0.45);
  z-index: 45;
}
.cart-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(400px, 100vw);
  background: var(--color-bg);
  z-index: 50;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 24px rgba(0,0,0,0.15);
}
.cart-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px; border-bottom: 1px solid var(--color-border);
}
.cart-panel-header h3 { font-family: var(--font-display); margin: 0; }
.cart-items { flex: 1; overflow-y: auto; padding: 12px 20px; }
.cart-item {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--color-border);
}
.cart-item-name { font-weight: 600; font-size: 0.92rem; }
.cart-item-price { color: var(--color-text-muted); font-size: 0.82rem; }
.qty-control { display: flex; align-items: center; gap: 8px; }
.qty-control button {
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--color-border);
  background: #fff; cursor: pointer; font-weight: 700;
}
.cart-footer { padding: 18px 20px; border-top: 1px solid var(--color-border); }
.cart-total { margin-bottom: 12px; font-size: 1rem; }
.cart-empty { text-align: center; color: var(--color-text-muted); padding: 40px 0; }

/* ---------- Modals ---------- */
.modal {
  position: fixed; inset: 0;
  background: rgba(43, 38, 32, 0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 90; padding: 20px;
}
/* El modal de producto se abre desde ADENTRO del panel admin (z-index 70),
   así que necesita quedar siempre por encima de él. */
.modal-top { z-index: 95; }
.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 380px;
  width: 100%;
}
.modal-box-lg { max-width: 480px; max-height: 88vh; overflow-y: auto; }
.modal-box h3 { font-family: var(--font-display); margin-top: 0; }
.modal-input {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--color-border); margin: 10px 0; font-size: 1rem;
}
.modal-error { color: var(--color-danger); font-size: 0.85rem; margin: 0 0 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* ---------- Admin ---------- */
.admin-panel {
  position: fixed; inset: 0;
  background: var(--color-bg);
  z-index: 70;
  overflow-y: auto;
}
.admin-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; background: var(--color-green); color: #fff;
  position: sticky; top: 0;
}
.admin-header h2 { font-family: var(--font-display); margin: 0; font-size: 1.3rem; }
.admin-header .icon-btn { color: #fff; }
.admin-tabs { display: flex; gap: 8px; padding: 16px 24px 0; }
.admin-tab {
  border: none; background: var(--color-bg-card); padding: 10px 18px;
  border-radius: var(--radius-pill); cursor: pointer; font-weight: 600;
  opacity: 0.6;
}
.admin-tab.active { opacity: 1; background: var(--color-maroon); color: #fff; }
.admin-tab-content { padding: 20px 24px 60px; max-width: 720px; }
.admin-product-list { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.admin-product-row {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-radius: var(--radius-sm); padding: 10px 14px;
  cursor: pointer; box-shadow: var(--shadow-card);
}
.admin-product-row img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }
.admin-product-row .info { flex: 1; }
.admin-product-row .info strong { display: block; font-size: 0.92rem; }
.admin-product-row .info span { font-size: 0.78rem; color: var(--color-text-muted); }
.admin-product-row .tag {
  font-size: 0.68rem; font-weight: 700; padding: 3px 8px; border-radius: var(--radius-pill);
  background: var(--color-minorista-bg); color: var(--color-minorista-text);
}
.admin-product-row .tag.mayorista { background: var(--color-mayorista-bg); color: var(--color-mayorista-text); }
.admin-product-row .tag.cafeterias { background: var(--color-cafeterias-bg); color: var(--color-cafeterias-text); }
.admin-product-row .tag.inactivo { background: #eee; color: #999; }
.admin-product-row .tag-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }

.list-price-block {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: #fff;
}
.list-price-block .form-row { margin-top: 10px; }

.admin-form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.admin-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; font-weight: 600; }
.admin-form input, .admin-form select {
  padding: 11px 12px; border-radius: var(--radius-sm); border: 1px solid var(--color-border);
  font-weight: 400; font-size: 0.95rem;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkbox-label { flex-direction: row !important; align-items: center; gap: 8px !important; }
.save-msg { color: var(--color-green-dark); font-weight: 600; }

.image-input-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: -6px; }
.hidden-file-input { display: none; }
.file-btn { font-size: 0.85rem; padding: 9px 14px; }
.image-preview {
  width: 100%; max-height: 160px; object-fit: cover;
  border-radius: var(--radius-sm); margin-top: 4px;
  border: 1px solid var(--color-border);
}

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--color-text); color: #fff;
  padding: 12px 20px; border-radius: var(--radius-pill);
  font-size: 0.88rem; z-index: 80;
  box-shadow: var(--shadow-float);
}

/* ---------- Spinner de carga ---------- */
.loading-overlay {
  position: fixed; inset: 0;
  background: var(--color-bg);
  z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px;
}
.loading-overlay p { color: var(--color-text-muted); font-size: 0.9rem; margin: 0; }
.spinner {
  width: 46px; height: 46px;
  border: 4px solid var(--color-minorista-bg);
  border-top-color: var(--color-maroon);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Modal de imagen (burbuja recordatorio) ---------- */
.modal-box-img { padding: 12px; max-width: 340px; }
.modal-box-img img { width: 100%; border-radius: var(--radius-md); display: block; }
.modal-actions-center { justify-content: center; margin-top: 12px; }
.pago-resultado-icono { font-size: 2.6rem; text-align: center; margin-bottom: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .hero-inner { grid-template-columns: 1fr; padding: 24px; }
  .hero-image { order: -1; }
  .form-row { grid-template-columns: 1fr; }
  .cart-panel { width: 100vw; }
}
