/* SEOX Sales-Chatbot — site-wide widget (FAB + panel).
   Self-contained, namespaced `.sx-chat*`. Light default, dark via
   html[data-theme="dark"]. Brand magenta #d4238a. */

.sx-chat-fab,
.sx-chat-panel { box-sizing: border-box; }
.sx-chat-panel *, .sx-chat-fab * { box-sizing: border-box; }

/* ── FAB ─────────────────────────────────────────────────── */
.sx-chat-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9500;
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: linear-gradient(135deg, #d4238a 0%, #a51b6c 100%);
  box-shadow: 0 10px 30px rgba(212, 35, 138, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(.22,1,.36,1), box-shadow 0.25s ease;
}
.sx-chat-fab:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 14px 38px rgba(212, 35, 138, 0.5); }
.sx-chat-fab:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.sx-chat-fab svg { width: 28px; height: 28px; stroke: #fff; fill: none; }
.sx-chat-fab .sx-fab-close { display: none; }
.sx-chat-fab.is-open .sx-fab-open { display: none; }
.sx-chat-fab.is-open .sx-fab-close { display: block; }

/* attention pulse */
.sx-chat-fab::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(212, 35, 138, 0.45);
  animation: sxPulse 2.6s infinite;
}
.sx-chat-fab.is-open::after { animation: none; }
@keyframes sxPulse {
  0% { box-shadow: 0 0 0 0 rgba(212, 35, 138, 0.45); }
  70% { box-shadow: 0 0 0 16px rgba(212, 35, 138, 0); }
  100% { box-shadow: 0 0 0 0 rgba(212, 35, 138, 0); }
}

/* hint bubble */
.sx-chat-hint {
  position: fixed;
  right: 96px;
  bottom: 34px;
  z-index: 9499;
  max-width: 230px;
  background: #fff;
  color: #14142b;
  font: 600 13.5px/1.45 "Inter", system-ui, sans-serif;
  padding: 12px 16px;
  border-radius: 14px 14px 4px 14px;
  box-shadow: 0 12px 34px rgba(20,20,43,0.18);
  opacity: 0; transform: translateY(8px) scale(.96);
  transition: opacity .35s ease, transform .35s ease;
  pointer-events: none;
}
.sx-chat-hint.is-visible { opacity: 1; transform: translateY(0) scale(1); }

/* ── Panel ───────────────────────────────────────────────── */
.sx-chat-panel {
  position: fixed;
  right: 24px;
  bottom: 96px;
  z-index: 11050;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(20,20,43,0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0; transform: translateY(16px) scale(.98);
  pointer-events: none;
  visibility: hidden;
  transition: opacity .3s cubic-bezier(.22,1,.36,1), transform .3s cubic-bezier(.22,1,.36,1), visibility 0s linear .3s;
  font-family: "Inter", system-ui, sans-serif;
}
.sx-chat-panel.is-open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; visibility: visible; transition: opacity .3s cubic-bezier(.22,1,.36,1), transform .3s cubic-bezier(.22,1,.36,1), visibility 0s; }

.sx-chat-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #d4238a 0%, #a51b6c 100%);
  color: #fff; flex-shrink: 0;
}
.sx-chat-head-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sx-chat-head-avatar svg { width: 22px; height: 22px; stroke: #fff; fill: none; }
.sx-chat-head-info h4 { margin: 0; font: 700 15px/1.2 "Plus Jakarta Sans", sans-serif; }
.sx-chat-head-info p { margin: 2px 0 0; font-size: 12px; opacity: .9; display: flex; align-items: center; gap: 6px; }
.sx-chat-head-info p::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #4ade80; }

.sx-chat-msgs {
  flex: 1; overflow-y: auto;
  padding: 18px 16px;
  display: flex; flex-direction: column; gap: 12px;
  background: #f7f7fa;
  scroll-behavior: smooth;
}
.sx-msg { max-width: 85%; font-size: 14px; line-height: 1.5; padding: 11px 14px; border-radius: 14px; word-wrap: break-word; animation: sxFade .3s ease; }
@keyframes sxFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.sx-msg.bot { align-self: flex-start; background: #fff; color: #14142b; border: 1px solid #ececf1; border-bottom-left-radius: 4px; }
.sx-msg.user { align-self: flex-end; background: linear-gradient(135deg, #d4238a, #a51b6c); color: #fff; border-bottom-right-radius: 4px; }
.sx-msg strong { font-weight: 700; }
.sx-msg.typing { display: inline-flex; gap: 4px; align-items: center; }
.sx-msg.typing span { width: 7px; height: 7px; border-radius: 50%; background: #c7c7d1; animation: sxBlink 1.2s infinite; }
.sx-msg.typing span:nth-child(2) { animation-delay: .2s; }
.sx-msg.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes sxBlink { 0%,60%,100% { opacity: .3; } 30% { opacity: 1; } }

/* quick replies */
.sx-quick { display: flex; flex-wrap: wrap; gap: 8px; align-self: flex-start; max-width: 100%; }
.sx-quick button {
  font: 600 13px/1.2 "Inter", sans-serif;
  background: #fff; color: #d4238a;
  border: 1.5px solid #d4238a;
  border-radius: 999px; padding: 9px 14px; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.sx-quick button:hover { background: #d4238a; color: #fff; }

/* recommendation cards */
.sx-recs { display: flex; flex-direction: column; gap: 8px; align-self: stretch; }
.sx-rec {
  display: block; text-decoration: none;
  background: #fff; border: 1px solid #ececf1; border-radius: 12px;
  padding: 12px 14px; transition: border-color .15s ease, transform .15s ease;
}
.sx-rec:hover { border-color: #d4238a; transform: translateX(2px); }
.sx-rec-title { font: 700 14px/1.3 "Plus Jakarta Sans", sans-serif; color: #14142b; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.sx-rec-price { font-size: 12.5px; font-weight: 700; color: #d4238a; white-space: nowrap; }
.sx-rec-desc { font-size: 12.5px; line-height: 1.45; color: #5a5a6e; margin: 4px 0 0; }

/* CTA */
.sx-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  align-self: stretch; text-decoration: none; text-align: center;
  background: linear-gradient(135deg, #d4238a, #a51b6c); color: #fff;
  font: 700 14px/1.2 "Plus Jakarta Sans", sans-serif;
  padding: 13px 16px; border-radius: 12px;
  box-shadow: 0 8px 22px rgba(212,35,138,0.3);
  transition: transform .15s ease;
}
.sx-cta:hover { transform: translateY(-2px); }
.sx-cta svg { width: 15px; height: 15px; stroke: #fff; fill: none; }

/* input */
.sx-chat-input {
  display: flex; gap: 8px; align-items: center;
  padding: 12px; border-top: 1px solid #ececf1; background: #fff; flex-shrink: 0;
}
.sx-chat-input input {
  flex: 1; border: 1px solid #d7d7df; border-radius: 999px;
  padding: 11px 15px; font: 400 14px/1.2 "Inter", sans-serif; color: #14142b;
  outline: none; transition: border-color .15s ease;
}
.sx-chat-input input:focus { border-color: #d4238a; }
.sx-chat-input input:disabled { background: #f2f2f5; cursor: not-allowed; }
.sx-chat-send {
  width: 42px; height: 42px; flex-shrink: 0; border: none; border-radius: 50%;
  background: #d4238a; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s ease;
}
.sx-chat-send:hover { background: #a51b6c; }
.sx-chat-send:disabled { background: #c7c7d1; cursor: not-allowed; }
.sx-chat-send svg { width: 18px; height: 18px; stroke: #fff; fill: none; }
.sx-chat-foot { font-size: 10.5px; color: #9a9aae; text-align: center; padding: 0 12px 8px; background: #fff; }

/* ── Dark mode ───────────────────────────────────────────── */
html[data-theme="dark"] .sx-chat-hint { background: #1c1b22; color: #ededf2; box-shadow: 0 12px 34px rgba(0,0,0,0.5); }
html[data-theme="dark"] .sx-chat-panel { background: #131218; box-shadow: 0 24px 70px rgba(0,0,0,0.6); }
html[data-theme="dark"] .sx-chat-msgs { background: #0e0d12; }
html[data-theme="dark"] .sx-msg.bot { background: rgba(255,255,255,0.04); color: #ededf2; border-color: rgba(255,255,255,0.08); }
html[data-theme="dark"] .sx-quick button { background: rgba(212,35,138,0.12); }
html[data-theme="dark"] .sx-rec { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.08); }
html[data-theme="dark"] .sx-rec-title { color: #ededf2; }
html[data-theme="dark"] .sx-rec-desc { color: #a6a6b5; }
html[data-theme="dark"] .sx-chat-input { background: #131218; border-color: rgba(255,255,255,0.08); }
html[data-theme="dark"] .sx-chat-input input { background: rgba(255,255,255,0.05); color: #ededf2; border-color: rgba(255,255,255,0.12); }
html[data-theme="dark"] .sx-chat-input input:disabled { background: rgba(255,255,255,0.02); }
html[data-theme="dark"] .sx-chat-foot { background: #131218; color: #6b6b7b; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 480px) {
  .sx-chat-panel { right: 12px; left: 12px; width: auto; bottom: 88px; height: auto; max-height: calc(100vh - 104px); }
  .sx-chat-hint { display: none; }
  .sx-chat-fab { right: 16px; bottom: 16px; }
}
/* lift FAB above the consent banner while it is visible (mobile) */
@media (max-width: 768px) {
  body.sx-consent-open .sx-chat-fab { bottom: 150px; }
  body.sx-consent-open .sx-chat-panel { bottom: 218px; }
}

@media (prefers-reduced-motion: reduce) {
  .sx-chat-fab, .sx-chat-panel, .sx-msg, .sx-chat-hint, .sx-cta, .sx-rec { transition: none; animation: none; }
  .sx-chat-fab::after { animation: none; }
}
