/* ================================================
   SULFITO - Carta Digital
   Paleta: Vino bordó + Durazno + Crema cálida
   ================================================ */

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

:root {
  --bg:           #F7F1EA;
  --card:         #FFFFFF;
  --primary:      #6E2233;
  --primary-d:    #511826;
  --primary-l:    #F4E6E9;
  --accent:       #B5774A;
  --accent-l:     #FBEFE2;
  --text:         #241619;
  --text-mid:     #5A4A4D;
  --text-muted:   #9A8A8D;
  --border:       #E8DDD6;
  --shadow-s:     0 1px 6px rgba(0,0,0,.07);
  --shadow-m:     0 4px 16px rgba(0,0,0,.1);
  --shadow-l:     0 12px 32px rgba(0,0,0,.14);
  --r:            14px;
  --header-h:     60px;
  --footer-h:     56px;
  --transition:   .22s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overscroll-behavior-y: none;
}

/* ── HEADER ─────────────────────────────────── */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}

.header-logo { flex: 1; display: flex; justify-content: center; }

.header-logo img {
  height: 34px;
  /* el logo ya es durazno: se muestra tal cual sobre el header vino */
  object-fit: contain;
}

.btn-icon {
  background: none;
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: background var(--transition);
  flex-shrink: 0;
}

.btn-icon:hover { background: rgba(255,255,255,.15); }
.btn-icon svg   { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.btn-icon.invisible { opacity: 0; pointer-events: none; }

/* ── VIEWS ───────────────────────────────────── */

.main { padding-bottom: calc(var(--footer-h) + 16px); }

.view { display: none; animation: fadeUp .28s ease; }
.view.active { display: block; }

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

/* ── CATEGORIES VIEW ─────────────────────────── */

.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  color: var(--primary);
  padding: 22px 16px 14px;
  font-weight: 700;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0 12px;
}

.cat-card {
  border-radius: var(--r);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  aspect-ratio: 1 / 0.9;
  box-shadow: var(--shadow-s);
  transition: transform var(--transition), box-shadow var(--transition);
}

.cat-card:active { transform: scale(.96); }

.cat-card-bg {
  position: absolute;
  inset: 0;
  background: var(--cc, var(--primary));
  transition: filter .2s;
}

.cat-card:hover .cat-card-bg { filter: brightness(1.08); }

.cat-card-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
}

.cat-icon {
  font-size: 30px;
  line-height: 1;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.3));
}

.cat-name {
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: .6px;
  text-align: center;
  line-height: 1.25;
  text-shadow: 0 1px 4px rgba(0,0,0,.35);
}

.cat-sub-badge {
  font-size: 9px;
  color: rgba(255,255,255,.75);
  letter-spacing: .3px;
  margin-top: 2px;
}

/* ── SUBCATEGORY STRIP ───────────────────────── */

.sub-strip {
  padding: 14px 12px 6px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.sub-strip-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
  padding-left: 2px;
}

.sub-strip-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.sub-card {
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--cc, var(--primary));
  box-shadow: var(--shadow-s);
  transition: transform var(--transition), opacity var(--transition);
}

.sub-card:active { transform: scale(.96); opacity: .9; }

.sub-card-icon { font-size: 20px; flex-shrink: 0; }

.sub-card-name {
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: .4px;
  line-height: 1.25;
  text-shadow: 0 1px 3px rgba(0,0,0,.3);
}

@media (min-width: 480px) {
  .sub-strip-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── PRODUCTS VIEW ───────────────────────────── */

.products-header {
  padding: 20px 16px 14px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: var(--header-h);
  z-index: 10;
}

.products-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 21px;
  color: var(--primary);
  font-weight: 700;
}

.products-header .cat-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 3px;
  font-style: italic;
  line-height: 1.5;
}

.price-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.price-legend span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.price-legend .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}

.products-list { padding: 10px 12px; }

.product-item {
  background: var(--card);
  border-radius: var(--r);
  padding: 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-s);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
  border: 1px solid transparent;
}

.product-item:active {
  transform: scale(.99);
  box-shadow: var(--shadow-m);
  border-color: var(--border);
}

.product-item.featured {
  border-left: 3px solid var(--accent);
}

.product-thumb {
  width: 68px;
  height: 68px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

.product-thumb-placeholder {
  width: 68px;
  height: 68px;
  border-radius: 10px;
  background: var(--primary-l);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.product-info { flex: 1; min-width: 0; }

.product-name {
  font-weight: 600;
  font-size: 14.5px;
  color: var(--text);
  line-height: 1.3;
}

.product-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.45;
}

.product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.tag {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
}

.tag-sin-tacc    { background: #FFF3CD; color: #856404; }
.tag-destacado   { background: var(--accent-l); color: var(--accent); }
.tag-frio        { background: #D6EAF8; color: #1A5276; }
.tag-caliente    { background: #FDEDEC; color: #943126; }
.tag-vegano      { background: #D5F5E3; color: #196F3D; }
.tag-vegetariano { background: #E8F8F5; color: #0E6655; }

.product-price-col {
  flex-shrink: 0;
  text-align: right;
}

.price-row {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.price-chip {
  background: var(--primary-l);
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
  padding: 3px 10px;
  border-radius: 20px;
}

.price-chip.alt {
  background: var(--accent-l);
  color: var(--accent);
}

.price-label {
  font-size: 9px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 2px;
}

/* ── PRODUCT MODAL ───────────────────────────── */

.modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
}

.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
  animation: scrimIn .2s ease;
}

@keyframes scrimIn { from { opacity: 0; } to { opacity: 1; } }

.modal-sheet {
  position: relative;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  animation: sheetUp .26s ease;
}

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

.modal-img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 22px 22px 0 0;
}

.modal-img-placeholder {
  width: 100%;
  height: 120px;
  background: var(--primary-l);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  border-radius: 22px 22px 0 0;
}

.modal-body { padding: 20px 20px 36px; }

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(0,0,0,.35);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: background var(--transition);
}

.modal-close:hover { background: rgba(0,0,0,.5); }

.modal-cat-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-l);
  padding: 2px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.modal-name {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: var(--text);
  line-height: 1.25;
}

.modal-desc {
  font-size: 13.5px;
  color: var(--text-mid);
  margin-top: 8px;
  line-height: 1.6;
}

.modal-prices {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.modal-price-block {
  background: var(--primary-l);
  border-radius: 12px;
  padding: 10px 16px;
  text-align: center;
  flex: 1;
  min-width: 90px;
}

.modal-price-block.alt { background: var(--accent-l); }

.modal-price-block .amount {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

.modal-price-block.alt .amount { color: var(--accent); }

.modal-price-block .size-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
}

.modal-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* ── SEARCH OVERLAY ──────────────────────────── */

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(28,28,28,.6);
  backdrop-filter: blur(2px);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow-l);
}

.search-bar svg { width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: 'Poppins', sans-serif;
  color: var(--text);
  background: transparent;
}

.search-bar input::placeholder { color: var(--text-muted); }

.search-bar button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  padding: 2px 4px;
}

.search-results {
  background: #fff;
  border-radius: 14px;
  overflow-y: auto;
  flex: 1;
  max-height: calc(100vh - 120px);
  box-shadow: var(--shadow-m);
}

.search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}

.search-item:last-child { border-bottom: none; }
.search-item:active { background: var(--bg); }

.search-item-text { flex: 1; }
.search-item-name { font-size: 14px; font-weight: 500; color: var(--text); }
.search-item-cat  { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.search-item-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
  margin-left: 12px;
}

/* ── FOOTER ──────────────────────────────────── */

.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--footer-h);
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 50;
}

.footer-links { display: flex; gap: 18px; }

.footer-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-mid);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color var(--transition);
}

.footer-link:hover { color: var(--primary); }

.footer-link svg { width: 20px; height: 20px; flex-shrink: 0; }

.footer-by {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: .8px;
}

/* ── LOADING / EMPTY ─────────────────────────── */

.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 52px 20px;
  color: var(--text-muted);
  font-size: 13px;
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── HIDDEN ──────────────────────────────────── */

.hidden { display: none !important; }

/* ── RESPONSIVE ──────────────────────────────── */

@media (min-width: 480px) {
  .categories-grid    { grid-template-columns: repeat(3, 1fr); }
  .sub-strip-grid     { grid-template-columns: repeat(3, 1fr); }
}

/* ── TABLET (768px+) ─────────────────────────── */
@media (min-width: 768px) {
  :root {
    --header-h:  72px;
    --footer-h:  62px;
  }

  /* Header */
  .header { padding: 0 24px; }
  .header-logo img { height: 40px; }

  /* Categorías */
  .categories-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    padding: 0 24px;
    max-width: 960px;
    margin: 0 auto;
  }

  .section-title { font-size: 28px; padding: 28px 24px 16px; }

  .cat-card { aspect-ratio: 1 / 0.85; }
  .cat-icon { font-size: 36px; }
  .cat-name { font-size: 12px; }

  /* Subcategorías strip */
  .sub-strip { padding: 16px 24px 10px; max-width: 960px; margin: 0 auto; }
  .sub-strip-grid { grid-template-columns: repeat(4, 1fr); gap: 10px; }
  .sub-card { padding: 12px 16px; }
  .sub-card-icon { font-size: 22px; }
  .sub-card-name { font-size: 12px; }

  /* Header de productos */
  .products-header { padding: 24px 32px 18px; }
  .products-header h2 { font-size: 24px; }

  /* Lista de productos — sin límite fijo, padding amplio */
  .products-list {
    padding: 16px 24px;
    max-width: 960px;
    margin: 0 auto;
  }

  /* Item de producto */
  .product-item {
    padding: 16px 20px;
    gap: 14px;
    border-radius: 16px;
    margin-bottom: 10px;
  }

  .product-thumb,
  .product-thumb-placeholder {
    width: 90px;
    height: 90px;
    border-radius: 12px;
    flex-shrink: 0;
  }

  .product-name  { font-size: 15.5px; }
  .product-desc  { font-size: 13px; }
  .price-chip    { font-size: 14px; padding: 4px 14px; }
  .price-label   { font-size: 10px; }

  /* Modal — centrado en pantalla, no bottom-sheet */
  .modal-wrap {
    align-items: center;
    justify-content: center;
    padding: 24px;
  }

  .modal-sheet {
    border-radius: 20px;
    max-width: 520px;
    width: 100%;
    max-height: 88vh;
  }

  .modal-img {
    max-height: 300px;
    border-radius: 20px 20px 0 0;
  }

  .modal-img-placeholder {
    height: 180px;
    font-size: 64px;
    border-radius: 20px 20px 0 0;
  }

  .modal-body    { padding: 24px 28px 40px; }
  .modal-name    { font-size: 24px; }
  .modal-desc    { font-size: 14px; }

  .modal-price-block .amount { font-size: 22px; }

  .modal-close {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  /* Search overlay */
  .search-overlay { padding: 24px; }
  .search-bar { padding: 14px 18px; }
  .search-bar input { font-size: 16px; }
  .search-results { max-height: calc(100vh - 140px); }

  /* Footer */
  .footer { padding: 0 32px; height: auto; min-height: var(--footer-h); }
  .footer-links { gap: 24px; }
  .footer-link  { font-size: 14px; }
  .footer-link svg { width: 22px; height: 22px; }
  .footer-by    { font-size: 11px; }
}

/* ── TABLET LANDSCAPE / IPAD PRO (1024px+) ─────── */
@media (min-width: 1024px) {
  .categories-grid {
    grid-template-columns: repeat(5, 1fr);
    max-width: 1080px;
  }

  .sub-strip-grid     { grid-template-columns: repeat(5, 1fr); }
  .sub-strip          { max-width: 1080px; }

  .products-list      { max-width: 1080px; }
  .products-header    { max-width: 1080px; margin: 0 auto; padding-left: 32px; padding-right: 32px; }

  .product-item       { padding: 18px 24px; }

  .modal-sheet        { max-width: 600px; }
  .modal-img          { max-height: 340px; }
}
