/* ============================================================
   SPYA Market Orders / Altokeapp — hoja de estilos del frontend.
   Traducido de la guía visual aprobada. Todo vive adentro de
   .smo-app-shell para que el look sea consistente sin importar
   el tema de WordPress que tenga el sitio alrededor.
   ============================================================ */

.smo-app-shell{
  --smo-paper:#EFF1E9;
  --smo-paper-2:#E7E9DF;
  --smo-ink:#221E1A;
  --smo-ink-soft:#5B564C;
  --smo-red:#E30613;
  --smo-green:#2F6B4E;
  --smo-green-vivo:#3CB878;
  --smo-green-bg:#E4EEE6;
  --smo-ochre:#E2A63B;
  --smo-terracota:#C1552B;
  --smo-line:#D8D4C4;
  --smo-white:#FFFFFF;
  --smo-shadow-card: 0 1px 2px rgba(34,30,26,0.06), 0 6px 16px rgba(34,30,26,0.06);

  background: var(--smo-paper);
  color: var(--smo-ink);
  font-family:'Work Sans', sans-serif;
  border-radius: 20px;
  padding: 0 0 24px;
  max-width: 720px;
  margin: 0 auto;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}

/* IMPORTANTE (corrección de bug): sin esto, cualquier campo con
   width:100% + padding (buscador, inputs de checkout, etc.) queda
   MÁS ANCHO que su contenedor, empujando toda la página hacia el
   costado — eso era lo que causaba el desencuadre y la franja
   blanca reportados. */
.smo-app-shell, .smo-app-shell *{ box-sizing: border-box; }

.smo-app-shell h1, .smo-app-shell h2, .smo-app-shell h3, .smo-app-shell h4{
  font-family:'Space Grotesk', sans-serif;
  margin: 0;
  letter-spacing: -0.01em;
}

.smo-app-shell .smo-mono{ font-family:'Space Mono', monospace; }

/* ---- Barra superior (marca + carrito) ---- */
.smo-app-bar{
  padding: 20px 20px 14px;
  background: var(--smo-white);
  border-radius: 20px 20px 0 0;
  border-bottom: 1px solid var(--smo-line);
}
.smo-app-bar-top{
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:14px;
}
.smo-marca{ display:flex; align-items:center; gap:8px; }
.smo-marca .smo-punto{ width:10px; height:10px; border-radius:50%; background: var(--smo-red); }
.smo-marca span{ font-family:'Space Grotesk', sans-serif; font-weight:700; font-size:18px; }
.smo-marca small{ display:block; font-size:11px; color: var(--smo-ink-soft); font-weight:500; }

.smo-carrito-link{
  display:flex; align-items:center; gap:8px;
  background: var(--smo-ink); color: var(--smo-white);
  border-radius: 10px; padding: 9px 14px;
  text-decoration:none; font-weight:600; font-size:13px;
  position:relative;
}
.smo-carrito-link .smo-badge{
  background: var(--smo-red); border-radius:50%;
  width:19px; height:19px; font-size:11px;
  display:flex; align-items:center; justify-content:center;
  font-family:'Space Mono', monospace;
}

/* ---- Buscador ---- */
.smo-buscador{
  display:flex; align-items:center; gap:8px;
  background: var(--smo-paper-2);
  border-radius:12px; padding: 11px 14px;
}
.smo-buscador input{
  border:none; background:none; outline:none;
  font-family:'Work Sans', sans-serif; font-size:14px;
  width:100%; color: var(--smo-ink);
}

/* ---- Chips de categoria ---- */
.smo-chips{
  display:flex; gap:8px; overflow-x:auto;
  padding: 14px 20px 16px; background: var(--smo-white);
}
.smo-chip{
  flex:none; font-size:13px; font-weight:600;
  padding:8px 14px; border-radius:999px;
  background: var(--smo-paper-2); color: var(--smo-ink-soft);
  border:none; cursor:pointer; white-space:nowrap;
}
.smo-chip.smo-activo{ background: var(--smo-ink); color: var(--smo-white); }

/* ---- Contenedor del catalogo ---- */
.smo-catalogo{ padding: 18px 20px; }
.smo-catalogo-grid{
  display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap:14px;
}
@media (min-width: 560px){
  .smo-catalogo-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.smo-catalogo-vacio{ text-align:center; color: var(--smo-ink-soft); padding: 30px 0; }

.smo-producto{
  background: var(--smo-white);
  border:1px solid var(--smo-line);
  border-radius:16px; padding:12px;
  box-shadow: var(--smo-shadow-card);
  position: relative;
  min-width: 0; /* evita que el contenido (nombre largo, precio) empuje la grilla fuera de pantalla */
  overflow-wrap: break-word;
}
.smo-btn-favorito{
  position:absolute; top:8px; right:8px; z-index:2;
  width:28px; height:28px; border-radius:50%;
  background: rgba(255,255,255,.9); border:1px solid var(--smo-line);
  color: var(--smo-line); font-size:14px; line-height:1;
  cursor:pointer; display:flex; align-items:center; justify-content:center;
}
.smo-btn-favorito.smo-favorito-activo{ color: var(--smo-red); border-color: var(--smo-red); }

/* ---- Cartel de oferta + descuento (igual que el showcase) ---- */
.smo-badge-oferta{
  position:absolute; top:8px; left:8px; z-index:2;
  background: var(--smo-red); color: var(--smo-white);
  font-family:'Space Grotesk', sans-serif; font-weight:700; font-size:10px;
  text-transform:uppercase; letter-spacing:.03em;
  padding:4px 8px; border-radius:5px;
}
.smo-badge-descuento{
  position:absolute; top:8px; right:8px; z-index:2;
  background: var(--smo-green); color: var(--smo-white);
  font-family:'Space Mono', monospace; font-weight:700; font-size:11px;
  padding:4px 7px; border-radius:999px;
}
/* Cuando también hay favorito, el descuento se corre para no chocar
   con el corazón — se resuelve con una clase condicional desde PHP
   (is_user_logged_in()) en vez de :has(), por compatibilidad con
   navegadores viejos de celular. */
.smo-badge-descuento.smo-badge-descuento-bajo{ top:42px; }
.smo-precio-lista{
  display:block; font-size:11.5px; color: var(--smo-ink-soft);
  text-decoration: line-through; margin-bottom:3px;
}
.smo-agregar-a-lista{ display:flex; gap:6px; margin-top:8px; }
.smo-select-lista{ flex:1; font-size:11.5px; border:1px solid var(--smo-line); border-radius:8px; padding:5px; }
.smo-btn-guardar-lista{ font-size:11px; font-weight:700; background:var(--smo-paper-2); border:none; border-radius:8px; padding:6px 8px; cursor:pointer; }
.smo-producto-imagen{
  width:100%; height:100px; object-fit:contain;
  background: var(--smo-paper-2); border-radius:12px;
  margin-bottom:8px;
}
.smo-producto-marca{
  display:block; font-size:10.5px; text-transform:uppercase;
  letter-spacing:.04em; color: var(--smo-ink-soft); font-weight:700;
}
.smo-producto-nombre{ font-size:13.5px; font-weight:600; margin:3px 0 10px; line-height:1.25; }
.smo-producto-sin-stock{ color: var(--smo-red); font-size:12px; font-weight:600; }

.smo-agregar-carrito{ display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.smo-input-cantidad{
  width:44px; border:1px solid var(--smo-line); border-radius:8px;
  padding:6px; font-family:'Space Mono', monospace; font-size:13px;
}

/* ---- Etiqueta de precio (elemento distintivo) ---- */
.smo-price-tag{
  font-family:'Space Mono', monospace; font-weight:700; font-size:14px;
  background: var(--smo-green); color: var(--smo-white);
  padding:6px 10px 6px 15px; border-radius:0 6px 6px 0;
  position:relative; line-height:1.1; display:inline-block;
  flex:1 1 auto; min-width:0; text-align:center;
}
.smo-price-tag::before{
  content:""; position:absolute; left:-6px; top:50%; transform:translateY(-50%);
  width:12px; height:12px; background: var(--smo-white); border-radius:50%;
  box-shadow: inset 0 0 0 2px var(--smo-green);
}
.smo-price-tag::after{
  content:""; position:absolute; left:-9px; top:0; bottom:0; width:9px;
  background: var(--smo-green); clip-path: polygon(100% 0, 0 50%, 100% 100%);
}

.smo-btn-agregar{
  font-family:'Space Grotesk', sans-serif; font-weight:700; font-size:12.5px;
  background: var(--smo-green-vivo); color: var(--smo-white);
  border:none; border-radius:8px; padding:9px 12px; cursor:pointer;
  flex:1 1 auto; min-width:64px;
}
.smo-btn-agregar:disabled{ opacity:.6; cursor:default; }

/* ---- Carrito ---- */
.smo-carrito{ padding: 18px 20px; background: var(--smo-white); border-radius: 0 0 20px 20px; }
.smo-carrito-vacio{ text-align:center; color: var(--smo-ink-soft); padding: 30px 0; }

.smo-carrito-item{
  display:flex; gap:12px; padding:16px 0;
  border-bottom:1px solid var(--smo-line);
  align-items:flex-start;
}
.smo-carrito-producto{ display:flex; gap:12px; flex:1; min-width:0; }
.smo-carrito-producto img{
  width:52px; height:52px; object-fit:contain; border-radius:10px;
  background: var(--smo-paper-2); flex:none;
}
.smo-carrito-producto .smo-nombre-wrap{ min-width:0; }
.smo-carrito-producto strong{ font-size:11px; text-transform:uppercase; color: var(--smo-ink-soft); }
.smo-carrito-producto span{ display:block; font-size:13.5px; font-weight:600; margin-top:2px; }

.smo-stepper{
  display:inline-flex; align-items:center; gap:12px;
  background: var(--smo-paper-2); border-radius:8px; padding:5px 10px;
  margin-top:8px;
}
.smo-stepper button{ border:none; background:none; font-size:15px; font-weight:700; cursor:pointer; width:14px; color: var(--smo-ink); }
.smo-stepper .smo-cant{ font-family:'Space Mono', monospace; font-size:13px; min-width:16px; text-align:center; }

.smo-toggle-sustitucion{
  display:flex; align-items:center; gap:8px;
  font-size:11.5px; color: var(--smo-ink-soft); margin-top:10px; cursor:pointer;
}
.smo-switch{
  width:32px; height:18px; border-radius:99px; background: var(--smo-line);
  position:relative; flex:none; transition: background .15s;
}
.smo-switch::after{
  content:""; position:absolute; top:2px; left:2px;
  width:14px; height:14px; border-radius:50%; background: var(--smo-white);
  transition: left .15s;
}
.smo-check-sustitucion{ display:none; }
.smo-check-sustitucion:checked + .smo-switch{ background: var(--smo-green); }
.smo-check-sustitucion:checked + .smo-switch::after{ left:16px; }

.smo-carrito-item-derecha{ text-align:right; flex:none; }
.smo-carrito-item-subtotal{ font-family:'Space Mono', monospace; font-weight:700; font-size:13.5px; }
.smo-btn-quitar{ display:block; margin-top:8px; font-size:11.5px; color: var(--smo-red); background:none; border:none; cursor:pointer; padding:0; }

.smo-carrito-total{
  background: var(--smo-paper-2); border-radius:14px; padding:16px; margin-top:16px;
}
.smo-carrito-total strong{ font-family:'Space Mono', monospace; }
.smo-carrito-nota{ font-size:12px; color: var(--smo-ink-soft); margin: 6px 0 0; }

.smo-carrito-acciones{ margin-top:16px; }
.smo-btn-confirmar, .smo-btn-primario-full{
  display:block; width:100%; text-align:center; text-decoration:none;
  font-family:'Space Grotesk', sans-serif; font-weight:700; font-size:14.5px;
  background: var(--smo-red); color: var(--smo-white) !important;
  border:none; border-radius:12px; padding:15px; cursor:pointer;
}

/* ---- Checkout / login-registro ---- */
.smo-checkout, .smo-auth-wrap{ padding: 18px 20px; background: var(--smo-white); border-radius: 20px; }
.smo-checkout-error, .smo-auth-error{
  background:#FDECEA; color:#B00020; padding:12px 14px; border-radius:10px; margin-bottom:16px; font-size:13.5px;
}
.smo-checkout-resumen{ list-style:none; padding:0; margin:0 0 14px; font-size:13.5px; }
.smo-checkout-resumen li{ padding:5px 0; border-bottom:1px dashed var(--smo-line); }

.smo-checkout label, .smo-auth-col label{
  display:block; font-size:11.5px; font-weight:700; text-transform:uppercase;
  letter-spacing:.04em; color: var(--smo-ink-soft); margin-bottom:6px; margin-top:14px;
}
.smo-checkout input[type="text"], .smo-checkout input[type="tel"],
.smo-checkout input[type="date"], .smo-checkout textarea, .smo-checkout input[type="file"],
.smo-auth-col input{
  width:100%; border:1px solid var(--smo-line); border-radius:10px;
  padding:11px 12px; font-family:'Work Sans', sans-serif; font-size:13.5px;
  background: var(--smo-white);
}

.smo-franjas{ display:flex; gap:8px; flex-wrap:wrap; }
.smo-franjas input[type="radio"]{ display:none; }
.smo-franja-opcion{
  font-size:12.5px; font-weight:600; padding:9px 13px;
  border-radius:10px; border:1px solid var(--smo-line); color: var(--smo-ink-soft);
  cursor:pointer; display:inline-block;
}
.smo-franjas input[type="radio"]:checked + .smo-franja-opcion{
  background: var(--smo-ink); color: var(--smo-white); border-color: var(--smo-ink);
}

.smo-datos-bancarios{
  background: var(--smo-white); border:1.5px dashed var(--smo-ink);
  border-radius:14px; padding:16px; margin:10px 0 18px;
}
.smo-datos-bancarios .smo-fila{ display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; font-size:13px; gap:8px; flex-wrap:wrap; }
.smo-datos-bancarios .smo-valor{ font-family:'Space Mono', monospace; font-weight:700; word-break: break-all; }
.smo-copiar{ font-size:10.5px; background: var(--smo-paper-2); border:none; border-radius:6px; padding:4px 9px; cursor:pointer; }

/* ---- Auth (login/registro) ---- */
.smo-auth-columnas{ display:flex; gap:24px; flex-wrap:wrap; }
.smo-auth-col{ flex:1; min-width:220px; }
.smo-auth-col button{
  margin-top:16px;
  font-family:'Space Grotesk', sans-serif; font-weight:700; font-size:13.5px;
  background: var(--smo-red); color: var(--smo-white); border:none; border-radius:10px;
  padding:11px 16px; cursor:pointer; width:100%;
}

/* ---- Confirmacion ---- */
.smo-gracias{ padding:32px 22px; text-align:center; background: var(--smo-white); border-radius:20px; }
.smo-stamp{
  width:120px; height:120px; border-radius:50%; border:3px solid var(--smo-red);
  color: var(--smo-red); display:flex; align-items:center; justify-content:center;
  margin: 0 auto; font-family:'Space Grotesk', sans-serif; font-weight:700; font-size:13px;
  line-height:1.2; text-transform:uppercase; transform:rotate(-9deg); letter-spacing:.03em;
}
.smo-badge-estado{
  display:inline-block; margin-top:12px; background: var(--smo-green-bg); color: var(--smo-green);
  font-size:12px; font-weight:700; padding:7px 14px; border-radius:99px;
}
.smo-ticket{ text-align:left; margin-top:22px; background: var(--smo-paper-2); border-radius:14px; padding:16px; }
.smo-ticket .smo-linea{ display:flex; justify-content:space-between; font-size:13px; padding:7px 0; border-bottom:1px dashed var(--smo-line); }
.smo-ticket .smo-linea:last-child{ border:none; font-family:'Space Mono', monospace; font-weight:700; padding-top:12px; }

@media (prefers-reduced-motion: reduce){ .smo-app-shell *{ animation:none !important; transition:none !important; } }

/* ============================================================
   Home rica del catálogo (banner + accesos + secciones)
   ============================================================ */

/* Chips con fila + botón "Ver todas" */
.smo-chips-fila{ display:flex; align-items:center; gap:8px; padding:16px 20px; background:var(--smo-white); }
.smo-chips-fila .smo-chips{ padding:0; }
.smo-btn-ver-todas{
  flex:none; display:flex; align-items:center; gap:6px; font-size:12.5px; font-weight:700;
  color:var(--smo-red); background:none; border:1.5px solid var(--smo-red); border-radius:999px;
  padding:7px 12px; white-space:nowrap; cursor:pointer;
}
.smo-chip{ color:var(--smo-white); box-shadow:0 3px 8px rgba(0,0,0,.15), inset 0 1px 0 rgba(255,255,255,.25); }
.smo-chip-ofertas{ background:linear-gradient(160deg,#3a8f74,#1f5443); }
.smo-chip-slug-almacen{ background:linear-gradient(160deg,#E8B85B,#B8822C); color:var(--smo-ink); }
.smo-chip-slug-bebidas{ background:linear-gradient(160deg,#6FA8C8,#3D6E8C); }
.smo-chip:not(.smo-chip-ofertas):not(.smo-chip-slug-almacen):not(.smo-chip-slug-bebidas){ background:var(--smo-paper-2); color:var(--smo-ink-soft); box-shadow:none; }
.smo-chip.smo-activo{ background:var(--smo-ink); color:var(--smo-white); box-shadow:0 3px 8px rgba(0,0,0,.15); }

/* Banner */
.smo-banner{
  margin:0 20px 6px; border-radius:18px; padding:22px; color:var(--smo-white);
  background:linear-gradient(135deg,#48A97E 0%, #1f5443 100%);
  background-size:cover; background-position:center;
  box-shadow:0 8px 20px rgba(31,84,67,.3); position:relative; overflow:hidden;
}
.smo-banner-fila{ display:flex; align-items:center; justify-content:space-between; gap:12px; }
.smo-banner h2{ font-size:20px; line-height:1.15; }
.smo-banner p{ font-size:12px; opacity:.9; margin:8px 0 0; max-width:220px; line-height:1.4; }
.smo-banner-scooter{ font-size:40px; filter:drop-shadow(0 4px 6px rgba(0,0,0,.25)); }
.smo-banner-canasta{ font-size:20px; letter-spacing:2px; margin-top:10px; }

/* Grilla de accesos por categoría */
.smo-grilla-categorias{ display:grid; grid-template-columns:repeat(4,1fr); gap:10px; }
.smo-cat-card{ text-align:center; text-decoration:none; color:inherit; display:block; }
.smo-cat-icono{
  width:58px; height:58px; border-radius:18px; display:flex; align-items:center; justify-content:center;
  font-size:26px; margin:0 auto 7px;
  box-shadow: inset 0 -6px 10px rgba(0,0,0,.06), 0 4px 10px rgba(0,0,0,.06);
}
.smo-cat-card span{ font-size:10.5px; font-weight:600; color:var(--smo-ink-soft); }

/* Secciones con fila horizontal de productos */
.smo-seccion{ padding:24px 20px 6px; }
.smo-seccion-header{ display:flex; align-items:baseline; justify-content:space-between; margin-bottom:14px; }
.smo-seccion-header h3{ font-size:16.5px; }
.smo-seccion-ofertas h3{ color:var(--smo-terracota, #C1552B); }
.smo-seccion-header a{ font-size:12px; color:var(--smo-red); font-weight:700; text-decoration:none; }

.smo-fila-scroll{ display:flex; gap:14px; overflow-x:auto; padding-bottom:6px; margin:0 -20px; padding-left:20px; padding-right:20px; }
.smo-producto-mini{
  flex:0 0 144px; background:var(--smo-white); border-radius:16px; padding:12px;
  box-shadow:0 2px 4px rgba(34,30,26,.06), 0 8px 18px rgba(34,30,26,.08);
  border:1px solid rgba(226,166,59,.35);
}
.smo-producto-mini-imagen{ width:100%; height:82px; object-fit:contain; background:var(--smo-paper-2); border-radius:12px; margin-bottom:8px; }
.smo-producto-mini .smo-producto-marca{ font-size:9.5px; }
.smo-producto-mini .smo-producto-nombre{ font-size:12.5px; min-height:31px; margin:3px 0 9px; }
.smo-btn-mini{ width:100%; margin-top:9px; font-size:11.5px; padding:8px; }

.smo-separador{ height:10px; background:var(--smo-paper); }

/* Pantalla "Todas las categorías" (overlay) */
.smo-pantalla-categorias{ display:none; position:absolute; top:0; left:0; right:0; bottom:0; background:var(--smo-white); z-index:30; overflow-y:auto; }
.smo-pantalla-categorias.smo-abierta{ display:block; }
.smo-cat-header{ display:flex; align-items:center; gap:12px; padding:20px; border-bottom:1px solid var(--smo-line); position:sticky; top:0; background:var(--smo-white); }
.smo-cat-header button{ background:var(--smo-paper-2); border:none; border-radius:10px; width:34px; height:34px; font-size:16px; cursor:pointer; }
.smo-cat-header h2{ font-size:17px; }
.smo-cat-grupo{ border-bottom:1px solid var(--smo-line); }
.smo-cat-grupo-header{ display:flex; align-items:center; justify-content:space-between; padding:16px 20px; cursor:pointer; }
.smo-cat-grupo-izq{ font-weight:700; font-size:14.5px; }
.smo-cat-flecha{ transition:transform .18s; color:var(--smo-ink-soft); }
.smo-cat-grupo.smo-abierto .smo-cat-flecha{ transform:rotate(180deg); }
.smo-cat-subs{ display:none; padding:0 20px 16px 20px; flex-wrap:wrap; gap:8px; }
.smo-cat-grupo.smo-abierto .smo-cat-subs{ display:flex; }
.smo-cat-sub{ font-size:12.5px; font-weight:600; color:var(--smo-ink-soft); background:var(--smo-paper-2); border-radius:999px; padding:7px 12px; text-decoration:none; }

/* ---- Barra de progreso del pedido ---- */
.smo-barra-progreso{ display:flex; justify-content:space-between; margin:18px 0; }
.smo-paso-progreso{
  flex:1; text-align:center; position:relative;
  font-size:10.5px; color: var(--smo-ink-soft);
}
.smo-paso-progreso::before{
  content:""; position:absolute; top:5px; left:-50%; width:100%; height:2px;
  background: var(--smo-line); z-index:0;
}
.smo-paso-progreso:first-child::before{ display:none; }
.smo-paso-punto{
  display:block; width:12px; height:12px; border-radius:50%;
  background: var(--smo-line); margin:0 auto 6px; position:relative; z-index:1;
}
.smo-paso-progreso.smo-paso-hecho .smo-paso-punto,
.smo-paso-progreso.smo-paso-hecho::before{ background: var(--smo-green); }
.smo-paso-progreso.smo-paso-actual .smo-paso-punto{ background: var(--smo-red); }
.smo-paso-progreso.smo-paso-hecho .smo-paso-texto,
.smo-paso-progreso.smo-paso-actual .smo-paso-texto{ color: var(--smo-ink); font-weight:600; }

/* ---- Mis pedidos (panel del cliente) ---- */
.smo-mis-pedidos-lista{ display:flex; flex-direction:column; gap:10px; }
.smo-mis-pedidos-fila{
  display:block; text-decoration:none; color:var(--smo-ink);
  border:1px solid var(--smo-line); border-radius:12px; padding:12px 14px;
}
.smo-mis-pedidos-fila:hover{ border-color: var(--smo-ink); }

/* ---- Toast de notificación (reemplaza window.alert) ----
   No vive dentro de .smo-app-shell porque se agrega a document.body
   directamente, así que sus variables de color van repetidas acá. */
.smo-toast{
  position: fixed; left:50%; bottom:24px; transform: translate(-50%, 20px);
  background:#221E1A; color:#FFFFFF;
  font-family:'Work Sans', sans-serif; font-size:13.5px; font-weight:600;
  padding:13px 20px; border-radius:12px;
  box-shadow: 0 10px 24px rgba(0,0,0,.22);
  opacity:0; pointer-events:none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 9999; max-width: 90vw; text-align:center;
}
.smo-toast-visible{ opacity:1; transform:translate(-50%, 0); }
.smo-toast-error{ background:#B00020; }
@media (prefers-reduced-motion: reduce){ .smo-toast{ transition:none; } }
