/* =====================================================================
   MutantFitt · Asistente de la tienda (widget). Negro, blanco y grises; aislado con el prefijo .mfa y variables propias:
   no cambia ningún estilo de la tienda. Sin estilos en línea (CSP).
   ===================================================================== */
.mfa {
  --mfa-bg: #0a0a0a; --mfa-panel: #0f0f0f; --mfa-surface: #181818; --mfa-surface-2: #222222; --mfa-line: #2a2a2a;
  --mfa-text: #ffffff; --mfa-muted: #a8a8a8; --mfa-faint: #7a7a7a; --mfa-ok: #9be2a8; --mfa-warn: #f0c36a; --mfa-err: #ff9d97;
  --mfa-radius: 14px; --mfa-font: "Archivo", "Helvetica Neue", Arial, sans-serif;
  position: fixed; right: 16px; bottom: 16px; z-index: 70; font-family: var(--mfa-font); color: var(--mfa-text);
  -webkit-font-smoothing: antialiased; font-size: 15px; line-height: 1.45;
}
.mfa *, .mfa *::before, .mfa *::after { box-sizing: border-box; }
:where(.mfa) button, :where(.mfa) textarea { font: inherit; color: inherit; }
:where(.mfa) a { color: inherit; }
.mfa :focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }
/* En las páginas de cuenta y soporte la web tiene estilos globales de títulos: el widget usa siempre su propia letra */
.mfa h2, .mfa h3, .mfa p, .mfa input, .mfa label { font-family: var(--mfa-font); text-transform: none; }
.mfa h2, .mfa h3 { line-height: 1.2; }
.mfa-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* El asistente nuevo sustituye al botón «Ayuda» que llevaba al chat anterior */
.mf-has-assistant .mf-help { display: none !important; }
/* No tapa la barra de compra del móvil ni el cajón del carrito */
body:has(.mf-sticky-buy:not([hidden])) .mfa { bottom: 76px; }
body.mf-noscroll .mfa:not(.is-open) { display: none; }

/* ---------- botón flotante ---------- */
.mfa-launch { display: inline-flex; align-items: center; gap: 10px; height: 52px; padding: 0 18px 0 16px; border-radius: 999px; cursor: pointer;
  background: var(--mfa-bg); border: 1px solid #3a3a3a; box-shadow: 0 12px 32px rgba(0, 0, 0, .35); transition: border-color .2s, transform .2s; }
.mfa-launch:hover { border-color: #ffffff; transform: translateY(-1px); }
.mfa-launch-logo { height: 22px; width: auto; display: block; }
.mfa-launch-text { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.mfa.is-open .mfa-launch { display: none; }

/* ---------- panel ---------- */
.mfa-panel { position: fixed; right: 16px; bottom: 16px; width: min(400px, calc(100vw - 32px)); height: min(640px, calc(100dvh - 32px));
  display: flex; flex-direction: column; background: var(--mfa-panel); border: 1px solid var(--mfa-line); border-radius: var(--mfa-radius);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55); overflow: hidden; animation: mfa-in .18s ease-out; }
.mfa-panel[hidden] { display: none; }
@keyframes mfa-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.mfa-head { display: flex; align-items: center; gap: 10px; padding: 12px 10px 12px 16px; border-bottom: 1px solid var(--mfa-line); background: var(--mfa-bg); }
.mfa-logo { height: 26px; width: auto; flex: none; }
.mfa-id { min-width: 0; flex: 1; }
.mfa-title { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: -.005em; line-height: 1.15; overflow-wrap: break-word; }
.mfa-sub { margin: 2px 0 0; font-size: 12px; line-height: 1.25; color: var(--mfa-muted); }
.mfa-langs { display: inline-flex; border: 1px solid var(--mfa-line); border-radius: 999px; padding: 2px; flex: none; }
.mfa-lang { min-width: 36px; height: 30px; padding: 0 8px; border: 0; border-radius: 999px; background: none; color: var(--mfa-muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; cursor: pointer; }
.mfa-lang[aria-pressed="true"] { background: #ffffff; color: #0a0a0a; }
.mfa-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 0; border-radius: 10px; background: none; cursor: pointer; color: var(--mfa-muted); }
.mfa-icon:hover { background: var(--mfa-surface); color: #ffffff; }

/* ---------- conversación ---------- */
.mfa-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; scroll-behavior: smooth; }
.mfa-welcome { padding: 4px 2px 6px; }
.mfa-welcome h3 { margin: 0 0 6px; font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.mfa-welcome p { margin: 0; color: var(--mfa-muted); }
.mfa-row { display: flex; }
.mfa-row.is-user { justify-content: flex-end; }
.mfa-bubble { max-width: 100%; border-radius: 12px; padding: 10px 12px; }
.mfa-bubble p { margin: 0; }
.mfa-bubble p + p { margin-top: 8px; }
.mfa-bubble.is-user { max-width: 85%; background: #ffffff; color: #0a0a0a; border-bottom-right-radius: 4px; }
.mfa-bubble.is-bot { width: 100%; background: var(--mfa-surface); border: 1px solid var(--mfa-line); border-bottom-left-radius: 4px; display: flex; flex-direction: column; gap: 10px; }
.mfa-bubble.is-error { border-color: #5a2a28; }
.mfa-bubble.is-error p { color: var(--mfa-err); }
.mfa-text { white-space: normal; overflow-wrap: anywhere; }
.mfa-note { margin: 0; font-size: 12px; color: var(--mfa-warn); }
.mfa-system { margin: 0; text-align: center; font-size: 12px; color: var(--mfa-faint); }
.mfa-retry { align-self: flex-start; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid #ffffff; background: #ffffff; color: #0a0a0a; font-size: 13px; font-weight: 700; cursor: pointer; }
.mfa-loading-text { color: var(--mfa-muted); font-size: 13px; }
.mfa-bubble.is-loading { flex-direction: row; align-items: center; gap: 10px; }
.mfa-dots { display: inline-flex; gap: 4px; }
.mfa-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--mfa-muted); animation: mfa-dot 1s infinite ease-in-out; }
.mfa-dots i:nth-child(2) { animation-delay: .15s; } .mfa-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes mfa-dot { 0%, 80%, 100% { opacity: .25; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }

/* ---------- tarjetas de producto ---------- */
.mfa-cards { display: grid; grid-template-columns: 1fr; gap: 8px; }
.mfa-card { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; padding: 8px; border: 1px solid var(--mfa-line); border-radius: 10px; background: var(--mfa-panel); }
.mfa-card-media { display: block; aspect-ratio: 4 / 5; border-radius: 8px; overflow: hidden; background: #ececec; }
.mfa-card-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mfa-card-media.is-empty { background: repeating-linear-gradient(135deg, #e4e4e4 0 10px, #ededed 10px 20px); }
.mfa-card-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mfa-card-title { font-weight: 700; font-size: 14px; line-height: 1.25; text-decoration: none; }
.mfa-card-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.mfa-card-price { margin: 0; font-size: 14px; } .mfa-card-price span { color: var(--mfa-muted); } .mfa-card-price s { color: var(--mfa-faint); }
.mfa-card-status { margin: 0; font-size: 12px; font-weight: 600; }
.mfa-card-status.is-available { color: var(--mfa-ok); } .mfa-card-status.is-soldout { color: var(--mfa-muted); } .mfa-card-status.is-backorder { color: var(--mfa-warn); }
.mfa-card-sizes { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.mfa-card-sizes li { min-width: 26px; padding: 1px 6px; border: 1px solid #3a3a3a; border-radius: 6px; font-size: 11px; text-align: center; }
.mfa-card-sizes li.is-out { color: var(--mfa-faint); text-decoration: line-through; border-style: dashed; }
.mfa-card-colors { margin: 0; font-size: 12px; color: var(--mfa-muted); }
.mfa-card-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; text-decoration: none; }
.mfa-card-link svg { width: 14px; height: 14px; }

/* ---------- enlaces y accesos rápidos ---------- */
.mfa-links { display: flex; flex-wrap: wrap; gap: 6px; }
.mfa-link { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 1px solid #3a3a3a; border-radius: 999px; font-size: 13px; font-weight: 600; text-decoration: none; }
.mfa-link:hover { border-color: #ffffff; } .mfa-link svg { width: 14px; height: 14px; }
/* Los accesos rápidos se acomodan en varias líneas: ninguno queda cortado ni escondido detrás de un desplazamiento */
.mfa-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px 0; flex: none; }
.mfa-chip { flex: 0 1 auto; max-width: 100%; min-height: 32px; padding: 5px 12px; border: 1px solid var(--mfa-line); border-radius: 999px; background: var(--mfa-surface);
  font-size: 12.5px; line-height: 1.2; text-align: center; cursor: pointer; white-space: normal; overflow-wrap: anywhere; }
.mfa-chip:hover { border-color: #ffffff; }

/* ---------- campo de texto ---------- */
.mfa-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 8px 16px; flex: none; }
.mfa-input { flex: 1; min-height: 44px; max-height: 120px; resize: none; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--mfa-line); background: var(--mfa-surface); line-height: 1.4; }
.mfa-input::placeholder { color: var(--mfa-faint); }
.mfa-input:focus { outline: none; border-color: #ffffff; }
.mfa-send { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 0; border-radius: 12px; background: #ffffff; color: #0a0a0a; cursor: pointer; }
.mfa-send:disabled { opacity: .5; cursor: default; }
.mfa-foot { display: flex; align-items: center; gap: 10px; margin: 0; padding: 0 12px 10px 16px; font-size: 11px; line-height: 1.35; color: var(--mfa-faint); flex: none; }
.mfa-foot-note { flex: 1; min-width: 0; }
.mfa-foot-btn { flex: none; min-height: 30px; max-width: 46%; padding: 4px 10px; border: 1px solid var(--mfa-line); border-radius: 999px; background: none; color: var(--mfa-muted);
  font-size: 11px; line-height: 1.2; text-align: center; cursor: pointer; }
.mfa-foot-btn:hover { color: #ffffff; border-color: #ffffff; }

/* ---------- preferencias y privacidad ---------- */
.mfa-prefs { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 12px; }
.mfa-prefs p { margin: 0; color: var(--mfa-muted); font-size: 13.5px; }
.mfa-prefs-title { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.mfa-prefs-title:focus { outline: none; }
.mfa-prefs .mfa-prefs-stored { color: var(--mfa-text); }
.mfa-prefs .mfa-prefs-status { color: var(--mfa-ok); min-height: 1.2em; }
.mfa-switch { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--mfa-line); border-radius: 12px; background: var(--mfa-surface); cursor: pointer; font-weight: 700; }
.mfa-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.mfa-switch-ui { position: relative; flex: none; width: 42px; height: 24px; border-radius: 999px; background: #3a3a3a; transition: background .2s; }
.mfa-switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #ffffff; transition: transform .2s; }
.mfa-switch input:checked + .mfa-switch-ui { background: #ffffff; }
.mfa-switch input:checked + .mfa-switch-ui::after { transform: translateX(18px); background: #0a0a0a; }
.mfa-switch input:focus-visible + .mfa-switch-ui { outline: 2px solid #ffffff; outline-offset: 3px; }
.mfa-switch input:disabled + .mfa-switch-ui { opacity: .5; }
.mfa-prefs-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.mfa-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid #3a3a3a; background: none; font-size: 13px; font-weight: 700; cursor: pointer; }
.mfa-btn:hover { border-color: #ffffff; }
.mfa-btn.is-primary { background: #ffffff; border-color: #ffffff; color: #0a0a0a; }
.mfa-btn svg { width: 16px; height: 16px; }
.mfa [hidden] { display: none !important; }

/* ---------- móvil: pantalla completa ---------- */
@media (max-width: 600px) {
  .mfa { right: 12px; bottom: 12px; }
  .mfa-launch { height: 48px; padding: 0 14px; }
  .mfa-launch-text { display: none; }
  .mfa-panel { inset: 0; right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; border: 0;
    padding-bottom: env(safe-area-inset-bottom); padding-top: env(safe-area-inset-top); }
  .mfa-icon, .mfa-lang { min-height: 44px; } .mfa-icon { width: 44px; height: 44px; }
  .mfa-input { font-size: 16px; }   /* evita el zoom automático de iOS */
  .mfa-chip { min-height: 36px; font-size: 13px; }
  .mfa-foot-btn { min-height: 36px; }
  .mfa-head { gap: 6px; padding-left: 12px; }
}
/* Pantallas muy estrechas: sin el logo en la cabecera, el título y el subtítulo caben sin partir palabras */
@media (max-width: 380px) {
  .mfa-logo { display: none; }
  .mfa-sub { font-size: 11px; }
}
html.mfa-lock, html.mfa-lock body { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .mfa-panel, .mfa-dots i { animation: none; } .mfa-launch, .mfa-log, .mfa-switch-ui, .mfa-switch-ui::after { transition: none; scroll-behavior: auto; }
}
@media print { .mfa { display: none; } }
