/* ============================================================================
   order-shared.css — Ola 2 (2026-08-30)
   Reglas COMPARTIDAS por las 4 familias de temas (base/retail/resto/mostrador).
   Antes este bloque estaba appendeado byte a byte en las 4 bases (~40 KB
   duplicados). Los cambios de las features comunes (checkout, strip, portada,
   sheet, reseñas, cupones…) se hacen ACA, una sola vez.
   La parte tematizada (colores, tipografia, layout propio) sigue en cada
   order-base-*.css. Carga: entre order-tokens.css y la base del tema.
   ========================================================================= */


/* Fase B: tienda cerrada NAVEGABLE — el aviso pasa de pantalla completa a banner */
.th-closed--banner { display: flex; align-items: center; gap: var(--space-3); max-width: none; margin: var(--space-3) var(--space-4); padding: var(--space-3) var(--space-4); text-align: left; }
.th-closed--banner > i { font-size: 22px; margin-bottom: 0; flex-shrink: 0; }
.th-closed--banner .th-closed__txt { color: var(--text-muted); line-height: 1.45; font-size: 14px; }
.th-closed--banner .th-closed__txt b { color: var(--text); }

/* Fase B: toast liviano (reemplaza los alert() nativos del checkout) */
.th-toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(16px); max-width: min(92vw, 420px); background: var(--text); color: var(--card); padding: 12px 18px; border-radius: var(--radius-md); box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,.25)); font-size: 14px; line-height: 1.4; opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease; z-index: 1200; }
.th-toast--visible { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (prefers-reduced-motion: reduce) { .th-toast { transition: none; } }

/* Fase B: nota por producto (sheet + línea de carrito) */
.th-sheet__nota { padding: 0 var(--space-4) var(--space-3); }
.th-sheet__nota label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.th-sheet__nota label span { font-weight: 400; color: var(--text-muted); }
.th-sheet__nota textarea { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card); color: var(--text); padding: 8px 10px; font: inherit; font-size: 14px; resize: none; }
.th-cart-item__nota { display: block; color: var(--text-muted); font-style: italic; font-size: 12.5px; }

/* Fase B: Resumen del carrito (subtotal / cupón / envío antes del Total) */
.th-resumen { border-top: 1px dashed var(--border); padding-top: var(--space-3); margin-top: var(--space-3); display: grid; gap: 6px; }
.th-resumen__row { display: flex; justify-content: space-between; font-size: 14px; color: var(--text-muted); }
.th-resumen__row--desc { color: var(--accent); font-weight: 600; }

/* Fase B: cupón de descuento en el checkout */
.th-cupon { display: flex; gap: 8px; margin: var(--space-3) 0; }
.th-cupon input { flex: 1; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card); color: var(--text); padding: 9px 12px; font: inherit; font-size: 14px; text-transform: uppercase; }
.th-cupon input::placeholder { text-transform: none; }
.th-cupon button { border: 1px solid var(--accent-safe, var(--accent)); background: transparent; color: var(--accent-safe, var(--accent)); border-radius: var(--radius-md); padding: 0 16px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.th-cupon button:disabled { opacity: .5; cursor: default; }
.th-cupon--ok { align-items: center; justify-content: space-between; background: var(--bg); border: 1px dashed var(--accent-safe, var(--accent)); border-radius: var(--radius-md); padding: 8px 12px; font-size: 14px; }
.th-cupon--ok button { border: none; font-size: 18px; padding: 0 4px; line-height: 1; }

/* Fase B: strip de estado + modo + envío en la carta */
.th-envio-strip { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin: var(--space-2) var(--space-4); padding: 10px var(--space-3); background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); font-size: 13.5px; }
.th-envio-strip__estado { font-weight: 600; color: var(--text); white-space: nowrap; }
.th-envio-strip__estado i { font-size: 9px; color: #2E9E5B; vertical-align: 1px; }
.th-envio-strip__estado.is-cerrado i { color: #C0392B; }
.th-envio-strip__modos { display: flex; gap: 4px; background: var(--bg); border-radius: 999px; padding: 3px; }
.th-envio-strip__modos button { border: none; background: transparent; color: var(--text-muted); font: inherit; font-size: 13px; font-weight: 600; padding: 5px 14px; border-radius: 999px; cursor: pointer; }
.th-envio-strip__modos button.is-activo { background: var(--accent); color: var(--accent-fg, #fff); }
.th-envio-strip__dato { color: var(--text-muted); white-space: nowrap; }

/* Fase D: portada del comercio (foto hero) + rating */
.th-portada { position: relative; height: 150px; margin: var(--space-2) var(--space-4) 0; border-radius: var(--radius-lg); background-size: cover; background-position: center; box-shadow: var(--shadow-sm, 0 1px 4px rgba(0,0,0,.12)); }
.th-portada__rating { position: absolute; right: 10px; bottom: 10px; background: rgba(0,0,0,.65); color: #fff; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
@media (min-width: 720px) { .th-portada { height: 220px; } }

/* Criterio unificado de ancho (2026-08-31): la portada, el strip de envio y el
   banner de cerrado respetan el mismo contenedor que navbar/carta (1120px).
   Antes iban de borde a borde y en desktop quedaban desalineados. */
@media (min-width: 768px) {
  .th-portada,
  .th-envio-strip,
  .th-closed--banner {
    max-width: var(--th-container, 1120px);
    margin-left: auto;
    margin-right: auto;
  }
}

/* Fase D: checkout en 2 pasos */
.th-steps { display: flex; align-items: center; gap: 10px; margin: 0 0 var(--space-3); }
.th-steps button { border: none; background: transparent; font: inherit; font-size: 14px; font-weight: 600; color: var(--text-muted); padding: 6px 2px; cursor: pointer; border-bottom: 2px solid transparent; }
.th-steps button.is-on { color: var(--text); border-bottom-color: var(--accent-safe, var(--accent)); }
.th-steps button:disabled { opacity: .45; cursor: default; }
.th-steps__sep { flex: 0 0 24px; height: 1px; background: var(--border); }

/* Fase D: transferencia bancaria en el checkout */
.th-transferencia { background: var(--bg); border: 1px dashed var(--border); border-radius: var(--radius-md); padding: 10px 14px; margin: var(--space-2) 0; font-size: 14px; }
.th-transferencia p { margin: 0 0 6px; }
.th-transferencia button { border: 1px solid var(--accent-safe, var(--accent)); background: transparent; color: var(--accent-safe, var(--accent)); border-radius: var(--radius-md); padding: 5px 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; margin-bottom: 6px; }

/* Fase D: reseña post-entrega */
.th-resenia { margin: var(--space-3) 0; padding: var(--space-3); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md); }
.th-resenia__titulo { font-weight: 600; margin: 0 0 6px; }
.th-resenia__stars { display: flex; gap: 4px; margin-bottom: 8px; }
.th-resenia__stars button { border: none; background: transparent; font-size: 28px; line-height: 1; color: var(--border); cursor: pointer; padding: 2px; }
.th-resenia__stars button.is-on { color: #F5A623; }
.th-resenia textarea { margin-bottom: 8px; }

/* Fase D: upsell en el paso 1 del carrito */
.th-upsell { margin: var(--space-3) 0; }
.th-upsell__titulo { font-weight: 600; margin: 0 0 8px; }
.th-upsell__items { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.th-upsell__item { flex: 0 0 130px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 8px; font: inherit; font-size: 13px; text-align: left; cursor: pointer; color: var(--text); }
.th-upsell__item img { width: 100%; height: 70px; object-fit: cover; border-radius: calc(var(--radius-md) - 4px); }
.th-upsell__item b { color: var(--accent-safe, var(--accent)); }

/* Fase E1: cantidad en el card — botón Agregar ⇄ stepper [− n +] */
.th-card__agregar { border: 1px solid var(--accent-safe, var(--accent)); background: transparent; color: var(--accent-safe, var(--accent)); border-radius: 999px; padding: 6px 16px; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.th-card__agregar:disabled { opacity: .4; cursor: default; }
.th-card-stepper { display: inline-flex; align-items: center; gap: 2px; background: var(--accent-safe, var(--accent)); border-radius: 999px; padding: 2px; }
.th-card-stepper button { width: 30px; height: 30px; border: none; background: transparent; color: var(--accent-fg, #fff); font-size: 17px; font-weight: 700; line-height: 1; cursor: pointer; border-radius: 999px; }
.th-card-stepper button:hover { background: rgba(255,255,255,.18); }
.th-card-stepper button:disabled { opacity: .45; cursor: default; }
.th-card-stepper span { min-width: 22px; text-align: center; color: var(--accent-fg, #fff); font-weight: 700; font-size: 14.5px; }
@keyframes pb-badge-pop { 0% { transform: scale(1); } 40% { transform: scale(1.45); } 100% { transform: scale(1); } }
.pb-badge-pop { animation: pb-badge-pop .35s ease; }
@media (prefers-reduced-motion: reduce) { .pb-badge-pop { animation: none; } }

/* Fase E2: detalle de producto con foto hero (nivel fu.do) */
.th-sheet__header { padding-top: 0; }
.th-sheet__header:not(:has(.th-sheet__img)) { padding-top: var(--space-4); }
.th-sheet .th-sheet__header .th-sheet__img { max-height: none; height: 240px; width: calc(100% + 2 * var(--space-4)); margin: 0 calc(-1 * var(--space-4)) var(--space-3); border-radius: var(--radius) var(--radius) 0 0; object-fit: cover; }
.th-sheet__close { position: absolute; top: 10px; right: 10px; z-index: 2; background: rgba(0,0,0,.45); color: #fff; }
.th-sheet__close:hover { background: rgba(0,0,0,.6); }
.th-sheet__title { font-size: 21px; font-weight: 700; }
.th-sheet__price { font-size: 18px; }
@media (min-width: 720px) {
  .th-sheet__panel { border-radius: var(--radius); }
  .th-sheet .th-sheet__header .th-sheet__img { height: 280px; }
}

/* Fase E3: portada con identidad (nombre + estado + Info) y fallback sin foto */
.th-portada { height: auto; min-height: 130px; display: flex; align-items: flex-end; }
.th-portada:not(.th-portada--foto) { background: linear-gradient(135deg, var(--accent-safe, var(--accent)) 0%, rgba(0,0,0,.45) 160%); background-color: var(--accent-safe, var(--accent)); }
.th-portada__info { width: 100%; padding: 14px 16px; color: #fff; }
.th-portada__nombre { margin: 0 0 6px; font-size: clamp(20px, 5vw, 30px); line-height: 1.1; color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.45); }
.th-portada__meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.th-portada__estado { font-size: 13px; font-weight: 600; background: rgba(0,0,0,.5); padding: 4px 10px; border-radius: 999px; }
.th-portada__estado i { font-size: 8px; color: #4ADE80; vertical-align: 1px; }
.th-portada__estado.is-cerrado i { color: #F87171; }
.th-portada__rating { position: static; background: rgba(0,0,0,.5); }
.th-portada__infobtn { border: 1px solid rgba(255,255,255,.65); background: rgba(0,0,0,.35); color: #fff; border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
@media (min-width: 720px) { .th-portada { min-height: 170px; } }

/* Fase E3/E4: ficha Info del local + chips del strip + link del banner */
.th-info-body { padding: var(--space-3) var(--space-4) var(--space-4); display: grid; gap: 14px; }
.th-info-item { display: flex; gap: 12px; align-items: flex-start; font-size: 14.5px; }
.th-info-item > i { width: 20px; text-align: center; color: var(--accent-safe, var(--accent)); font-size: 16px; margin-top: 2px; }
.th-info-item b { display: block; font-size: 13px; margin-bottom: 2px; }
.th-info-item span, .th-info-item a { color: var(--text-muted); }
.th-info-acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.th-info-accion { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); color: var(--accent) !important; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; }
.th-info-accion--btn { font-family: inherit; }
.th-info-item > div { display: flex; flex-direction: column; align-items: flex-start; }
.th-info-turno { display: block; }
.th-info-rating { display: inline-block; margin-top: 4px; color: #F5A623; font-weight: 700; }
.th-info-rating small { color: var(--text-muted); font-weight: 400; }
.th-envio-strip__chipbtn { border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.th-closed__link { border: none; background: transparent; color: var(--accent-safe, var(--accent)); font: inherit; font-size: 14px; font-weight: 600; text-decoration: underline; cursor: pointer; padding: 0; margin-top: 4px; }

/* Fase E5: checkout liviano */
.th-datos-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: var(--space-3); }
.th-datos-card__txt { display: grid; gap: 2px; font-size: 14px; min-width: 0; }
.th-datos-card__txt span { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-datos-card__txt i { color: #2E9E5B; margin-left: 4px; }
.th-datos-card button { border: 1px solid var(--accent-safe, var(--accent)); background: transparent; color: var(--accent-safe, var(--accent)); border-radius: var(--radius-md); padding: 6px 14px; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; flex-shrink: 0; }
.th-check-inline { display: flex; align-items: center; gap: 6px; font-size: 14px; margin-bottom: 6px; cursor: pointer; }
.th-inline-err { display: block; color: #C0392B; font-size: 12.5px; margin-top: 3px; }

/* Fase E6: estado vacío de búsqueda */
.th-busqueda-vacia { text-align: center; padding: var(--space-5) var(--space-4); color: var(--text-muted); }
.th-busqueda-vacia b { color: var(--text); }
.th-busqueda-vacia button { display: block; margin: 12px auto 0; border: 1px solid var(--accent-safe, var(--accent)); background: transparent; color: var(--accent-safe, var(--accent)); border-radius: 999px; padding: 7px 18px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }

/* Footer "Powered by POSBerry" (todos los temas): el reset global
   img{display:block} de order-tokens.css sacaba el icono del flujo inline y
   quedaba pegado al borde izquierdo — flex centra icono + texto siempre. */
.th-footer { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.th-footer a { display: inline-flex; align-items: center; }
