/* ── AskAMissionary Chatbot Widget ─────────────────────────────────────────── */

/* Brand color default — overridden by inline style from PHP settings */
#aam-chatbot-widget {
    --aam-brand: #246091;
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

/* ── Bubble button ── */
#aam-chat-bubble {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--aam-brand);
    border: none;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    color: #fff;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: filter 0.2s, transform 0.1s;
}
#aam-chat-bubble svg {
    display: block;
    flex-shrink: 0;
}
#aam-chat-bubble:hover { filter: brightness(0.85); }
#aam-chat-bubble:active { transform: scale(0.95); }
#aam-chat-bubble:focus-visible {
    outline: 3px solid #f0a500;
    outline-offset: 2px;
}

/* ── Chat panel ── */
#aam-chat-panel {
    display: none;
    flex-direction: column;
    position: absolute;
    bottom: 68px;
    right: 0;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 480px;
    max-height: calc(100vh - 100px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    overflow: hidden;
}

/* ── Header ── */
#aam-chat-header {
    background: var(--aam-brand);
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
#aam-chat-title {
    font-weight: 600;
    font-size: 15px;
}
#aam-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 4px;
}
#aam-chat-close:hover { background: rgba(255,255,255,0.15); }
#aam-chat-close:focus-visible { outline: 2px solid #f0a500; }

/* ── Message log ── */
#aam-chat-log {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aam-message {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
}
.aam-message.aam-user {
    background: var(--aam-brand);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.aam-message.aam-bot {
    background: #f0f4f8;
    color: #1a1a1a;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.aam-message a {
    color: var(--aam-brand);
    text-decoration: underline;
}
.aam-message.aam-user a {
    color: #b3d4f5;
}

/* ── Sources list ── */
.aam-sources {
    margin-top: 10px;
    font-size: 13px;
    border-top: 1px solid #d0dde8;
    padding-top: 8px;
}
.aam-sources ul {
    margin: 4px 0 0 0;
    padding-left: 18px;
}
.aam-sources li { margin: 2px 0; }

/* ── CTA block ── */
.aam-cta {
    margin-top: 12px;
    background: #eaf3fb;
    border-left: 3px solid var(--aam-brand);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 13px;
}
.aam-cta p { margin: 0 0 8px 0; }
.aam-cta-btn {
    display: inline-block;
    background: var(--aam-brand);
    color: #fff !important;
    text-decoration: none !important;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}
.aam-cta-btn:hover { filter: brightness(0.85); }

/* ── Input row ── */
#aam-chat-input-row {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #e0e8f0;
    flex-shrink: 0;
    align-items: flex-end;
}
#aam-chat-input {
    flex: 1;
    resize: none;
    border: 1px solid #c5d5e4;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.4;
    outline: none;
    max-height: 100px;
}
#aam-chat-input:focus {
    border-color: var(--aam-brand);
    box-shadow: 0 0 0 2px rgba(36,96,145,0.2);
}
#aam-chat-send {
    background: var(--aam-brand);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: filter 0.2s;
}
#aam-chat-send:hover:not(:disabled) { filter: brightness(0.85); }
#aam-chat-send:disabled { opacity: 0.55; cursor: not-allowed; }
#aam-chat-send:focus-visible { outline: 3px solid #f0a500; outline-offset: 2px; }

/* ── Admin note ── */
#aam-chat-admin-note {
    background: #fff8e1;
    color: #7a5f00;
    font-size: 11px;
    text-align: center;
    padding: 4px 8px;
    flex-shrink: 0;
}

/* ── Screen reader only ── */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
