/* Website AI chatbot — loaded only when the chatbot is enabled (partials/ai-chatbot.blade.php). */
.aicb { --aicb-accent: #7c5cff; --aicb-bg: #15102b; --aicb-surface: #1e1838; --aicb-line: rgba(255, 255, 255, .1); --aicb-text: #f1eefc; --aicb-mut: #a9a2c9; --aicb-gap: 1.2rem;
    display: none; position: fixed; z-index: 80; bottom: var(--aicb-gap); inset-inline-end: var(--aicb-gap); font-family: inherit; color: var(--aicb-text); }
.aicb.is-ready { display: block; }
.aicb--start { inset-inline-end: auto; inset-inline-start: var(--aicb-gap); }
/* keep clear of the WhatsApp / call buttons that sit at the start side */
/* sits on top of the floating contact stack (Messenger / WhatsApp / call) — see partials/site-float */
.aicb { bottom: calc(var(--aicb-gap) + var(--cstack-offset, 0rem)); }
.aicb *, .aicb *::before, .aicb *::after { box-sizing: border-box; }

.aicb__launcher { position: relative; display: grid; place-items: center; width: 3.5rem; height: 3.5rem; border: 0; border-radius: 50%; cursor: pointer; color: #fff;
    background: var(--aicb-accent); box-shadow: 0 16px 34px -12px rgba(0, 0, 0, .65), inset 0 0 0 1px rgba(255, 255, 255, .18); transition: transform .25s ease; }
.aicb__launcher:hover { transform: translateY(-2px) scale(1.04); }
.aicb__launcher:focus-visible, .aicb button:focus-visible, .aicb a:focus-visible, .aicb textarea:focus-visible, .aicb input:focus-visible, .aicb__log:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.aicb__ic-close, .aicb.is-open .aicb__ic-open { display: none; }
.aicb.is-open .aicb__ic-close { display: block; }

.aicb__panel { position: absolute; bottom: calc(100% + .75rem); inset-inline-end: 0; display: flex; flex-direction: column; width: min(24rem, calc(100vw - 2 * var(--aicb-gap)));
    height: min(36rem, calc(100vh - 7rem)); height: min(36rem, calc(100dvh - 7rem)); border-radius: 20px; overflow: hidden; background: var(--aicb-bg); border: 1px solid var(--aicb-line);
    box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .75); animation: aicbIn .22s ease-out; }
.aicb--start .aicb__panel { inset-inline-end: auto; inset-inline-start: 0; }
.aicb__panel[hidden] { display: none; }
@keyframes aicbIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

.aicb__head { display: flex; align-items: center; gap: .7rem; padding: .85rem 1rem; background: linear-gradient(135deg, var(--aicb-accent), color-mix(in srgb, var(--aicb-accent) 55%, #000)); color: #fff; }
.aicb__avatar { display: grid; place-items: center; flex: none; width: 2.3rem; height: 2.3rem; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.aicb__title { flex: 1; min-width: 0; }
.aicb__title .aicb__name { margin: 0; font-size: .98rem; font-weight: 800; line-height: 1.3; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aicb__title p { margin: 0; font-size: .72rem; opacity: .85; }
.aicb__title p::before { content: ""; display: inline-block; width: .45rem; height: .45rem; margin-inline-end: .35rem; border-radius: 50%; background: #4ade80; vertical-align: middle; }
.aicb__close { display: grid; place-items: center; width: 2rem; height: 2rem; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer; }

.aicb__log { flex: 1; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: .55rem; padding: 1rem; scroll-behavior: smooth; }
.aicb__msg { max-width: 86%; padding: .6rem .8rem; border-radius: 16px; font-size: .9rem; line-height: 1.65; overflow-wrap: anywhere; }
.aicb__msg--bot { align-self: flex-start; background: var(--aicb-surface); border: 1px solid var(--aicb-line); border-end-start-radius: 4px; }
.aicb__msg--user { align-self: flex-end; background: var(--aicb-accent); color: #fff; border-end-end-radius: 4px; white-space: pre-wrap; }
.aicb__msg--error { border-color: rgba(248, 113, 113, .45); }
.aicb__msg p { margin: 0 0 .4rem; }
.aicb__msg p:last-child, .aicb__msg ul:last-child, .aicb__msg ol:last-child { margin-bottom: 0; }
.aicb__msg ul, .aicb__msg ol { margin: 0 0 .4rem; padding-inline-start: 1.1rem; }
.aicb__msg a { color: color-mix(in srgb, var(--aicb-accent) 45%, #fff); text-decoration: underline; text-underline-offset: 2px; }
.aicb__msg code { padding: .05rem .3rem; border-radius: 5px; background: rgba(255, 255, 255, .08); font-size: .85em; }
.aicb__typing { display: inline-flex; gap: .25rem; align-items: center; }
.aicb__typing i { width: .42rem; height: .42rem; border-radius: 50%; background: var(--aicb-mut); animation: aicbDot 1.1s infinite ease-in-out; }
.aicb__typing i:nth-child(2) { animation-delay: .15s; }
.aicb__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes aicbDot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.aicb__chips { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0 1rem .6rem; }
.aicb__chips:empty { display: none; }
.aicb__chip { padding: .38rem .7rem; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--aicb-accent) 55%, transparent); background: transparent; color: var(--aicb-text); font: inherit; font-size: .78rem; cursor: pointer; }
.aicb__chip:hover { background: color-mix(in srgb, var(--aicb-accent) 22%, transparent); }

.aicb__lead { display: grid; gap: .45rem; padding: .75rem; border-radius: 14px; background: var(--aicb-surface); border: 1px dashed color-mix(in srgb, var(--aicb-accent) 60%, transparent); font-size: .82rem; }
.aicb__lead input, .aicb__lead textarea { width: 100%; padding: .5rem .65rem; border-radius: 10px; border: 1px solid var(--aicb-line); background: var(--aicb-bg); color: var(--aicb-text); font: inherit; font-size: .85rem; }
.aicb__lead-actions { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.aicb__btn { padding: .45rem .9rem; border: 0; border-radius: 10px; background: var(--aicb-accent); color: #fff; font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer; text-decoration: none; }
.aicb__btn--ghost { background: transparent; border: 1px solid var(--aicb-line); color: var(--aicb-text); }
.aicb__btn[disabled] { opacity: .6; cursor: progress; }

.aicb__form { display: flex; align-items: flex-end; gap: .5rem; padding: .7rem .8rem; border-top: 1px solid var(--aicb-line); background: var(--aicb-bg); }
.aicb__input { flex: 1; min-height: 2.6rem; max-height: 7.5rem; resize: none; padding: .62rem .8rem; border-radius: 14px; border: 1px solid var(--aicb-line); background: var(--aicb-surface); color: var(--aicb-text); font: inherit; font-size: .9rem; line-height: 1.4; }
.aicb__input::placeholder { color: var(--aicb-mut); }
.aicb__send { display: grid; place-items: center; flex: none; width: 2.6rem; height: 2.6rem; border: 0; border-radius: 50%; background: var(--aicb-accent); color: #fff; cursor: pointer; }
.aicb__send[disabled] { opacity: .5; cursor: progress; }
[dir="rtl"] .aicb__send svg { transform: scaleX(-1); }
.aicb__foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .3rem .8rem; padding: .45rem .9rem .6rem; font-size: .68rem; color: var(--aicb-mut); background: var(--aicb-bg); }
.aicb__foot a { color: var(--aicb-text); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.aicb__sr, .aicb__hp { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

@media (max-width: 480px) {
    .aicb { --aicb-gap: .9rem; }
    .aicb.is-open .aicb__panel { position: fixed; inset: auto .5rem .5rem .5rem; width: auto; height: min(36rem, calc(100dvh - 1rem)); }
    .aicb.is-open .aicb__launcher { visibility: hidden; }
}
@media (prefers-reduced-motion: reduce) {
    .aicb__panel, .aicb__typing i { animation: none; }
    .aicb__launcher, .aicb__log { transition: none; scroll-behavior: auto; }
}


/* ---------- launcher motion: pop-in, rotating halo, breathing glow, "typing" dots ---------- */
.aicb__launcher {
    --aicb-shadow: 0 16px 34px -12px rgba(0, 0, 0, .65), inset 0 0 0 1px rgba(255, 255, 255, .18);
    background: linear-gradient(135deg, var(--aicb-accent), color-mix(in srgb, var(--aicb-accent) 55%, #ff7a6b));
    animation: aicbPop .7s cubic-bezier(.34, 1.56, .64, 1) .5s both, aicbGlow 3.2s ease-out 2s infinite;
}
.aicb__launcher::before {
    content: ""; position: absolute; inset: -5px; border-radius: 50%; pointer-events: none;
    background: conic-gradient(from 0deg, transparent 0 12%, var(--aicb-accent) 38%, #ffb547 58%, #ff7a6b 74%, transparent 92%);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
    animation: aicbSpin 3.6s linear infinite;
}
.aicb__ic-open { animation: aicbNod 7s ease-in-out 3s infinite; transform-origin: 50% 60%; }
.aicb__dot { animation: aicbDotPulse 1.5s ease-in-out infinite; }
.aicb__dot:nth-of-type(2) { animation-delay: .18s; }
.aicb__dot:nth-of-type(3) { animation-delay: .36s; }
.aicb.is-open .aicb__launcher { animation: none; box-shadow: var(--aicb-shadow); }
.aicb.is-open .aicb__launcher::before { display: none; }
@keyframes aicbPop { from { opacity: 0; scale: .3; rotate: -25deg; } to { opacity: 1; scale: 1; rotate: 0deg; } }
@keyframes aicbGlow {
    0% { box-shadow: var(--aicb-shadow), 0 0 0 0 color-mix(in srgb, var(--aicb-accent) 55%, transparent); }
    70%, 100% { box-shadow: var(--aicb-shadow), 0 0 0 16px color-mix(in srgb, var(--aicb-accent) 0%, transparent); }
}
@keyframes aicbSpin { to { rotate: 360deg; } }
@keyframes aicbNod { 0%, 86%, 100% { rotate: 0deg; } 89% { rotate: -12deg; } 92% { rotate: 10deg; } 95% { rotate: -5deg; } }
@keyframes aicbDotPulse { 0%, 60%, 100% { opacity: .35; } 30% { opacity: 1; } }

/* ---------- teaser bubble: typing dots → typed message → progress bar → next ---------- */
.aicb__teaser { position: absolute; bottom: .2rem; inset-inline-end: calc(100% + .8rem); display: flex; align-items: center; gap: .6rem;
    width: min(18rem, calc(100vw - 6.5rem)); min-height: 3.4rem; padding: .7rem .5rem .85rem .75rem; border-radius: 18px 18px 5px 18px; overflow: hidden;
    background: #fff; color: #1b1433; border: 1px solid color-mix(in srgb, var(--aicb-accent) 22%, transparent);
    box-shadow: 0 22px 46px -16px rgba(0, 0, 0, .6), 0 0 0 4px color-mix(in srgb, var(--aicb-accent) 10%, transparent);
    transform-origin: 100% 100%; transition: translate .3s ease, box-shadow .3s ease; }
[dir="rtl"] .aicb__teaser { border-radius: 18px 18px 18px 5px; padding: .7rem .75rem .85rem .5rem; transform-origin: 0 100%; }
.aicb--start .aicb__teaser { inset-inline-end: auto; inset-inline-start: calc(100% + .8rem); }
.aicb__teaser[hidden] { display: none; }
.aicb__teaser:hover { translate: 0 -2px; box-shadow: 0 26px 50px -16px rgba(0, 0, 0, .65), 0 0 0 4px color-mix(in srgb, var(--aicb-accent) 18%, transparent); }
.aicb__teaser.is-in { animation: aicbTeaser .55s cubic-bezier(.34, 1.56, .64, 1) both; }
.aicb__teaser.is-out { animation: aicbTeaserOut .3s ease-in both; }
.aicb.is-open .aicb__teaser { display: none; }

.aicb__teaser-avatar { position: relative; flex: none; display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; color: #fff;
    background: linear-gradient(135deg, var(--aicb-accent), color-mix(in srgb, var(--aicb-accent) 50%, #ff7a6b)); }
.aicb__teaser-avatar svg { animation: aicbTwinkle 2.6s ease-in-out infinite; }
.aicb__teaser-avatar::after { content: ""; position: absolute; bottom: 0; inset-inline-end: 0; width: .6rem; height: .6rem; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 2px #fff; }

.aicb__teaser-text { flex: 1; min-width: 0; border: 0; background: none; padding: 0; color: inherit; font: inherit; font-size: .9rem; font-weight: 600; line-height: 1.55; text-align: start; cursor: pointer; }
.aicb__teaser-msg { display: inline; transition: opacity .25s ease, filter .25s ease; }
.aicb__teaser.is-swap .aicb__teaser-msg { opacity: 0; filter: blur(4px); }
.aicb__teaser.is-writing .aicb__teaser-msg::after { content: ""; display: inline-block; width: 2px; height: 1.05em; margin-inline-start: 2px; vertical-align: -.18em; border-radius: 2px; background: var(--aicb-accent); animation: aicbCaret .8s steps(1) infinite; }
.aicb__teaser-typing { display: none; gap: .28rem; align-items: center; height: 1.4rem; padding-inline: .15rem; }
.aicb__teaser-typing i { width: .42rem; height: .42rem; border-radius: 50%; background: color-mix(in srgb, var(--aicb-accent) 70%, #fff); animation: aicbDot 1s infinite ease-in-out; }
.aicb__teaser-typing i:nth-child(2) { animation-delay: .15s; }
.aicb__teaser-typing i:nth-child(3) { animation-delay: .3s; }
.aicb__teaser.is-typing .aicb__teaser-typing { display: inline-flex; }
.aicb__teaser.is-typing .aicb__teaser-msg { display: none; }

.aicb__teaser-close { flex: none; align-self: flex-start; border: 0; background: none; color: #8a83a8; font-size: 1.15rem; line-height: 1; cursor: pointer; padding: 0 .15rem; border-radius: 6px; transition: color .2s ease, background .2s ease; }
.aicb__teaser-close:hover { color: #1b1433; background: rgba(27, 20, 51, .07); }

.aicb__teaser-bar { position: absolute; inset-inline: 0; bottom: 0; height: 3px; background: color-mix(in srgb, var(--aicb-accent) 10%, transparent); }
.aicb__teaser-bar i { display: block; height: 100%; scale: 0 1; transform-origin: 0 50%; background: linear-gradient(90deg, var(--aicb-accent), #ffb547, #ff7a6b); }
[dir="rtl"] .aicb__teaser-bar i { transform-origin: 100% 50%; background: linear-gradient(270deg, var(--aicb-accent), #ffb547, #ff7a6b); }
.aicb__teaser.is-holding .aicb__teaser-bar i { animation: aicbBar var(--aicb-hold, 5s) linear forwards; }
.aicb__teaser.is-paused .aicb__teaser-bar i { animation-play-state: paused; }

.aicb.has-teaser .aicb__launcher::after { content: ""; position: absolute; top: .1rem; inset-inline-end: .1rem; width: .75rem; height: .75rem; border-radius: 50%; background: #ff4d6d; box-shadow: 0 0 0 2px #fff; animation: aicbBadge 1.8s ease-out infinite; }

@keyframes aicbTeaser { from { opacity: 0; transform: translateY(10px) scale(.85); } to { opacity: 1; transform: none; } }
@keyframes aicbTeaserOut { to { opacity: 0; transform: translateY(6px) scale(.92); } }
@keyframes aicbCaret { 50% { opacity: 0; } }
@keyframes aicbBar { from { scale: 0 1; } to { scale: 1 1; } }
@keyframes aicbTwinkle { 0%, 100% { rotate: 0deg; scale: 1; } 50% { rotate: 15deg; scale: 1.15; } }
@keyframes aicbBadge { 0% { box-shadow: 0 0 0 2px #fff, 0 0 0 2px rgba(255, 77, 109, .6); } 100% { box-shadow: 0 0 0 2px #fff, 0 0 0 10px rgba(255, 77, 109, 0); } }

@media (max-width: 480px) {
    .aicb__teaser { width: min(15.5rem, calc(100vw - 5.5rem)); }
    .aicb__teaser-text { font-size: .85rem; }
    .aicb__teaser-avatar { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .aicb__launcher, .aicb__launcher::before, .aicb__ic-open, .aicb__dot, .aicb__teaser-avatar svg, .aicb.has-teaser .aicb__launcher::after,
    .aicb__teaser.is-in, .aicb__teaser.is-out, .aicb__teaser-typing i, .aicb__teaser.is-holding .aicb__teaser-bar i { animation: none; }
    .aicb__launcher::before, .aicb__teaser-bar { display: none; }
}

/* ---------- same effects, drawn on the GPU (no box-shadow animation) ---------- */
.aicb__launcher { animation: aicbPop .7s cubic-bezier(.34, 1.56, .64, 1) .5s both; }
.aicb__halo, .aicb__ping { position: absolute; border-radius: 50%; pointer-events: none; opacity: 0; }
/* glow: spreads 16px around the button and fades */
.aicb__halo { inset: 0; z-index: -1; background: color-mix(in srgb, var(--aicb-accent) 55%, transparent); animation: aicbHalo 3.2s ease-out 2s infinite; }
@keyframes aicbHalo { 0% { opacity: 1; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(1.57); } }
/* ping under the new-message badge */
.aicb__ping { display: none; top: .1rem; inset-inline-end: .1rem; width: .75rem; height: .75rem; background: rgba(255, 77, 109, .6); }
.aicb.has-teaser .aicb__ping { display: block; animation: aicbPing 1.8s ease-out infinite; }
.aicb.has-teaser .aicb__launcher::after { animation: none; }
@keyframes aicbPing { 0% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(2.67); } }
.aicb.is-open .aicb__halo, .aicb.is-open .aicb__ping { display: none; }

/* looping effects wait for the visitor's first interaction (the loader adds .is-live) */
.aicb:not(.is-live) .aicb__halo, .aicb:not(.is-live) .aicb__launcher::before, .aicb:not(.is-live) .aicb__ic-open,
.aicb:not(.is-live) .aicb__dot { animation-play-state: paused; }

@media (prefers-reduced-motion: reduce) { .aicb__halo, .aicb.has-teaser .aicb__ping { animation: none; } }
