:root {
  --navy: #0f2a5c;
  --navy-dark: #0a1e45;
  --blue-accent: #1c4fa0;
  --blue-vivid: #0066e0;
  --cyan: #00b8e6;
  --cyan-dark: #0092b8;
  --orange: #ff6a1a;
  --orange-dark: #e0530a;
  --bg-soft: #eef1f6;
  --text-main: #1a2333;
  --text-mut: #5b6472;
  --border: #dde2ea;
  --green: #1fa855;
  --green-dark: #17903f;
  --white: #ffffff;
  --radius: 10px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-main);
  background: var(--bg-soft);
}
h1, h2, h3 { margin: 0; }
p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; }
.no-scroll { overflow: hidden; }

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  font-weight: 800;
  font-size: 15px;
  color: var(--navy);
  border: 1.5px solid var(--navy);
  border-radius: 6px;
  padding: 4px 8px;
  letter-spacing: 0.5px;
}
.brand-text { font-size: 13px; color: var(--text-mut); line-height: 1.3; }
.brand-text strong { display: block; color: var(--navy); font-size: 14px; }

.cart-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 14px;
}
.cart-toggle .count {
  background: var(--orange);
  color: var(--white);
  border-radius: 50%;
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 55%, var(--blue-vivid) 100%);
  color: var(--white);
  padding: 52px 24px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -160px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(0,184,230,0.35), rgba(0,184,230,0) 70%);
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute;
  right: 40px;
  top: -120px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.10), rgba(255,255,255,0) 70%);
  pointer-events: none;
}
.hero-inner { max-width: 760px; position: relative; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
}
.hero-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px 1px rgba(0,184,230,0.8); }
.hero h1 { font-size: 38px; line-height: 1.15; margin-bottom: 16px; }
.hero p { font-size: 16px; line-height: 1.5; color: rgba(255,255,255,0.88); max-width: 520px; }

/* Contact strip */
.contact-strip {
  background: var(--navy-dark);
  color: rgba(255,255,255,0.9);
  font-size: 13px;
  padding: 10px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
  justify-content: center;
}
.contact-strip a { color: #bcd4ff; text-decoration: none; }
.contact-strip a:hover { text-decoration: underline; }

/* Main content */
.main-content { max-width: 1080px; margin: 0 auto; padding: 28px 24px 100px; }

.price-note {
  display: inline-block;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13px;
  color: var(--text-mut);
  margin-bottom: 18px;
}
.price-note strong { color: var(--navy); }

.search-wrap { margin-bottom: 16px; }
.search-wrap input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: var(--white);
}
.search-wrap input:focus { outline: 2px solid var(--blue-accent); outline-offset: 1px; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.filter-btn {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}
.filter-btn.active { background: var(--navy); border-color: var(--navy); color: var(--white); }

.category-section { margin-bottom: 34px; }
.category-head { margin-bottom: 14px; padding-left: 12px; border-left: 4px solid var(--cyan); }
.category-head h2 { font-size: 20px; color: var(--navy); margin-bottom: 4px; }
.category-head p { font-size: 13px; color: var(--text-mut); }

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

.product-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px -8px rgba(15,42,92,0.25);
  border-color: var(--blue-vivid);
}
.prod-photo {
  height: 140px;
  background: #fcfdff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 10px;
}
.prod-photo img { max-height: 118px; max-width: 82%; object-fit: contain; }
.prod-icon { width: 64px; height: 64px; color: var(--blue-vivid); opacity: 0.8; }
.prod-icon svg { width: 100%; height: 100%; }
.prod-photo img.prod-photo-generic { max-height: 108px; }
.prod-photo:has(img.prod-photo-generic)::after {
  content: "Imagen referencial";
  position: absolute;
  right: 6px;
  bottom: 5px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-mut);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 999px;
}

.prod-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; }
.prod-cat { font-size: 11px; font-weight: 800; letter-spacing: 0.4px; color: var(--cyan-dark); }
.badge-top {
  align-self: flex-start;
  background: linear-gradient(90deg, var(--orange) 0%, #ff8c42 100%);
  color: var(--white);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2px;
  padding: 3px 9px;
  border-radius: 999px;
  margin-top: 2px;
  box-shadow: 0 2px 6px -1px rgba(255,106,26,0.5);
}
.prod-body h3 { font-size: 16px; margin-top: 4px; }
.prod-pres { font-size: 13px; color: var(--text-mut); }
.prod-desc { font-size: 13px; color: var(--text-mut); line-height: 1.4; margin-top: 4px; min-height: 36px; }
.prod-code { font-size: 12px; color: #9aa2af; margin-top: 6px; }
.prod-stock { font-size: 12px; font-weight: 700; margin-top: 2px; }
.prod-stock.in { color: var(--green-dark); }
.prod-stock.out { color: #b3261e; }

.mode-toggle { display: flex; gap: 0; margin-top: 8px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.mode-btn { flex: 1; background: var(--white); border: none; padding: 8px 6px; font-size: 12.5px; font-weight: 600; color: var(--text-main); border-right: 1px solid var(--border); }
.mode-btn:last-child { border-right: none; }
.mode-btn.active { background: var(--navy); color: var(--white); }

.prod-price { font-size: 21px; font-weight: 800; color: var(--blue-vivid); margin-top: 10px; }
.prod-price span { display: block; font-size: 11px; font-weight: 500; color: var(--text-mut); }

.qty-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.stepper { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.step-btn { background: var(--white); border: none; width: 32px; height: 38px; font-size: 16px; color: var(--navy); }
.qty-input { width: 34px; border: none; border-left: 1px solid var(--border); border-right: 1px solid var(--border); text-align: center; height: 38px; font-size: 14px; }
.add-btn {
  flex: 1;
  background: linear-gradient(90deg, var(--orange) 0%, var(--orange-dark) 100%);
  color: var(--white);
  border: none;
  border-radius: 8px;
  height: 38px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.2px;
  box-shadow: 0 3px 8px -2px rgba(255,106,26,0.55);
  transition: filter .15s ease, transform .1s ease;
}
.add-btn:hover { filter: brightness(1.06); }
.add-btn:active { transform: scale(0.98); }
.add-btn.added { background: var(--green-dark); box-shadow: none; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-mut); }
.whatsapp-link {
  display: inline-block;
  margin-top: 14px;
  background: var(--green);
  color: var(--white);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
}

/* Bottom bar */
.bottom-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--navy-dark);
  color: var(--white);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 25;
}
.bottom-bar button {
  background: var(--white);
  color: var(--navy);
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  font-weight: 700;
  font-size: 13px;
}

/* Cart drawer */
.cart-overlay {
  position: fixed; inset: 0; background: rgba(10,20,40,0.45);
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 30;
}
.cart-overlay.open { opacity: 1; pointer-events: auto; }

.cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(420px, 100%);
  background: var(--white);
  transform: translateX(100%);
  transition: transform .25s ease;
  z-index: 31;
  display: flex;
  flex-direction: column;
}
.cart-drawer.open { transform: translateX(0); }
.cart-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.cart-head h2 { font-size: 19px; color: var(--navy); }
.cart-close { background: none; border: none; font-size: 20px; color: var(--text-mut); }

.cart-items { flex: 1; overflow-y: auto; padding: 14px 20px; }
.cart-empty { color: var(--text-mut); font-size: 14px; padding: 20px 0; }
.cart-row {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.cart-row-main { display: flex; flex-direction: column; gap: 3px; }
.cart-row-main span { color: var(--text-mut); font-size: 12.5px; }
.remove-btn { background: none; border: none; color: #b3261e; font-size: 12.5px; padding: 0; text-align: left; width: fit-content; }
.cart-row-price { font-weight: 700; color: var(--navy); white-space: nowrap; }

.cart-footer { border-top: 1px solid var(--border); padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.cart-total-row { display: flex; justify-content: space-between; font-size: 15px; margin-bottom: 4px; }
.cart-total-row strong { color: var(--navy); font-size: 19px; }
.cart-footer input, .cart-footer textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit;
}
.delivery-toggle { display: flex; gap: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.delivery-btn { flex: 1; background: var(--white); border: none; padding: 10px; font-size: 13.5px; font-weight: 600; border-right: 1px solid var(--border); }
.delivery-btn:last-child { border-right: none; }
.delivery-btn.active { background: var(--navy); color: var(--white); }
#address-row { display: flex; flex-direction: column; gap: 8px; }
.delivery-note {
  font-size: 12px; line-height: 1.4; color: var(--cyan-dark); background: #eaf9fc;
  border: 1px solid #c9eef5; border-radius: 8px; padding: 8px 10px; margin: 0;
}
.send-btn {
  background: var(--green); color: var(--white); border: none; border-radius: 8px;
  padding: 14px; font-size: 15px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.send-btn:hover { background: var(--green-dark); }
.form-error { color: #b3261e; font-size: 12.5px; }
.cart-helper { font-size: 11.5px; color: var(--text-mut); text-align: center; }

/* Footer */
.site-footer {
  background: var(--navy-dark);
  color: rgba(255,255,255,0.75);
  padding: 28px 24px 90px;
  text-align: center;
  font-size: 13px;
}
.site-footer strong { display: block; color: var(--white); font-size: 15px; margin-bottom: 6px; }
.site-footer .fine-print { margin-top: 10px; font-size: 12px; color: rgba(255,255,255,0.5); }

@media (max-width: 640px) {
  .hero h1 { font-size: 28px; }
  .site-header { padding: 12px 16px; }
  .main-content { padding: 20px 16px 110px; }
  .product-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .prod-photo { height: 100px; }
}
@media (max-width: 420px) {
  .product-grid { grid-template-columns: 1fr; }
}
