/* ── Isolamento: reset defensivo contra temas WP ─────────────────────────── */
.lsc-root,
.lsc-root *,
.lsc-root *::before,
.lsc-root *::after {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}
.lsc-root button {
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  font-size: inherit;
  line-height: 1;
  margin: 0;
  cursor: pointer;
}
.lsc-root svg {
  display: block;
  overflow: visible;
}
.lsc-root input {
  font-family: inherit;
  font-size: inherit;
  line-height: normal;
  margin: 0;
}

/* ── Root ─────────────────────────────────────────────────────────────────── */
.lsc-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 99999;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  color: #111827;
}
.lsc-root[data-side="left"] { right: auto; left: 18px; }

/* ── Invite bubble ────────────────────────────────────────────────────────── */
.lsc-invite-wrap {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 230px;
  /* drop-shadow cobre o balão inteiro incluindo a seta */
  filter: drop-shadow(0 6px 18px rgba(0,0,0,.18));
  animation: lsc-invite-in .22s ease;
}
.lsc-root[data-side="left"] .lsc-invite-wrap { right: auto; left: 0; }
.lsc-invite-wrap[hidden] { display: none !important; animation: none; }

@keyframes lsc-invite-in {
  from { opacity: 0; transform: translateY(10px) scale(.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.lsc-invite-inner {
  position: relative;
  background: #fff;
  border-radius: 14px;
  padding: 14px 14px 12px;
}

/* Seta apontando para o botão toggle */
.lsc-invite-inner::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 18px;
  width: 16px;
  height: 16px;
  background: #fff;
  transform: rotate(45deg);
  border-radius: 0 0 3px 0;
}
.lsc-root[data-side="left"] .lsc-invite-inner::after { right: auto; left: 18px; border-radius: 0 0 0 3px; }

/* Barra de cor do tema no topo */
.lsc-invite-inner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--lsc-accent, #16a34a);
  border-radius: 14px 14px 0 0;
}

.lsc-invite-dismiss {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 0;
  background: transparent;
  color: #9ca3af;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color .12s, background .12s;
  line-height: 1;
}
.lsc-invite-dismiss:hover { color: #374151; background: #f3f4f6; }

.lsc-invite-msg {
  font-size: 14px;
  line-height: 1.45;
  color: #111827;
  margin: 0 18px 12px 0;
  padding: 0;
  word-break: break-word;
}

.lsc-invite-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 999px;
  background: var(--lsc-accent, #16a34a);
  color: var(--lsc-accent-contrast, #fff);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  line-height: 1;
}
.lsc-invite-cta:hover  { opacity: .9; }
.lsc-invite-cta:active { transform: scale(.96); }
.lsc-invite-cta svg { display: block; flex-shrink: 0; }

/* ── Toggle ───────────────────────────────────────────────────────────────── */
.lsc-toggle {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 0;
  background: var(--lsc-accent, #16a34a);
  color: var(--lsc-accent-contrast, #fff);
  box-shadow: 0 10px 25px rgba(0,0,0,.22);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  outline: 0;
  transition: transform .15s ease, box-shadow .15s ease;
}
.lsc-toggle:hover { transform: scale(1.07); box-shadow: 0 14px 30px rgba(0,0,0,.28); }
.lsc-toggle:focus-visible { outline: 3px solid rgba(22,163,74,.45); outline-offset: 3px; }
.lsc-icon { display: block; flex-shrink: 0; color: var(--lsc-accent-contrast, #fff); }

/* ── Badge ────────────────────────────────────────────────────────────────── */
.lsc-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-weight: 800;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff, 0 4px 10px rgba(239,68,68,.4);
  pointer-events: none;
}

/* ── Panel ────────────────────────────────────────────────────────────────── */
.lsc-panel {
  position: absolute;
  right: 0;
  bottom: 70px;
  width: 340px;
  max-width: calc(100vw - 36px);
  height: 460px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,.24);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform-origin: bottom right;
  animation: lsc-panel-in .18s ease;
}
.lsc-root[data-side="left"] .lsc-panel { right: auto; left: 0; transform-origin: bottom left; }
.lsc-panel[hidden] { display: none !important; animation: none; }

@keyframes lsc-panel-in {
  from { opacity: 0; transform: scale(.93) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.lsc-header {
  background: var(--lsc-accent, #16a34a);
  color: var(--lsc-accent-contrast, #fff);
  padding: 11px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 8px;
}
.lsc-title { font-weight: 700; font-size: 14px; flex: 1; min-width: 0; }
.lsc-actions { display: flex; align-items: center; gap: 6px; }

.lsc-action {
  border: 1px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.12);
  color: var(--lsc-accent-contrast, #fff);
  border-radius: 999px;
  padding: 5px 10px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  line-height: 1;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  transition: background .12s;
}
.lsc-action:hover { background: rgba(255,255,255,.24); }

.lsc-close {
  border: 0;
  background: transparent;
  color: var(--lsc-accent-contrast, #fff);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .85;
  transition: opacity .12s, background .12s;
  flex-shrink: 0;
  line-height: 1;
}
.lsc-close:hover { opacity: 1; background: rgba(255,255,255,.18); }

/* Garante que [hidden] funciona mesmo em elementos com display explícito */
.lsc-loading[hidden],
.lsc-empty[hidden],
.lsc-messages[hidden],
.lsc-compose[hidden],
.lsc-auth[hidden],
.lsc-rating[hidden] { display: none !important; }

/* ── Mensagens ────────────────────────────────────────────────────────────── */
.lsc-messages {
  flex: 1;
  padding: 12px;
  background: linear-gradient(180deg, var(--lsc-accent-soft, #f0fdf4) 0%, #ffffff 45%);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}

/* ── Loading ──────────────────────────────────────────────────────────────── */
.lsc-loading {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--lsc-accent-soft, #f0fdf4) 0%, #fff 100%);
}
.lsc-loading-dots { display: flex; gap: 6px; align-items: center; }
.lsc-loading-dots span {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lsc-accent, #16a34a);
  animation: lsc-pulse .9s ease-in-out infinite;
  opacity: .5;
}
.lsc-loading-dots span:nth-child(2) { animation-delay: .18s; }
.lsc-loading-dots span:nth-child(3) { animation-delay: .36s; }

@keyframes lsc-pulse {
  0%, 100% { opacity: .4; transform: scale(.8); }
  45%       { opacity: 1; transform: scale(1.15); }
}

/* ── Empty state ──────────────────────────────────────────────────────────── */
.lsc-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 24px 20px;
  background: linear-gradient(180deg, var(--lsc-accent-soft, #f0fdf4) 0%, #fff 100%);
}
.lsc-empty-icon { opacity: .3; margin-bottom: 2px; color: var(--lsc-accent, #16a34a); }
.lsc-empty strong { font-size: 14px; color: #374151; display: block; }
.lsc-empty span   { font-size: 13px; color: #6b7280; }
.lsc-empty-time {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: 12px;
  color: #9ca3af;
  background: #f3f4f6;
  border-radius: 999px;
  padding: 4px 10px;
}

/* ── Bubbles ──────────────────────────────────────────────────────────────── */
.lsc-msg {
  max-width: 80%;
  padding: 8px 11px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  word-break: break-word;
  animation: lsc-msg-in .15s ease;
}
@keyframes lsc-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.lsc-msg-user   { align-self: flex-end; background: var(--lsc-accent-soft, #dcfce7); border-bottom-right-radius: 4px; }
.lsc-msg-editor { align-self: flex-start; background: #fff; border: 1px solid rgba(0,0,0,.06); border-bottom-left-radius: 4px; }
.lsc-meta       { margin-top: 4px; font-size: 11px; opacity: .55; }
.lsc-link { color: inherit; text-decoration: underline; word-break: break-all; }
.lsc-link:hover { opacity: .75; }

/* ── Typing indicator ─────────────────────────────────────────────────────── */
.lsc-typing {
  align-self: flex-start;
  background: #fff;
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 10px 13px;
  display: flex;
  gap: 4px;
  align-items: center;
  animation: lsc-msg-in .15s ease;
}
.lsc-typing span {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9ca3af;
  animation: lsc-pulse .9s ease-in-out infinite;
  opacity: .6;
}
.lsc-typing span:nth-child(2) { animation-delay: .18s; }
.lsc-typing span:nth-child(3) { animation-delay: .36s; }

/* ── Compose ──────────────────────────────────────────────────────────────── */
.lsc-compose {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid rgba(0,0,0,.07);
  background: #fff;
  flex-shrink: 0;
  align-items: center;
}
.lsc-input {
  flex: 1;
  border: 1px solid rgba(0,0,0,.16);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 14px;
  color: inherit;
  background: #fff;
  outline: 0;
  min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
.lsc-input:focus { border-color: var(--lsc-accent, #16a34a); box-shadow: 0 0 0 3px rgba(22,163,74,.12); }

/* Botão de envio: ícone de seta */
.lsc-send {
  flex-shrink: 0;
  border: 0;
  border-radius: 999px;
  width: 38px;
  height: 38px;
  padding: 0;
  background: var(--lsc-accent, #16a34a);
  color: var(--lsc-accent-contrast, #fff);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .15s, transform .1s;
}
.lsc-send:hover   { opacity: .88; }
.lsc-send:active  { transform: scale(.93); }
.lsc-send:disabled { opacity: .4; cursor: not-allowed; }

/* Auth send button: texto, um pouco maior */
.lsc-auth .lsc-send {
  width: auto;
  padding: 0 14px;
  height: 38px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
}

/* ── Auth ─────────────────────────────────────────────────────────────────── */
.lsc-auth {
  padding: 16px 14px 14px;
  background: #fff;
  flex-shrink: 0;
}
.lsc-auth-title { font-weight: 800; margin-bottom: 5px; font-size: 15px; }
.lsc-auth-sub   { font-size: 13px; color: #6b7280; line-height: 1.5; margin-bottom: 14px; }
.lsc-auth-row   { display: flex; gap: 8px; }
.lsc-auth-row .lsc-input { padding: 9px 12px; }
.lsc-auth-msg   { margin-top: 10px; font-size: 13px; color: #374151; min-height: 18px; }
.lsc-auth-links { margin-top: 10px; font-size: 13px; }
.lsc-auth-links a { color: var(--lsc-accent, #16a34a); }
.lsc-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--lsc-accent, #16a34a);
  background: transparent;
  color: var(--lsc-accent, #16a34a);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .12s, color .12s;
  line-height: 1;
}
.lsc-btn-secondary:hover {
  background: var(--lsc-accent, #16a34a);
  color: var(--lsc-accent-contrast, #fff);
}

/* ── Rating ───────────────────────────────────────────────────────────────── */
.lsc-rating {
  padding: 14px;
  border-top: 1px solid rgba(0,0,0,.07);
  background: #f9fafb;
  flex-shrink: 0;
}
.lsc-rating-title  { font-weight: 700; margin-bottom: 10px; font-size: 14px; }
.lsc-rating-stars  { display: flex; gap: 4px; }
.lsc-star {
  border: 0;
  background: transparent;
  padding: 5px;
  border-radius: 8px;
  color: #d1d5db;
  cursor: pointer;
  display: flex;
  transition: color .12s, background .12s;
}
.lsc-star:hover,
.lsc-star.is-on { color: #f59e0b; background: #fef3c7; }
.lsc-star.is-on .lsc-star-svg path { fill: currentColor; }
.lsc-rating-actions { margin-top: 10px; }
.lsc-rating-skip {
  border: 0;
  background: transparent;
  color: #9ca3af;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  font-family: inherit;
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 400px) {
  .lsc-root { right: 12px; bottom: 12px; }
  .lsc-root[data-side="left"] { left: 12px; }
  .lsc-panel { width: calc(100vw - 24px); max-width: none; height: 70vh; bottom: 72px; }
  .lsc-toggle { width: 52px; height: 52px; }
}
