/* ═══════════════════════════════════════════════════════════
   Legacy AI chatbot inside the React shell (loaded by spa.php right
   after css/chatbot.css; the widget markup and js/chatbot.js are
   unchanged). Owner: chrome agent.

   - Typeface of the new design system.
   - The launcher hides while the mobile menu is open: at z-index 9998
     it would otherwise float above the menu sheet (z 960).
   - Safe-area insets (iPhone home indicator).
   - The ContactDock takes the side opposite the launcher, so a
     right-hand launcher no longer has to clear the old WhatsApp float
     (bottom 152px) and can sit in the corner.
   - The cookie card sits on the launcher's side on desktop (full width
     on phones); lift the launcher above it on both sides. --ag-cookie-h
     is published by the React cookie card (its height + 12px gap).
   ═══════════════════════════════════════════════════════════ */

#ag-chat {
  font-family: "Plus Jakarta Sans Variable", "Jakarta Fallback", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transition: bottom .3s cubic-bezier(.16, 1, .3, 1), opacity .2s ease, visibility .2s;
}
#ag-chat.ag-right { right: 22px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }

body.ag-nav-open #ag-chat {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#ag-chat .ag-chat-launcher:focus-visible,
#ag-chat .ag-chat-close:focus-visible,
#ag-chat .ag-chat-send:focus-visible {
  outline: 3px solid rgb(106 0 255 / .45);
  outline-offset: 2px;
}

body.ag-cookie-open #ag-chat.ag-left,
body.ag-cookie-open #ag-chat.ag-right {
  bottom: calc(20px + env(safe-area-inset-bottom, 0px) + var(--ag-cookie-h, 0px) + 12px);
}
/* Integrator: lifted above the cookie card, the closed launcher landed on the
   hero CTAs (1440×900: over "Start your project"). Hide it until the visitor
   answers the cookie card; an open chat stays visible and lifted. */
body.ag-cookie-open #ag-chat:not(.ag-open) {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@media (max-width: 480px) {
  #ag-chat,
  #ag-chat.ag-right { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  #ag-chat.ag-right { right: 16px; }
}
@media (max-width: 560px) {
  body.ag-cookie-open #ag-chat.ag-left,
  body.ag-cookie-open #ag-chat.ag-right {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px) + var(--ag-cookie-h, 0px) + 12px);
  }
}

@media (prefers-reduced-motion: reduce) {
  #ag-chat { transition: opacity .12s ease, visibility .12s; }
}

@media print {
  #ag-chat { display: none !important; }
}

/* ═══════════════════════════════════════════════════════════
   PREMIUM SKIN (lead, 2026-11-19, owner request: "more attractive and
   professional, effects, premium feel, new look").

   CSS only: the widget markup (includes/chatbot-widget.php), js/chatbot.js
   and every Admin → Chatbot option keep working:
     colour / second colour  → --ag-chat-c / --ag-chat-c2 drive every tint
     corner style            → rounded (default) / soft / square
     size                    → compact / standard / large
     position, avatar, launcher icon + label, voice button

   Effects: glowing launcher with a rotating light arc and a pulse until the
   chat has been opened, icon morph, glass panel that springs open from the
   launcher, drifting aurora header, live status ping, bubbles that slide in
   from their own side, wave typing dots, chips with a light sweep, composer
   focus ring, send-button lift. All motion stops under reduced motion.
   Selectors start with #ag-chat#ag-chat so they win over css/chatbot.css
   without !important.
   ═══════════════════════════════════════════════════════════ */

#ag-chat#ag-chat {
  --agp-c1: var(--ag-chat-c, #6a00ff);
  /* With one admin colour the gradient ends in brand violet; a second colour is blended toward it. */
  --agp-c2: color-mix(in oklab, var(--ag-chat-c2, var(--ag-chat-c, #6a00ff)) 52%, #6a00ff 48%);
  --agp-grad: linear-gradient(135deg, var(--agp-c1) 0%, var(--agp-c2) 100%);
  --agp-glow: color-mix(in srgb, var(--agp-c1) 55%, transparent);
  --agp-ink: #11162d;
  --agp-muted: #5e6475;
  --agp-line: #e7e9f0;
  --agp-surface: #f6f4fd;
  --agp-ease: cubic-bezier(.16, 1, .3, 1);
  --agp-r-panel: 22px;
  --agp-r-bubble: 16px;
  --agp-r-ctl: 14px;
  --agp-r-launch: 50%;
  --agp-w: 364px;
  --agp-h: 560px;
  --agp-launch: 56px;
  color: var(--agp-ink);
  -webkit-font-smoothing: antialiased;
}
#ag-chat#ag-chat[data-style="soft"]   { --agp-r-panel: 14px; --agp-r-bubble: 12px; --agp-r-ctl: 10px; }
#ag-chat#ag-chat[data-style="square"] { --agp-r-panel: 4px;  --agp-r-bubble: 4px;  --agp-r-ctl: 4px; --agp-r-launch: 12px; }
#ag-chat#ag-chat[data-size="compact"] { --agp-w: 328px; --agp-h: 480px; }
#ag-chat#ag-chat[data-size="large"]   { --agp-w: 420px; --agp-h: 640px; }

/* ── Launcher ─────────────────────────────────────────── */
#ag-chat#ag-chat .ag-chat-launcher {
  position: relative;
  width: var(--agp-launch); height: var(--agp-launch);
  border-radius: var(--agp-r-launch);
  background:
    radial-gradient(120% 120% at 28% 20%, rgb(255 255 255 / .38) 0%, transparent 46%),
    var(--agp-grad);
  box-shadow:
    0 14px 30px -10px var(--agp-glow),
    0 6px 14px -6px rgb(17 22 45 / .35),
    inset 0 1px 0 rgb(255 255 255 / .45),
    inset 0 -8px 14px rgb(17 22 45 / .16);
  transition: transform .32s var(--agp-ease), box-shadow .32s var(--agp-ease);
  isolation: isolate;
}
#ag-chat#ag-chat .ag-chat-launcher:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow:
    0 20px 38px -10px var(--agp-glow),
    0 8px 18px -6px rgb(17 22 45 / .4),
    inset 0 1px 0 rgb(255 255 255 / .5),
    inset 0 -8px 14px rgb(17 22 45 / .16);
}
#ag-chat#ag-chat .ag-chat-launcher:active { transform: scale(.95); }

/* Light arc that travels round the edge */
#ag-chat#ag-chat .ag-chat-launcher::before {
  content: "";
  position: absolute; inset: -4px; z-index: -1;
  border-radius: inherit;
  background: conic-gradient(from 0deg, transparent 0 58%, rgb(255 255 255 / .95) 74%, var(--agp-c1) 86%, transparent 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  animation: agp-spin 3.6s linear infinite;
}
/* Pulse that invites the first click; stops once the chat has been opened */
#ag-chat#ag-chat .ag-chat-launcher::after {
  content: "";
  position: absolute; inset: 0; z-index: -2;
  border-radius: inherit;
  background: var(--agp-grad);
  opacity: 0;
}
#ag-chat#ag-chat:not(.ag-open):not(.ag-seen) .ag-chat-launcher::after { animation: agp-pulse 2.6s var(--agp-ease) infinite; }
#ag-chat#ag-chat.ag-open .ag-chat-launcher::before { animation-play-state: paused; opacity: 0; }
#ag-chat#ag-chat[data-style="square"] .ag-chat-launcher::before { display: none; }

#ag-chat#ag-chat .ag-chat-launcher svg { width: 25px; height: 25px; filter: drop-shadow(0 1px 1px rgb(17 22 45 / .25)); }
#ag-chat#ag-chat .ag-chat-launcher .ag-ic-img { width: 28px; height: 28px; }

/* Icon morph (round launcher only; the labelled pill keeps the plain swap) */
#ag-chat#ag-chat .ag-chat-launcher:not(.has-label) .ag-ic-open,
#ag-chat#ag-chat .ag-chat-launcher:not(.has-label) .ag-ic-close {
  display: block;
  position: absolute; inset: 0; margin: auto;
  transition: opacity .28s ease, transform .42s var(--agp-ease);
}
#ag-chat#ag-chat .ag-chat-launcher:not(.has-label) .ag-ic-close { opacity: 0; transform: rotate(-90deg) scale(.5); }
#ag-chat#ag-chat.ag-open .ag-chat-launcher:not(.has-label) .ag-ic-open  { opacity: 0; transform: rotate(90deg) scale(.5); }
#ag-chat#ag-chat.ag-open .ag-chat-launcher:not(.has-label) .ag-ic-close { opacity: 1; transform: none; }

#ag-chat#ag-chat .ag-chat-launcher.has-label {
  width: auto; height: var(--agp-launch);
  border-radius: 999px;
  padding: 0 22px 0 16px;
}
#ag-chat#ag-chat .ag-chat-launcher.has-label::before { display: none; }
#ag-chat#ag-chat .ag-chat-launcher-label { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
#ag-chat#ag-chat.ag-open .ag-chat-launcher.has-label { width: var(--agp-launch); padding: 0; }

#ag-chat#ag-chat .ag-chat-ping {
  top: -1px; right: -1px;
  width: 14px; height: 14px;
  background: #22c55e;
  border: 2.5px solid #fff;
  animation: agp-ping 1.8s ease-out infinite;
}

/* ── Panel ────────────────────────────────────────────── */
#ag-chat#ag-chat .ag-chat-panel {
  bottom: calc(var(--agp-launch) + 14px);
  width: min(var(--agp-w), calc(100vw - 32px));
  height: min(var(--agp-h), calc(100dvh - 128px - var(--ag-cookie-h, 0px)));
  max-height: none;
  border: 1px solid rgb(255 255 255 / .7);
  border-radius: var(--agp-r-panel);
  background: rgb(255 255 255 / .9);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
          backdrop-filter: blur(22px) saturate(1.5);
  box-shadow:
    0 36px 80px -24px rgb(38 0 92 / .5),
    0 14px 30px -18px rgb(17 22 45 / .35),
    0 0 0 1px rgb(17 22 45 / .07);
  transform: translateY(18px) scale(.9);
  transition: opacity .22s ease, transform .42s var(--agp-ease), visibility .22s, bottom .3s var(--agp-ease);
}
#ag-chat#ag-chat.ag-left  .ag-chat-panel { transform-origin: 28px 100%; }
#ag-chat#ag-chat.ag-right .ag-chat-panel { transform-origin: calc(100% - 28px) 100%; }
#ag-chat#ag-chat.ag-open  .ag-chat-panel { transform: none; }

/* ── Header: drifting aurora ──────────────────────────── */
#ag-chat#ag-chat .ag-chat-head {
  position: relative;
  padding: 14px 14px 14px 16px;
  gap: 12px;
  background:
    radial-gradient(90% 140% at 100% 0%, rgb(255 255 255 / .28), transparent 55%),
    radial-gradient(70% 120% at 0% 100%, color-mix(in srgb, var(--agp-c2) 70%, #0b1026) 0%, transparent 70%),
    linear-gradient(120deg, var(--agp-c1), var(--agp-c2), var(--agp-c1));
  background-size: 100% 100%, 100% 100%, 220% 100%;
  animation: agp-aurora 9s ease-in-out infinite;
  overflow: hidden;
}
/* Soft light sweeping across the header */
#ag-chat#ag-chat .ag-chat-head::before {
  content: "";
  position: absolute; top: -60%; bottom: -60%; left: -40%;
  width: 38%;
  background: linear-gradient(100deg, transparent, rgb(255 255 255 / .22), transparent);
  transform: rotate(8deg);
  animation: agp-sweep 6s ease-in-out infinite;
  pointer-events: none;
}
#ag-chat#ag-chat .ag-chat-head::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / .6), transparent);
}
#ag-chat#ag-chat .ag-chat-head > * { position: relative; z-index: 1; }

#ag-chat#ag-chat .ag-chat-avatar {
  width: 42px; height: 42px;
  font-size: 17px; font-weight: 800;
  background: rgb(255 255 255 / .2);
  box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / .55), 0 6px 14px -6px rgb(17 22 45 / .5);
}
#ag-chat#ag-chat .ag-chat-title  { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; }
#ag-chat#ag-chat .ag-chat-status { font-size: 12px; opacity: .92; margin-top: 3px; gap: 6px; }
#ag-chat#ag-chat .ag-chat-dot {
  width: 7px; height: 7px;
  background: #4ade80;
  animation: agp-ping 1.8s ease-out infinite;
}
#ag-chat#ag-chat .ag-chat-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgb(255 255 255 / .16);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .28);
  font-size: 20px;
  transition: background .2s ease, transform .4s var(--agp-ease);
}
#ag-chat#ag-chat .ag-chat-close:hover { background: rgb(255 255 255 / .3); transform: rotate(90deg); }

/* ── Messages ─────────────────────────────────────────── */
#ag-chat#ag-chat .ag-chat-log {
  padding: 16px 14px 10px;
  gap: 10px;
  background:
    radial-gradient(120% 60% at 0% 0%, color-mix(in srgb, var(--agp-c1) 7%, transparent), transparent 60%),
    linear-gradient(180deg, #fdfcff 0%, var(--agp-surface) 100%);
  scrollbar-width: thin;
  scrollbar-color: #cfc8ea transparent;
}
#ag-chat#ag-chat .ag-chat-log::-webkit-scrollbar { width: 5px; }
#ag-chat#ag-chat .ag-chat-log::-webkit-scrollbar-thumb { background: #cfc8ea; border-radius: 99px; }

#ag-chat#ag-chat .ag-msg {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: var(--agp-r-bubble);
  font-size: 14px; line-height: 1.5;
  color: var(--agp-ink);
  animation: agp-in-left .42s var(--agp-ease) both;
}
#ag-chat#ag-chat .ag-msg-bot {
  background: #fff;
  border: 1px solid var(--agp-line);
  border-bottom-left-radius: 6px;
  box-shadow: 0 6px 16px -10px rgb(38 0 92 / .28);
}
#ag-chat#ag-chat .ag-msg-user {
  background: var(--agp-grad);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 10px 20px -10px var(--agp-glow);
  animation-name: agp-in-right;
}
#ag-chat#ag-chat .ag-msg-err { background: #fff1f2; border: 1px solid #ffd9df; color: #b42340; }

#ag-chat#ag-chat .ag-typing { gap: 5px; padding: 14px 16px; }
#ag-chat#ag-chat .ag-typing span {
  width: 7px; height: 7px;
  background: var(--agp-grad);
  animation: agp-wave 1.1s ease-in-out infinite;
}
#ag-chat#ag-chat .ag-typing span:nth-child(2) { animation-delay: .14s; }
#ag-chat#ag-chat .ag-typing span:nth-child(3) { animation-delay: .28s; }

/* ── Quick replies ────────────────────────────────────── */
#ag-chat#ag-chat .ag-chat-chips { gap: 7px; padding: 2px 14px 10px; background: var(--agp-surface); }
#ag-chat#ag-chat .ag-chat-chips:empty { padding: 0; }
#ag-chat#ag-chat .ag-chip {
  position: relative;
  padding: 7px 13px;
  font-size: 13px; font-weight: 500;
  color: var(--agp-ink);
  background: #fff;
  border: 1px solid var(--agp-line);
  box-shadow: 0 2px 6px -4px rgb(17 22 45 / .25);
  overflow: hidden;
  transition: transform .25s var(--agp-ease), border-color .2s ease, color .2s ease, box-shadow .25s ease;
  animation: agp-in-up .4s var(--agp-ease) both;
}
#ag-chat#ag-chat .ag-chip:nth-child(2) { animation-delay: .05s; }
#ag-chat#ag-chat .ag-chip:nth-child(3) { animation-delay: .1s; }
#ag-chat#ag-chat .ag-chip:nth-child(4) { animation-delay: .15s; }
#ag-chat#ag-chat .ag-chip:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--agp-c1) 45%, #fff);
  color: var(--agp-c1);
  box-shadow: 0 8px 16px -10px var(--agp-glow);
}
#ag-chat#ag-chat .ag-chip-cta {
  background: var(--agp-grad);
  border-color: transparent;
  color: #fff; font-weight: 600;
  box-shadow: 0 8px 18px -10px var(--agp-glow);
}
#ag-chat#ag-chat .ag-chip-cta:hover { color: #fff; opacity: 1; }
/* Light sweep across the call-to-action chip */
#ag-chat#ag-chat .ag-chip-cta::after {
  content: "";
  position: absolute; top: 0; bottom: 0; left: -60%;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgb(255 255 255 / .45), transparent);
  animation: agp-shine 3.2s ease-in-out infinite;
}

/* ── Composer ─────────────────────────────────────────── */
#ag-chat#ag-chat .ag-chat-form {
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--agp-line);
  background: rgb(255 255 255 / .92);
}
#ag-chat#ag-chat .ag-chat-input {
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: var(--agp-r-ctl);
  background: #f3f1fa;
  font-size: 14px; line-height: 1.45;
  color: var(--agp-ink);
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
#ag-chat#ag-chat .ag-chat-input::placeholder { color: #8a90a2; }
#ag-chat#ag-chat .ag-chat-input:focus {
  background: #fff;
  border-color: color-mix(in srgb, var(--agp-c1) 55%, #fff);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--agp-c1) 16%, transparent);
}
#ag-chat#ag-chat .ag-chat-send,
#ag-chat#ag-chat .ag-chat-mic {
  width: 42px; height: 42px;
  border-radius: var(--agp-r-ctl);
}
#ag-chat#ag-chat .ag-chat-send {
  background:
    radial-gradient(120% 120% at 28% 20%, rgb(255 255 255 / .35) 0%, transparent 46%),
    var(--agp-grad);
  box-shadow: 0 10px 20px -10px var(--agp-glow), inset 0 1px 0 rgb(255 255 255 / .4);
  transition: transform .28s var(--agp-ease), box-shadow .28s ease, opacity .2s ease, filter .2s ease;
}
#ag-chat#ag-chat .ag-chat-send svg { width: 17px; height: 17px; transition: transform .32s var(--agp-ease); }
#ag-chat#ag-chat .ag-chat-send:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 14px 24px -10px var(--agp-glow), inset 0 1px 0 rgb(255 255 255 / .45); }
#ag-chat#ag-chat .ag-chat-send:not(:disabled):hover svg { transform: translate(2px, -1px) rotate(-12deg); }
#ag-chat#ag-chat .ag-chat-send:not(:disabled):active { transform: scale(.94); }
#ag-chat#ag-chat .ag-chat-send:disabled { opacity: 1; filter: grayscale(1) opacity(.42); box-shadow: none; }
#ag-chat#ag-chat .ag-chat-mic { background: #f3f1fa; color: #4a5068; }
#ag-chat#ag-chat .ag-chat-mic:hover { background: #e9e5f7; color: var(--agp-c1); }
#ag-chat#ag-chat .ag-chat-mic svg { width: 18px; height: 18px; }
#ag-chat#ag-chat .ag-chat-mic.is-live { background: var(--agp-grad); color: #fff; }

#ag-chat#ag-chat .ag-chat-foot {
  padding: 0 0 10px;
  font-size: 11.5px; color: var(--agp-muted);
  background: rgb(255 255 255 / .92);
}
#ag-chat#ag-chat .ag-chat-foot a { color: var(--agp-ink); font-weight: 700; }
#ag-chat#ag-chat .ag-chat-foot a:hover { color: var(--agp-c1); text-decoration: none; }

/* ── Phones: a tall card above the launcher ───────────── */
@media (max-width: 480px) {
  #ag-chat#ag-chat { --agp-launch: 52px; }
  #ag-chat#ag-chat .ag-chat-panel {
    position: fixed;
    inset: auto 10px calc(82px + env(safe-area-inset-bottom, 0px)) 10px;
    width: auto;
    height: min(74dvh, 580px);
  }
  body.ag-cookie-open #ag-chat#ag-chat .ag-chat-panel {
    bottom: calc(82px + env(safe-area-inset-bottom, 0px) + var(--ag-cookie-h, 0px) + 12px);
  }
  #ag-chat#ag-chat .ag-chat-input { font-size: 16px; } /* no iOS zoom on focus */
}

@keyframes agp-spin     { to { transform: rotate(360deg); } }
@keyframes agp-pulse    { 0% { opacity: .5; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(1.75); } }
@keyframes agp-ping     { 0% { box-shadow: 0 0 0 0 rgb(74 222 128 / .65); } 80%, 100% { box-shadow: 0 0 0 7px rgb(74 222 128 / 0); } }
@keyframes agp-aurora   { 0%, 100% { background-position: 0 0, 0 0, 0% 0; } 50% { background-position: 0 0, 0 0, 100% 0; } }
@keyframes agp-sweep    { 0%, 55% { left: -40%; } 100% { left: 130%; } }
@keyframes agp-shine    { 0%, 60% { left: -60%; } 100% { left: 130%; } }
@keyframes agp-in-left  { from { opacity: 0; transform: translate(-10px, 8px) scale(.96); } }
@keyframes agp-in-right { from { opacity: 0; transform: translate(10px, 8px) scale(.96); } }
@keyframes agp-in-up    { from { opacity: 0; transform: translateY(8px); } }
@keyframes agp-wave     { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-6px); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  #ag-chat#ag-chat .ag-chat-launcher::before,
  #ag-chat#ag-chat .ag-chat-launcher::after,
  #ag-chat#ag-chat .ag-chat-ping,
  #ag-chat#ag-chat .ag-chat-dot,
  #ag-chat#ag-chat .ag-chat-head,
  #ag-chat#ag-chat .ag-chat-head::before,
  #ag-chat#ag-chat .ag-chip,
  #ag-chat#ag-chat .ag-chip-cta::after,
  #ag-chat#ag-chat .ag-msg { animation: none; }
  #ag-chat#ag-chat .ag-chat-panel,
  #ag-chat#ag-chat .ag-chat-launcher,
  #ag-chat#ag-chat .ag-chat-launcher svg,
  #ag-chat#ag-chat .ag-chat-close,
  #ag-chat#ag-chat .ag-chat-send { transition: opacity .12s ease; }
  #ag-chat#ag-chat .ag-typing span { animation-duration: 2.2s; }
}
