/* =========================================================
   AMAZONIA MARKET - styles.css (versión mejorada)
   Todas las opciones del editor (agregar_producto.py) se aplican
   a través de variables CSS que app.js actualiza al cargar.
   ========================================================= */
:root {
  /* Paleta base */
  --primary:  #2A2A9C;
  --primary2: #3838B8;
  --primary3: #4B4BD9;
  --accent:   #F5B301;
  --accent2:  #FFC933;
  --bg-gray:  #F4F5F7;
  --card:     #FFFFFF;
  --text:     #0F172A;
  --muted:    #64748B;
  --price:    #16A34A;

  /* --- Ajustes editables desde agregar_producto.py --- */
  --tb-bg:          var(--primary);       /* Fondo de la barra azul */
  --tb-delivery-fg: #ffffff;              /* Color del texto "Delivery gratis..." */
  --tb-menu-bg:     rgba(255,255,255,.08);
  --tb-menu-fg:     #ffffff;
  --tb-search-bg:   var(--accent);
  --tb-search-fg:   #0F172A;
  --tb-cart-bg:     rgba(255,255,255,.08);
  --tb-cart-fg:     #ffffff;

  --menu-bg: var(--primary);
  --menu-fg: #ffffff;

  --more-bg: var(--primary);
  --more-fg: #ffffff;

  --img-border-color: transparent;
  --img-border-width: 0px;

  --cart-card-bg:  #ffffff;
  --cart-name-fg:  var(--primary);
  --cart-unit-fg:  #0F172A;
  --cart-price-bg: var(--price);
  --cart-price-fg: #ffffff;

  --brand-justify:  flex-start;
  --brand-offset-x: 0px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg-gray);
  color: var(--text);
  font-family: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; }

.am-wrap       { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.am-wrap-wide  { max-width: 1400px; margin: 0 auto; padding: 0 24px; }

/* =============== TOPBAR AZUL =============== */
.am-topbar {
  background: var(--tb-bg);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
  padding-bottom: 10px;
  margin-bottom: 8px;
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

/* Banner delivery marquee */
.am-delivery-banner {
  overflow: hidden;
  border-bottom: 1px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.18);
  padding: 16px 0 18px;
  min-height: 56px;
  display: flex; align-items: center;
  position: relative; z-index: 1;
}
.am-delivery-track {
  display: inline-flex; white-space: nowrap;
  animation: am-marquee 28s linear infinite;
  will-change: transform;
}
.am-delivery-track span {
  font-weight: 900; font-size: 22px; letter-spacing: .4px;
  padding: 0 60px; color: var(--tb-delivery-fg); line-height: 1.2;
}
.am-delivery-banner:hover .am-delivery-track { animation-play-state: paused; }
@keyframes am-marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Fila principal */
.am-topbar-row {
  display: flex; align-items: center; gap: 14px;
  padding-top: 12px;
  position: relative; z-index: 1;
}

.am-tb-menu {
  background: var(--tb-menu-bg);
  border: 1px solid rgba(255,255,255,.18);
  color: var(--tb-menu-fg);
  border-radius: 14px;
  width: 54px; min-width: 54px; height: 54px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
  transition: filter .15s, transform .15s;
}
.am-tb-menu:hover { filter: brightness(1.12); transform: translateY(-1px); }

.am-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
  min-width: 190px;
  flex: 1 1 auto;
  justify-content: var(--brand-justify);
  transform: translateX(var(--brand-offset-x));
}
.am-brand-logo {
  height: 54px; width: auto; display: block;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.35));
}
.am-brand-name {
  font-family: 'Pacifico', 'Brush Script MT', cursive;
  font-size: 30px; color: #fff; line-height: 1;
  text-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.am-brand-market {
  font-family: 'Poppins', sans-serif;
  font-weight: 900; color: var(--accent);
  font-size: 16px; letter-spacing: 3px; margin-top: 2px;
}

/* Buscador */
.am-search {
  display: flex; align-items: center; flex: 2 1 auto;
  min-width: 260px;
}
.am-search input {
  flex: 1; height: 48px;
  border: none; border-radius: 8px 0 0 8px;
  background: #fff; color: #000;
  padding: 0 14px; font-size: 15px;
  outline: none;
}
.am-search input::placeholder { color: #6B7280; }
.am-search-btn {
  height: 48px; min-width: 48px;
  background: var(--tb-search-bg); color: var(--tb-search-fg);
  border: none; border-radius: 0 8px 8px 0;
  font-size: 20px; font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
  transition: filter .15s;
}
.am-search-btn:hover { filter: brightness(1.05); }

/* Mi cuenta */
.am-tb-item {
  display: inline-flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
  color: #fff; text-decoration: none;
  padding: 10px 16px; border-radius: 12px;
  font-weight: 600; font-size: 14px; line-height: 1.1;
  transition: background .15s, transform .15s;
  white-space: nowrap; cursor: pointer;
}
.am-tb-item:hover { background: rgba(255,255,255,.18); transform: translateY(-1px); }
.am-tb-icon { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; font-size: 18px;}
.am-tb-sub { display: block; font-size: 11px; opacity: .85; font-weight: 500; }
.am-tb-strong { display: block; font-size: 14px; font-weight: 800; letter-spacing: .3px; }

/* Redes sociales */
.am-socials { display: inline-flex; gap: 6px; align-items: center; }
.am-socials a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  text-decoration: none; box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

/* Botón carrito */
.am-cart-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 54px; height: 54px; border-radius: 14px;
  background: var(--tb-cart-bg); color: var(--tb-cart-fg);
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
  font-size: 26px; line-height: 1;
  transition: transform .15s, filter .15s;
}
.am-cart-btn:hover { transform: translateY(-1px); filter: brightness(1.12); }
.am-cart-badge {
  position: absolute; top: -6px; right: -6px;
  background: var(--accent); color: #0F172A;
  font-size: 11px; font-weight: 900;
  min-width: 22px; height: 22px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
  border: 2px solid #fff;
}

/* Panel menú desplegable */
.am-menu-panel {
  position: relative;
  max-width: 280px; margin: 8px 0 12px 12px;
  background: var(--menu-bg); color: var(--menu-fg);
  border-radius: 14px; box-shadow: 0 10px 24px rgba(0,0,0,.22);
  overflow: hidden;
}
.am-menu-panel .am-menu-head {
  padding: 10px 18px; font-weight: 800; font-size: 13px;
  letter-spacing: 1px; text-transform: uppercase; opacity: .85;
  border-bottom: 1px solid rgba(255,255,255,.2);
  color: var(--menu-fg);
}
.am-menu-panel a {
  display: block; padding: 12px 18px;
  border-bottom: 1px solid rgba(255,255,255,.15);
  color: var(--menu-fg); text-decoration: none;
  font-weight: 600; font-size: 14px;
}
.am-menu-panel a:hover { background: rgba(255,255,255,.08); }

/* =============== CIRCULOS DE CATEGORIAS =============== */
.am-cats-wrap {
  background: #fff;
  border-bottom: 1px solid #E5E7EB;
  padding: 8px 0 10px;
  margin-bottom: 12px;
}
.am-cats-scroll {
  max-width: 1280px; margin: 0 auto;
  display: flex; gap: 22px; padding: 0 24px;
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: thin;
}
.am-cats-scroll::-webkit-scrollbar { height: 6px; }
.am-cats-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.am-cat-circle {
  flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; text-decoration: none; color: var(--text);
  min-width: 110px;
}
.am-cat-circle .bubble {
  width: 96px; height: 96px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--primary3), var(--primary) 75%);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 44px;
  box-shadow: 0 10px 22px rgba(42,42,156,.35),
              inset 0 -6px 14px rgba(0,0,0,.15);
  transition: transform .15s, box-shadow .15s;
  overflow: hidden;
}
.am-cat-circle .bubble img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; }
.am-cat-circle:hover .bubble { transform: translateY(-3px) scale(1.03); }
.am-cat-circle .label {
  font-weight: 700; font-size: 14px; text-align: center;
  color: var(--text); max-width: 130px; line-height: 1.2;
}

/* =============== BANNER ANUNCIOS =============== */
.am-ads-wrap { max-width: 1400px; margin: 4px auto 6px; padding: 0 8px; }
.am-ads-hero { position: relative; width: 100%; border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.am-ads-hero .am-slide { position: absolute; inset: 0; display: block; opacity: 0; pointer-events: none; text-decoration: none; transition: opacity .4s ease; }
.am-ads-hero .am-slide.active { opacity: 1; pointer-events: auto; }
.am-ads-hero .am-slide img { width: 100%; height: 100%; object-fit: contain; object-position: center; display: block; }
.am-ads-hero .ovr { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.am-ads-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: -70px; position: relative; z-index: 3; padding: 0 22px; }
.am-ads-card { background: #fff; border-radius: 10px; padding: 16px 16px 14px; box-shadow: 0 6px 18px rgba(0,0,0,.10); display: flex; flex-direction: column; text-decoration: none; color: #111; transition: transform .18s, box-shadow .18s; }
.am-ads-card:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(0,0,0,.16); }
.am-ads-card .t { font-weight: 800; font-size: 18px; color: #1D4ED8; margin-bottom: 10px; line-height: 1.15; }
.am-ads-card .imgbox { width: 100%; aspect-ratio: 1/1; overflow: hidden; border-radius: 6px; background: #ffffff; display: flex; align-items: center; justify-content: center; }
.am-ads-card .imgbox img { width: 100%; height: 100%; object-fit: contain; background: #ffffff; }
.am-ads-card .lnk { margin-top: 10px; font-size: 13px; color: #1D4ED8; font-weight: 700; }

/* =============== HOME =============== */
/* --- Home: cada apartado es una fila completa con 4 mosaicos en línea (estilo Madison) --- */
.am-tiles-row { display: block; margin: 18px 0; }
.am-tile { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 14px 14px 16px; box-shadow: 0 2px 10px rgba(0,0,0,.06); display: block; min-width: 0; }
.am-tile-empty { display: none; }
.am-tile-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.am-tile-title { font-weight: 800; font-size: 18px; line-height: 1.2; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--primary); margin: 0; min-width: 0; }
.am-tile-count { color: #6b7280; font-size: 12px; font-weight: 600; margin-left: 4px; }
.am-tile-more { flex-shrink: 0; text-decoration: none; font-weight: 700; font-size: 13px; color: var(--more-fg, var(--primary)); background: transparent; box-shadow: none; padding: 4px 2px; border-radius: 0; white-space: nowrap; }
.am-tile-more:hover { text-decoration: underline; }
.am-quad-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.am-quad-item { display: flex; flex-direction: column; align-items: center; background: #fafafa; border-radius: 10px; padding: 8px 6px; text-decoration: none; color: inherit; min-width: 0; }
.am-quad-empty { background: transparent; }
.am-quad-imgwrap { width: 100%; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #d6d6d6; border-radius: 8px; }
.am-quad-imgwrap img { max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; border: var(--img-border-width) solid var(--img-border-color); border-radius: 8px; }
.am-quad-name { margin-top: 6px; font-size: 12px; font-weight: 700; color: #111827; text-align: center; line-height: 1.2; min-height: 28px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
@media (max-width: 520px) {
  .am-quad-grid { gap: 8px; }
  .am-quad-name { font-size: 11px; }
  .am-tile-title { font-size: 16px; }
  .am-tile { padding: 12px 10px 14px; }
}

/* =============== PRODUCTOS =============== */
.am-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 18px 0; }
.am-card { background: #fff; border-radius: 16px; padding: 14px 12px 12px; border: 1px solid #E2E8F0; box-shadow: 0 8px 18px rgba(15,23,42,.10); text-align: center; display: flex; flex-direction: column; }
.am-card img { width: 100%; aspect-ratio: 1/1; object-fit: contain; border-radius: 12px; background: #ffffff; max-height: 170px; border: var(--img-border-width) solid var(--img-border-color); cursor: zoom-in; }
.am-name { font-weight: 600; color: var(--text); margin: 10px 4px 6px; font-size: 14px; line-height: 1.25; min-height: 36px; }
.am-price { display: inline-block; background: var(--price); color: #fff; font-weight: 800; font-size: 16px; padding: 5px 14px; border-radius: 10px; margin: 2px 0 6px; box-shadow: 0 2px 6px rgba(22,163,74,.25); }
.am-add-btn { margin-top: auto; background: linear-gradient(135deg, var(--primary) 0%, var(--primary3) 100%); color: #fff; border: none; border-radius: 12px; padding: 10px 16px; font-size: 14px; font-weight: 700; min-height: 42px; cursor: pointer; box-shadow: 0 4px 12px rgba(42,42,156,.28); transition: transform .15s, box-shadow .15s; }
.am-add-btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.am-btns-row { margin-top: auto; display: flex; gap: 8px; }
.am-btns-row .am-add-btn { margin-top: 0; flex: 1 1 0; min-width: 0; padding: 10px 8px; }
.am-grams-btn { background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%) !important; color: #0F172A !important; box-shadow: 0 4px 12px rgba(245,179,1,.35) !important; }
.am-grams-unit { font-weight: 800; color: var(--primary); font-size: 16px; margin-left: -4px; }
.am-modal-hint { text-align: center; font-size: 12px; color: var(--muted); margin: -6px 0 6px; }
@media (max-width: 520px){
  .am-btns-row { flex-direction: column; gap: 6px; }
  .am-btns-row .am-add-btn { width: 100%; }
}

.am-empty { text-align: center; padding: 50px 20px; color: var(--muted); background: #fff; border-radius: 16px; border: 1px dashed #e5e7eb; margin: 20px 0; }

.am-view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 6px; }
.am-view-title { color: var(--primary); font-size: 26px; font-weight: 800; text-transform: capitalize; }
.am-btn { border: none; cursor: pointer; padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: 14px; text-decoration: none; display: inline-block; transition: filter .15s, transform .15s; }
.am-btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary3)); color: #fff; box-shadow: 0 4px 12px rgba(42,42,156,.28); }
.am-btn-primary:hover { transform: translateY(-1px); filter: brightness(1.05); }
.am-btn-ghost   { background: #fff; color: var(--text); border: 1px solid #e5e7eb; }
.am-btn-danger  { background: #EF4444; color: #fff; box-shadow: 0 6px 14px rgba(239,68,68,.35); }
.am-btn-success { background: var(--price); color: #fff; box-shadow: 0 4px 12px rgba(22,163,74,.28); }

/* =============== CARRITO =============== */
.am-cart-page { background: #EFF3FF; padding: 22px; border-radius: 18px; margin-top: 18px; }
.am-cart-row {
  display: grid; grid-template-columns: 90px 2fr 1fr 1fr 1fr 60px;
  gap: 10px; align-items: center;
  padding: 12px 8px; border-bottom: 1px solid #E5E7EB;
  background: var(--cart-card-bg);
  border-radius: 12px; margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.am-cart-row img { width: 80px; height: 80px; object-fit: contain; background: #F8FAFC; border-radius: 8px; border: var(--img-border-width) solid var(--img-border-color); }
.am-cart-name { font-weight: 700; color: var(--cart-name-fg); }
.am-cart-price { text-align: center; font-weight: 700; }
.am-cart-unit  { color: var(--cart-unit-fg); }
.am-cart-qty { display: inline-flex; align-items: center; gap: 6px; }
.am-cart-qty button { width: 34px; height: 34px; border: none; border-radius: 8px; cursor: pointer; background: linear-gradient(135deg, var(--primary), var(--primary3)); color: #fff; font-weight: 900; font-size: 18px; }
.am-cart-qty input { width: 44px; height: 34px; text-align: center; border: 1px solid #E2E8F0; border-radius: 8px; font-weight: 800; color: var(--primary); }
.am-cart-line { display: inline-block; background: var(--cart-price-bg); color: var(--cart-price-fg); font-weight: 700; font-size: 13px; padding: 4px 10px; border-radius: 8px; text-align: center; }
.am-cart-del { background: #EF4444; color: #fff; border: none; width: 40px; height: 40px; border-radius: 10px; cursor: pointer; font-size: 18px; }
.am-cart-total-box { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.am-cart-total-label { font-size: 20px; font-weight: 700; color: var(--primary); }
.am-cart-total { font-size: 42px; font-weight: 900; color: var(--price); text-shadow: 0 2px 6px rgba(22,163,74,.25); line-height: 1.1; }
.am-cart-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }

/* =============== MODAL =============== */
.am-modal-overlay { position: fixed; inset: 0; z-index: 999; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 20px; }
.am-modal-overlay[hidden] { display: none !important; }
.am-toast[hidden] { display: none !important; }
.am-modal { background: #fff; border-radius: 18px; padding: 22px; max-width: 380px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.am-modal-img { display: block; margin: 0 auto 10px; max-height: 160px; width: auto; border-radius: 12px; background: #f8fafc; border: 1px solid #E2E8F0; }
.am-modal-name { text-align: center; font-weight: 700; font-size: 18px; color: var(--text); margin: 4px 0 2px; }
.am-modal-price { text-align: center; color: var(--price); font-weight: 800; font-size: 20px; margin-bottom: 14px; }
.am-qty-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 10px 0 18px; }
.am-qty-btn { width: 44px; height: 44px; border: none; border-radius: 10px; background: linear-gradient(135deg, var(--primary), var(--primary3)); color: #fff; font-size: 22px; font-weight: 900; cursor: pointer; }
.am-qty-row input { width: 70px; height: 44px; text-align: center; border: 2px solid var(--primary); border-radius: 10px; font-size: 18px; font-weight: 800; color: var(--primary); }
.am-modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

.am-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--price); color: #fff; padding: 14px 22px; border-radius: 12px; font-weight: 700; z-index: 1000; box-shadow: 0 8px 24px rgba(0,0,0,.28); }

/* =============== RESPONSIVE =============== */
@media (max-width: 1100px) {
  .am-topbar-row { flex-wrap: wrap; row-gap: 10px; }
  .am-tb-account, .am-socials { display: none; }
  .am-ads-cards { grid-template-columns: repeat(4,1fr); gap: 10px; margin-top: -50px; padding: 0 14px; }
  .am-ads-card { padding: 10px 8px 8px; border-radius: 8px; }
  .am-ads-card .t { font-size: 13px; margin-bottom: 6px; }
  .am-ads-card .lnk { font-size: 11px; margin-top: 6px; }
}
@media (max-width: 780px) {
  .am-topbar-row { gap: 8px; }
  .am-delivery-track span { font-size: 17px; padding: 0 36px; }
  .am-brand { min-width: 0; flex: 1 1 auto; justify-content: center; }
  .am-brand-name { font-size: 22px; }
  .am-brand-market { font-size: 10px; letter-spacing: 2px; }
  .am-search { flex: 1 1 100%; order: 5; }
  .am-cart-btn { width: 46px; height: 46px; font-size: 22px; }
  .am-tb-menu { width: 46px; min-width: 46px; height: 46px; }
  /* Productos: 4 columnas como en PC, más compactas */
  .am-grid { grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; margin: 12px 0; }
  .am-card { padding: 8px 6px 8px; border-radius: 10px; box-shadow: 0 3px 8px rgba(15,23,42,.10); }
  .am-card img { max-height: 110px; border-radius: 8px; }
  .am-name { font-size: 11px; margin: 6px 2px 4px; min-height: 28px; line-height: 1.2; }
  .am-price { font-size: 12px; padding: 3px 9px; border-radius: 8px; margin: 2px 0 5px; }
  .am-add-btn { padding: 7px 6px; font-size: 11px; min-height: 32px; border-radius: 8px; }
  /* Anuncios: mantener misma estructura que PC pero más compacto */
  .am-ads-wrap { padding: 0 6px; }
  .am-ads-hero { height: 180px !important; border-radius: 10px; }
  .am-ads-cards { grid-template-columns: repeat(4,1fr); gap: 6px; margin-top: -32px; padding: 0 8px; }
  .am-ads-card { padding: 6px 5px 6px; border-radius: 7px; box-shadow: 0 3px 8px rgba(0,0,0,.10); }
  .am-ads-card .t { font-size: 10px; margin-bottom: 4px; line-height: 1.1; }
  .am-ads-card .imgbox { border-radius: 4px; }
  .am-ads-card .lnk { font-size: 9px; margin-top: 4px; }
  .am-cart-row {
    grid-template-columns: 70px 1fr 60px;
    grid-template-areas:
      "img name del"
      "img price price"
      "img qty line";
    gap: 6px 10px;
  }
  .am-cart-row img { grid-area: img; width: 70px; height: 70px; }
  .am-cart-name { grid-area: name; }
  .am-cart-price { grid-area: price; text-align: left; }
  .am-cart-qty { grid-area: qty; }
  .am-cart-line { grid-area: line; justify-self: end; }
  .am-cart-del  { grid-area: del; justify-self: end; }
  .am-view-title { font-size: 22px; }
  .am-cart-total { font-size: 32px; }
}
@media (max-width: 520px) {
  /* Productos: 4 columnas, aún más compactas */
  .am-grid { grid-template-columns: repeat(4, minmax(0,1fr)); gap: 6px; margin: 10px 0; }
  .am-card { padding: 6px 4px 7px; border-radius: 8px; }
  .am-card img { max-height: 82px; border-radius: 6px; }
  .am-name { font-size: 10px; margin: 5px 1px 3px; min-height: 24px; line-height: 1.15; }
  .am-price { font-size: 11px; padding: 3px 7px; border-radius: 7px; margin: 2px 0 4px; }
  .am-add-btn { padding: 6px 4px; font-size: 10px; min-height: 28px; border-radius: 7px; }
  /* Se mantienen 4 tarjetas de anuncios en fila como en PC, aún más pequeñas */
  .am-ads-wrap { padding: 0 4px; }
  .am-ads-hero { height: 140px !important; border-radius: 8px; }
  .am-ads-cards { grid-template-columns: repeat(4,1fr); gap: 4px; margin-top: -24px; padding: 0 6px; }
  .am-ads-card { padding: 5px 3px 5px; border-radius: 6px; }
  .am-ads-card .t { font-size: 9px; margin-bottom: 3px; }
  .am-ads-card .lnk { font-size: 8px; margin-top: 3px; }
  .am-wrap, .am-wrap-wide { padding: 0 10px; }
}
@media (max-width: 380px) {
  .am-ads-hero { height: 115px !important; }
  .am-ads-cards { margin-top: -20px; gap: 3px; padding: 0 4px; }
  .am-ads-card { padding: 4px 3px; }
  .am-ads-card .t { font-size: 8px; }
  .am-ads-card .lnk { font-size: 7px; }
  .am-grid { grid-template-columns: repeat(4, minmax(0,1fr)); gap: 4px; }
  .am-card { padding: 5px 3px 6px; }
  .am-card img { max-height: 68px; }
  .am-name { font-size: 9px; min-height: 22px; line-height: 1.15; }
  .am-price { font-size: 10px; padding: 2px 5px; }
  .am-add-btn { font-size: 9px; min-height: 26px; padding: 5px 3px; }
}

/* =========================================================
   Mejoras añadidas: badge Cashea, botón flotante WhatsApp,
   botón flotante "Pagar ahora".
   ========================================================= */

/* Logo Cashea al lado del precio (sin bordes ni fondo) */
.am-card { position: relative; }
.am-price-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 2px 0 6px;
  flex-wrap: wrap;
}
.am-cashea-inline {
  height: 26px;
  width: auto;
  display: inline-block;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}
@media (max-width: 780px) {
  .am-cashea-inline { height: 20px; }
  .am-price-row { gap: 5px; }
}
@media (max-width: 520px) {
  .am-cashea-inline { height: 17px; }
  .am-price-row { gap: 4px; }
}
@media (max-width: 380px) {
  .am-cashea-inline { height: 15px; }
}

/* Logo Cashea en la esquina superior derecha del banner de anuncios
   -> Redondeado completo con "halo" tipo botón (solo ilusión visual) */
.am-ads-hero { position: relative; }
.am-ads-cashea {
  position: absolute;
  top: 12px;
  right: 14px;
  height: 72px;
  width: 72px;              /* forzamos cuadrado para bordes 100% circulares */
  object-fit: contain;
  padding: 6px;
  z-index: 4;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 9999px;    /* totalmente circular */
  box-shadow:
    0 6px 18px rgba(0,0,0,.28),
    0 2px 6px rgba(0,0,0,.18),
    0 0 0 4px rgba(255,255,255,.35);
  pointer-events: none;     /* solo ilusión de botón */
  transition: transform .18s ease, box-shadow .18s ease;
}
.am-ads-cashea:hover {
  transform: translateY(-1px);
  box-shadow:
    0 10px 24px rgba(0,0,0,.32),
    0 4px 10px rgba(0,0,0,.22),
    0 0 0 5px rgba(255,255,255,.45);
}
@media (max-width: 780px) {
  .am-ads-cashea { height: 58px; width: 58px; top: 8px; right: 10px; padding: 6px; }
}
@media (max-width: 520px) {
  .am-ads-cashea { height: 48px; width: 48px; top: 6px; right: 8px; padding: 5px; }
}

/* Mejora #3: en el apartado "BOLSOS Y CARTERAS" los productos van con fondo blanco */
.am-card[data-cat="bolsos y carteras"],
.am-card[data-cat="BOLSOS Y CARTERAS"] {
  background: #ffffff !important;
}
.am-card[data-cat="bolsos y carteras"] img,
.am-card[data-cat="BOLSOS Y CARTERAS"] img {
  background: #ffffff !important;
}
.am-quad-item[data-cat="bolsos y carteras"] .am-quad-imgwrap,
.am-quad-item[data-cat="BOLSOS Y CARTERAS"] .am-quad-imgwrap {
  background: #ffffff !important;
}

/* Botón flotante WhatsApp (inferior derecha) */
.am-wa-float {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #25D366;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
  z-index: 9998;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
  animation: amWaPulse 2.2s ease-in-out infinite;
}
.am-wa-float:hover { transform: scale(1.08); box-shadow: 0 8px 22px rgba(0,0,0,.32); }
.am-wa-float svg { width: 36px; height: 36px; }
@keyframes amWaPulse {
  0%   { box-shadow: 0 6px 18px rgba(0,0,0,.25), 0 0 0 0 rgba(37,211,102,.55); }
  70%  { box-shadow: 0 6px 18px rgba(0,0,0,.25), 0 0 0 16px rgba(37,211,102,0); }
  100% { box-shadow: 0 6px 18px rgba(0,0,0,.25), 0 0 0 0 rgba(37,211,102,0); }
}

/* Botón flotante "Pagar ahora" (inferior izquierda) */
.am-pay-float {
  position: fixed;
  left: 18px;
  bottom: 18px;
  background: #25D366;
  color: #ffffff !important;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: .3px;
  padding: 14px 22px;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
  z-index: 9999;
  display: none;               /* JS lo cambia a flex cuando hay items */
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .15s ease, background .15s ease;
}
.am-pay-float:hover { transform: translateY(-2px); background: #1ebe5d; }
@media (max-width: 520px) {
  .am-pay-float { font-size: 14px; padding: 12px 18px; left: 12px; bottom: 12px; }
  .am-wa-float  { width: 54px; height: 54px; right: 12px; bottom: 12px; }
  .am-wa-float svg { width: 32px; height: 32px; }
}

/* ============ Banner secundario y tercer banner (GRANDES) ============
   Relacion FIJA 16:9 en todas las pantallas (PC, tablet y telefono).
   Imagen recomendada: 1600 x 900 px (o 1920 x 1080 px).
   Al mantener la misma relacion en todos los tamanos, la imagen encaja
   exacta: sin margenes blancos, sin recortes y mucho mas alta que antes. */
.am-secondary-banner-wrap {
  width: 100%;
  margin: 22px 0 26px;
  padding: 0;
}
.am-secondary-banner {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;   /* 1600 x 900 */
  overflow: hidden;
  background: #E9B85C;    /* color base por si la imagen no es 16:9 */
  box-shadow: 0 10px 26px rgba(0,0,0,.16);
  color: #1D4ED8;
}
.am-secondary-banner .am-slide {
  position: absolute;
  inset: 0;
  display: block;
  opacity: 0;
  pointer-events: none;
  text-decoration: none;
  transition: opacity .4s ease;
  color: #1D4ED8;
}
.am-secondary-banner .am-slide.active {
  opacity: 1;
  pointer-events: auto;
}
.am-secondary-banner .am-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;    /* imagen completa, nada se corta */
  object-position: center;
  display: block;
}
@media (max-width: 900px) {
  .am-secondary-banner-wrap { margin: 16px 0 20px; }
  .am-secondary-banner { aspect-ratio: 16 / 9; }
}
@media (max-width: 560px) {
  .am-secondary-banner-wrap { margin: 14px 0 18px; }
  .am-secondary-banner { aspect-ratio: 16 / 9; border-radius: 0; }
}

/* ============ Lightbox de imagen de producto ============ */
.am-lightbox {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.85);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; cursor: zoom-out;
}
.am-lightbox img {
  max-width: 92vw; max-height: 92vh;
  background: #fff; border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  object-fit: contain;
}
.am-lightbox .close {
  position: absolute; top: 18px; right: 22px;
  background: #fff; color: #111; border: 0; border-radius: 50%;
  width: 42px; height: 42px; font-size: 22px; font-weight: 900;
  cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.3);
}
