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

:root {
  --red: #E40414;
  --red-dark: #b00310;
  --red-light: #ff1a2a;
  --gray-100: #f8f9fa;
  --gray-200: #f1f1f1;
  --gray-300: #e9ecef;
  --gray-400: #d9d9d9;
  --gray-500: #ced4da;
  --gray-600: #adb5bd;
  --gray-700: #6c757d;
  --gray-800: #343a40;
  --gray-900: #212529;
  --panel: #6e716e;
  --link-blue: #1979c2;
  --bg: #ffffff;
  --bg-alt: #f6f6f6;
  --card-bg: #ffffff;
  --text: #333333;
  --text-secondary: #6a6a6a;
  --text-muted: #999999;
  --border: #e5e5e5;
  --whatsapp: #25d366;
  --footer-bg: #2d2d2d;
  --font: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
  --transition: 0.15s ease;
  --radius: 0px;
  --shadow: 0 1px 2px rgba(0,0,0,0.04);
}

[data-theme="dark"] {
  --bg: #1a1a1a;
  --bg-alt: #222;
  --card-bg: #2a2a2a;
  --text: #e0e0e0;
  --text-secondary: #a0a0a0;
  --text-muted: #707070;
  --border: #3a3a3a;
  --footer-bg: #111;
  --gray-200: #2a2a2a;
  --gray-400: #3a3a3a;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; }
input { font-family: inherit; font-size: inherit; }
::selection { background: var(--red); color: white; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }

/* Top Bar */
.topbar {
  background: var(--panel);
  color: rgba(255,255,255,0.8);
  font-size: 0.65rem;
  text-align: center;
  padding: 0.35rem;
  font-weight: 600;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card-bg);
  box-shadow: 0 1px 0 var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  height: 70px;
  gap: 0.75rem;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--red);
  flex-shrink: 0;
}
.logo svg { flex-shrink: 0; }
.search-bar {
  flex: 1;
  max-width: 500px;
  position: relative;
}
.search-bar input {
  width: 100%;
  padding: 0.55rem 0.75rem 0.55rem 2.5rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.8rem;
  outline: none;
}
.search-bar input:focus { border-color: var(--red); }
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--text-secondary);
  transition: color var(--transition);
}
.theme-toggle:hover { color: var(--red); }
.search-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.search-toggle:hover { color: var(--red); }
.header-link {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.45rem 0.6rem;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  transition: color var(--transition);
}
.header-link:hover { color: var(--red); }
.cart-btn {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 0.8rem;
  background: var(--red);
  color: white;
  font-size: 0.78rem;
  font-weight: 700;
  transition: background var(--transition);
}
.cart-btn:hover { background: var(--red-dark); }
.cart-count {
  background: rgba(255,255,255,0.2);
  padding: 0.05rem 0.35rem;
  font-size: 0.65rem;
  font-weight: 700;
}

/* Search slide (mobile) */
.search-slide {
  position: fixed;
  top: 70px;
  left: 0;
  right: 0;
  z-index: 99;
  background: var(--card-bg);
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.search-slide.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: all;
}
.search-slide-inner {
  display: flex;
  align-items: center;
  gap: 0;
}
.search-slide-icon {
  display: flex;
  align-items: center;
  padding: 0 0 0 0.75rem;
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}
.search-slide input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
  margin: 0 0.5rem;
}
.search-slide input:focus { border-color: var(--red); }
.search-slide-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  color: var(--text-muted);
}
.search-slide-close:hover { color: var(--red); }

/* Category nav (menu rojo) */
.catnav {
  background: var(--red);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.catnav-inner {
  display: flex;
  gap: 0;
  height: 48px;
  align-items: center;
}
.catnav-link {
  flex-shrink: 0;
  padding: 0.6rem 1rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
  transition: color var(--transition), background var(--transition);
}
.catnav-link:hover { background: rgba(255,255,255,0.1); color: #fff; }
.catnav-link.active { background: rgba(255,255,255,0.15); color: #fff; }

/* Hero Banner */
.hero-banner {
  background: var(--bg-alt);
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--border);
}
.hero-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}
.hero-text h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 0.5rem;
}
.hero-text p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  max-width: 400px;
  line-height: 1.6;
}
.hero-text .hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
  padding: 0.6rem 1.5rem;
  background: var(--red);
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  transition: background var(--transition);
}
.hero-text .hero-btn:hover { background: var(--red-dark); }
.hero-visual svg { width: 160px; height: 160px; opacity: 0.1; }

/* Categories */
.categories {
  padding: 1.25rem 0 0.75rem;
}
.category-list {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.category-btn {
  padding: 0.4rem 0.9rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  border: 1px solid var(--border);
  background: var(--card-bg);
  transition: all var(--transition);
}
.category-btn:hover { border-color: var(--red); color: var(--red); }
.category-btn.active { background: var(--red); color: white; border-color: var(--red); }

/* Products */
.products-section {
  padding: 0 0 2.5rem;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.section-title {
  font-size: 1.1rem;
  font-weight: 800;
}
.product-grid, #products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.product-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.product-card:hover { box-shadow: 0 2px 6px rgba(0,0,0,0.05); }
.product-image {
  position: relative;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  aspect-ratio: 1;
}
.product-image svg, .product-image img {
  width: 52px;
  height: 52px;
  opacity: 0.25;
  transition: transform 0.3s ease;
}
.product-card:hover .product-image svg { transform: scale(1.08); }
.discount-badge {
  position: absolute;
  top: 0;
  left: 0;
  padding: 0.25rem 0.6rem;
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--red);
  color: white;
}
.product-label {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  padding: 0.15rem 0.45rem;
  font-size: 0.55rem;
  font-weight: 700;
  background: #ff0000;
  color: white;
  text-transform: uppercase;
}
.product-info {
  padding: 0.75rem;
}
.product-category {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}
.product-name {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-price {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  margin-bottom: 0.5rem;
}
.product-price .current {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
}
.product-price .old {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-decoration: line-through;
}
.add-to-cart {
  width: 100%;
  padding: 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--red);
  color: white;
  transition: background var(--transition);
}
.add-to-cart:hover { background: var(--red-dark); }
.add-to-cart:disabled { opacity: 0.4; cursor: default; }

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.3rem;
  margin-top: 1.5rem;
}
.page-btn {
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all var(--transition);
}
.page-btn:hover { border-color: var(--red); color: var(--red); }
.page-btn.active { background: var(--red); color: white; border-color: var(--red); }
.page-btn:disabled { opacity: 0.35; }
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  text-align: center;
}
.empty-state svg { width: 40px; height: 40px; opacity: 0.3; }
.empty-state h3 { font-size: 0.9rem; font-weight: 700; }
.empty-state p { font-size: 0.8rem; }

/* Cart Sidebar */
.cart-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.cart-overlay.open { opacity: 1; pointer-events: all; }
.cart-sidebar {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  max-width: 88vw;
  height: 100%;
  z-index: 300;
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
}
.cart-sidebar.open { right: 0; }
.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}
.cart-header h3 { font-size: 1rem; font-weight: 700; }
.cart-close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}
.cart-close:hover { color: var(--red); }
.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 1rem;
}
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  gap: 0.5rem;
}
.cart-empty svg { opacity: 0.2; }
.cart-item {
  display: flex;
  gap: 0.65rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}
.cart-item:last-child { border-bottom: none; }
.cart-item-image {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cart-item-image svg { width: 20px; height: 20px; opacity: 0.3; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 0.8rem; font-weight: 600; margin-bottom: 0.1rem; }
.cart-item-price { font-size: 0.8rem; color: var(--red); font-weight: 700; }
.cart-item-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
}
.quantity-btn {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 700;
  transition: all var(--transition);
}
.quantity-btn:hover { border-color: var(--red); color: var(--red); }
.cart-item-quantity {
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}
.cart-item-remove {
  background: none;
  color: var(--text-muted);
  font-size: 0.65rem;
  margin-left: 0.2rem;
}
.cart-item-remove:hover { color: var(--red); }
.cart-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
}
.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
}
.cart-total span:first-child { font-weight: 700; font-size: 0.85rem; }
.cart-total .total-amount {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--red);
}
.checkout-btn {
  width: 100%;
  padding: 0.65rem;
  background: var(--red);
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  transition: background var(--transition);
}
.checkout-btn:hover { background: var(--red-dark); }

/* Product Modal */
.modal, #product-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  overflow: hidden;
}
.modal.open, #product-modal.open { opacity: 1; pointer-events: all; overflow: auto; }
#product-modal .product-modal-content {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  max-width: 400px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(15px);
  transition: transform 0.3s ease;
}
#product-modal.open .product-modal-content { transform: translateY(0); }
.product-modal-image {
  aspect-ratio: 4/3;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.product-modal-image svg { width: 64px; height: 64px; opacity: 0.15; }
.product-modal-info {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.product-modal-info .product-category { font-size: 0.6rem; }
.product-modal-info h2 { font-size: 1.1rem; font-weight: 700; line-height: 1.25; }
.product-modal-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.product-modal-prices .current {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
}
.product-modal-prices .old {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: line-through;
  margin-left: 0.4rem;
}
.product-modal-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.product-modal-actions .add-to-cart {
  flex: 1;
  padding: 0.65rem;
  background: var(--red);
  color: white;
  font-weight: 700;
  font-size: 0.8rem;
}
.product-modal-actions .add-to-cart:hover { background: var(--red-dark); }
.whatsapp-btn-modal {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: #25d366;
  color: white;
  flex-shrink: 0;
  transition: opacity var(--transition);
}
.whatsapp-btn-modal:hover { opacity: 0.85; }
.product-modal-close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
  color: var(--text-secondary);
}
.product-modal-close:hover { color: var(--red); }

/* Auth Modal */
.modal-content {
  background: var(--card-bg);
  width: 100%;
  max-width: 380px;
  padding: 1.75rem;
  transform: translateY(15px);
  transition: transform 0.3s ease;
}
.modal.open .modal-content { transform: translateY(0); }
.auth-tabs {
  display: flex;
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
}
.auth-tab {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition);
}
.auth-tab.active { background: var(--red); color: white; border-color: var(--red); }
.auth-form { display: flex; flex-direction: column; gap: 0.85rem; }
.auth-form h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.2rem; }
.form-group { display: flex; flex-direction: column; gap: 0.2rem; }
.form-group label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-secondary);
}
.form-group input {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition);
}
.form-group input:focus { border-color: var(--red); }
.auth-submit {
  padding: 0.65rem;
  background: var(--red);
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  transition: background var(--transition);
  margin-top: 0.35rem;
}
.auth-submit:hover { background: var(--red-dark); }

/* Toast */
.toast {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%) translateY(70px);
  z-index: 500;
  background: var(--red);
  color: white;
  padding: 0.6rem 1.2rem;
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0;
  transition: all 0.3s ease;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Footer */
.footer {
  background: var(--footer-bg);
  color: rgba(255,255,255,0.5);
  padding: 2.5rem 0 0;
  margin-top: 2rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 1.5rem;
  padding-bottom: 1.5rem;
}
.footer-brand .logo { color: #fff; }
.footer-brand p {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.35);
  line-height: 1.6;
  margin-top: 0.5rem;
  max-width: 260px;
}
.footer-col h4 {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: white;
  margin-bottom: 0.75rem;
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; }
.footer-col li { font-size: 0.8rem; }
.footer-col a { color: rgba(255,255,255,0.4); transition: color var(--transition); }
.footer-col a:hover { color: var(--red); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.05);
  padding: 1rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.25);
}
.footer-bottom a { color: var(--red-light); }

/* WhatsApp Float */
.whatsapp-float {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 50;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--whatsapp);
  color: white;
  box-shadow: 0 3px 12px rgba(37,211,102,0.3);
  transition: opacity var(--transition);
}
.whatsapp-float:hover { opacity: 0.85; }

/* Overlay */
#overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}
#overlay.open {
  background: rgba(0,0,0,0.3);
  pointer-events: all;
}

/* Breadcrumbs area */
.breadcrumbs {
  background: var(--bg-alt);
  padding: 0.65rem 0;
  font-size: 0.72rem;
  color: var(--text-secondary);
}
.breadcrumbs span { color: var(--text-muted); }

/* Responsive */
@media (max-width: 1100px) {
  .product-grid, #products-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .product-grid, #products-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .hero-inner { flex-direction: column; text-align: center; }
  .hero-text p { margin: 0 auto; }
  .hero-visual { display: none; }
}
@media (max-width: 768px) {
  .header-inner { height: 60px; }
  .header-link span { display: none; }
  .cart-sidebar { width: 100vw; right: -100vw; }
}
@media (max-width: 540px) {
  .search-toggle { display: flex; }
  .search-bar { display: none; }
  .topbar { font-size: 0.55rem; padding: 0.25rem; }
  .catnav-link { font-size: 0.7rem; padding: 0.5rem 0.75rem; }
  .hero-text h1 { font-size: 1.3rem; }
  .hero-text p { font-size: 0.8rem; }
  .section-header { flex-direction: column; align-items: flex-start; gap: 0.2rem; }
  .cart-sidebar { width: 100%; right: -100%; }
  .footer-grid { grid-template-columns: 1fr; gap: 1.25rem; }
  .footer-bottom { flex-direction: column; gap: 0.4rem; text-align: center; }
}
@media (max-width: 480px) {
  .product-grid, #products-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .product-image { padding: 1rem; }
  .product-image svg { width: 36px; height: 36px; }
  .product-info { padding: 0.5rem; }
  .product-price .current { font-size: 0.9rem; }
  .product-name { font-size: 0.7rem; }
}
