/* Asistente IA – Sexshop.Express */
.eac {
  --eac-color: #E6195A;
  --eac-ink: #1d1a22;
  --eac-muted: #6f6a78;
  --eac-bg: #ffffff;
  --eac-soft: #f5f3f7;
  --eac-line: #ebe8ef;
  --eac-radius: 20px;
  position: fixed;
  bottom: 20px;
  z-index: 2147483000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--eac-ink);
  -webkit-font-smoothing: antialiased;
}
.eac { --eac-css: 3; }
.eac--right { right: 20px; }
.eac--left { left: 20px; }
.eac *, .eac *::before, .eac *::after { box-sizing: border-box; }
.eac [hidden] { display: none !important; }
.eac button { font: inherit; -webkit-appearance: none; appearance: none; margin: 0; border: 0; text-transform: none; letter-spacing: normal; line-height: 1.35; }

/* ---- botón flotante ---- */
.eac-launcher {
  position: relative;
  width: 64px;
  height: 64px;
  padding: 2px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--eac-color), #7a0d3c);
  box-shadow: 0 10px 28px rgba(122, 13, 60, .35), 0 2px 6px rgba(0, 0, 0, .15);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}
.eac-launcher:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 14px 34px rgba(122, 13, 60, .45); }
.eac-launcher:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 6px var(--eac-color); }
.eac-launcher__img { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; display: block; border: 2px solid #fff; }
.eac-launcher__dot { position: absolute; right: 3px; bottom: 3px; width: 14px; height: 14px; border-radius: 50%; background: #22c55e; border: 2px solid #fff; }
.eac-launcher__badge {
  position: absolute; top: -2px; right: -2px; display: none;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: #fff; color: var(--eac-color); font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}
.eac-launcher.has-badge .eac-launcher__badge { display: block; }
.eac-launcher.has-badge { animation: eac-pulse 2.2s ease-out 3; }
@keyframes eac-pulse { 0% { box-shadow: 0 0 0 0 rgba(230, 25, 90, .55); } 70% { box-shadow: 0 0 0 16px rgba(230, 25, 90, 0); } 100% { box-shadow: 0 0 0 0 rgba(230, 25, 90, 0); } }
.eac.is-open .eac-launcher { display: none; }

/* ---- invitación / volver al chat ---- */
.eac .eac-teaser {
  position: absolute; bottom: 76px; display: flex; align-items: center; gap: 6px;
  max-width: none; padding: 0; border-radius: 0; background: transparent; box-shadow: none;
  white-space: normal; animation: eac-in .35s ease;
}
.eac--right .eac-teaser { right: 4px; flex-direction: row-reverse; }
.eac--left .eac-teaser { left: 4px; }
.eac .eac-teaser__open {
  max-width: 250px; width: max-content; padding: 10px 14px; border: 0; border-radius: 16px 16px 4px 16px;
  background: #fff; color: var(--eac-ink); box-shadow: 0 10px 30px rgba(0, 0, 0, .16);
  font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; white-space: normal;
}
.eac--left .eac-teaser__open { border-radius: 16px 16px 16px 4px; }
.eac .eac-teaser.is-resume .eac-teaser__open { background: linear-gradient(135deg, var(--eac-color), #8e1048); color: #fff; box-shadow: 0 10px 26px rgba(142, 16, 72, .35); }
.eac .eac-teaser__x {
  flex: 0 0 26px; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%;
  background: #fff; color: #555; font-size: 16px; line-height: 24px; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}

/* ---- panel ---- */
.eac-panel {
  position: absolute; bottom: 0; width: 390px; height: min(640px, calc(100vh - 40px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--eac-bg); border-radius: var(--eac-radius);
  box-shadow: 0 24px 60px rgba(28, 10, 30, .28), 0 2px 10px rgba(0, 0, 0, .08);
  animation: eac-in .28s cubic-bezier(.2, .9, .3, 1.2);
}
.eac--right .eac-panel { right: 0; transform-origin: bottom right; }
.eac--left .eac-panel { left: 0; transform-origin: bottom left; }
@keyframes eac-in { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }

.eac-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px;
  background: linear-gradient(135deg, var(--eac-color) 0%, #8e1048 100%); color: #fff;
}
.eac-head__avatar { position: relative; flex: 0 0 44px; }
.eac-head__avatar img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255, 255, 255, .85); display: block; }
.eac-online { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; border-radius: 50%; background: #22c55e; border: 2px solid #fff; }
.eac-head__info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.eac-head__name { font-size: 16px; font-weight: 700; letter-spacing: .1px; }
.eac-head__sub { font-size: 12.5px; opacity: .88; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eac-head__actions { display: flex; gap: 4px; }
.eac-icon {
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 10px; background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer; text-decoration: none;
  transition: background .15s;
}
.eac-icon:hover, .eac-icon:focus-visible { background: rgba(255, 255, 255, .28); color: #fff; outline: none; }
.eac-icon svg { width: 18px; height: 18px; }

/* ---- conversación ---- */
.eac-log {
  flex: 1; overflow-y: auto; padding: 16px 14px 8px; background: var(--eac-soft);
  scroll-behavior: smooth; overscroll-behavior: contain;
}
.eac-msg { display: flex; align-items: flex-end; gap: 8px; margin: 0 0 10px; animation: eac-msg .22s ease; }
@keyframes eac-msg { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.eac-msg--user { justify-content: flex-end; }
.eac-msg__avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: 0 0 28px; }
.eac-bubble {
  max-width: 82%; padding: 10px 13px; border-radius: 18px; background: #fff; color: var(--eac-ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06); overflow-wrap: anywhere;
}
.eac-msg--bot .eac-bubble { border-bottom-left-radius: 6px; }
.eac-msg--user .eac-bubble { background: var(--eac-color); color: #fff; border-bottom-right-radius: 6px; white-space: pre-wrap; }
.eac-bubble p { margin: 0 0 6px; }
.eac-bubble p:last-child { margin-bottom: 0; }
.eac-bubble ul { margin: 4px 0 6px; padding-left: 18px; }
.eac-bubble li { margin: 2px 0; }
.eac-bubble a { color: var(--eac-color); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.eac-bubble strong { font-weight: 700; }

.eac-typing .eac-bubble { display: inline-flex; gap: 4px; padding: 13px 14px; }
.eac-typing .eac-bubble span { width: 7px; height: 7px; border-radius: 50%; background: #b9b3c2; animation: eac-dot 1.2s infinite ease-in-out; }
.eac-typing .eac-bubble span:nth-child(2) { animation-delay: .15s; }
.eac-typing .eac-bubble span:nth-child(3) { animation-delay: .3s; }
@keyframes eac-dot { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-5px); opacity: 1; } }

/* ---- persona real ---- */
.eac-banner { padding: 8px 14px; background: #fff7e6; color: #8a5a00; font-size: 12.5px; font-weight: 600; border-bottom: 1px solid #f5e1b8; }
.eac-msg--agent .eac-bubble { background: #eef6ff; border: 1px solid #d6e8ff; }
.eac-agent-label { display: block; margin-bottom: 3px; font-size: 11px; font-weight: 700; color: #1d5fbf; }
.eac-msg__avatar--agent { display: inline-flex; align-items: center; justify-content: center; background: #d6e8ff; font-size: 15px; }

/* ---- tarjetas de producto ---- */
.eac-cards-wrap { margin: 0 -14px 12px; }
.eac-cards {
  display: flex; gap: 10px; overflow-x: auto; padding: 2px 14px 8px 50px;
  scroll-snap-type: x mandatory; scrollbar-width: thin;
}
.eac-card {
  flex: 0 0 168px; scroll-snap-align: start; display: flex; flex-direction: column;
  background: #fff; border-radius: 16px; padding: 8px; box-shadow: 0 2px 10px rgba(30, 10, 40, .08);
  border: 1px solid var(--eac-line);
}
.eac-card__img { display: block; border-radius: 12px; overflow: hidden; background: #fafafa; aspect-ratio: 1 / 1; }
.eac-card__img img { width: 100%; height: 100%; object-fit: contain; display: block; transition: transform .25s; }
.eac-card:hover .eac-card__img img { transform: scale(1.04); }
.eac-card__noimg { width: 100%; height: 100%; background: linear-gradient(135deg, #fde7ef, #f3e8ff); }
.eac-card__brand { margin-top: 8px; font-size: 11px; font-weight: 700; color: var(--eac-muted); text-transform: uppercase; letter-spacing: .5px; }
.eac-card__name {
  margin-top: 2px; font-size: 13.5px; font-weight: 600; line-height: 1.3; color: var(--eac-ink); text-decoration: none;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 35px;
}
.eac-card__name:hover { color: var(--eac-color); }
.eac-card__price { margin-top: 6px; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.eac-card__now { font-size: 16px; font-weight: 800; color: var(--eac-color); }
.eac-card__old { font-size: 12px; color: var(--eac-muted); }
.eac-card__actions { margin-top: 8px; display: flex; gap: 6px; }
.eac-card__btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; height: 34px; padding: 0 8px;
  border: 0; border-radius: 10px; background: var(--eac-color); color: #fff; font-size: 13px; font-weight: 700;
  text-decoration: none; cursor: pointer; transition: filter .15s, transform .1s;
}
.eac-card__btn:hover { filter: brightness(1.08); color: #fff; }
.eac-card__btn:active { transform: scale(.97); }
.eac-card__btn--ghost { background: var(--eac-soft); color: var(--eac-ink); }
.eac-card__btn--ghost:hover { color: var(--eac-ink); filter: brightness(.96); }
.eac-card__btn.is-done { background: #16a34a; }
.eac-card__btn:disabled { opacity: .85; cursor: default; }
.eac-card__out { flex: 1; text-align: center; font-size: 12px; color: var(--eac-muted); line-height: 34px; }

/* ---- respuestas rápidas ---- */
.eac-chips { display: flex; gap: 6px; padding: 8px 12px 2px; overflow-x: auto; background: var(--eac-soft); scrollbar-width: none; }
.eac-chips::-webkit-scrollbar { display: none; }
.eac-chip {
  flex: 0 0 auto; padding: 7px 12px; border: 1.5px solid var(--eac-color); border-radius: 999px;
  background: #fff; color: var(--eac-color); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s;
}
.eac-chip:hover, .eac-chip:focus-visible { background: var(--eac-color); color: #fff; outline: none; }

/* ---- escribir ---- */
.eac-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--eac-line); background: #fff; }
.eac-input {
  flex: 1; resize: none; min-height: 42px; max-height: 120px; padding: 10px 14px;
  border: 1.5px solid var(--eac-line); border-radius: 21px; background: var(--eac-soft);
  font: inherit; font-size: 15px; line-height: 1.35; color: var(--eac-ink); outline: none; transition: border-color .15s, background .15s;
}
.eac-input:focus { border-color: var(--eac-color); background: #fff; }
.eac-send {
  flex: 0 0 42px; width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: var(--eac-color); color: #fff; cursor: pointer; transition: transform .1s, opacity .15s;
}
.eac-send:hover { filter: brightness(1.08); }
.eac-send:active { transform: scale(.94); }
.eac-send:disabled { opacity: .5; cursor: default; }
.eac-send svg { width: 20px; height: 20px; }
.eac-notice { padding: 0 14px 10px; background: #fff; font-size: 11px; color: var(--eac-muted); text-align: center; }
.eac-notice a { color: var(--eac-muted); text-decoration: underline; }

/* ---- móvil: pantalla completa ---- */
@media (max-width: 640px) {
  .eac { bottom: 14px; }
  .eac--right { right: 14px; }
  .eac--left { left: 14px; }
  .eac-launcher { width: 58px; height: 58px; }
  .eac-launcher__img { width: 54px; height: 54px; }
  .eac.is-open { inset: 0; bottom: 0; }
  .eac-panel { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; animation: none; }
  .eac-head { padding-top: max(14px, env(safe-area-inset-top)); }
  .eac-notice { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .eac-input { font-size: 16px; } /* evita el zoom de iOS */
  .eac-teaser { bottom: 68px; }
  .eac-teaser__open { max-width: calc(100vw - 90px); }
}

@media (prefers-reduced-motion: reduce) {
  .eac *, .eac *::before, .eac *::after { animation: none !important; transition: none !important; }
}

@media print { .eac { display: none !important; } }
