/* ==========================================================
   Alpha Care — AI chat assistant
   Brand colours from the site: teal #19919E, navy #0A315A, font DM Sans.
   Every rule is scoped to #acchat and sets its own values, so the theme's
   button / input styles don't leak in.
   ========================================================== */
#acchat {
  --ac-teal: #19919E;
  --ac-teal-dark: #127580;
  --ac-navy: #0A315A;
  --ac-text: #1F2937;
  --ac-muted: #6B7280;
  --ac-line: #E3E3EA;
  --ac-bg: #FFFFFF;
  --ac-soft: #F4F7FA;
  --ac-ease: cubic-bezier(.2, .8, .2, 1);
  position: fixed; bottom: 82px; z-index: 99998;
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px; line-height: 1.5; color: var(--ac-text); text-align: left;
}
/* Right side: stacked above the WhatsApp button (bottom 15px, right 15px). */
#acchat.acchat-right { right: 18px; }
#acchat.acchat-left { left: 18px; bottom: 18px; }
#acchat *, #acchat *::before, #acchat *::after { box-sizing: border-box; }
#acchat [hidden] { display: none !important; }
#acchat p { margin: 0; padding: 0; }
#acchat svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#acchat button {
  margin: 0; font-family: inherit; text-transform: none; letter-spacing: normal; text-shadow: none;
  cursor: pointer; -webkit-appearance: none; appearance: none; min-height: 0; line-height: 1.2;
}
#acchat button:focus-visible, #acchat a:focus-visible { outline: 2px solid var(--ac-teal); outline-offset: 2px; }

/* Launcher */
#acchat .acchat-launcher {
  display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; padding: 0;
  border: 0; border-radius: 50%; background: var(--ac-teal); color: #fff;
  box-shadow: 0 8px 24px -6px rgba(10, 49, 90, .45);
  transition: transform .4s var(--ac-ease), box-shadow .3s, background-color .3s;
}
#acchat.acchat-right .acchat-launcher { margin-left: auto; }
#acchat .acchat-launcher:hover, #acchat .acchat-launcher:focus { background: var(--ac-teal-dark); color: #fff; transform: translateY(-2px); box-shadow: 0 12px 30px -6px rgba(10, 49, 90, .55); }
#acchat .acchat-launcher svg { width: 26px; height: 26px; }

/* Panel */
#acchat .acchat-panel {
  position: relative; display: flex; flex-direction: column; width: 370px; max-width: calc(100vw - 36px);
  height: 560px; max-height: calc(100vh - 180px); max-height: calc(100dvh - 180px); margin-bottom: 12px;
  border: 1px solid var(--ac-line); border-radius: 18px; overflow: hidden; background: var(--ac-bg);
  box-shadow: 0 24px 60px -20px rgba(10, 49, 90, .45), 0 8px 20px -10px rgba(0, 0, 0, .2);
  animation: acchatIn .35s var(--ac-ease);
}
#acchat.acchat-left .acchat-panel { max-height: calc(100vh - 110px); max-height: calc(100dvh - 110px); }
@keyframes acchatIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

#acchat .acchat-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 12px 14px 18px; background: var(--ac-navy); color: #fff; }
#acchat .acchat-title { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; font-weight: 700; line-height: 1.2; color: #fff; }
#acchat .acchat-dot { width: 8px; height: 8px; border-radius: 50%; background: #3DDC84; box-shadow: 0 0 0 3px rgba(61, 220, 132, .25); }
#acchat .acchat-subtitle { margin-top: 3px; padding-left: 16px; font-size: .75rem; line-height: 1.2; color: rgba(255, 255, 255, .75); }
#acchat .acchat-close {
  display: flex; align-items: center; justify-content: center; flex: none; width: 34px; height: 34px; padding: 0;
  border: 1px solid rgba(255, 255, 255, .3); border-radius: 50%; background: transparent; color: #fff; transition: background-color .25s;
}
#acchat .acchat-close:hover, #acchat .acchat-close:focus { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .5); }
#acchat .acchat-close svg { width: 16px; height: 16px; }

/* Messages */
#acchat .acchat-log { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; background: var(--ac-soft); overscroll-behavior: contain; scrollbar-width: thin; }
#acchat .acchat-log:focus-visible { outline: 2px solid var(--ac-teal); outline-offset: -2px; }
#acchat .acchat-row { display: flex; }
#acchat .acchat-row-user { justify-content: flex-end; }
#acchat .acchat-bubble { max-width: 86%; padding: 10px 13px; border-radius: 16px; font-size: .92rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
#acchat .acchat-row-bot .acchat-bubble { background: #fff; border: 1px solid var(--ac-line); color: var(--ac-text); border-bottom-left-radius: 5px; }
#acchat .acchat-row-user .acchat-bubble { background: var(--ac-teal); color: #fff; border-bottom-right-radius: 5px; }
#acchat .acchat-bubble a { color: var(--ac-teal-dark); text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
#acchat .acchat-row-user .acchat-bubble a { color: #fff; }

#acchat .acchat-typing { display: inline-flex; align-items: center; gap: 5px; padding: 14px; }
#acchat .acchat-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--ac-teal); animation: acchatDot 1.2s infinite ease-in-out; }
#acchat .acchat-typing span:nth-child(2) { animation-delay: .15s; }
#acchat .acchat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes acchatDot { 0%, 60%, 100% { opacity: .25; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }

/* Quick replies */
#acchat .acchat-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px; background: var(--ac-soft); }
#acchat .acchat-chip {
  padding: 7px 12px; border-radius: 999px; border: 1px solid rgba(25, 145, 158, .4); background: #fff;
  color: var(--ac-teal-dark); font-size: .8rem; font-weight: 500; transition: background-color .25s, border-color .25s;
}
#acchat .acchat-chip:hover, #acchat .acchat-chip:focus { background: rgba(25, 145, 158, .1); border-color: var(--ac-teal); color: var(--ac-teal-dark); }

/* Input */
#acchat .acchat-form { display: flex; align-items: flex-end; gap: 8px; margin: 0; padding: 10px 12px; border-top: 1px solid var(--ac-line); background: #fff; }
#acchat .acchat-input {
  flex: 1 1 auto; width: auto; min-width: 0; height: 44px; min-height: 44px; max-height: 120px; margin: 0; padding: 11px 13px; resize: none;
  border-radius: 12px; border: 1px solid var(--ac-line); background: #fff; color: var(--ac-text); box-shadow: none;
  font-family: inherit; font-size: 16px; line-height: 1.35; /* 16px stops iOS zooming on focus */
  transition: border-color .2s, box-shadow .2s;
}
#acchat .acchat-input::placeholder { color: var(--ac-muted); opacity: 1; }
#acchat .acchat-input:focus { outline: none; border-color: var(--ac-teal); box-shadow: 0 0 0 3px rgba(25, 145, 158, .15); }
#acchat .acchat-send {
  display: flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 12px; background: var(--ac-teal); color: #fff; transition: background-color .25s, opacity .25s;
}
#acchat .acchat-send:hover, #acchat .acchat-send:focus { background: var(--ac-teal-dark); color: #fff; }
#acchat .acchat-send[disabled] { opacity: .45; cursor: default; }
#acchat .acchat-send svg { width: 20px; height: 20px; }

/* Footer */
#acchat .acchat-footer { padding: 0 12px 11px; background: #fff; }
#acchat .acchat-actions { display: flex; gap: 8px; }
#acchat .acchat-action {
  flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; padding: 9px 8px; border-radius: 999px;
  border: 1px solid var(--ac-line); background: #fff; color: var(--ac-navy); font-size: .82rem; font-weight: 600; line-height: 1.2;
  text-decoration: none; white-space: nowrap; transition: border-color .25s, background-color .25s, color .25s;
}
#acchat .acchat-action:hover, #acchat .acchat-action:focus { border-color: var(--ac-navy); color: var(--ac-navy); text-decoration: none; }
#acchat .acchat-action-primary { border-color: #25D366; background: #25D366; color: #fff; }
#acchat .acchat-action-primary:hover, #acchat .acchat-action-primary:focus { background: #1EBE5A; border-color: #1EBE5A; color: #fff; }
#acchat .acchat-note { margin-top: 8px; font-size: .7rem; line-height: 1.4; color: var(--ac-muted); text-align: center; }

/* Phones: the open chat fills the screen */
@media (max-width: 480px) {
  #acchat.acchat-right { right: 14px; bottom: 78px; }
  #acchat.acchat-left { left: 14px; bottom: 14px; }
  #acchat.acchat-open { top: 0; right: 0; bottom: 0; left: 0; }
  #acchat.acchat-open .acchat-panel { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; border: 0; border-radius: 0; }
  #acchat.acchat-open .acchat-launcher { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  #acchat .acchat-panel, #acchat .acchat-typing span { animation: none; }
  #acchat .acchat-launcher { transition: none; }
}
