/**
 * AGORA AI (AGUSM Missionary Helper) — Embedded Widget Styles
 *
 * Matches the /agusm page brand: navy + red + gold, Archivo/Inter, sharp
 * corners. Everything is scoped under .agusm-helper, and every interactive
 * element is HARD-RESET (appearance/border/background/font/text-decoration)
 * so the WordPress theme's global button/input/link styles can't bleed in.
 * The surrounding section (dark navy band, big heading) lives in the page
 * body snippet — this file only styles the chat frame itself.
 */

.agusm-helper {
    --ah-red: #C8102E;
    --ah-red-hover: #A50C26;
    --ah-navy: #0e1d44;
    --ah-navy-deep: #05091b;
    --ah-ink: #0c1020;
    --ah-paper: #faf7f1;
    --ah-line: #d9dde7;
    --ah-slate: #55607a;
    --ah-gold: #e9b24a;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--ah-ink);
    width: 100%;
}

/* Hard reset — the theme must not touch anything inside the widget */
.agusm-helper,
.agusm-helper * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0 !important;
    background: none;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
    text-decoration: none !important;
    text-transform: none;
    letter-spacing: normal;
    box-shadow: none;
}

/* ─── Chat frame ──────────────────────────────────────────────── */
.agusm-helper .agusm-helper__frame {
    background: #fff;
    border-top: 5px solid var(--ah-red);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ─── Brand header bar (matches the site's navy strips) ───────── */
.agusm-helper .agusm-helper__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    background: var(--ah-navy);
    padding: 14px 22px;
}

.agusm-helper .agusm-helper__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Archivo Black', 'Archivo', sans-serif;
    font-size: 17px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #fff;
}

.agusm-helper .agusm-helper__brand em {
    font-style: normal;
    color: var(--ah-gold);
}

.agusm-helper .agusm-helper__brand-mark {
    display: inline-block;
    width: 12px;
    height: 12px;
    background: var(--ah-red);
}

.agusm-helper .agusm-helper__tag {
    font-family: 'Archivo', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 10.5px;
    color: rgba(255, 255, 255, 0.55);
}

/* ─── Messages area ───────────────────────────────────────────── */
.agusm-helper .agusm-helper__messages {
    min-height: 150px;
    max-height: 440px;
    overflow-y: auto;
    padding: 24px 24px 12px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: var(--ah-paper);
}

.agusm-helper .agusm-helper__message {
    max-width: 84%;
    padding: 14px 18px;
    font-size: 14.5px;
    line-height: 1.65;
    word-wrap: break-word;
}

.agusm-helper .agusm-helper__message--bot {
    align-self: flex-start;
    background: #fff;
    border: 1px solid var(--ah-line);
    border-left: 4px solid var(--ah-red);
    color: var(--ah-ink);
}

.agusm-helper .agusm-helper__message--user {
    align-self: flex-end;
    background: var(--ah-navy);
    color: #fff;
}

.agusm-helper .agusm-helper__message--error {
    align-self: flex-start;
    background: #fdf1f1;
    border: 1px solid #f0c9c9;
    border-left: 4px solid var(--ah-red);
    color: #7a1020;
}

.agusm-helper .agusm-helper__message a {
    color: var(--ah-red);
    font-weight: 600;
    border-bottom: 1px solid rgba(200, 16, 46, 0.35);
    word-break: break-all;
}

.agusm-helper .agusm-helper__message a:hover {
    color: var(--ah-red-hover);
}

/* "Source: …" line the helper appends to answers */
.agusm-helper .agusm-helper__source {
    display: block;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed var(--ah-line);
    font-size: 12px;
    color: var(--ah-slate);
}

/* ─── Starter block: "Try one" + suggestion chips ─────────────── */
.agusm-helper .agusm-helper__starter {
    background: var(--ah-paper);
    padding: 2px 24px 20px;
}

.agusm-helper .agusm-helper__chips-label {
    font-family: 'Archivo', sans-serif;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2.4px;
    font-size: 10.5px;
    color: var(--ah-red);
    margin-bottom: 10px;
}

.agusm-helper .agusm-helper__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.agusm-helper .agusm-helper__chip {
    -webkit-appearance: none;
    appearance: none;
    display: inline-block;
    border: 1px solid var(--ah-line);
    background: #fff;
    padding: 9px 15px;
    font-family: 'Inter', sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--ah-navy);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.agusm-helper .agusm-helper__chip:hover {
    border-color: var(--ah-red);
    color: var(--ah-red);
    background: #fff;
}

/* ─── Input row ───────────────────────────────────────────────── */
.agusm-helper .agusm-helper__form {
    display: flex;
    align-items: stretch;
    border-top: 1px solid var(--ah-line);
    background: #fff;
}

.agusm-helper .agusm-helper__input {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    min-width: 0;
    border: 0;
    outline: none;
    padding: 19px 22px;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: var(--ah-ink);
    background: #fff;
}

.agusm-helper .agusm-helper__input::placeholder {
    color: var(--ah-slate);
    opacity: 0.7;
}

.agusm-helper .agusm-helper__input:focus {
    outline: none;
    box-shadow: inset 0 -3px 0 var(--ah-red);
}

.agusm-helper .agusm-helper__send {
    -webkit-appearance: none;
    appearance: none;
    border: 0;
    background: var(--ah-red);
    color: #fff;
    font-family: 'Archivo', sans-serif;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 13px;
    padding: 0 36px;
    cursor: pointer;
    transition: background 0.15s;
}

.agusm-helper .agusm-helper__send:hover {
    background: var(--ah-red-hover);
    color: #fff;
}

.agusm-helper .agusm-helper__send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ─── Footer disclaimer ───────────────────────────────────────── */
.agusm-helper .agusm-helper__foot {
    padding: 12px 20px;
    background: var(--ah-navy-deep);
    color: rgba(255, 255, 255, 0.55);
    font-size: 11.5px;
    line-height: 1.5;
    text-align: center;
}

/* ─── Typing indicator ────────────────────────────────────────── */
.agusm-helper .agusm-helper__typing {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid var(--ah-line);
    border-left: 4px solid var(--ah-red);
}

.agusm-helper .agusm-helper__typing-dot {
    width: 7px;
    height: 7px;
    background: var(--ah-slate);
    animation: agusm-helper-bounce 1.2s infinite ease-in-out;
}

.agusm-helper .agusm-helper__typing-dot:nth-child(2) { animation-delay: 0.15s; }
.agusm-helper .agusm-helper__typing-dot:nth-child(3) { animation-delay: 0.3s; }

.agusm-helper .agusm-helper__typing-label {
    margin-left: 8px;
    font-size: 12px;
    color: var(--ah-slate);
    font-style: italic;
}

@keyframes agusm-helper-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* ─── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .agusm-helper .agusm-helper__head {
        padding: 12px 16px;
    }
    .agusm-helper .agusm-helper__messages {
        padding: 16px 14px 8px;
        max-height: 55vh;
    }
    .agusm-helper .agusm-helper__message {
        max-width: 92%;
    }
    .agusm-helper .agusm-helper__starter {
        padding: 2px 14px 16px;
    }
    .agusm-helper .agusm-helper__send {
        padding: 0 22px;
    }
}
