/*
 * Ayansh Admission Assistant — floating chat widget (bottom-left by default, or bottom-right).
 * Shared by the React pages (index.php) and the PHP pages (includes/footer.php). All classes are prefixed "ayc-".
 * Colour (Admin → Chatbot → Design) is a class .ayc-c-<name> that sets the tokens below; no looping animations.
 */
.ayc-root {
  --ayc-off: 0px;    /* cookie banner / mobile apply bar under the widget */
  --ayc-raise: 0px;  /* right side: the site's floating WhatsApp / back-to-top buttons */
  /* Colour tokens (indigo = default) */
  --ayc-a1: #4338ca; --ayc-a2: #7c3aed; --ayc-a1h: #3730a3; --ayc-a2h: #6d28d9;              /* user bubble, send, form button */
  --ayc-h1: #142b50; --ayc-h2: #312e81; --ayc-h3: #5b21b6; --ayc-h4: #9d174d; --ayc-glow: rgb(236 72 153 / .45); /* header */
  --ayc-link: #6d28d9; --ayc-mark: #7c3aed; --ayc-focus: #8b5cf6; --ayc-ring: rgb(139 92 246 / .2);
  --ayc-tint: #ede9fe; --ayc-soft2: #f5f3ff; --ayc-mid: #c4b5fd; --ayc-ink2: #5b21b6; --ayc-bg: #f8f7fc;
  position: fixed; left: 16px; bottom: calc(var(--ayc-off) + var(--ayc-raise) + 16px); z-index: 75; font-family: inherit;
  transition: bottom .2s cubic-bezier(.2,.8,.2,1);
}
.ayc-root.ayc-c-violet  { --ayc-a1: #6d28d9; --ayc-a2: #a21caf; --ayc-a1h: #5b21b6; --ayc-a2h: #86198f;
  --ayc-h1: #2e1065; --ayc-h2: #4c1d95; --ayc-h3: #6d28d9; --ayc-h4: #a21caf; --ayc-glow: rgb(232 121 249 / .4);
  --ayc-link: #6d28d9; --ayc-mark: #8b5cf6; --ayc-focus: #a78bfa; --ayc-ring: rgb(167 139 250 / .25);
  --ayc-tint: #ede9fe; --ayc-soft2: #f5f3ff; --ayc-mid: #c4b5fd; --ayc-ink2: #5b21b6; --ayc-bg: #faf8fe; }
.ayc-root.ayc-c-blue    { --ayc-a1: #1d4ed8; --ayc-a2: #0369a1; --ayc-a1h: #1e40af; --ayc-a2h: #075985;
  --ayc-h1: #0b1f44; --ayc-h2: #1e3a8a; --ayc-h3: #1d4ed8; --ayc-h4: #0369a1; --ayc-glow: rgb(56 189 248 / .4);
  --ayc-link: #1d4ed8; --ayc-mark: #2563eb; --ayc-focus: #3b82f6; --ayc-ring: rgb(59 130 246 / .2);
  --ayc-tint: #dbeafe; --ayc-soft2: #eff6ff; --ayc-mid: #93c5fd; --ayc-ink2: #1e40af; --ayc-bg: #f6f9fe; }
.ayc-root.ayc-c-emerald { --ayc-a1: #047857; --ayc-a2: #0f766e; --ayc-a1h: #065f46; --ayc-a2h: #115e59;
  --ayc-h1: #022c22; --ayc-h2: #064e3b; --ayc-h3: #047857; --ayc-h4: #0f766e; --ayc-glow: rgb(52 211 153 / .35);
  --ayc-link: #047857; --ayc-mark: #059669; --ayc-focus: #10b981; --ayc-ring: rgb(16 185 129 / .2);
  --ayc-tint: #d1fae5; --ayc-soft2: #ecfdf5; --ayc-mid: #6ee7b7; --ayc-ink2: #065f46; --ayc-bg: #f5fbf8; }
.ayc-root.ayc-c-rose    { --ayc-a1: #be123c; --ayc-a2: #be185d; --ayc-a1h: #9f1239; --ayc-a2h: #9d174d;
  --ayc-h1: #4c0519; --ayc-h2: #881337; --ayc-h3: #be123c; --ayc-h4: #c2410c; --ayc-glow: rgb(251 146 60 / .35);
  --ayc-link: #be123c; --ayc-mark: #e11d48; --ayc-focus: #f43f5e; --ayc-ring: rgb(244 63 94 / .2);
  --ayc-tint: #ffe4e6; --ayc-soft2: #fff1f2; --ayc-mid: #fda4af; --ayc-ink2: #9f1239; --ayc-bg: #fdf7f8; }
.ayc-root.ayc-c-orange  { --ayc-a1: #c2410c; --ayc-a2: #b45309; --ayc-a1h: #9a3412; --ayc-a2h: #92400e;
  --ayc-h1: #431407; --ayc-h2: #7c2d12; --ayc-h3: #c2410c; --ayc-h4: #b45309; --ayc-glow: rgb(251 191 36 / .35);
  --ayc-link: #c2410c; --ayc-mark: #ea580c; --ayc-focus: #f97316; --ayc-ring: rgb(249 115 22 / .2);
  --ayc-tint: #ffedd5; --ayc-soft2: #fff7ed; --ayc-mid: #fdba74; --ayc-ink2: #9a3412; --ayc-bg: #fdf9f5; }
.ayc-root.ayc-c-teal    { --ayc-a1: #0f766e; --ayc-a2: #0e7490; --ayc-a1h: #115e59; --ayc-a2h: #155e75;
  --ayc-h1: #042f2e; --ayc-h2: #134e4a; --ayc-h3: #0f766e; --ayc-h4: #0e7490; --ayc-glow: rgb(45 212 191 / .35);
  --ayc-link: #0f766e; --ayc-mark: #0d9488; --ayc-focus: #14b8a6; --ayc-ring: rgb(20 184 166 / .2);
  --ayc-tint: #ccfbf1; --ayc-soft2: #f0fdfa; --ayc-mid: #5eead4; --ayc-ink2: #115e59; --ayc-bg: #f4fbfa; }

@media (min-width: 640px) { .ayc-root { left: 24px; bottom: calc(var(--ayc-off) + var(--ayc-raise) + 24px); } }
/* Right side: mirror the dock, greeting bubble and panel */
.ayc-root.is-right { left: auto; right: 16px; }
@media (min-width: 640px) { .ayc-root.is-right { left: auto; right: 24px; } }
/* The open panel ignores the floating buttons and covers them */
.ayc-root.is-open { bottom: calc(var(--ayc-off) + 16px); }
@media (min-width: 640px) { .ayc-root.is-open { bottom: calc(var(--ayc-off) + 24px); } }
.ayc-root.is-off { display: none !important; }
/* While the right-hand panel is open, the site's own floating WhatsApp / back-to-top buttons would peek out under it */
html.ayc-right-open #wa-float, html.ayc-right-open #backToTop,
html.ayc-right-open a[aria-label="Chat with us on WhatsApp"], html.ayc-right-open button[aria-label="Back to top"] { visibility: hidden !important; }
.ayc-root *, .ayc-root *::before, .ayc-root *::after { box-sizing: border-box; }
.ayc-root svg { flex-shrink: 0; }

/* Dock (closed state) */
.ayc-dock { position: relative; display: grid; place-items: center; width: 60px; height: 60px; padding: 0; border: 0; border-radius: 9999px; background: #fff; cursor: pointer;
  box-shadow: 0 14px 32px -12px rgb(30 27 75 / .6), 0 0 0 3px #10b981; transition: transform .15s ease-out, box-shadow .15s; }
.ayc-dock:hover { transform: translateY(-2px); box-shadow: 0 18px 36px -12px rgb(30 27 75 / .65), 0 0 0 3px #10b981; }
.ayc-dock:focus-visible { outline: 3px solid var(--ayc-focus); outline-offset: 4px; }
.ayc-dock .ayc-avatar { width: 52px; height: 52px; }
.ayc-online { position: absolute; right: 1px; bottom: 3px; width: 14px; height: 14px; border-radius: 9999px; background: #22c55e; box-shadow: 0 0 0 2.5px #fff; }
.ayc-root.is-open .ayc-dock, .ayc-root.is-open .ayc-hello { display: none; }

/* Greeting bubble */
/* The bubble sits inside the 60px dock, so it must size to its text (max-content), not to the dock */
.ayc-hello { position: absolute; left: 72px; bottom: 6px; display: flex; align-items: center; gap: 10px; width: max-content; max-width: min(280px, calc(100vw - 104px));
  padding: 10px 8px 10px 14px; border-radius: 14px 14px 14px 4px; background: #fff; color: #0f172a; font-size: 14px; font-weight: 600; line-height: 1.4;
  white-space: normal; text-wrap: pretty; box-shadow: 0 12px 28px -12px rgb(15 23 42 / .4), 0 0 0 1px var(--ayc-tint); cursor: pointer; }
.ayc-hello::before { content: ""; position: absolute; left: -6px; bottom: 10px; width: 12px; height: 12px; background: #fff; transform: rotate(45deg); border-radius: 2px;
  box-shadow: -1px 1px 0 var(--ayc-tint); }
.ayc-root.is-right .ayc-hello { left: auto; right: 72px; border-radius: 14px 14px 4px 14px; }
.ayc-root.is-right .ayc-hello::before { left: auto; right: -6px; box-shadow: 1px -1px 0 var(--ayc-tint); }
.ayc-hello > span { position: relative; }
.ayc-hello:hover { box-shadow: 0 14px 30px -12px rgb(15 23 42 / .45), 0 0 0 1px var(--ayc-mid); }
.ayc-hello[hidden] { display: none; }
.ayc-hello-x { display: grid; place-items: center; width: 24px; height: 24px; flex-shrink: 0; border: 0; border-radius: 9999px; background: #f1f5f9; color: #64748b; cursor: pointer; }
.ayc-hello-x:hover { background: #e2e8f0; color: #0f172a; }

/* Panel */
.ayc-panel { position: absolute; left: 0; bottom: 0; display: flex; flex-direction: column; width: 392px; height: min(640px, calc(100vh - var(--ayc-off) - 48px)); overflow: hidden;
  border-radius: 20px; background: var(--ayc-bg); box-shadow: 0 24px 60px -16px rgb(15 23 42 / .45), 0 0 0 1px rgb(15 23 42 / .06); }
.ayc-root.is-right .ayc-panel { left: auto; right: 0; }
.ayc-panel[hidden] { display: none; }
@media (max-width: 479px) {
  .ayc-root.is-open { left: 0; right: 0; bottom: 0; top: 0; }
  .ayc-panel, .ayc-root.is-right .ayc-panel { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; }
}

.ayc-head { position: relative; display: flex; align-items: center; gap: 10px; padding: 12px 10px 12px 14px; color: #fff; overflow: hidden;
  background: radial-gradient(18rem 10rem at 100% 0%, var(--ayc-glow), transparent 60%), linear-gradient(125deg, var(--ayc-h1) 0%, var(--ayc-h2) 40%, var(--ayc-h3) 72%, var(--ayc-h4) 100%); }
.ayc-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg,#6366f1,#a855f7,#ec4899,#f97316,#eab308,#10b981,#06b6d4); }
.ayc-head-av { position: relative; display: grid; place-items: center; width: 42px; height: 42px; flex-shrink: 0; border-radius: 9999px; background: #fff; box-shadow: 0 0 0 2px rgb(255 255 255 / .35); }
.ayc-head-av .ayc-avatar { width: 38px; height: 38px; }
.ayc-head-av .ayc-online { width: 11px; height: 11px; right: -1px; bottom: 0; box-shadow: 0 0 0 2px var(--ayc-h2); }
.ayc-title { min-width: 0; flex: 1; }
.ayc-title strong { display: block; font-size: 14px; font-weight: 700; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ayc-title span { display: flex; align-items: center; gap: 6px; font-size: 12px; color: rgb(255 255 255 / .8); }
.ayc-title span::before { content: ""; width: 7px; height: 7px; border-radius: 9999px; background: #4ade80; }
.ayc-hbtn { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 10px; background: transparent; color: rgb(255 255 255 / .9); cursor: pointer; text-decoration: none; }
.ayc-hbtn:hover { background: rgb(255 255 255 / .14); color: #fff; }
.ayc-hbtn:focus-visible { outline: 2px solid #fde68a; outline-offset: 1px; }

/* Messages */
.ayc-log { flex: 1; overflow-y: auto; padding: 16px 14px 8px; scroll-behavior: smooth; overscroll-behavior: contain; }
.ayc-row { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 12px; }
.ayc-row.is-user { justify-content: flex-end; }
.ayc-row-av { width: 28px; height: 28px; flex-shrink: 0; border-radius: 9999px; background: #fff; display: grid; place-items: center; box-shadow: 0 1px 3px rgb(15 23 42 / .12); }
.ayc-row-av .ayc-avatar { width: 26px; height: 26px; }
.ayc-row.is-cont .ayc-row-av { visibility: hidden; }
.ayc-bubble { max-width: 84%; padding: 11px 14px; border-radius: 16px 16px 16px 4px; background: #fff; color: #334155; font-size: 14px; line-height: 1.5;
  box-shadow: 0 1px 2px rgb(15 23 42 / .06); border: 1px solid var(--ayc-tint); overflow-wrap: anywhere; }
.ayc-row.is-user .ayc-bubble { border: 0; border-radius: 16px 16px 4px 16px; color: #fff; background: linear-gradient(135deg, var(--ayc-a1), var(--ayc-a2)); }
.ayc-bubble p { margin: 0; }
.ayc-bubble p + p, .ayc-bubble p + ul, .ayc-bubble ul + p, .ayc-bubble p + ol, .ayc-bubble ol + p, .ayc-bubble ul + ul, .ayc-bubble ol + ol { margin-top: 6px; }
.ayc-bubble h4 { margin: 0 0 4px; font-size: 15px; font-weight: 700; color: #0f172a; }
.ayc-bubble ul, .ayc-bubble ol { margin: 4px 0 0; padding-left: 18px; }
.ayc-bubble ul { list-style: disc; }
.ayc-bubble ol { list-style: decimal; }
.ayc-bubble li + li { margin-top: 3px; }
.ayc-bubble li::marker { color: var(--ayc-mark); }
.ayc-bubble strong { color: #0f172a; font-weight: 600; }
.ayc-bubble a { color: var(--ayc-link); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.ayc-typing { color: #64748b; font-style: italic; }

/* Course cards inside answers */
.ayc-cards { display: grid; gap: 8px; margin-top: 8px; }
.ayc-card { display: block; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--ayc-line, #ddd6fe); background: var(--ayc-soft, #f5f3ff); text-decoration: none !important; color: inherit; position: relative; overflow: hidden; }
.ayc-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--ayc-tone, #7c3aed); }
.ayc-card:hover { filter: brightness(.98); }
.ayc-card-t { display: block; font-size: 14px; font-weight: 700; color: #0f172a !important; text-decoration: none; }
.ayc-card-m { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; font-size: 12.5px; color: #475569; font-weight: 500; }
.ayc-card-m b { color: var(--ayc-ink, #5b21b6); font-weight: 700; }
.ayc-card-m s { color: #94a3b8; }

/* Quick replies / action buttons */
.ayc-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 14px 36px; }
.ayc-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 13px; border-radius: 9999px; border: 1px solid #e2e8f0; background: #fff; color: #1e293b;
  font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, color .15s; }
.ayc-chip:hover { border-color: var(--ayc-mid); background: var(--ayc-soft2); color: var(--ayc-ink2); }
.ayc-chip:focus-visible { outline: 2px solid var(--ayc-focus); outline-offset: 2px; }
.ayc-chip.is-wa { border-color: #86efac; color: #166534; }
.ayc-chip.is-wa:hover { background: #f0fdf4; }
.ayc-chip.is-cta { border: 0; color: #0f172a; font-weight: 700; background: linear-gradient(135deg, #fcd34d, #fb923c 55%, #f472b6); }
.ayc-chip.is-cta:hover { background: linear-gradient(135deg, #fbbf24, #f97316 55%, #ec4899); color: #0f172a; }
.ayc-chip svg { flex-shrink: 0; }
.ayc-hlogo { width: 36px; height: 36px; border-radius: 9999px; transition: background .15s, transform .15s; }
.ayc-hlogo:hover { background: rgb(255 255 255 / .16); transform: scale(1.06); }
.ayc-hlogo svg { border-radius: 9999px; box-shadow: 0 0 0 2px rgb(255 255 255 / .85); }

/* Call-back form */
.ayc-form { display: grid; gap: 8px; margin-top: 8px; }
.ayc-field { display: grid; gap: 4px; }
.ayc-form input, .ayc-form select { width: 100%; height: 40px; padding: 0 10px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; font: inherit; font-size: 14px; color: #0f172a; }
.ayc-form input:focus, .ayc-form select:focus { outline: 0; border-color: var(--ayc-focus); box-shadow: 0 0 0 3px var(--ayc-ring); }
.ayc-form [aria-invalid="true"] { border-color: #dc2626; }
.ayc-form [aria-invalid="true"]:focus { border-color: #dc2626; box-shadow: 0 0 0 3px rgb(220 38 38 / .15); }
.ayc-form .ayc-err, .ayc-form .ayc-ferr { margin: 0; font-size: 12px; color: #dc2626; }
.ayc-form .ayc-ferr[hidden], .ayc-form .ayc-err[hidden] { display: none; }
.ayc-form button { height: 40px; border: 0; border-radius: 10px; font: inherit; font-size: 14px; font-weight: 700; color: #fff; cursor: pointer; background: linear-gradient(135deg, var(--ayc-a1), var(--ayc-a2)); }
.ayc-form button[disabled] { opacity: .6; cursor: default; }

/* Composer */
.ayc-compose { padding: 10px 12px 6px; background: #fff; border-top: 1px solid var(--ayc-tint); }
.ayc-inputwrap { display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 14px; border: 1.5px solid #e2e8f0; border-radius: 14px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.ayc-inputwrap:focus-within { border-color: var(--ayc-focus); box-shadow: 0 0 0 3px var(--ayc-ring); }
.ayc-input { flex: 1; min-width: 0; height: 40px; border: 0; outline: 0; background: transparent; font: inherit; font-size: 15px; color: #0f172a; }
.ayc-input::placeholder { color: #94a3b8; }
.ayc-ibtn { display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 10px; background: transparent; color: #64748b; cursor: pointer; }
.ayc-ibtn:hover { background: #f1f5f9; color: #0f172a; }
.ayc-ibtn.is-on { color: #dc2626; background: #fef2f2; }
.ayc-send { color: #fff; background: linear-gradient(135deg, var(--ayc-a1), var(--ayc-a2)); }
.ayc-send:hover { color: #fff; background: linear-gradient(135deg, var(--ayc-a1h), var(--ayc-a2h)); }
.ayc-send[disabled] { background: #e2e8f0; color: #94a3b8; cursor: default; }
.ayc-meta { display: flex; justify-content: space-between; gap: 8px; padding: 6px 4px 2px; font-size: 11px; color: #94a3b8; }
.ayc-meta b { color: #64748b; font-weight: 600; }
.ayc-meta a { color: inherit; text-decoration: none; }
.ayc-meta a:hover b { color: #334155; }

@media (prefers-reduced-motion: reduce) { .ayc-root, .ayc-dock, .ayc-log { transition: none !important; scroll-behavior: auto !important; } }
@media print { .ayc-root { display: none !important; } }

/* Photo avatar (assets/chatbot/avatar.webp) */
.ayc-photo { display: block; border-radius: 9999px; object-fit: cover; object-position: 50% 20%; background: var(--ayc-tint); }
