/* Public help assistant widget.
   Uses the site tokens from main.css so it inherits the palette and type
   automatically if those are ever retuned. */

.rr-chat {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1040;              /* under the disclaimer overlay, over page content */
    font-family: var(--font-body);
}

/* ── Launcher ─────────────────────────────────────────────── */

.rr-chat-launcher {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: var(--clr-teal);
    color: var(--clr-white);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--shadow-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .18s ease, transform .18s ease;
}

.rr-chat-launcher:hover  { background: var(--clr-teal-lt); transform: translateY(-2px); }
.rr-chat-launcher:focus-visible { outline: 3px solid var(--clr-navy); outline-offset: 3px; }

.rr-chat-open .rr-chat-launcher { transform: scale(.9); opacity: .85; }

/* ── Panel ────────────────────────────────────────────────── */

.rr-chat-panel {
    position: absolute;
    right: 0;
    bottom: 72px;
    width: 370px;
    max-width: calc(100vw - 32px);
    height: 480px;
    max-height: calc(100vh - 140px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--clr-white);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-hover);
}

.rr-chat-panel[hidden] { display: none; }

.rr-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: var(--clr-navy);
    color: var(--clr-white);
}

.rr-chat-header-text { display: flex; flex-direction: column; gap: 2px; }

.rr-chat-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    line-height: 1.2;
}

.rr-chat-subtitle { font-size: .75rem; opacity: .75; }

.rr-chat-close {
    background: transparent;
    border: none;
    color: var(--clr-white);
    opacity: .8;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: var(--radius-sm);
}

.rr-chat-close:hover { opacity: 1; }
.rr-chat-close:focus-visible { outline: 2px solid var(--clr-white); outline-offset: 2px; }

/* ── Message log ──────────────────────────────────────────── */

.rr-chat-log {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--clr-bg-hero);
}

.rr-chat-msg {
    max-width: 90%;
    padding: 10px 13px;
    border-radius: var(--radius-md);
    font-size: .875rem;
    line-height: 1.5;
    white-space: pre-wrap;      /* indexed text keeps its spacing */
    overflow-wrap: anywhere;    /* a long URL must not widen the panel */
}

.rr-chat-msg-user {
    align-self: flex-end;
    background: var(--clr-teal);
    color: var(--clr-white);
    border-bottom-right-radius: var(--radius-sm);
}

.rr-chat-msg-bot {
    align-self: flex-start;
    background: var(--clr-white);
    color: var(--clr-text);
    border: 1px solid var(--clr-border-light);
    border-bottom-left-radius: var(--radius-sm);
}

.rr-chat-msg-error {
    align-self: flex-start;
    background: #fdf2f2;
    border: 1px solid #f5c6c6;
    color: #8a2b2b;
}

.rr-chat-answer-heading {
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--clr-navy);
}

.rr-chat-answer-text { margin: 0; }

.rr-chat-answer-link {
    display: inline-block;
    margin-top: 8px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--clr-teal);
    text-decoration: none;
}

.rr-chat-answer-link:hover { text-decoration: underline; }

/* ── Suggestion chips ─────────────────────────────────────── */

.rr-chat-suggestions {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--clr-border-light);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.rr-chat-suggestions-label {
    width: 100%;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--clr-muted);
}

.rr-chat-chip {
    display: inline-block;
    padding: 5px 10px;
    font-size: .78rem;
    color: var(--clr-navy);
    background: var(--clr-teal-bg);
    border-radius: 999px;
    text-decoration: none;
}

.rr-chat-chip:hover { background: var(--clr-teal); color: var(--clr-white); }

/* ── Pending indicator ────────────────────────────────────── */

.rr-chat-pending { display: flex; gap: 4px; align-items: center; }

.rr-chat-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--clr-muted);
    animation: rr-chat-bounce 1.2s infinite ease-in-out;
}

.rr-chat-dot:nth-child(2) { animation-delay: .15s; }
.rr-chat-dot:nth-child(3) { animation-delay: .3s; }

@keyframes rr-chat-bounce {
    0%, 60%, 100% { opacity: .3; transform: translateY(0); }
    30%           { opacity: 1;  transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
    .rr-chat-dot      { animation: none; opacity: .6; }
    .rr-chat-launcher { transition: none; }
}

/* ── Composer ─────────────────────────────────────────────── */

.rr-chat-form {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--clr-border);
    background: var(--clr-white);
}

.rr-chat-input {
    flex: 1;
    min-width: 0;
    padding: 9px 12px;
    font-size: .875rem;
    font-family: inherit;
    color: var(--clr-text);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-sm);
}

.rr-chat-input:focus {
    outline: none;
    border-color: var(--clr-teal);
    box-shadow: 0 0 0 3px var(--clr-teal-bg);
}

.rr-chat-input:disabled { background: var(--clr-bg-feat); }

.rr-chat-send {
    flex: none;
    width: 40px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--clr-teal);
    color: var(--clr-white);
    cursor: pointer;
}

.rr-chat-send:hover:not(:disabled) { background: var(--clr-teal-lt); }
.rr-chat-send:disabled { opacity: .5; cursor: default; }
.rr-chat-send:focus-visible { outline: 3px solid var(--clr-navy); outline-offset: 2px; }

.rr-chat-visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ── Small screens: full-width sheet ──────────────────────── */

@media (max-width: 480px) {
    .rr-chat { right: 16px; bottom: 16px; }

    .rr-chat-panel {
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
    }
}
