/* chat-widget.css - the floating help chat on the quote and payment pages.
 *
 * Everything is prefixed vdchat- so that nothing here meets the page's own
 * styles. (quote-styles.css still carries an older, unused .chat-widget block;
 * this does not use it.)
 *
 * Who said what is never shown by colour alone: every message carries a
 * written label ("Assistant" / "You") and the two sit on opposite sides.
 */

.vdchat {
    --vdchat-lift: 0px;                 /* set by chat-widget.js above the pay bar */
    --vdchat-bg: #0F1522;
    --vdchat-panel: #131B2B;
    --vdchat-line: rgba(248, 253, 255, 0.16);
    --vdchat-text: #F8FDFF;
    --vdchat-muted: #B6C2CF;
    --vdchat-accent: #00E5FF;
    --vdchat-accent-ink: #04121A;
    position: fixed;
    right: 16px;
    bottom: calc(16px + var(--vdchat-lift) + env(safe-area-inset-bottom, 0px));
    z-index: 990;                       /* under the page's modals (1000) */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.45;
    color: var(--vdchat-text);
    transition: bottom 0.3s ease;
}

.vdchat.vdchat-open {
    z-index: 1001;                      /* an open chat is in use: above the pay bar */
}

.vdchat [hidden] {
    display: none !important;
}

.vdchat button,
.vdchat textarea {
    font: inherit;
}

/* ---- Launcher ---------------------------------------------------------- */

.vdchat-launcher {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 18px 0 14px;
    border: 2px solid var(--vdchat-accent-ink);
    border-radius: 999px;
    background: var(--vdchat-accent);
    color: var(--vdchat-accent-ink);
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
}

.vdchat-launcher:hover {
    filter: brightness(1.08);
}

.vdchat-open .vdchat-launcher {
    display: none;
}

.vdchat button:focus-visible,
.vdchat textarea:focus-visible,
.vdchat a:focus-visible,
.vdchat-list:focus-visible {
    outline: 3px solid #FFFFFF;
    outline-offset: 2px;
}

/* ---- Offer of help ------------------------------------------------------ */

.vdchat-nudge {
    display: flex;
    align-items: stretch;
    max-width: min(300px, calc(100vw - 32px));
    border: 2px solid var(--vdchat-accent);
    border-radius: 14px;
    background: var(--vdchat-panel);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

.vdchat-nudge-open {
    flex: 1;
    padding: 12px 6px 12px 14px;
    border: 0;
    background: none;
    color: var(--vdchat-text);
    text-align: left;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.vdchat-nudge-close {
    min-width: 44px;
    border: 0;
    border-left: 1px solid var(--vdchat-line);
    background: none;
    color: var(--vdchat-text);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

/* ---- Panel -------------------------------------------------------------- */

.vdchat-panel {
    display: flex;
    flex-direction: column;
    width: min(380px, calc(100vw - 32px));
    height: min(560px, calc(100vh - 32px - var(--vdchat-lift)));
    height: min(560px, calc(100dvh - 32px - var(--vdchat-lift)));
    min-height: 0;
    border: 1px solid var(--vdchat-line);
    border-radius: 16px;
    background: var(--vdchat-panel);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
    /* If the fixed parts ever outgrow a very short screen, the whole panel
       scrolls rather than cutting off the Send button. */
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-color: var(--vdchat-muted) transparent;
}

.vdchat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 10px 10px 16px;
    border-bottom: 1px solid var(--vdchat-line);
    background: var(--vdchat-bg);
}

.vdchat-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.vdchat-name {
    font-weight: 700;
}

.vdchat-badge {
    padding: 1px 7px;
    border: 1px solid var(--vdchat-text);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.vdchat-close {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--vdchat-line);
    border-radius: 10px;
    background: none;
    color: var(--vdchat-text);
    cursor: pointer;
}

.vdchat-close span[aria-hidden] {
    font-size: 20px;
    line-height: 1;
}

.vdchat-notice {
    margin: 0;
    padding: 8px 16px;
    border-bottom: 1px solid var(--vdchat-line);
    color: var(--vdchat-muted);
    font-size: 12.5px;
}

.vdchat-list {
    flex: 1 1 auto;
    min-height: 88px;
    overflow-y: auto;
    scrollbar-color: var(--vdchat-muted) transparent;
    overscroll-behavior: contain;
    padding: 14px 14px 6px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vdchat-msg {
    max-width: 88%;
}

.vdchat-msg-bot {
    align-self: flex-start;
}

.vdchat-msg-you {
    align-self: flex-end;
}

.vdchat-who {
    margin-bottom: 3px;
    color: var(--vdchat-muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.vdchat-msg-you .vdchat-who {
    text-align: right;
}

.vdchat-text {
    padding: 10px 12px;
    border: 1px solid var(--vdchat-line);
    border-radius: 12px;
    background: var(--vdchat-bg);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.vdchat-msg-you .vdchat-text {
    border: 2px solid var(--vdchat-accent);
    background: transparent;
}

.vdchat-text a,
.vdchat-foot a {
    color: var(--vdchat-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.vdchat-typing {
    padding: 2px 16px 6px;
    color: var(--vdchat-muted);
    font-size: 13px;
    font-style: italic;
}

.vdchat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 14px 10px;
}

.vdchat-chip {
    min-height: 36px;
    padding: 6px 12px;
    border: 1px solid var(--vdchat-accent);
    border-radius: 999px;
    background: none;
    color: var(--vdchat-text);
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
}

.vdchat-chip:hover {
    background: rgba(0, 229, 255, 0.12);
}

.vdchat-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--vdchat-line);
    background: var(--vdchat-bg);
}

.vdchat-input {
    flex: 1;
    min-width: 0;
    resize: none;
    padding: 9px 11px;
    border: 1px solid var(--vdchat-line);
    border-radius: 10px;
    background: #0A0E17;
    color: var(--vdchat-text);
    font-size: 16px;                    /* below 16px iOS zooms the page on focus */
}

.vdchat-input::placeholder {
    color: var(--vdchat-muted);
}

.vdchat-send {
    min-height: 44px;
    padding: 0 16px;
    border: 0;
    border-radius: 10px;
    background: var(--vdchat-accent);
    color: var(--vdchat-accent-ink);
    font-weight: 700;
    cursor: pointer;
}

.vdchat-send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.vdchat-foot {
    margin: 0;
    padding: 7px 16px 9px;
    background: var(--vdchat-bg);
    color: var(--vdchat-muted);
    font-size: 12.5px;
    text-align: center;
}

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

/* ---- Phones: the open chat takes the screen ----------------------------- */

@media (max-width: 520px) {
    .vdchat.vdchat-open {
        inset: 0;
        bottom: 0;
        align-items: stretch;
        gap: 0;
    }

    .vdchat-open .vdchat-panel {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        border: 0;
        border-radius: 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
}

/* ---- Short screens (a phone on its side): keep only what is needed ------- */

@media (max-height: 480px) {
    .vdchat-notice,
    .vdchat-foot {
        display: none;
    }

    .vdchat-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 8px;
    }

    .vdchat-chip {
        flex: 0 0 auto;
    }

    .vdchat-form {
        padding: 6px 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .vdchat {
        transition: none;
    }
}
