/* ============================================================
   AI-assistent – diskret panel som glider in nere till höger
   när besökaren skrollat större delen av landningssidan.
   Bygger på sajtens designtokens (style.css :root).
   ============================================================ */

.abx-agent {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 90;
  width: min(380px, calc(100vw - 24px));
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
  font-size: 15px;
  color: var(--ink);
  overflow: hidden;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .45s ease, transform .45s cubic-bezier(0.22, 1, 0.36, 1);
}
.abx-agent.is-visible { opacity: 1; transform: translateY(0); }
.abx-agent.is-hidden { display: none; }
@media (prefers-reduced-motion: reduce) {
  .abx-agent { transition: none; }
}

/* ---- Minimerad: liten "Assistent"-knapp i hörnet ---- */
.abx-chip {
  position: fixed; right: 16px; bottom: 16px; z-index: 90;
  font-family: inherit; font-size: 14px; font-weight: 500;
  background: var(--navy); color: #fff;
  border: 0; border-radius: 980px; padding: 12px 20px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  opacity: 0; transform: translateY(12px);
  transition: opacity .35s ease, transform .35s ease, background .2s;
}
.abx-chip.is-visible { opacity: 1; transform: translateY(0); }
.abx-chip.is-hidden { display: none; }
.abx-chip:hover { background: var(--blue); }
@media (prefers-reduced-motion: reduce) {
  .abx-chip { transition: none; }
}

/* ---- Huvud ---- */
.abx-agent__head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 16px;
  background: var(--navy); color: #fff;
}
.abx-agent__title { font-weight: 600; font-size: 15px; line-height: 1.25; }
.abx-agent__sub { font-size: 12px; color: rgba(255, 255, 255, 0.72); }
.abx-agent__headright { display: flex; align-items: center; gap: 8px; }
.abx-agent__demo {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.18); border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px; padding: 3px 7px;
}
.abx-agent__close {
  background: none; border: 0; color: rgba(255, 255, 255, 0.85);
  font-size: 22px; line-height: 1; cursor: pointer;
  padding: 10px 12px; margin: -8px -10px -8px 0; /* stor träffyta utan att växa visuellt */
}
.abx-agent__close:hover { color: #fff; }

/* ---- Kropp ---- */
.abx-agent__body { padding: 16px; }
.abx-lead { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.abx-text { line-height: 1.55; margin-bottom: 12px; }

/* ---- Knappar ---- */
.abx-btn {
  display: block; width: 100%; box-sizing: border-box;
  font-family: inherit; font-size: 15px; font-weight: 500;
  border: 0; border-radius: 980px; padding: 11px 16px;
  cursor: pointer; text-align: center; text-decoration: none;
  transition: background .2s;
}
.abx-btn + .abx-btn { margin-top: 8px; }
.abx-btn--primary { background: var(--blue); color: #fff; }
.abx-btn--primary:hover { background: var(--blue-hover); }
.abx-btn--ghost { background: var(--grey-tile); color: var(--ink); }
.abx-btn--ghost:hover { background: #e3e3e8; }
.abx-btn--plain { background: none; color: var(--text-secondary); font-size: 14px; padding: 8px; }
.abx-btn--plain:hover { color: var(--ink); }

/* ---- Chatt ---- */
.abx-chat {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 320px; overflow-y: auto; padding: 2px 0 8px;
}
.abx-msg {
  max-width: 85%; padding: 9px 13px; border-radius: 14px;
  line-height: 1.5; white-space: pre-wrap; overflow-wrap: break-word;
}
.abx-msg--ai { align-self: flex-start; background: var(--grey-tile); color: var(--ink); border-bottom-left-radius: 4px; }
.abx-msg--user { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }

.abx-typing { display: inline-flex; gap: 4px; }
.abx-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: #a9a9b0;
  animation: abxPulse 1.2s infinite;
}
.abx-typing span:nth-child(2) { animation-delay: .2s; }
.abx-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes abxPulse { 0%, 60%, 100% { opacity: .35; } 30% { opacity: 1; } }

/* ---- Inmatning ---- */
.abx-inputrow { display: flex; gap: 8px; margin-top: 4px; }
.abx-inputrow input {
  flex: 1; min-width: 0; font-family: inherit; font-size: 16px; color: var(--ink);
  background: var(--white); border: 1px solid var(--hairline);
  border-radius: 12px; padding: 10px 12px;
}
.abx-inputrow input:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26, 106, 255, 0.13);
}
.abx-send {
  flex: none; font-family: inherit; font-size: 15px; font-weight: 500;
  border: 0; border-radius: 12px; background: var(--blue); color: #fff;
  padding: 0 16px; cursor: pointer; transition: background .2s;
}
.abx-send:hover { background: var(--blue-hover); }
.abx-send:disabled { opacity: .5; cursor: default; }

.abx-note { font-size: 12.5px; line-height: 1.45; color: var(--text-secondary); margin-top: 8px; }

/* Endast för skärmläsare (t.ex. "Assistenten skriver …") */
.abx-sr {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- Sidfot med direktkontakt ---- */
.abx-agent__foot {
  border-top: 1px solid var(--hairline);
  padding: 10px 16px; font-size: 13px; color: var(--text-secondary);
  background: var(--grey-bg);
}
.abx-agent__foot a { color: var(--navy); text-decoration: none; font-weight: 500; }
.abx-agent__foot a:hover { text-decoration: underline; }

/* ---- Mobil ---- */
@media (max-width: 480px) {
  .abx-agent { right: 8px; left: 8px; bottom: 8px; width: auto; }
  .abx-chat { max-height: 45vh; }
}
