/* The conversation chat (Conversations list and the Send Message window). Colours follow the theme accent in site.css. */

.asap-chat {
    --chat-accent: var(--dxbl-accent-color, #0b6074);
    display: flex;
    flex-direction: column;
    height: clamp(300px, 56vh, 540px);
    border: 1px solid #d9dee3;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.asap-chat__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    padding: 10px 16px;
    border-bottom: 1px solid #e3e7eb;
    background: #f6f8fa;
}

.asap-chat__title { font-weight: 700; font-size: 1.05rem; color: #0a3d4c; }
.asap-chat__meta { font-size: 0.85rem; color: #55616b; }

.asap-chat__badge {
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: #e3eef1;
    color: #0a3d4c;
}

.asap-chat__messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: #fbfcfd;
}

.asap-chat__sentinel { height: 1px; flex: 0 0 auto; }

.asap-chat__earlier {
    align-self: center;
    border: 0;
    background: none;
    color: var(--chat-accent);
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
}

.asap-chat__day {
    align-self: center;
    margin: 6px 0 2px;
    padding: 2px 12px;
    border-radius: 999px;
    background: #e9edf0;
    color: #55616b;
    font-size: 0.75rem;
}

.asap-chat__row { display: flex; }
.asap-chat__row--first { margin-top: 7px; }
.asap-chat__row--staff { justify-content: flex-end; }
.asap-chat__row--applicant { justify-content: flex-start; }
.asap-chat__row--system { justify-content: center; margin-top: 7px; }

/* A compact bubble: the name on its own line only at the start of a run, then the text with the time beside it
   (or below it, when the text is long). Wide enough that most messages are one or two lines. */
.asap-chat__bubble {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    column-gap: 10px;
    max-width: min(88%, 680px);
    padding: 5px 11px 4px;
    border-radius: 12px;
    line-height: 1.35;
    font-size: 0.92rem;
    overflow-wrap: anywhere;
}

/* Soft tints, like the portal: staff (this side) in a light teal, the applicant in white with a thin border. */
.asap-chat__row--staff .asap-chat__bubble {
    background: #dcedf1;
    border: 1px solid #c4dfe6;
    color: #14313b;
    border-bottom-right-radius: 4px;
}

.asap-chat__row--applicant .asap-chat__bubble {
    background: #fff;
    border: 1px solid #dde3e8;
    border-left: 3px solid var(--chat-accent);
    color: #1d2a33;
    border-bottom-left-radius: 4px;
}

.asap-chat__row--system .asap-chat__bubble {
    max-width: 92%;
    background: #fff7e0;
    color: #6b5200;
    border: 1px solid #f0e0a8;
    border-radius: 8px;
    font-size: 0.82rem;
    text-align: center;
    justify-content: center;
}

.asap-chat__who { flex: 1 0 100%; font-size: 0.7rem; font-weight: 600; color: #4b5a64; }
.asap-chat__text { flex: 0 1 auto; white-space: pre-wrap; }
.asap-chat__time { margin-left: auto; font-size: 0.66rem; color: #6b7780; white-space: nowrap; }
.asap-chat__new { font-weight: 700; }

.asap-chat__empty { margin: auto; color: #6b7780; text-align: center; }

.asap-chat__error {
    padding: 6px 16px;
    background: #fdecea;
    color: #8a1c14;
    font-size: 0.85rem;
}

.asap-chat__composer {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 16px 12px;
    border-top: 1px solid #e3e7eb;
    background: #fff;
}

.asap-chat__input {
    width: 100%;
    min-height: 64px;
    max-height: 160px;
    resize: vertical;
    padding: 8px 10px;
    border: 1px solid #c3cbd2;
    border-radius: 6px;
    font: inherit;
}

.asap-chat__input:focus { outline: 2px solid var(--chat-accent); outline-offset: 0; }

.asap-chat__actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.asap-chat__hint { font-size: 0.75rem; color: #6b7780; }

.asap-chat__send {
    padding: 7px 22px;
    border: 0;
    border-radius: 6px;
    background: var(--chat-accent);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.asap-chat__send:disabled { opacity: 0.5; cursor: default; }

.asap-chat__closed { padding: 12px 16px; border-top: 1px solid #e3e7eb; color: #55616b; background: #f6f8fa; font-size: 0.9rem; }
