@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@500;600&display=swap");

:root {
  --bg: #faf8f3;
  --surface: #ffffff;
  --ink: #1f2421;
  --muted: #6b6a5e;
  --line: #e5e0d3;
  --accent: #2f5d50;
  --accent-soft: #e7efe9;
  --accent-ink: #ffffff;
  --tag: #c98a2c;
  --tag-ink: #2a1c05;
  --danger: #a83232;
  --radius: 10px;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}

a { color: inherit; }

h1, h2, .brand, .hero h1 {
  font-family: "Fraunces", Georgia, serif;
}

.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; }

/* --- Nav --- */
.navbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}

.navbar .brand {
  font-weight: 600;
  font-size: 1.3rem;
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.navbar-search {
  flex: 1;
  display: flex;
  justify-content: flex-start;
  padding-left: 1rem;
  min-width: 160px;
}

.navbar .nav-right {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-left: auto;
}

/* El panel de admin usa un <nav> directo (sin .navbar-search de por medio),
   así que necesita su propia regla para quedar pegado a la derecha. */
.navbar > nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#user-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

#user-nav[hidden], #guest-nav[hidden] {
  display: none;
}

.navbar nav a {
  text-decoration: none;
  font-size: 0.95rem;
  color: var(--muted);
}

.navbar nav a:hover { color: var(--ink); }

/* Estado de sesión en el nav */
.user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.35rem 0.7rem 0.35rem 0.4rem;
  font-size: 0.85rem;
}

.user-chip .avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.cart-link {
  position: relative;
  text-decoration: none;
  font-size: 0.95rem;
}

.cart-badge {
  position: absolute;
  top: -8px;
  right: -12px;
  background: var(--tag);
  color: var(--tag-ink);
  font-size: 0.65rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.05rem 0.35rem;
  font-family: "IBM Plex Mono", monospace;
}

.btn-link-danger {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
}
.btn-link-danger:hover { color: var(--danger); }

/* --- Menú hamburguesa (solo mobile) --- */
.hamburger-btn {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  font-size: 1.15rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}

@media (max-width: 700px) {
  .hamburger-btn {
    display: flex;
    order: 2;
    margin-left: auto;
  }

  /* En mobile, el nav-right deja de ir en línea junto a la marca y se
     convierte en un panel desplegable debajo del navbar, oculto hasta
     que se toca el botón ☰. */
  .navbar .nav-right {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
    padding: 0.25rem 1.25rem 1rem;
  }

  .navbar .nav-right.open {
    display: flex;
  }

  .navbar .nav-right > * {
    width: 100%;
  }

  .navbar .nav-right .cart-link {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--line);
  }

  .navbar .nav-right #guest-nav a,
  .navbar .nav-right #user-nav {
    padding: 0.75rem 0;
  }

  #user-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }

  #user-nav .btn-nav {
    width: 100%;
    text-align: center;
  }

  /* El panel de admin usa un <nav> suelto en vez de .nav-right */
  .navbar > nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 1.25rem 1rem;
  }

  .navbar > nav.open {
    display: flex;
  }

  .navbar > nav #admin-email {
    margin-right: 0 !important;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--line);
  }

  .navbar > nav .btn-nav {
    width: 100%;
    text-align: center;
    margin: 0.35rem 0;
  }

  .navbar > nav #logout-btn {
    width: 100%;
    margin: 0.5rem 0 0 !important;
  }
}

/* --- Hero --- */
.hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem 2rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 600;
  margin: 0 0 0.4rem;
  letter-spacing: -0.01em;
}

.hero .subtitle {
  color: var(--muted);
  margin: 0;
  max-width: 42ch;
}

.hero .hero-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.6rem;
}

/* --- Layout --- */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

h1 { font-size: 1.6rem; margin-bottom: 0.25rem; }
.subtitle { color: var(--muted); margin-top: 0; margin-bottom: 2rem; }

/* --- Barra de búsqueda (en el navbar) --- */
.search-input {
  width: 100%;
  max-width: 380px;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--bg);
}

.search-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
/* --- Filtros del catálogo --- */

.filters {
  max-width: 1100px;
  margin: 0 auto 1.75rem;
  padding: 0 1.5rem;
}

.filters .chip-row {
  padding: 0;
  margin: 0 0 0.9rem;
}

.brand-filter {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.brand-filter label {
  display: inline;
  margin: 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.brand-filter select {
  min-width: 220px;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.brand-filter select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
/* --- Category chips --- */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 1.5rem;
  max-width: 1100px;
  margin: 0 auto 1.75rem;
}

.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--muted);
}

.chip:hover { border-color: var(--accent); color: var(--ink); }

.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* --- Product grid (cliente) --- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.4rem;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.product-card:hover {
  box-shadow: 0 6px 20px rgba(31, 36, 33, 0.08);
  transform: translateY(-2px);
}

.product-media {
  position: relative;
}

.product-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--line);
  display: block;
}

/* Firma visual: etiqueta de precio tipo "sticker" */
.price-tag {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: var(--tag);
  color: var(--tag-ink);
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.3rem 0.55rem;
  border-radius: 4px;
  transform: rotate(3deg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.product-info { padding: 0.9rem; display: flex; flex-direction: column; gap: 0.4rem; flex: 1; }
.product-info h3 { margin: 0; font-size: 1.05rem; font-family: "Fraunces", serif; font-weight: 600; }
.product-brand {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.product-desc { color: var(--muted); font-size: 0.85rem; margin: 0; min-height: 2.4em; }

.dupe-tag {
  margin: 0;
  font-size: 1rem;
  font-weight: 400;
  color: var(--ink);
}
.dupe-tag b { font-weight: 700; }

.tamano-selector-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tamano-chip {
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  font-size: 0.72rem;
  font-family: "IBM Plex Mono", monospace;
  cursor: pointer;
}

.tamano-chip:hover { border-color: var(--accent); }

.tamano-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.tamano-chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  text-decoration: line-through;
}

.tamano-label {
  font-size: 0.72rem;
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  display: inline-block;
  width: fit-content;
}

.product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  margin-top: auto;
}

.stock { color: var(--accent); font-family: "IBM Plex Mono", monospace; }
.stock-out { color: var(--danger); font-family: "IBM Plex Mono", monospace; }

.disponibilidad-link {
  color: var(--accent);
  font-size: 0.8rem;
  text-decoration: none;
  border-bottom: 1px dashed var(--accent);
}

.disponibilidad-link:hover { opacity: 0.8; }

.btn-add, button[type="submit"], .btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
  width: 100%;
}

.btn-add:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }
.btn-add:hover:not(:disabled), button[type="submit"]:hover { opacity: 0.9; }

/* --- Botón flotante de WhatsApp --- */
.whatsapp-float {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 56px;
  height: 56px;
  background: #25d366;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  z-index: 50;
  transition: transform 0.15s ease;
}

.whatsapp-float img {
  width: 100%;         /* Ajusta este porcentaje si quieres la imagen más chica o más grande */
  height: 100%;
  object-fit: contain; /* Evita que la imagen se deforme */
  pointer-events: none; /* Evita interferencias al hacer clic */
  border-radius: 50%;  /* Hace que la imagen sea completamente circular */
}

.whatsapp-float:hover { transform: scale(1.06); }

@media (max-width: 600px) {
  .whatsapp-float { bottom: 1rem; right: 1rem; width: 50px; height: 50px; font-size: 1.4rem; }
}

/* ============================================================
   Mejoras generales para mobile
   ============================================================ */
@media (max-width: 640px) {
  /* Navbar: la búsqueda pasa a su propia fila completa debajo de
     la marca y los íconos, en vez de apretarse entre ambos. */
  .navbar {
    padding: 0.75rem 1rem;
  }

  .navbar-search {
    order: 3;
    flex-basis: 100%;
    padding-left: 0;
    margin-top: 0.5rem;
  }

  .search-input {
    max-width: none;
  }

  /* Chips de categoría/estado: scroll horizontal en vez de amontonarse
     en varias líneas y empujar el contenido hacia abajo. */
  .chip-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.4rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .chip-row::-webkit-scrollbar { display: none; }
  .chip { flex-shrink: 0; }

  /* Grilla de productos: dos columnas se navegan mejor con el pulgar
     que una sola columna ancha. */
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
  }

  .product-info { padding: 0.65rem; }
  .product-info h3 { font-size: 0.92rem; }
  .product-desc { display: none; } /* con dos columnas angostas, la descripción larga estorba más de lo que ayuda */

  /* Objetivos táctiles más grandes (mínimo recomendado ~40-44px) */
  .chip, .tamano-btn {
    padding: 0.55rem 1rem;
  }

  .tamano-chip {
    padding: 0.4rem 0.7rem;
    font-size: 0.78rem;
  }

  .qty-control button {
    width: 36px;
    height: 36px;
  }

  .cart-remove, .btn-link-danger {
    padding: 0.4rem;
  }

  /* Tabla del panel de admin: scroll horizontal contenido en vez de
     desbordarse fuera de la pantalla. */
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  /* Espacio extra abajo para que el botón flotante de WhatsApp no tape
     el último botón de la página (Enviar pedido, Agregar al carrito, etc). */
  main {
    padding-bottom: 6rem;
  }
}

#empty-state { color: var(--muted); text-align: center; padding: 3rem 0; }

/* --- Forms (login / admin) --- */
.form-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 420px;
}

.form-card.wide { max-width: 640px; }

label {
  display: block;
  font-size: 0.85rem;
  margin: 0.75rem 0 0.25rem;
  color: var(--muted);
}

input, textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
}

input:focus, textarea:focus, button:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.form-row { display: flex; gap: 1rem; }
.form-row > div { flex: 1; }

.form-actions { display: flex; gap: 0.6rem; margin-top: 1rem; }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem 0.9rem;
  cursor: pointer;
}

.btn-nav {
  display: inline-block;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--ink);
}

.btn-nav:hover { border-color: var(--accent); color: var(--accent); }

.btn-nav.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn-nav[hidden] {
  display: none;
}

.error-msg { color: var(--danger); font-size: 0.85rem; min-height: 1.2em; }

/* --- Admin table --- */
table { width: 100%; border-collapse: collapse; margin-top: 1.5rem; }
th, td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.actions button { margin-right: 0.4rem; font-size: 0.8rem; padding: 0.35rem 0.6rem; }
.btn-edit { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.btn-delete { background: var(--danger); color: white; border: none; border-radius: 6px; cursor: pointer; }

/* --- Tamaños (admin) --- */
.tamano-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.tamano-row input {
  margin: 0;
}

.tamano-remove {
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  color: var(--muted);
}
.tamano-remove:hover { color: var(--danger); border-color: var(--danger); }

@media (max-width: 600px) {
  .tamano-row { grid-template-columns: 1fr 1fr; grid-template-areas: "nombre nombre" "precio stock" "remove remove"; }
}

/* --- Selector de tamaño (detalle de producto) --- */
.tamano-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1.25rem;
}

.tamano-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: "IBM Plex Mono", monospace;
}

.tamano-btn:hover { border-color: var(--accent); }

.tamano-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.tamano-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  text-decoration: line-through;
}

@media (max-width: 600px) {
  .form-row { flex-direction: column; }
  .hero { padding-top: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .product-card { transition: none; }
}



/* --- Imágenes múltiples (admin) --- */
.form-help {
  color: var(--muted);
  font-size: 0.8rem;
  margin: -0.35rem 0 0.7rem;
}

.imagen-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.imagen-row-main {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
}

.imagen-row .imagen-url {
  flex: 1;
  min-width: 0;
}

.imagen-position {
  flex: 0 0 auto;
  min-width: 42px;
  text-align: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  color: var(--muted);
}

.imagen-position.is-cover {
  color: var(--accent);
  font-weight: 600;
}

.imagen-remove {
  flex: 0 0 auto;
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  color: var(--muted);
}

.imagen-remove:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.imagenes-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.8rem;
}

.imagen-preview-item {
  position: relative;
  margin: 0;
}

.imagen-preview-item img {
  display: block;
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--line);
}

.imagen-preview-item.cover img {
  border: 2px solid var(--accent);
}

.imagen-preview-item figcaption {
  text-align: center;
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.imagen-preview-item.cover figcaption {
  color: var(--accent);
  font-weight: 600;
}

.imagen-preview-item.preview-error img {
  opacity: 0.35;
}

/* --- Galería de imágenes (detalle del producto) --- */
.product-gallery {
  width: 100%;
}

.product-main-image img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--line);
  border: 1px solid var(--line);
  display: block;
}

.product-thumbnails {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.product-thumbnail {
  width: 72px;
  height: 72px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
}

.product-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-thumbnail:hover {
  border-color: var(--line);
}

.product-thumbnail.active {
  border-color: var(--accent);
}

/* --- Detalle de producto --- */
.product-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 460px) 1fr;
  gap: 2.5rem;
}

.product-detail-media img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--line);
  border: 1px solid var(--line);
}

.btn-whatsapp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: #25d366;
  color: #ffffff;
  text-decoration: none;
  border-radius: var(--radius);
  padding: 0.65rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.btn-whatsapp:hover { opacity: 0.92; }

@media (max-width: 720px) {
  .product-detail-grid { grid-template-columns: 1fr; gap: 1.25rem; }
}

/* --- Carrito --- */
.cart-empty {
  color: var(--muted);
  text-align: center;
  padding: 3rem 0;
}

.cart-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin: 1.5rem 0;
}

.cart-row {
  display: grid;
  grid-template-columns: 64px 1fr auto auto auto;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem;
}

.cart-row img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--line);
}

.cart-row .cart-name { font-weight: 600; font-family: "Fraunces", serif; }
.cart-row .cart-unit-price { font-family: "IBM Plex Mono", monospace; font-size: 0.8rem; color: var(--muted); }

.qty-control {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.qty-control button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.qty-control button:hover { border-color: var(--accent); }
.qty-control button:disabled { opacity: 0.4; cursor: not-allowed; }

.qty-control span {
  min-width: 1.5rem;
  text-align: center;
  font-family: "IBM Plex Mono", monospace;
}

.cart-line-total {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  min-width: 5.5rem;
  text-align: right;
}

.cart-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
}
.cart-remove:hover { color: var(--danger); }

.cart-summary {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  max-width: 360px;
  margin-left: auto;
}

.cart-summary .cart-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.cart-summary .cart-total-row .mono { font-family: "IBM Plex Mono", monospace; }

.order-confirmation {
  text-align: center;
  padding: 3rem 1rem;
}

.order-confirmation .check {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.estado-badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.estado-pendiente { background: #f4e6c9; color: #6b4e0e; }
.estado-en-preparación { background: #d8e6f4; color: #1f4a70; }
.estado-enviado { background: #dbe7df; color: #1f4a35; }
.estado-completado { background: var(--accent-soft); color: var(--accent); }
.estado-cancelado { background: #f4d9d9; color: var(--danger); }

@media (max-width: 640px) {
  .cart-row {
    grid-template-columns: 48px 1fr;
    grid-template-areas:
      "img name"
      "img qty"
      "img total";
  }
  .cart-row img { grid-area: img; width: 48px; height: 48px; }
  .cart-row > div:nth-child(2) { grid-area: name; }
  .cart-row .qty-control { grid-area: qty; }
  .cart-row .cart-line-total { grid-area: total; text-align: left; }
  .cart-remove { position: absolute; top: 0.5rem; right: 0.5rem; }
  .cart-row { position: relative; }
}

@media (max-width: 600px) {
  .imagen-row {
    align-items: stretch;
  }

  .imagen-row-main {
    flex-direction: column;
    align-items: stretch;
  }

  .imagen-position {
    text-align: left;
  }

  .imagen-remove {
    align-self: flex-end;
  }

  .product-thumbnail {
    width: 64px;
    height: 64px;
  }
}
@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@500;600&display=swap");

:root {
  --bg: #faf8f3;
  --surface: #ffffff;
  --ink: #1f2421;
  --muted: #6b6a5e;
  --line: #e5e0d3;
  --accent: #2f5d50;
  --accent-soft: #e7efe9;
  --accent-ink: #ffffff;
  --tag: #c98a2c;
  --tag-ink: #2a1c05;
  --danger: #a83232;
  --radius: 10px;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}

a { color: inherit; }

h1, h2, .brand, .hero h1 {
  font-family: "Fraunces", Georgia, serif;
}

.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; }

/* --- Nav --- */
.navbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}

.navbar .brand {
  font-weight: 600;
  font-size: 1.3rem;
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.navbar-search {
  flex: 1;
  display: flex;
  justify-content: flex-start;
  padding-left: 1rem;
  min-width: 160px;
}

.navbar .nav-right {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-left: auto;
}

/* El panel de admin usa un <nav> directo (sin .navbar-search de por medio),
   así que necesita su propia regla para quedar pegado a la derecha. */
.navbar > nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#user-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

#user-nav[hidden], #guest-nav[hidden] {
  display: none;
}

.navbar nav a {
  text-decoration: none;
  font-size: 0.95rem;
  color: var(--muted);
}

.navbar nav a:hover { color: var(--ink); }

/* Estado de sesión en el nav */
.user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.35rem 0.7rem 0.35rem 0.4rem;
  font-size: 0.85rem;
}

.user-chip .avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.cart-link {
  position: relative;
  text-decoration: none;
  font-size: 0.95rem;
}

.cart-badge {
  position: absolute;
  top: -8px;
  right: -12px;
  background: var(--tag);
  color: var(--tag-ink);
  font-size: 0.65rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.05rem 0.35rem;
  font-family: "IBM Plex Mono", monospace;
}

.btn-link-danger {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
}
.btn-link-danger:hover { color: var(--danger); }

/* --- Menú hamburguesa (solo mobile) --- */
.hamburger-btn {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  font-size: 1.15rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}

@media (max-width: 700px) {
  .hamburger-btn {
    display: flex;
    order: 2;
    margin-left: auto;
  }

  /* En mobile, el nav-right deja de ir en línea junto a la marca y se
     convierte en un panel desplegable debajo del navbar, oculto hasta
     que se toca el botón ☰. */
  .navbar .nav-right {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
    padding: 0.25rem 1.25rem 1rem;
  }

  .navbar .nav-right.open {
    display: flex;
  }

  .navbar .nav-right > * {
    width: 100%;
  }

  .navbar .nav-right .cart-link {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--line);
  }

  .navbar .nav-right #guest-nav a,
  .navbar .nav-right #user-nav {
    padding: 0.75rem 0;
  }

  #user-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }

  #user-nav .btn-nav {
    width: 100%;
    text-align: center;
  }

  /* El panel de admin usa un <nav> suelto en vez de .nav-right */
  .navbar > nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 1.25rem 1rem;
  }

  .navbar > nav.open {
    display: flex;
  }

  .navbar > nav #admin-email {
    margin-right: 0 !important;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--line);
  }

  .navbar > nav .btn-nav {
    width: 100%;
    text-align: center;
    margin: 0.35rem 0;
  }

  .navbar > nav #logout-btn {
    width: 100%;
    margin: 0.5rem 0 0 !important;
  }
}

/* --- Hero --- */
.hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem 2rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 600;
  margin: 0 0 0.4rem;
  letter-spacing: -0.01em;
}

.hero .subtitle {
  color: var(--muted);
  margin: 0;
  max-width: 42ch;
}

.hero .hero-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.6rem;
}

/* --- Layout --- */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

h1 { font-size: 1.6rem; margin-bottom: 0.25rem; }
.subtitle { color: var(--muted); margin-top: 0; margin-bottom: 2rem; }

/* --- Barra de búsqueda (en el navbar) --- */
.search-input {
  width: 100%;
  max-width: 380px;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--bg);
}

.search-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* --- Category chips --- */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 1.5rem;
  max-width: 1100px;
  margin: 0 auto 1.75rem;
}

.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--muted);
}

.chip:hover { border-color: var(--accent); color: var(--ink); }

.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* --- Product grid (cliente) --- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.4rem;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.product-card:hover {
  box-shadow: 0 6px 20px rgba(31, 36, 33, 0.08);
  transform: translateY(-2px);
}

.product-media {
  position: relative;
}

.product-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--line);
  display: block;
}

/* Firma visual: etiqueta de precio tipo "sticker" */
.price-tag {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: var(--tag);
  color: var(--tag-ink);
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.3rem 0.55rem;
  border-radius: 4px;
  transform: rotate(3deg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.product-info { padding: 0.9rem; display: flex; flex-direction: column; gap: 0.4rem; flex: 1; }
.product-info h3 { margin: 0; font-size: 1.05rem; font-family: "Fraunces", serif; font-weight: 600; }
.product-brand {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.product-desc { color: var(--muted); font-size: 0.85rem; margin: 0; min-height: 2.4em; }

.dupe-tag {
  margin: 0;
  font-size: 1rem;
  font-weight: 400;
  color: var(--ink);
}
.dupe-tag b { font-weight: 700; }

.tamano-selector-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tamano-chip {
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  font-size: 0.72rem;
  font-family: "IBM Plex Mono", monospace;
  cursor: pointer;
}

.tamano-chip:hover { border-color: var(--accent); }

.tamano-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.tamano-chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  text-decoration: line-through;
}

.tamano-label {
  font-size: 0.72rem;
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  display: inline-block;
  width: fit-content;
}

.product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  margin-top: auto;
}

.stock { color: var(--accent); font-family: "IBM Plex Mono", monospace; }
.stock-out { color: var(--danger); font-family: "IBM Plex Mono", monospace; }

.disponibilidad-link {
  color: var(--accent);
  font-size: 0.8rem;
  text-decoration: none;
  border-bottom: 1px dashed var(--accent);
}

.disponibilidad-link:hover { opacity: 0.8; }

.btn-add, button[type="submit"], .btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
  width: 100%;
}

.btn-add:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }
.btn-add:hover:not(:disabled), button[type="submit"]:hover { opacity: 0.9; }

/* --- Botón flotante de WhatsApp --- */
.whatsapp-float {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 56px;
  height: 56px;
  background: #25d366;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  z-index: 50;
  transition: transform 0.15s ease;
}

.whatsapp-float:hover { transform: scale(1.06); }

@media (max-width: 600px) {
  .whatsapp-float { bottom: 1rem; right: 1rem; width: 50px; height: 50px; font-size: 1.4rem; }
}

/* ============================================================
   Mejoras generales para mobile
   ============================================================ */
@media (max-width: 640px) {
  /* Navbar: la búsqueda pasa a su propia fila completa debajo de
     la marca y los íconos, en vez de apretarse entre ambos. */
  .navbar {
    padding: 0.75rem 1rem;
  }

  .navbar-search {
    order: 3;
    flex-basis: 100%;
    padding-left: 0;
    margin-top: 0.5rem;
  }

  .search-input {
    max-width: none;
  }

  /* Chips de categoría/estado: scroll horizontal en vez de amontonarse
     en varias líneas y empujar el contenido hacia abajo. */
  .chip-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.4rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .chip-row::-webkit-scrollbar { display: none; }
  .chip { flex-shrink: 0; }

  /* Grilla de productos: dos columnas se navegan mejor con el pulgar
     que una sola columna ancha. */
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
  }

  .product-info { padding: 0.65rem; }
  .product-info h3 { font-size: 0.92rem; }
  .product-desc { display: none; } /* con dos columnas angostas, la descripción larga estorba más de lo que ayuda */

  /* Objetivos táctiles más grandes (mínimo recomendado ~40-44px) */
  .chip, .tamano-btn {
    padding: 0.55rem 1rem;
  }

  .tamano-chip {
    padding: 0.4rem 0.7rem;
    font-size: 0.78rem;
  }

  .qty-control button {
    width: 36px;
    height: 36px;
  }

  .cart-remove, .btn-link-danger {
    padding: 0.4rem;
  }

  /* Tabla del panel de admin: scroll horizontal contenido en vez de
     desbordarse fuera de la pantalla. */
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  /* Espacio extra abajo para que el botón flotante de WhatsApp no tape
     el último botón de la página (Enviar pedido, Agregar al carrito, etc). */
  main {
    padding-bottom: 6rem;
  }
}

#empty-state { color: var(--muted); text-align: center; padding: 3rem 0; }

/* --- Forms (login / admin) --- */
.form-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 420px;
}

.form-card.wide { max-width: 640px; }

label {
  display: block;
  font-size: 0.85rem;
  margin: 0.75rem 0 0.25rem;
  color: var(--muted);
}

input, textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
}

input:focus, textarea:focus, button:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.form-row { display: flex; gap: 1rem; }
.form-row > div { flex: 1; }

.form-actions { display: flex; gap: 0.6rem; margin-top: 1rem; }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem 0.9rem;
  cursor: pointer;
}

.btn-nav {
  display: inline-block;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--ink);
}

.btn-nav:hover { border-color: var(--accent); color: var(--accent); }

.btn-nav.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn-nav[hidden] {
  display: none;
}

.error-msg { color: var(--danger); font-size: 0.85rem; min-height: 1.2em; }

/* --- Admin table --- */
table { width: 100%; border-collapse: collapse; margin-top: 1.5rem; }
th, td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.actions button { margin-right: 0.4rem; font-size: 0.8rem; padding: 0.35rem 0.6rem; }
.btn-edit { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.btn-delete { background: var(--danger); color: white; border: none; border-radius: 6px; cursor: pointer; }

/* --- Tamaños (admin) --- */
.tamano-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.tamano-row input {
  margin: 0;
}

.tamano-remove {
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  color: var(--muted);
}
.tamano-remove:hover { color: var(--danger); border-color: var(--danger); }

@media (max-width: 600px) {
  .tamano-row { grid-template-columns: 1fr 1fr; grid-template-areas: "nombre nombre" "precio stock" "remove remove"; }
}

/* --- Selector de tamaño (detalle de producto) --- */
.tamano-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1.25rem;
}

.tamano-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: "IBM Plex Mono", monospace;
}

.tamano-btn:hover { border-color: var(--accent); }

.tamano-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.tamano-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  text-decoration: line-through;
}

@media (max-width: 600px) {
  .form-row { flex-direction: column; }
  .hero { padding-top: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .product-card { transition: none; }
}



/* --- Imágenes múltiples (admin) --- */
.form-help {
  color: var(--muted);
  font-size: 0.8rem;
  margin: -0.35rem 0 0.7rem;
}

.imagen-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.imagen-row-main {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
}

.imagen-row .imagen-url {
  flex: 1;
  min-width: 0;
}

.imagen-position {
  flex: 0 0 auto;
  min-width: 42px;
  text-align: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  color: var(--muted);
}

.imagen-position.is-cover {
  color: var(--accent);
  font-weight: 600;
}

.imagen-remove {
  flex: 0 0 auto;
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  color: var(--muted);
}

.imagen-remove:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.imagenes-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.8rem;
}

.imagen-preview-item {
  position: relative;
  margin: 0;
}

.imagen-preview-item img {
  display: block;
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--line);
}

.imagen-preview-item.cover img {
  border: 2px solid var(--accent);
}

.imagen-preview-item figcaption {
  text-align: center;
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.imagen-preview-item.cover figcaption {
  color: var(--accent);
  font-weight: 600;
}

.imagen-preview-item.preview-error img {
  opacity: 0.35;
}

/* --- Galería de imágenes (detalle del producto) --- */
.product-gallery {
  width: 100%;
}

.product-main-image img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--line);
  border: 1px solid var(--line);
  display: block;
}

.product-thumbnails {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.product-thumbnail {
  width: 72px;
  height: 72px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
}

.product-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-thumbnail:hover {
  border-color: var(--line);
}

.product-thumbnail.active {
  border-color: var(--accent);
}

/* --- Detalle de producto --- */
.product-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 460px) 1fr;
  gap: 2.5rem;
}

.product-detail-media img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--line);
  border: 1px solid var(--line);
}

.btn-whatsapp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: #25d366;
  color: #ffffff;
  text-decoration: none;
  border-radius: var(--radius);
  padding: 0.65rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.btn-whatsapp:hover { opacity: 0.92; }

@media (max-width: 720px) {
  .product-detail-grid { grid-template-columns: 1fr; gap: 1.25rem; }
}

/* --- Carrito --- */
.cart-empty {
  color: var(--muted);
  text-align: center;
  padding: 3rem 0;
}

.cart-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin: 1.5rem 0;
}

.cart-row {
  display: grid;
  grid-template-columns: 64px 1fr auto auto auto;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem;
}

.cart-row img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--line);
}

.cart-row .cart-name { font-weight: 600; font-family: "Fraunces", serif; }
.cart-row .cart-unit-price { font-family: "IBM Plex Mono", monospace; font-size: 0.8rem; color: var(--muted); }

.qty-control {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.qty-control button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.qty-control button:hover { border-color: var(--accent); }
.qty-control button:disabled { opacity: 0.4; cursor: not-allowed; }

.qty-control span {
  min-width: 1.5rem;
  text-align: center;
  font-family: "IBM Plex Mono", monospace;
}

.cart-line-total {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  min-width: 5.5rem;
  text-align: right;
}

.cart-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
}
.cart-remove:hover { color: var(--danger); }

.cart-summary {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  max-width: 360px;
  margin-left: auto;
}

.cart-summary .cart-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.cart-summary .cart-total-row .mono { font-family: "IBM Plex Mono", monospace; }

.order-confirmation {
  text-align: center;
  padding: 3rem 1rem;
}

.order-confirmation .check {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.estado-badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.estado-pendiente { background: #f4e6c9; color: #6b4e0e; }
.estado-en-preparación { background: #d8e6f4; color: #1f4a70; }
.estado-enviado { background: #dbe7df; color: #1f4a35; }
.estado-completado { background: var(--accent-soft); color: var(--accent); }
.estado-cancelado { background: #f4d9d9; color: var(--danger); }

@media (max-width: 640px) {
  .cart-row {
    grid-template-columns: 48px 1fr;
    grid-template-areas:
      "img name"
      "img qty"
      "img total";
  }
  .cart-row img { grid-area: img; width: 48px; height: 48px; }
  .cart-row > div:nth-child(2) { grid-area: name; }
  .cart-row .qty-control { grid-area: qty; }
  .cart-row .cart-line-total { grid-area: total; text-align: left; }
  .cart-remove { position: absolute; top: 0.5rem; right: 0.5rem; }
  .cart-row { position: relative; }
}

@media (max-width: 600px) {
  .imagen-row {
    align-items: stretch;
  }

  .imagen-row-main {
    flex-direction: column;
    align-items: stretch;
  }

  .imagen-position {
    text-align: left;
  }

  .imagen-remove {
    align-self: flex-end;
  }

  .product-thumbnail {
    width: 64px;
    height: 64px;
  }
}

@media (max-width: 600px) {
  .filters {
    padding: 0 1rem;
  }

  .brand-filter {
    align-items: stretch;
    flex-direction: column;
    gap: 0.35rem;
  }

  .brand-filter select {
    width: 100%;
    min-width: 0;
  }
}