/* ==========================================================
   Website chat assistant ("Termi") — shared on every page
   ========================================================== */
.chatbot { position: fixed; right: 22px; bottom: 22px; z-index: 1000; font-family: var(--font-body); }
.chatbot[data-state="open"] ~ .whatsapp-float { display: none; }

/* the WhatsApp button sits above the chat button */
.whatsapp-float { bottom: 94px; }

.chatbot__launcher {
    width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
    background: var(--navy); color: var(--amber);
    display: grid; place-items: center;
    box-shadow: 0 12px 26px -8px rgba(12, 19, 26, .6), inset 0 0 0 2px var(--gold);
    transition: transform .25s var(--ease), background .2s;
}
.chatbot__launcher:hover { transform: scale(1.06); }
.chatbot__launcher:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
.chatbot__icon-close { display: none; }
.chatbot[data-state="open"] .chatbot__icon-open { display: none; }
.chatbot[data-state="open"] .chatbot__icon-close { display: block; }

/* small invitation bubble */
.chatbot__teaser {
    position: absolute; right: 70px; bottom: 10px; display: flex; align-items: center; gap: 4px;
    background: var(--white); color: var(--ink); border-radius: 14px 14px 4px 14px;
    box-shadow: var(--shadow); padding: 4px 4px 4px 14px; white-space: nowrap;
    animation: chat-pop .35s var(--ease);
}
.chatbot__teaser[hidden] { display: none; }
.chatbot__teaser-text { border: 0; background: none; font: inherit; font-size: .9rem; font-weight: 500; color: inherit; cursor: pointer; padding: 6px 0; }
.chatbot__teaser-x { border: 0; background: none; font-size: 1.2rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 8px; }

/* panel */
.chatbot__panel {
    position: absolute; right: 0; bottom: 74px;
    width: 370px; height: min(600px, calc(100vh - 120px));
    display: flex; flex-direction: column;
    background: var(--cream); border-radius: 20px; overflow: hidden;
    box-shadow: 0 30px 60px -20px rgba(12, 19, 26, .55), 0 0 0 1px rgba(12, 19, 26, .06);
    animation: chat-pop .28s var(--ease);
}
.chatbot__panel[hidden] { display: none; }
@keyframes chat-pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.chatbot__head {
    display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px;
    background: var(--navy); color: var(--white);
    border-bottom: 3px solid var(--amber);
}
.chatbot__avatar { border-radius: 10px; flex: none; }
.chatbot__who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.chatbot__who strong { font-size: .95rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chatbot__status { font-size: .75rem; color: var(--amber-soft); }
.chatbot__close, .chatbot__restart {
    border: 0; background: transparent; color: rgba(255, 255, 255, .8); cursor: pointer;
    width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; flex: none;
}
.chatbot__close:hover, .chatbot__restart:hover { background: rgba(255, 255, 255, .1); color: var(--white); }

/* messages */
.chatbot__log { flex: 1; overflow-y: auto; padding: 16px 14px 6px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.chatmsg { display: flex; }
.chatmsg--user { justify-content: flex-end; }
.chatmsg__bubble {
    max-width: 85%; padding: 10px 13px; border-radius: 16px; font-size: .9rem; line-height: 1.5;
    overflow-wrap: anywhere;
}
.chatmsg--bot .chatmsg__bubble { background: var(--white); color: var(--ink); border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(12, 19, 26, .08); }
.chatmsg--user .chatmsg__bubble { background: var(--navy); color: var(--white); border-bottom-right-radius: 4px; }
.chatmsg__bubble strong { font-weight: 600; }
.chatmsg__links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chatmsg__link {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px;
    font-size: .85rem; font-weight: 600; text-decoration: none;
}
.chatmsg__link--whatsapp { background: #25d366; color: #fff; }
.chatmsg__link--call { background: var(--amber); color: var(--navy); }
.chatmsg__link:hover { filter: brightness(.95); }

.chatmsg__typing { display: inline-flex; gap: 4px; padding: 13px 14px; }
.chatmsg__typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .5; animation: chat-dot 1s infinite; }
.chatmsg__typing span:nth-child(2) { animation-delay: .15s; }
.chatmsg__typing span:nth-child(3) { animation-delay: .3s; }
@keyframes chat-dot { 0%, 60%, 100% { transform: none; opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }

/* quick buttons */
.chatbot__chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 6px 14px 10px; max-height: 132px; overflow-y: auto; }
.chatbot__chips:empty { display: none; }
.chatchip {
    border: 1.5px solid var(--gold); background: var(--white); color: var(--navy);
    border-radius: 999px; padding: 7px 13px; font: inherit; font-size: .82rem; font-weight: 500; cursor: pointer;
    transition: background .15s, color .15s;
}
.chatchip:hover, .chatchip:focus-visible { background: var(--navy); color: var(--amber); border-color: var(--navy); outline: none; }

/* input */
.chatbot__form { display: flex; gap: 8px; padding: 10px 12px; background: var(--white); border-top: 1px solid var(--line); }
.chatbot__form input {
    flex: 1; min-width: 0; border: 1.5px solid var(--line); border-radius: 999px; padding: 10px 15px;
    font: inherit; font-size: .9rem; color: var(--ink); background: var(--cream);
}
.chatbot__form input:focus { outline: none; border-color: var(--gold); background: var(--white); }
.chatbot__send {
    width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer; flex: none;
    background: var(--amber); color: var(--navy); display: grid; place-items: center;
}
.chatbot__send:hover { background: var(--amber-soft); }
.chatbot__foot { margin: 0; padding: 0 12px 8px; background: var(--white); font-size: .7rem; color: var(--muted); text-align: center; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* phones: the chat fills the screen */
@media (max-width: 560px) {
    .chatbot { right: 16px; bottom: 16px; }
    .whatsapp-float { right: 16px; bottom: 86px; }
    .chatbot[data-state="open"] .chatbot__launcher { display: none; }
    .chatbot__panel { position: fixed; inset: 0; width: auto; height: 100%; border-radius: 0; }
    body:has(.chatbot[data-state="open"]) { overflow: hidden; }
    .chatbot__teaser { right: 68px; }
}
@media (prefers-reduced-motion: reduce) {
    .chatbot__panel, .chatbot__teaser { animation: none; }
    .chatmsg__typing span { animation: none; }
}
