/* Anika Tech Academy chat widget. Everything is scoped under #anika-chat. Mobile-first. */
#anika-chat {
  --anika-colour: #0b1f3a;
  --ac-bg: #ffffff;
  --ac-text: #1a1d24;
  --ac-muted: #5b6270;
  --ac-bot: #f1f3f7;
  --ac-border: #dfe3ea;
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 2147483000;
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ac-text);
}
#anika-chat *, #anika-chat *::before, #anika-chat *::after { box-sizing: border-box; }

/* Launcher: 56px disc on phones, "Ask AnikaTech" pill from 520px. Height stays 56px (the theme's
   WhatsApp button is offset above it). */
#anika-chat .ac-launcher {
  position: relative; height: 56px; padding: 0 6px; border: 0; border-radius: 999px; cursor: pointer;
  display: flex; align-items: center; gap: 10px; margin-left: auto; color: #fff; text-align: left; font: inherit;
  background: linear-gradient(120deg, var(--anika-colour) 0%, #1a2f8f 70%, #5b21b6 100%);
  box-shadow: 0 8px 24px rgba(11, 31, 58, .35); transition: transform .18s ease, box-shadow .18s ease;
}
#anika-chat .ac-launcher:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(11, 31, 58, .42); }
#anika-chat .ac-launcher::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 0 rgba(0, 212, 255, .55); animation: ac-ring 2.8s ease-out 1s 3;
}
@keyframes ac-ring { to { box-shadow: 0 0 0 16px rgba(0, 212, 255, 0); } }
#anika-chat .ac-disc {
  position: relative; width: 44px; height: 44px; flex: none; border-radius: 50%; background: #fff;
  display: flex; align-items: center; justify-content: center;
}
#anika-chat .ac-disc svg { width: 30px; height: 30px; }
#anika-chat .ac-dot {
  position: absolute; top: -1px; right: -1px; width: 12px; height: 12px; border-radius: 50%;
  background: #22c55e; border: 2px solid #fff;
}
#anika-chat .ac-label { display: none; padding-right: 14px; }
#anika-chat .ac-label strong { display: block; font-size: 15px; line-height: 1.15; }
#anika-chat .ac-label small { display: block; font-size: 12px; opacity: .85; }
#anika-chat .ac-launcher:focus-visible, #anika-chat button:focus-visible, #anika-chat textarea:focus-visible {
  outline: 3px solid var(--anika-colour); outline-offset: 2px;
}

#anika-chat .ac-panel {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  background: var(--ac-bg); border: 1px solid var(--ac-border);
}
#anika-chat .ac-panel[hidden] { display: none; }
#anika-chat.ac-open .ac-launcher { display: none; }

#anika-chat .ac-header {
  display: flex; align-items: center; gap: 4px; padding: 12px 12px 12px 16px;
  background: var(--anika-colour); color: #fff;
}
#anika-chat .ac-title { font-weight: 600; flex: 1; }
#anika-chat .ac-icon {
  background: transparent; border: 0; color: #fff; font-size: 20px; line-height: 1;
  width: 34px; height: 34px; border-radius: 6px; cursor: pointer;
}
#anika-chat .ac-icon:hover { background: rgba(255, 255, 255, .15); }

#anika-chat .ac-messages {
  flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px;
  overscroll-behavior: contain;
}
#anika-chat .ac-msg { display: flex; flex-direction: column; max-width: 88%; }
#anika-chat .ac-user { align-self: flex-end; align-items: flex-end; }
#anika-chat .ac-bot { align-self: flex-start; }
#anika-chat .ac-bubble {
  padding: 9px 12px; border-radius: 14px; word-wrap: break-word; overflow-wrap: anywhere;
}
#anika-chat .ac-user .ac-bubble {
  background: var(--anika-colour); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap;
}
#anika-chat .ac-bot .ac-bubble { background: var(--ac-bot); border-bottom-left-radius: 4px; }
#anika-chat .ac-bubble p { margin: 0 0 6px; }
#anika-chat .ac-bubble p:last-child { margin-bottom: 0; }
#anika-chat .ac-bubble ul { margin: 4px 0 6px; padding-left: 20px; }
#anika-chat .ac-bubble hr { border: 0; border-top: 1px solid var(--ac-border); margin: 8px 0; }
#anika-chat .ac-bubble a { color: var(--anika-colour); text-decoration: underline; }

#anika-chat .ac-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
#anika-chat .ac-chip {
  font-size: 11px; color: var(--ac-muted); border: 1px solid var(--ac-border);
  border-radius: 999px; padding: 1px 8px; background: #fff;
}
#anika-chat .ac-system { align-self: center; font-size: 12px; color: var(--ac-muted); }

#anika-chat .ac-typing .ac-bubble { display: flex; gap: 4px; padding: 12px; }
#anika-chat .ac-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ac-muted);
  animation: ac-bounce 1.2s infinite ease-in-out;
}
#anika-chat .ac-typing span:nth-child(2) { animation-delay: .15s; }
#anika-chat .ac-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes ac-bounce { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

#anika-chat .ac-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--ac-border); }
#anika-chat .ac-input {
  flex: 1; resize: none; border: 1px solid var(--ac-border); border-radius: 10px;
  padding: 9px 11px; font: inherit; color: inherit; max-height: 120px; background: #fff;
  font-size: 16px; /* >=16px stops iOS zooming on focus */
}
#anika-chat .ac-send {
  border: 0; border-radius: 10px; padding: 0 16px; background: var(--anika-colour);
  color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
#anika-chat .ac-send:disabled { opacity: .5; cursor: default; }
#anika-chat .ac-note { font-size: 11px; color: var(--ac-muted); text-align: center; padding: 0 10px 8px; }

@media (min-width: 520px) {
  #anika-chat { right: 20px; bottom: 20px; }
  #anika-chat .ac-label { display: block; }
  #anika-chat .ac-panel {
    inset: auto 20px 20px auto; width: 380px; height: min(620px, calc(100vh - 40px));
    border-radius: 14px; overflow: hidden; box-shadow: 0 12px 40px rgba(0, 0, 0, .2);
  }
}

@media (prefers-reduced-motion: reduce) {
  #anika-chat .ac-launcher { transition: none; }
  #anika-chat .ac-launcher::after { animation: none; }
  #anika-chat .ac-typing span { animation: none; opacity: .6; }
}
