/* ---------- chat assistant (app/views/partials/chat.php, assets/js/chat.js) ---------- */
.chatbot { --cb-bottom: 24px; --cb-right: 24px; position: fixed; right: var(--cb-right); bottom: var(--cb-bottom); z-index: 110; font-size: 14.5px; }
.chatbot [hidden] { display: none !important; }
.chatbot svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* launcher */
.chatbot__launcher {
  position: relative; display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 22px 0 18px; border-radius: 30px;
  background: var(--primary); color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 18px 40px -16px rgba(18,51,46,.75), 0 0 0 6px rgba(139,208,188,.25);
  transition: transform .25s cubic-bezier(.2,.8,.2,1), background .2s, padding .25s;
  animation: cb-in .5s .6s both cubic-bezier(.2,.8,.2,1);
}
.chatbot__launcher:hover { background: var(--primary-dark); transform: translateY(-2px); }
.chatbot__launcher svg { width: 24px; height: 24px; }
.chatbot__launcher-ico--close { display: none; }
.chatbot.is-open .chatbot__launcher { padding: 0; width: 60px; justify-content: center; }
.chatbot.is-open .chatbot__launcher-ico--open, .chatbot.is-open .chatbot__launcher-label { display: none; }
.chatbot.is-open .chatbot__launcher-ico--close { display: grid; }
.chatbot__badge {
  position: absolute; top: -4px; right: -2px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: #e5484d; color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center; border: 2px solid #fff;
}
@keyframes cb-in { from { transform: translateY(30px) scale(.9); opacity: 0; } }

/* teaser bubble */
.chatbot__teaser {
  position: absolute; right: 0; bottom: 76px; width: 270px; padding: 14px 36px 14px 16px; border-radius: 18px 18px 6px 18px;
  background: #fff; box-shadow: 0 20px 44px -18px rgba(18,51,46,.45), 0 1px 3px rgba(18,51,46,.08); cursor: pointer;
  animation: cb-pop .4s cubic-bezier(.2,.8,.2,1);
}
.chatbot__teaser p { font-size: 14px; line-height: 1.45; }
.chatbot__teaser-close { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.chatbot__teaser-close svg { width: 14px; height: 14px; }
.chatbot__teaser-close:hover { background: var(--card); }
@keyframes cb-pop { from { transform: translateY(10px) scale(.96); opacity: 0; } }

/* panel */
.chatbot__panel {
  position: absolute; right: 0; bottom: 76px; width: 390px; height: min(640px, calc(100dvh - 120px));
  display: flex; flex-direction: column; overflow: hidden; border-radius: 26px; background: #fff;
  box-shadow: 0 30px 70px -24px rgba(18,51,46,.55), 0 2px 8px rgba(18,51,46,.08);
  transform-origin: bottom right; transform: translateY(14px) scale(.96); opacity: 0; visibility: hidden;
  transition: transform .3s cubic-bezier(.2,.8,.2,1), opacity .2s, visibility 0s .3s;
}
.chatbot.is-open .chatbot__panel { transform: none; opacity: 1; visibility: visible; transition: transform .3s cubic-bezier(.2,.8,.2,1), opacity .2s; }

.chatbot__head { display: flex; align-items: center; gap: 12px; padding: 16px 14px 16px 18px; background: var(--primary-dark); color: #fff; }
.chatbot__av { position: relative; flex-shrink: 0; }
.chatbot__av img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,.7); }
.chatbot__av i { position: absolute; right: 0; bottom: 1px; width: 11px; height: 11px; border-radius: 50%; background: #3ddc84; border: 2px solid var(--primary-dark); }
.chatbot__title { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.chatbot__title b { font-size: 16px; }
.chatbot__title small { font-size: 12px; color: rgba(255,255,255,.72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chatbot__icon-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: rgba(255,255,255,.85); }
.chatbot__icon-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.chatbot__icon-btn svg { width: 18px; height: 18px; }

.chatbot__log { position: relative; flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 10px; background: linear-gradient(#f7f8f6, #fff 140px); }
.chatbot__intro { display: grid; gap: 10px; }
.chatbot__msg { max-width: 86%; padding: 11px 14px; border-radius: 18px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; animation: cb-pop .25s ease-out; }
.chatbot__msg--bot { align-self: flex-start; background: var(--card); border-bottom-left-radius: 6px; }
.chatbot__msg--user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 6px; }
.chatbot__msg ul { list-style: none; display: grid; gap: 4px; margin: 4px 0; white-space: normal; }
.chatbot__msg li { position: relative; padding-left: 14px; }
.chatbot__msg li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 5px; height: 5px; border-radius: 50%; background: var(--primary); }
.chatbot__msg p + p, .chatbot__msg p + ul, .chatbot__msg ul + p { margin-top: 8px; }
.chatbot__msg p { white-space: normal; }
.chatbot__link {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 6px 12px; border-radius: 99px;
  background: #fff; border: 1.5px solid var(--mint); color: var(--primary); font-weight: 700; font-size: 13px; white-space: normal;
}
.chatbot__link::after { content: "›"; font-size: 16px; line-height: 1; }
.chatbot__link:hover { border-color: var(--mint-strong); }
.chatbot__msg--bot a[href^="tel:"] { color: var(--primary); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.chatbot__msg--error { background: #fff4e5; color: #6b4300; }
.chatbot__msg--event { align-self: center; max-width: 100%; background: var(--mint); color: var(--primary-dark); font-weight: 700; font-size: 13px; text-align: center; border-radius: 14px; }
.chatbot__note { font-size: 11.5px; color: var(--muted); line-height: 1.45; padding: 0 4px; }
.chatbot__note a, .chatbot__consent a { color: var(--primary); text-decoration: underline; }

.chatbot__typing { align-self: flex-start; display: flex; gap: 5px; padding: 14px 16px; border-radius: 18px; border-bottom-left-radius: 6px; background: var(--card); }
.chatbot__typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: cb-dot 1.2s infinite; }
.chatbot__typing i:nth-child(2) { animation-delay: .15s; }
.chatbot__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes cb-dot { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }

.chatbot__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.chatbot__chip {
  padding: 8px 13px; border-radius: 99px; border: 1.5px solid var(--mint); background: #fff;
  color: var(--primary-dark); font-weight: 700; font-size: 13px; text-align: left; transition: background .15s, border-color .15s;
}
.chatbot__chip:hover { background: var(--mint); border-color: var(--mint-strong); }

/* callback form */
.chatbot__form { align-self: stretch; display: grid; gap: 10px; padding: 16px; border-radius: 18px; background: #fff; border: 1.5px solid var(--mint); animation: cb-pop .25s ease-out; }
.chatbot__form-title { display: grid; gap: 2px; }
.chatbot__form-title b { font-size: 15px; }
.chatbot__form-title small { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.chatbot__field { display: grid; gap: 4px; }
.chatbot__field span, .chatbot__times legend { font-size: 12px; font-weight: 700; color: var(--muted); }
.chatbot__field input {
  height: 44px; padding: 0 12px; border-radius: 12px; border: 1.5px solid var(--line); font: inherit; font-size: 15px; color: var(--ink); background: #fff;
}
.chatbot__field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31,94,85,.12); }
.chatbot__field input[aria-invalid="true"] { border-color: #d64545; }
.chatbot__times { border: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chatbot__times legend { margin-bottom: 4px; }
.chatbot__times label { cursor: pointer; }
.chatbot__times input { position: absolute; opacity: 0; pointer-events: none; }
.chatbot__times span { display: block; padding: 7px 11px; border-radius: 99px; border: 1.5px solid var(--line); font-size: 12.5px; font-weight: 700; }
.chatbot__times input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.chatbot__times input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.chatbot__consent { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; line-height: 1.45; color: var(--muted); cursor: pointer; }
.chatbot__consent input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--primary); flex-shrink: 0; }
.chatbot__hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.chatbot__err { font-size: 12.5px; color: #b42318; font-weight: 600; }
.chatbot__submit { justify-content: center; height: 46px; }
.chatbot__submit svg { width: 18px; height: 18px; }
.chatbot__submit[disabled] { opacity: .6; pointer-events: none; }

/* composer + actions */
.chatbot__composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: #fff; }
.chatbot__composer textarea {
  flex: 1; resize: none; max-height: 120px; padding: 11px 14px; border-radius: 20px; border: 1.5px solid var(--line);
  font: inherit; font-size: 15px; line-height: 1.4; color: var(--ink); background: var(--card);
}
.chatbot__composer textarea:focus { outline: none; border-color: var(--mint-strong); background: #fff; }
.chatbot__send { width: 44px; height: 44px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; flex-shrink: 0; transition: background .15s, opacity .15s; }
.chatbot__send:hover { background: var(--primary-dark); }
.chatbot__send[disabled] { opacity: .45; pointer-events: none; }
.chatbot__actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 12px 12px; background: #fff; }
.chatbot__actions a, .chatbot__actions button {
  display: flex; align-items: center; justify-content: center; gap: 6px; height: 38px; border-radius: 12px;
  background: var(--card); font-weight: 700; font-size: 12.5px; color: var(--primary-dark); white-space: nowrap;
}
.chatbot__actions svg { width: 16px; height: 16px; }
.chatbot__actions a:hover, .chatbot__actions button:hover { background: var(--mint); }
.chatbot__actions a[href*="whatsapp"] { color: #188c46; }

/* mobile: launcher sits above the quick bar; the panel becomes a full-screen sheet */
@media (max-width: 900px) {
  .chatbot { --cb-right: 14px; --cb-bottom: calc(92px + env(safe-area-inset-bottom)); }
  .chatbot__launcher { height: 54px; width: 54px; padding: 0; justify-content: center; }
  .chatbot__launcher-label { display: none; }
  .chatbot__teaser { bottom: 66px; width: min(270px, calc(100vw - 28px)); }
  .chatbot__panel {
    position: fixed; inset: 0; width: auto; height: 100dvh; border-radius: 0;
    transform: translateY(100%); opacity: 1; transform-origin: bottom;
  }
  .chatbot.is-open .chatbot__launcher { display: none; }
  .chatbot__head { padding-top: calc(14px + env(safe-area-inset-top)); }
  .chatbot__actions { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .no-scroll .chatbot:not(.is-open) { display: none; }
}

@media print { .chatbot { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .chatbot__launcher, .chatbot__teaser, .chatbot__msg, .chatbot__form, .chatbot__typing i { animation: none; }
  .chatbot__panel { transition: none; }
}
