@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500&family=Playfair+Display:ital,wght@0,400;1,400&display=swap');

/* ── Variables ─────────────────────────────────────────── */
:root {
  --rose:   #D4537E;
  --rose-l: #FBEAF0;
  --rose-d: #72243E;
  --rose-b: #ED93B1;
  --gold:   #BA7517;
  --gold-l: #FAEEDA;
  --gold-m: #EF9F27;
  --dark:   #2C2C2A;
  --muted:  #5F5E5A;
  --light:  #F8F7F5;
  --border: rgba(0,0,0,0.08);
  --ff:     'Playfair Display', serif;
  --fb:     'DM Sans', sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow:    0 2px 12px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.12);
  --transition: 200ms ease;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ── Base ───────────────────────────────────────────────── */
body {
  font-family: var(--fb);
  background: #1e1e1c;
  color: var(--dark);
  min-height: 100dvh;
  overflow-x: hidden;
}

#app {
  background: var(--light);
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
}

/* ── Header ─────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--dark);
  padding: 14px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
}

.logo-name {
  font-family: var(--ff);
  font-size: 1.35rem;
  color: #fff;
  letter-spacing: 0.02em;
  line-height: 1;
}

.logo-sub {
  font-size: 0.72rem;
  color: var(--rose-b);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 300;
}

/* Búsqueda en header (oculta en móvil) */
.header-search {
  display: none;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 420px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  padding: 7px 14px;
}

.header-search-icon {
  width: 16px;
  height: 16px;
  stroke: rgba(255,255,255,0.5);
  flex-shrink: 0;
}

.header-search input {
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-family: var(--fb);
  font-size: 0.88rem;
  width: 100%;
}

.header-search input::placeholder { color: rgba(255,255,255,0.4); }

/* Acciones header (ocultas en móvil) */
.header-actions { display: none; }

.header-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.7);
  font-size: 0.82rem;
  font-weight: 400;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  transition: all var(--transition);
  white-space: nowrap;
}

.header-action-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  flex-shrink: 0;
}

.header-action-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/* ── Search bar dropdown (móvil) ────────────────────────── */
.search-bar {
  background: #fff;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.search-bar input {
  width: 100%;
  padding: 9px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--fb);
  font-size: 0.9rem;
  color: var(--dark);
  background: var(--light);
  outline: none;
  transition: border-color var(--transition);
}

.search-bar input:focus { border-color: var(--rose); }

/* ── Category bar ───────────────────────────────────────── */
.cat-bar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.cat-bar::-webkit-scrollbar { display: none; }
.cat-bar { scrollbar-width: none; }

.cat-chip {
  flex-shrink: 0;
  scroll-snap-align: start;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--light);
  border: 1.5px solid var(--border);
  transition: all var(--transition);
  white-space: nowrap;
}

.cat-chip:hover {
  border-color: var(--rose-b);
  color: var(--rose-d);
}

.cat-chip.active {
  background: var(--rose);
  color: #fff;
  border-color: var(--rose);
}

/* ── Products grid ──────────────────────────────────────── */
.productos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  padding: 16px 14px 120px;
}

/* ── Product card ───────────────────────────────────────── */
.producto-card {
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
}

.producto-card:active { transform: scale(0.97); }

.producto-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-img-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--gold-l);
}

.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 300ms ease;
}

.producto-card:hover .card-img-wrap img { transform: scale(1.04); }

.card-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  background: linear-gradient(135deg, var(--gold-l) 0%, var(--rose-l) 100%);
}

.badge-label {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1;
}

.badge-popular { background: var(--gold-m); color: #fff; }
.badge-nuevo   { background: var(--rose);   color: #fff; }

.badge-cat {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 500;
  background: rgba(44,44,42,0.7);
  color: #fff;
  backdrop-filter: blur(4px);
  line-height: 1;
}

.agotado-overlay {
  position: absolute;
  inset: 0;
  background: rgba(44,44,42,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.agotado-label {
  color: #fff;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1.5px solid rgba(255,255,255,0.6);
  padding: 5px 10px;
  border-radius: 6px;
}

.card-body { padding: 10px 11px 12px; }

.card-nombre {
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 3px;
  color: var(--dark);
}

.card-desc {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
  font-weight: 300;
}

.card-precio {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gold);
}

/* ── Empty state ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--muted);
  grid-column: 1 / -1;
}

.empty-icon  { font-size: 2.8rem; margin-bottom: 12px; }
.empty-title { font-family: var(--ff); font-size: 1.1rem; color: var(--dark); margin-bottom: 6px; }
.empty-desc  { font-size: 0.85rem; font-weight: 300; }

/* ── Vista Detalle ──────────────────────────────────────── */
#view-detalle {
  background: var(--light);
  min-height: 100dvh;
  padding-bottom: 100px;
}

#detalle-contenido {
  display: flex;
  flex-direction: column;
}

.detalle-img-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--gold-l);
  flex-shrink: 0;
}

.detalle-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detalle-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  background: linear-gradient(135deg, var(--gold-l) 0%, var(--rose-l) 100%);
}

.btn-volver {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: transform var(--transition);
  z-index: 10;
}

.btn-volver:active { transform: scale(0.93); }

.btn-volver svg {
  width: 18px;
  height: 18px;
  stroke: var(--dark);
  stroke-width: 2.2;
}

/* Columna derecha en detalle (agrupa body + wa btn) */
.detalle-right {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.detalle-body { padding: 20px 20px 0; flex: 1; }

.detalle-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.detalle-cat {
  font-size: 0.75rem;
  color: var(--rose);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.detalle-disponibilidad {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 500;
}

.detalle-disponibilidad.disponible { background: #E6F9EE; color: #1A7A40; }
.detalle-disponibilidad.agotado    { background: var(--rose-l); color: var(--rose-d); }

.detalle-nombre {
  font-family: var(--ff);
  font-size: 1.55rem;
  line-height: 1.25;
  color: var(--dark);
  margin-bottom: 6px;
}

.detalle-precio {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--gold);
  margin-bottom: 14px;
}

.detalle-separador {
  height: 1px;
  background: var(--border);
  margin: 0 0 14px;
}

.detalle-desc-titulo {
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.detalle-desc {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--dark);
  font-weight: 300;
  margin-bottom: 18px;
}

.detalle-ingredientes-titulo {
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
}

.ingredientes-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.ingrediente-chip {
  padding: 5px 12px;
  background: var(--rose-l);
  color: var(--rose-d);
  border-radius: 16px;
  font-size: 0.78rem;
}

/* Botón WhatsApp — fijo en móvil */
.btn-whatsapp {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 40px);
  max-width: 440px;
  padding: 15px 20px;
  background: #25D366;
  color: #fff;
  border-radius: var(--radius-md);
  font-family: var(--fb);
  font-size: 0.95rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(37,211,102,0.35);
  transition: transform var(--transition), box-shadow var(--transition);
  z-index: 200;
}

.btn-whatsapp:active { transform: translateX(-50%) scale(0.97); }

.btn-whatsapp svg {
  width: 20px;
  height: 20px;
  fill: #fff;
  flex-shrink: 0;
}

.btn-whatsapp.disabled {
  background: #ccc;
  box-shadow: none;
  pointer-events: none;
}

/* ── Bottom Nav (solo móvil) ────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: stretch;
  background: var(--dark);
  border-top: 1px solid rgba(255,255,255,0.08);
  z-index: 300;
  height: 62px;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: rgba(255,255,255,0.45);
  font-size: 0.68rem;
  font-weight: 400;
  padding: 8px 0;
  transition: color var(--transition);
}

.nav-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

.nav-btn.active { color: var(--rose-b); }
.nav-btn:active  { color: var(--rose); }

/* ── Modal Local ────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
}

.modal-card {
  position: relative;
  background: #fff;
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 28px 24px 40px;
  animation: slideUp 220ms ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 18px;
  font-size: 1.1rem;
  color: var(--muted);
  padding: 4px;
}

.modal-title {
  font-family: var(--ff);
  font-size: 1.35rem;
  margin-bottom: 18px;
  color: var(--dark);
}

.modal-detail {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--dark);
  margin-bottom: 10px;
}

.modal-detail span { font-size: 1rem; flex-shrink: 0; }

.modal-maps {
  display: block;
  margin-top: 20px;
  text-align: center;
  background: var(--dark);
  color: #fff;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
}

/* ── Transiciones de vista ──────────────────────────────── */
#view-catalogo, #view-detalle {
  animation: fadeIn var(--transition) ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Utilidades ─────────────────────────────────────────── */
.hidden { display: none !important; }


/* ════════════════════════════════════════════════════════
   RESPONSIVE — TABLET  ≥ 768px
   ════════════════════════════════════════════════════════ */
@media (min-width: 768px) {

  /* Layout principal sin restricción móvil */
  #app {
    max-width: 100%;
    box-shadow: none;
  }

  /* Header: mostrar búsqueda y acciones */
  .header-search  { display: flex; }
  .header-actions { display: flex; align-items: center; gap: 8px; }

  /* Cat bar: chips que envuelven en lugar de scroll */
  .cat-bar {
    flex-wrap: wrap;
    overflow-x: visible;
    padding: 14px 24px;
  }

  .cat-chip { flex-shrink: 0; }

  /* Grid: 3 columnas, padding lateral mayor */
  .productos-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    padding: 20px 24px 40px;
    max-width: 1400px;
    margin: 0 auto;
  }

  /* Sin bottom nav en desktop */
  .bottom-nav { display: none; }

  /* Search dropdown innecesario en desktop */
  #search-bar { display: none !important; }

  /* Detalle: layout dos columnas */
  #view-detalle {
    min-height: 100dvh;
    padding-bottom: 0;
  }

  #detalle-contenido {
    flex-direction: row;
    align-items: flex-start;
    min-height: calc(100dvh - 0px);
  }

  .detalle-img-wrap {
    width: 45%;
    aspect-ratio: unset;
    min-height: 100dvh;
    position: sticky;
    top: 0;
  }

  .btn-volver {
    top: 20px;
    left: 20px;
    width: 42px;
    height: 42px;
  }

  .detalle-right {
    width: 55%;
    padding: 40px 0 40px;
    min-height: 100dvh;
    justify-content: space-between;
  }

  .detalle-body {
    padding: 0 40px;
  }

  .detalle-nombre { font-size: 2rem; }
  .detalle-precio { font-size: 1.4rem; }

  /* Botón WhatsApp: posición normal (no fixed) */
  .btn-whatsapp {
    position: static;
    transform: none;
    width: calc(100% - 80px);
    max-width: none;
    margin: 32px 40px 0;
  }

  .btn-whatsapp:active {
    transform: scale(0.98);
  }

  /* Modal más centrado */
  .modal { align-items: center; }

  .modal-card {
    max-width: 480px;
    border-radius: var(--radius-lg);
    animation: fadeIn 220ms ease;
  }
}


/* ════════════════════════════════════════════════════════
   RESPONSIVE — DESKTOP  ≥ 1200px
   ════════════════════════════════════════════════════════ */
@media (min-width: 1200px) {

  .header { padding: 16px 40px; }

  .cat-bar { padding: 14px 40px; }

  /* Grid: 4 columnas */
  .productos-grid {
    grid-template-columns: repeat(4, 1fr);
    padding: 24px 40px 48px;
  }

  .card-nombre { font-size: 0.92rem; }
  .card-precio { font-size: 0.95rem; }

  .detalle-img-wrap { width: 50%; }
  .detalle-right    { width: 50%; padding: 48px 0; }
  .detalle-body     { padding: 0 48px; }

  .btn-whatsapp {
    width: calc(100% - 96px);
    margin: 36px 48px 0;
  }
}


/* ════════════════════════════════════════════════════════
   RESPONSIVE — WIDE  ≥ 1600px
   ════════════════════════════════════════════════════════ */
@media (min-width: 1600px) {

  .productos-grid {
    grid-template-columns: repeat(5, 1fr);
    max-width: 1560px;
  }
}
