/* ============================================================
   A1 Accounting & Tax Solutions — Chatbot styles.
   Standalone file: does not modify global.css. Reuses the site's
   existing CSS variables (colors, radius, shadows, fonts) so the
   chatbot automatically matches the rest of the website.
   ============================================================ */

/* ---- Floating launcher button ----
   Deliberately styled and sized to match the site's existing .float-btn
   icons (WhatsApp/Call/Book/Back-to-top) and placed as part of that same
   stack in the HTML, so its position is guaranteed never to overlap
   anything — it inherits the exact same, already-working placement
   logic (including the mobile offset above the sticky bar) instead of
   duplicating fragile positioning math. */
.a1c-launcher {
  background: var(--grad-brand);
  color: #fff;
  position: relative;
  animation: a1cFloat 2.6s ease-in-out infinite;
}
.a1c-launcher svg { width: 22px; height: 22px; }

/* Gentle floating bob to draw the eye — subtle, not distracting */
@keyframes a1cFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Soft pulsing ring behind the button, like a quiet "notification" cue.
   Placed on ::before so it never affects the button's own size/clickable
   area or interferes with the existing .float-btn hover scale effect. */
.a1c-launcher::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--teal);
  opacity: 0.55;
  z-index: -1;
  animation: a1cPulseRing 2.6s ease-out infinite;
}
@keyframes a1cPulseRing {
  0% { transform: scale(1); opacity: 0.45; }
  70% { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* Once the visitor has opened the chat at least once, stop drawing
   attention to it — they already know it's there. */
.a1c-launcher.a1c-attention-seen {
  animation: none;
}
.a1c-launcher.a1c-attention-seen::before {
  display: none;
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .a1c-launcher { animation: none; }
  .a1c-launcher::before { animation: none; display: none; }
}
.a1c-launcher .a1c-launcher-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--success);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
}

/* ---- Chat window ---- */
.a1c-window {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 380px;
  height: 600px;
  max-height: calc(100vh - var(--nav-h) - 2.5rem);
  background: #fff;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.98);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  font-family: var(--font-body, inherit);
}
.a1c-window.a1c-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.a1c-header {
  background: var(--grad-brand);
  color: #fff;
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}
.a1c-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.a1c-header-avatar svg { width: 20px; height: 20px; }
.a1c-header-text { flex: 1; min-width: 0; }
.a1c-header-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
}
.a1c-header-sub {
  font-size: 0.72rem;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 5px;
}
.a1c-header-sub::before {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: #4ade80;
  display: inline-block;
}
.a1c-header-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }
.a1c-header-actions button {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.a1c-header-actions button:hover { background: rgba(255,255,255,0.28); }
.a1c-header-actions button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.a1c-header-actions svg { width: 16px; height: 16px; }

/* ---- Message body ---- */
.a1c-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem;
  background: var(--off);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.a1c-row { display: flex; }
.a1c-row-bot { justify-content: flex-start; }
.a1c-row-user { justify-content: flex-end; }

.a1c-bubble {
  max-width: 84%;
  padding: 0.65rem 0.9rem;
  border-radius: var(--r-lg);
  font-size: 0.85rem;
  line-height: 1.55;
  animation: a1cFadeIn 0.2s ease;
}
@keyframes a1cFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.a1c-bubble-bot {
  background: #fff;
  color: var(--dark);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.a1c-bubble-user {
  background: var(--teal);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.a1c-typing { display: flex; gap: 4px; padding: 0.85rem 0.9rem; }
.a1c-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted);
  opacity: 0.5;
  animation: a1cBounce 1.1s infinite ease-in-out;
}
.a1c-typing span:nth-child(2) { animation-delay: 0.15s; }
.a1c-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes a1cBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.a1c-summary {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
}
.a1c-summary strong { color: var(--dark); }

/* ---- Footer (options / input) ---- */
.a1c-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 0.85rem 1.1rem;
  background: #fff;
}
.a1c-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 220px;
  overflow-y: auto;
}
.a1c-option-btn {
  text-align: left;
  padding: 0.65rem 0.9rem;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--dark);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-body, inherit);
}
.a1c-option-btn:hover { border-color: var(--sky); background: var(--sky-bg); }
.a1c-option-btn:focus-visible { outline: 2px solid var(--sky); outline-offset: 1px; }
.a1c-option-btn.a1c-option-primary {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
  text-align: center;
}
.a1c-option-btn.a1c-option-primary:hover { background: var(--sky); border-color: var(--sky); }
.a1c-option-btn.a1c-option-primary:disabled { opacity: 0.65; cursor: not-allowed; }
.a1c-option-btn.a1c-option-back {
  color: var(--muted);
  border-style: dashed;
  text-align: center;
}

.a1c-input-row { display: flex; gap: 0.6rem; align-items: center; }
.a1c-text-input {
  flex: 1;
  padding: 0.7rem 0.9rem;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--border);
  font-size: 0.85rem;
  font-family: var(--font-body, inherit);
  min-width: 0;
}
.a1c-text-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(26,92,122,0.12);
}
.a1c-send-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--teal);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.a1c-send-btn:hover { background: var(--sky); }
.a1c-send-btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.a1c-inline-err {
  color: var(--error);
  font-size: 0.78rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .a1c-window {
    right: 0.6rem;
    left: 0.6rem;
    top: calc(var(--nav-h) + 0.6rem);
    bottom: calc(0.6rem + 66px);
    width: auto;
    height: auto;
    max-height: none;
  }
}

@media (max-width: 860px) and (min-width: 481px) {
  .a1c-window {
    width: 360px;
    height: auto;
    top: calc(var(--nav-h) + 1rem);
    bottom: calc(1.5rem + 66px);
    max-height: none;
  }
}
