/**
 * Walon — Design tokens compartidos por el modal de carrito, la página de
 * carrito y el checkout. Complementa (no reemplaza) los tokens tipográficos
 * ya definidos en astra-child/inc/css/walon-fonts.css (--w-font-head,
 * --w-font-body, --w-wt-*).
 */
:root {
  /* Superficies */
  --walon-ink: #0f0f10;
  --walon-ink-soft: #3a3a3d;
  --walon-surface: #ffffff;
  --walon-surface-muted: #f6f7f8;
  --walon-surface-sunken: #eef0f1;
  --walon-border: #e4e5e7;
  --walon-border-strong: #cfd1d4;

  /* Acento y estado (mismos valores que ya usaba el plugin) */
  --walon-accent: #0f0f10;
  --walon-success: #00b050;
  --walon-success-bg: #e9f9ef;
  --walon-danger: #e31919;
  --walon-danger-bg: #fdecec;

  /* Radios — jerarquía intencional, no todo redondeado por igual:
     las fotos/imágenes usan un radio mínimo (más editorial, menos "ícono de app"),
     los controles (inputs/botones) un radio moderado, y solo contenedores
     grandes (modal, tarjetas) un radio algo mayor. Los pills siguen siendo pills. */
  --walon-radius-img: 4px;
  --walon-radius-xs: 6px;
  --walon-radius-sm: 8px;
  --walon-radius-md: 10px;
  --walon-radius-lg: 14px;
  --walon-radius-pill: 999px;

  /* Sombras (elevación) */
  --walon-shadow-1: 0 1px 3px rgba(15, 15, 16, 0.06), 0 1px 2px rgba(15, 15, 16, 0.04);
  --walon-shadow-2: 0 8px 24px rgba(15, 15, 16, 0.09), 0 2px 6px rgba(15, 15, 16, 0.06);
  --walon-shadow-3: 0 20px 48px rgba(15, 15, 16, 0.16), 0 6px 16px rgba(15, 15, 16, 0.08);

  /* Foco premium para inputs (anillo suave, no solo cambio de borde) */
  --walon-focus-ring: 0 0 0 4px rgba(15, 15, 16, 0.08);
  --walon-focus-ring-success: 0 0 0 4px rgba(0, 176, 80, 0.14);
  --walon-focus-ring-danger: 0 0 0 4px rgba(227, 25, 25, 0.12);

  /* Espaciado */
  --walon-space-xs: 6px;
  --walon-space-sm: 10px;
  --walon-space-md: 16px;
  --walon-space-lg: 24px;
  --walon-space-xl: 32px;

  /* Movimiento */
  --walon-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --walon-duration-fast: 0.18s;
  --walon-duration-base: 0.32s;
  --walon-duration-slow: 0.5s;
}

/* =========================================================
   Toast — notificaciones inline que reemplazan a alert()
========================================================= */
.walon-toast-stack {
  position: fixed;
  z-index: 1000010;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(92vw, 420px);
  pointer-events: none;
}

.walon-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--walon-ink);
  color: #fff;
  border-radius: var(--walon-radius-md);
  padding: 14px 16px;
  box-shadow: var(--walon-shadow-3);
  font-family: var(--w-font-body, "Neusa Next Pro", Arial, sans-serif);
  font-size: 14px;
  font-weight: var(--w-wt-medium, 500);
  line-height: 1.4;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition: opacity var(--walon-duration-base) var(--walon-ease),
    transform var(--walon-duration-base) var(--walon-ease);
}

.walon-toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.walon-toast .walon-toast-icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.walon-toast .walon-toast-icon svg {
  width: 100%;
  height: 100%;
}

.walon-toast.walon-toast-error {
  background: var(--walon-danger);
}

.walon-toast.walon-toast-success {
  background: var(--walon-success);
}

@media (max-width: 480px) {
  .walon-toast-stack {
    bottom: 16px;
  }
}

/* =========================================================
   Avisos de WooCommerce (carrito y checkout)
   Un solo diseño para los mensajes que WooCommerce pinta por defecto:
   éxito (verde), información (azul) y error (rojo), con ícono, la acción
   ("Ver carrito") a la derecha y una × para cerrar los que no bloquean.
   Los avisos propios del convenio (tope de modelos) usan el mismo diseño
   con la paleta del convenio: ver walon-convenios/assets/css/codigo.css.
========================================================= */
:root {
  --walon-info: #1f4fb4;
  --walon-info-bg: #eaf0fd;
  --walon-info-line: #b7c9f2;
  --walon-success-line: #a9e3be;
  --walon-danger-line: #f3b3b3;
}

body.woocommerce-cart .woocommerce-message,
body.woocommerce-cart .woocommerce-info,
body.woocommerce-cart ul.woocommerce-error,
body.woocommerce-checkout .woocommerce-message,
body.woocommerce-checkout .woocommerce-info,
body.woocommerce-checkout ul.woocommerce-error {
  --wn-bg: var(--walon-info-bg);
  --wn-line: var(--walon-info-line);
  --wn-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Ccircle cx='10' cy='10' r='8.25' stroke='%231f4fb4' stroke-width='1.7'/%3E%3Cpath d='M10 9v5' stroke='%231f4fb4' stroke-width='1.7' stroke-linecap='round'/%3E%3Ccircle cx='10' cy='6.4' r='1' fill='%231f4fb4'/%3E%3C/svg%3E");
  position: relative;
  display: flex !important;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 0 0 14px !important;
  padding: 13px 44px 13px 14px !important;
  background: var(--wn-bg) !important;
  border: 1px solid var(--wn-line) !important;
  border-radius: var(--walon-radius-md, 10px) !important;
  box-shadow: none !important;
  color: var(--walon-ink, #0f0f10) !important;
  font-family: var(--w-font-body, "Neusa Next Pro", Arial, sans-serif);
  font-size: 14px !important;
  font-weight: var(--w-wt-medium, 500);
  line-height: 1.45;
  list-style: none;
}

body.woocommerce-cart .woocommerce-message,
body.woocommerce-checkout .woocommerce-message {
  --wn-bg: var(--walon-success-bg, #e9f9ef);
  --wn-line: var(--walon-success-line);
  --wn-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M4 10.5l3.5 3.5L16 5.5' stroke='%230a7d3c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

body.woocommerce-cart ul.woocommerce-error,
body.woocommerce-checkout ul.woocommerce-error {
  --wn-bg: var(--walon-danger-bg, #fdecec);
  --wn-line: var(--walon-danger-line);
  --wn-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Ccircle cx='10' cy='10' r='8.25' stroke='%23c01616' stroke-width='1.7'/%3E%3Cpath d='M7 7l6 6M13 7l-6 6' stroke='%23c01616' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  display: grid !important;
  grid-template-columns: 28px 1fr;
  gap: 0 12px;
  align-items: start;
  padding-right: 14px !important;
}

/* Ícono: el de Astra (una caja suelta) se reemplaza por el propio. */
body.woocommerce-cart .woocommerce-message::before,
body.woocommerce-cart .woocommerce-info::before,
body.woocommerce-cart ul.woocommerce-error::before,
body.woocommerce-checkout .woocommerce-message::before,
body.woocommerce-checkout .woocommerce-info::before,
body.woocommerce-checkout ul.woocommerce-error::before {
  content: "" !important;
  position: static !important;
  flex: none;
  width: 28px;
  height: 28px;
  margin: 0 !important;
  border: 1px solid var(--wn-line);
  border-radius: 8px;
  background: #fff var(--wn-icon) center / 17px no-repeat !important;
  font-size: 0 !important;
}

body.woocommerce-cart ul.woocommerce-error::before,
body.woocommerce-checkout ul.woocommerce-error::before {
  grid-row: 1 / span 20;
  grid-column: 1;
}

body.woocommerce-cart ul.woocommerce-error li,
body.woocommerce-checkout ul.woocommerce-error li {
  grid-column: 2;
  margin: 0 0 4px;
  padding: 0;
  list-style: none;
}

body.woocommerce-cart ul.woocommerce-error li:last-child,
body.woocommerce-checkout ul.woocommerce-error li:last-child {
  margin-bottom: 0;
}

body.woocommerce-cart .woocommerce-message a:not(.button),
body.woocommerce-cart .woocommerce-info a:not(.button),
body.woocommerce-cart ul.woocommerce-error a,
body.woocommerce-checkout .woocommerce-message a:not(.button),
body.woocommerce-checkout .woocommerce-info a:not(.button),
body.woocommerce-checkout ul.woocommerce-error a {
  color: inherit;
  font-weight: var(--w-wt-bold, 700);
  text-decoration: underline;
}

/* Acción del aviso ("Ver carrito", "Deshacer"): a la derecha, como botón. */
body.woocommerce-cart .woocommerce-message .button,
body.woocommerce-cart .woocommerce-info .button,
body.woocommerce-checkout .woocommerce-message .button,
body.woocommerce-checkout .woocommerce-info .button {
  order: 2;
  float: none !important;
  margin: 0 0 0 auto !important;
  padding: 8px 14px !important;
  border-radius: var(--walon-radius-sm, 8px) !important;
  background: var(--walon-ink, #0f0f10) !important;
  color: #fff !important;
  font-size: 13px !important;
  font-weight: var(--w-wt-bold, 700);
  line-height: 1.2;
  text-decoration: none !important;
}

/* × para cerrar (la agrega walon-toast.js a éxito e información, nunca a un error). */
.walon-notice-x {
  position: absolute;
  top: 9px;
  right: 9px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--walon-ink-soft, #3a3a3d);
  cursor: pointer;
}

.walon-notice-x:hover {
  background: #fff;
}

.walon-notice-x:focus-visible {
  outline: 2px solid var(--walon-ink, #0f0f10);
  outline-offset: 2px;
}

.walon-notice-x svg {
  width: 13px;
  height: 13px;
}

/* Carrito vacío: no es un aviso, es un estado de la página. */
body.woocommerce-cart p.cart-empty {
  display: block !important;
  margin: 0 !important;
  padding: 38px 20px 6px !important;
  background: #fff !important;
  border: 1px solid var(--walon-border, #e4e5e7) !important;
  border-bottom: 0 !important;
  border-radius: var(--walon-radius-lg, 12px) var(--walon-radius-lg, 12px) 0 0 !important;
  color: var(--walon-ink, #0f0f10) !important;
  font-size: 20px !important;
  font-weight: var(--w-wt-heavy, 800);
  text-align: center;
}

body.woocommerce-cart p.cart-empty::before {
  display: block;
  width: 56px;
  height: 56px;
  margin: 0 auto 14px !important;
  border: 0;
  border-radius: 50%;
  background: var(--walon-surface-sunken, #eef0f1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M5 8h14l-1 12H6L5 8z' stroke='%236b6b6f' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M9 8V6.5a3 3 0 0 1 6 0V8' stroke='%236b6b6f' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") center / 26px no-repeat !important;
}

body.woocommerce-cart p.cart-empty::after {
  content: "Cuando agregues productos los verás aquí, con tus descuentos aplicados.";
  display: block;
  max-width: 34ch;
  margin: 8px auto 0;
  color: #6b6b6f;
  font-size: 14px;
  font-weight: var(--w-wt-regular, 400);
  line-height: 1.45;
}

body.woocommerce-cart .return-to-shop {
  margin: 0 0 32px !important;
  padding: 14px 20px 36px;
  background: #fff;
  border: 1px solid var(--walon-border, #e4e5e7);
  border-top: 0;
  border-radius: 0 0 var(--walon-radius-lg, 12px) var(--walon-radius-lg, 12px);
  text-align: center;
}

body.woocommerce-cart .return-to-shop .button {
  margin: 0;
}

@media (max-width: 480px) {
  body.woocommerce-cart .woocommerce-message .button,
  body.woocommerce-cart .woocommerce-info .button,
  body.woocommerce-checkout .woocommerce-message .button,
  body.woocommerce-checkout .woocommerce-info .button {
    margin-left: 0 !important;
  }
}
