﻿/* ---- assets/css/chatbot.css ---- */
/* ================================================================
   AMM WEBSITES — CLASS-FINDER CHATBOT WIDGET
   ------------------------------------------------------------------
   A lead-qualification chat widget: a few quick questions, then a
   Book Now link or a "call me back" handoff. Opens as a popup
   anchored near the launcher on desktop, full-screen below 480px.

   Deliberately styled off the SITE's own tokens (--brand/--brand-bright/
   --brand-deep, --ink-2/--panel/--paper/--grey/--line, --f-display/
   --f-body) rather than a separate colour system, so re-colouring the
   site for a new client — or picking a different accent via the demo
   picker — re-colours this widget too, with zero widget-specific
   edits. Only exception: --ink-on-accent below, a FIXED dark value
   (not the theme-flipping --ink) used wherever text/an icon sits
   directly on --brand — see the comment on that variable for why.
   ================================================================ */

#dlb-root, #dlb-root * {
    box-sizing: border-box;
}

#dlb-root {
    /* Fixed near-black for text/icons placed directly on --brand. --ink flips to
     near-white in the light theme, which would break contrast on the (always
     mid-to-bright) accent colours — this mirrors the site's own --on-dark
     pattern (a token that deliberately does NOT follow the theme), just the
     dark-on-bright-accent equivalent instead of light-on-dark-photo. */
    --ink-on-accent: #0a0a0a;
    font-family: var(--f-body);
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

/* Launcher */
#dlb-launcher {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--brand);
    color: var(--ink-on-accent);
    border: 3px solid var(--ink-2);
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0,0,0,.35);
    transition: transform .18s ease, background .2s ease;
}

    #dlb-launcher:hover {
        transform: scale(1.06);
        background: var(--brand-bright);
    }

    #dlb-launcher svg {
        width: 28px;
        height: 28px;
    }

    #dlb-launcher .dlb-pulse {
        position: absolute;
        width: 64px;
        height: 64px;
        border-radius: 50%;
        border: 2px solid var(--brand);
        animation: dlb-ping 2.4s cubic-bezier(0,0,.2,1) infinite;
    }

@keyframes dlb-ping {
    0% {
        transform: scale(1);
        opacity: .6;
    }

    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    #dlb-launcher .dlb-pulse {
        animation: none;
    }
}

/* Window */
#dlb-window {
    display: none;
    flex-direction: column;
    width: 372px;
    height: 560px;
    max-height: 78vh;
    background: var(--panel);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
    border: 1px solid var(--line);
    position: absolute;
    bottom: 78px;
    right: 0;
}

    #dlb-window.dlb-open {
        display: flex;
    }

/* Header */
#dlb-header {
    background: var(--ink-2);
    padding: 16px 18px 14px;
    border-bottom: 3px solid var(--brand);
    position: relative;
    flex: none;
}

    #dlb-header .dlb-eyebrow {
        font-family: var(--f-label);
        color: var(--brand-bright);
        font-size: 10px;
        letter-spacing: .14em;
        text-transform: uppercase;
        font-weight: 700;
        margin-bottom: 4px;
    }

    #dlb-header h1 {
        font-size: 20px;
        color: var(--paper);
        line-height: 1.05;
    }

#dlb-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: none;
    border: none;
    color: var(--grey);
    font-size: 20px;
    line-height: 1;
    padding: 4px;
    transition: color .15s ease;
}

    #dlb-close:hover, #dlb-close:focus-visible {
        color: var(--brand-bright);
    }

/* Progress stripes */
#dlb-progress {
    display: flex;
    gap: 4px;
    margin-top: 12px;
}

.dlb-stripe {
    flex: 1;
    height: 5px;
    background: var(--line);
    border-radius: 2px;
    overflow: hidden;
}

    .dlb-stripe.dlb-filled {
        background: var(--brand);
    }

/* Body */
#dlb-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--panel);
}

    #dlb-body::-webkit-scrollbar {
        width: 6px;
    }

    #dlb-body::-webkit-scrollbar-thumb {
        background: var(--line);
        border-radius: 3px;
    }

.dlb-msg {
    max-width: 82%;
    padding: 10px 13px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.45;
    animation: dlb-in .25s ease;
}

@media (prefers-reduced-motion: reduce) {
    .dlb-msg {
        animation: none;
    }
}

@keyframes dlb-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dlb-msg.bot {
    background: var(--surface-2);
    color: var(--paper);
    border: 1px solid var(--line);
    align-self: flex-start;
    border-bottom-left-radius: 3px;
}

.dlb-msg.user {
    background: var(--brand);
    color: var(--ink-on-accent);
    align-self: flex-end;
    border-bottom-right-radius: 3px;
    font-weight: 600;
}

/* Choice chips */
#dlb-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 2px 16px 12px;
    flex: none;
}

.dlb-chip {
    background: var(--surface-1);
    border: 1.5px solid var(--line);
    color: var(--paper);
    padding: 8px 13px;
    border-radius: 20px;
    font-family: var(--f-body);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease, transform .1s ease;
}

    .dlb-chip:hover, .dlb-chip:focus-visible {
        background: var(--brand);
        border-color: var(--brand);
        color: var(--ink-on-accent);
        transform: translateY(-1px);
    }

/* CTA link (book now) — reuses the site's own .btn.btn-primary look */
.dlb-cta-wrap {
    padding: 2px 16px 12px;
    flex: none;
}

    .dlb-cta-wrap .btn {
        width: 100%;
    }

/* Input row */
#dlb-inputrow {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--line);
    background: var(--surface-1);
    flex: none;
}

#dlb-input {
    flex: 1;
    background: var(--panel);
    border: 1px solid var(--line);
    color: var(--paper);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13.5px;
    font-family: inherit;
    outline: none;
    transition: border-color .2s ease;
}

    #dlb-input:focus {
        border-color: var(--brand);
    }

#dlb-send {
    background: var(--brand);
    border: none;
    color: var(--ink-on-accent);
    width: 40px;
    padding: 0;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s ease;
}

    #dlb-send:hover {
        background: var(--brand-bright);
    }

    #dlb-send:disabled {
        opacity: .4;
        cursor: not-allowed;
    }

.dlb-typing {
    display: flex;
    gap: 4px;
    padding: 4px 2px;
}

    .dlb-typing span {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: var(--grey);
        animation: dlb-bounce 1.1s infinite ease-in-out;
    }

        .dlb-typing span:nth-child(2) {
            animation-delay: .15s;
        }

        .dlb-typing span:nth-child(3) {
            animation-delay: .3s;
        }

@keyframes dlb-bounce {
    0%,60%,100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-5px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .dlb-typing span {
        animation: none;
    }
}

/* Full-screen on mobile — the "full screen chat on mobile" half of the brief */
@media (max-width: 480px) {
    #dlb-root {
        bottom: env(safe-area-inset-bottom, 0px);
        right: env(safe-area-inset-right, 0px);
        left: env(safe-area-inset-left, 0px);
    }

    #dlb-launcher {
        position: absolute;
        bottom: 16px;
        right: 16px;
    }

    #dlb-window {
        position: fixed;
        inset: 0;
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }

    #dlb-header {
        padding-top: calc(16px + env(safe-area-inset-top, 0px));
    }

    #dlb-close {
        top: calc(14px + env(safe-area-inset-top, 0px));
        font-size: 26px;
        padding: 8px;
    }

    #dlb-body {
        padding: 14px;
    }

    .dlb-msg {
        max-width: 88%;
        font-size: 15px;
    }

    .dlb-chip {
        font-size: 14px;
        padding: 10px 15px;
    }

    #dlb-inputrow {
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    }

    #dlb-input {
        font-size: 16px;
        padding: 12px;
    }
    /* 16px stops iOS Safari auto-zoom on focus */
    #dlb-send {
        width: 44px;
    }
}

@media (min-width: 481px) and (max-width: 640px) {
    #dlb-window {
        width: 92vw;
        right: -6px;
    }
}

/* Body scroll lock while full-screen on mobile — see chatbot.js toggleBodyScrollLock() */
body.dlb-scroll-lock {
    overflow: hidden;
}
