/* MAXX chat widget — usa las CSS variables de tienda_publica.css */

#maxx-fab {
  position: fixed;
  bottom: 96px;
  right: 28px;
  z-index: 91;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--accent, #E8622C);
  color: #fff;
  border: 0;
  padding: 12px 18px 12px 14px;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(232, 98, 44, 0.35);
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}
#maxx-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 40px rgba(232, 98, 44, 0.45);
}
#maxx-fab.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}
.maxx-fab-pulse {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--accent, #E8622C);
  opacity: 0.4;
  animation: maxxFabPulse 2s infinite;
  z-index: -1;
}
@keyframes maxxFabPulse {
  0% { transform: scale(1); opacity: 0.4; }
  100% { transform: scale(1.3); opacity: 0; }
}

#maxx-panel {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 92;
  width: 360px;
  max-width: calc(100vw - 24px);
  height: 540px;
  max-height: calc(100vh - 60px);
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e8e1d5);
  border-radius: 18px;
  box-shadow: 0 30px 60px -20px rgba(25, 22, 19, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s, opacity 0.22s;
  font-family: var(--font-sans, system-ui, sans-serif);
}
#maxx-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.maxx-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--accent, #E8622C) 0%, var(--accent-ink, #B4431A) 100%);
  color: #fff;
}
.maxx-head-info { display: flex; align-items: center; gap: 10px; }
.maxx-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display, 'Archivo Black', sans-serif);
  font-size: 16px;
  letter-spacing: -0.5px;
}
.maxx-name { font-weight: 700; font-size: 14px; line-height: 1.2; }
.maxx-sub { font-size: 11.5px; opacity: 0.85; line-height: 1.2; }
#maxx-close {
  background: rgba(255, 255, 255, 0.15);
  border: 0;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
#maxx-close:hover { background: rgba(255, 255, 255, 0.28); }

.maxx-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  background: var(--bg, #FAF7F2);
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
}
.maxx-msgs::-webkit-scrollbar { width: 6px; }
.maxx-msgs::-webkit-scrollbar-thumb { background: var(--line-2, #d9d1c2); border-radius: 3px; }

.maxx-msg { display: flex; }
.maxx-msg-user { justify-content: flex-end; }
.maxx-msg-bot { justify-content: flex-start; }

.maxx-bubble {
  max-width: 80%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink, #191613);
  word-wrap: break-word;
}
.maxx-msg-bot .maxx-bubble {
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e8e1d5);
  border-bottom-left-radius: 4px;
}
.maxx-msg-user .maxx-bubble {
  background: var(--accent, #E8622C);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.maxx-bubble a { color: inherit; text-decoration: underline; }
.maxx-bubble code {
  background: var(--bg-2, #f3eee6);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12.5px;
  font-family: ui-monospace, "Courier New", monospace;
}
.maxx-msg-user .maxx-bubble code {
  background: rgba(255, 255, 255, 0.2);
}

.maxx-typing {
  display: inline-flex;
  gap: 4px;
  padding: 12px 16px !important;
}
.maxx-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-4, #a59b8e);
  animation: maxxBlink 1.2s infinite;
}
.maxx-typing span:nth-child(2) { animation-delay: 0.15s; }
.maxx-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes maxxBlink {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.maxx-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface, #fff);
  border-top: 1px solid var(--line, #e8e1d5);
}
.maxx-form input {
  flex: 1;
  border: 1px solid var(--line, #e8e1d5);
  background: var(--bg, #faf7f2);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  color: var(--ink, #191613);
  transition: border-color 0.15s, background 0.15s;
}
.maxx-form input:focus {
  border-color: var(--accent, #E8622C);
  background: #fff;
}
.maxx-form button {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 0;
  background: var(--accent, #E8622C);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
}
.maxx-form button:hover { background: var(--accent-ink, #B4431A); }
.maxx-form button:active { transform: scale(0.92); }

.maxx-foot {
  padding: 6px 14px 10px;
  background: var(--surface, #fff);
  font-size: 11px;
  color: var(--ink-3, #6b6359);
  text-align: center;
}

@media (max-width: 480px) {
  #maxx-panel {
    width: calc(100vw - 16px);
    height: calc(100vh - 80px);
    bottom: 8px;
    right: 8px;
  }
  #maxx-fab { bottom: 84px; right: 16px; }
}

/* ─── Modal de captura de WhatsApp para recuperación de carrito ─── */

.maxx-cart-scrim {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(25, 22, 19, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  animation: maxxCartFadeIn 0.18s ease-out;
}
@keyframes maxxCartFadeIn { from { opacity: 0; } to { opacity: 1; } }

.maxx-cart-modal {
  background: var(--surface, #fff);
  border-radius: 18px;
  width: 100%;
  max-width: 420px;
  padding: 24px 22px 20px;
  position: relative;
  font-family: var(--font-sans, system-ui, sans-serif);
  box-shadow: 0 30px 60px -20px rgba(25, 22, 19, 0.4);
  animation: maxxCartSlideUp 0.22s ease-out;
}
@media (min-width: 640px) {
  .maxx-cart-scrim { align-items: center; }
}
@keyframes maxxCartSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.maxx-cart-modal-x {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: 0;
  color: var(--ink-3, #6b6359);
  font-size: 24px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
}
.maxx-cart-modal-x:hover { background: var(--bg-2, #f3eee6); }

.maxx-cart-modal-tag {
  display: inline-block;
  background: var(--accent-soft, #fde7da);
  color: var(--accent-ink, #b4431a);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.maxx-cart-modal-title {
  font-family: var(--font-display, 'Archivo Black', sans-serif);
  font-size: 22px;
  margin: 0 0 6px;
  color: var(--ink, #191613);
  line-height: 1.2;
}

.maxx-cart-modal-sub {
  font-size: 13.5px;
  color: var(--ink-2, #3a342e);
  margin: 0 0 16px;
  line-height: 1.45;
}

#maxx-cart-modal-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#maxx-cart-modal-form input {
  border: 1px solid var(--line, #e8e1d5);
  background: var(--bg, #faf7f2);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  color: var(--ink, #191613);
  transition: border-color 0.15s, background 0.15s;
}
#maxx-cart-modal-form input:focus {
  border-color: var(--accent, #e8622c);
  background: #fff;
}

.maxx-cart-modal-btn-primary {
  background: var(--accent, #e8622c);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.15s;
}
.maxx-cart-modal-btn-primary:hover { background: var(--accent-ink, #b4431a); }

.maxx-cart-modal-btn-soft {
  background: transparent;
  color: var(--ink-3, #6b6359);
  border: 0;
  padding: 8px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.maxx-cart-modal-btn-soft:hover { color: var(--ink, #191613); }

.maxx-cart-modal-foot {
  font-size: 11px;
  color: var(--ink-3, #6b6359);
  text-align: center;
  margin-top: 10px;
}

/* ─── Estrellas en cards de productos ─── */

.maxx-stars {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  margin: 4px 0 0;
}
.maxx-stars-glyphs {
  color: #f5a623;
  letter-spacing: 1px;
  line-height: 1;
}
.maxx-stars-count {
  color: var(--ink-3, #6b6359);
  font-size: 11px;
}

/* ─── Modal NPS: scores 0-10 ─── */

.maxx-nps-scores {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 4px;
  margin: 14px 0 4px;
}
.maxx-nps-score {
  border: 1px solid var(--line, #e8e1d5);
  background: var(--bg, #faf7f2);
  color: var(--ink-2, #3a342e);
  border-radius: 6px;
  padding: 8px 0;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.12s;
}
.maxx-nps-score:hover {
  border-color: var(--accent, #e8622c);
  color: var(--accent-ink, #b4431a);
}
.maxx-nps-score.selected {
  background: var(--accent, #e8622c);
  border-color: var(--accent, #e8622c);
  color: #fff;
  transform: scale(1.05);
}
.maxx-nps-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-3, #6b6359);
  margin-bottom: 12px;
}

#maxx-nps-modal textarea,
#maxx-review-modal textarea,
#maxx-review-modal input {
  border: 1px solid var(--line, #e8e1d5);
  background: var(--bg, #faf7f2);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  color: var(--ink, #191613);
  margin-bottom: 8px;
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
}
#maxx-nps-modal textarea:focus,
#maxx-review-modal textarea:focus,
#maxx-review-modal input:focus {
  border-color: var(--accent, #e8622c);
  background: #fff;
}

/* ─── Modal Review: estrellas grandes ─── */

.maxx-review-stars {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 14px 0;
}
.maxx-review-star {
  background: transparent;
  border: 0;
  font-size: 36px;
  color: var(--line-2, #d9d1c2);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.12s, transform 0.12s;
}
.maxx-review-star:hover { transform: scale(1.15); color: #f5a623; }
.maxx-review-star.selected { color: #f5a623; }

/* ─── PWA install toast ─── */

.maxx-pwa-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 95;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e8e1d5);
  border-radius: 14px;
  box-shadow: 0 20px 45px -10px rgba(25, 22, 19, 0.3);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-sans, system-ui, sans-serif);
  max-width: calc(100vw - 32px);
  width: 420px;
  animation: maxxPwaSlideIn 0.25s ease-out;
}
@keyframes maxxPwaSlideIn {
  from { transform: translate(-50%, 30px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}
.maxx-pwa-toast-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  background: var(--accent-soft, #fde7da);
  color: var(--accent-ink, #b4431a);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.maxx-pwa-toast-text {
  flex: 1;
  min-width: 0;
}
.maxx-pwa-toast-title {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--ink, #191613);
  margin-bottom: 2px;
}
.maxx-pwa-toast-sub {
  font-size: 12px;
  color: var(--ink-3, #6b6359);
  line-height: 1.35;
}
.maxx-pwa-toast-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.maxx-pwa-btn-primary {
  background: var(--accent, #e8622c);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.maxx-pwa-btn-primary:hover { background: var(--accent-ink, #b4431a); }
.maxx-pwa-btn-soft {
  background: transparent;
  color: var(--ink-3, #6b6359);
  border: 0;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.maxx-pwa-btn-soft:hover { color: var(--ink, #191613); }

@media (max-width: 480px) {
  .maxx-pwa-toast {
    bottom: 16px;
    width: calc(100vw - 24px);
    padding: 12px 14px;
  }
  .maxx-pwa-toast-sub { font-size: 11.5px; }
}
