/* Advisor Bot Builder chat */

.abb-chat,
.abb-chat * {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

.abb-chat {
    width: 100%;
    max-width: 920px;
    margin: 28px auto;
    font-family: Arial, Helvetica, sans-serif;
    color: #111827;
}

.abb-chat-inner {
    background: #ffffff;
    border: 1px solid #eef2f7;
    border-radius: 24px;
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.07);
    padding: 26px 26px 18px;
    display: flex;
    flex-direction: column;
    height: 720px;
    max-height: 85vh;
}

.abb-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.abb-chat-title {
    font-size: 18px;
    font-weight: 700;
}

/* With the title turned off, the restart button stays on the right. */
.abb-chat-header-no-title {
    justify-content: flex-end;
}

.abb-restart {
    appearance: none;
    border: 1px solid #2563eb;
    background: #2563eb;
    color: #ffffff;
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
}

.abb-restart:hover {
    filter: brightness(0.92);
}

.abb-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 6px 4px 14px;
    scroll-behavior: smooth;
}

.abb-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}

.abb-row-user {
    justify-content: flex-end;
}

/* Round frame that clips the picture. */
.abb-avatar {
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f2f6fb, #e8eef7);
    color: #2563eb;
    font-size: 26px;
    font-weight: 700;
}

.abb-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.abb-column {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 78%;
}

.abb-row-user .abb-column {
    align-items: flex-end;
}

.abb-bubble {
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 17px;
    line-height: 1.55;
    word-wrap: break-word;
}

.abb-bubble-bot {
    background: #f3f6fa;
    border: 1px solid #eef2f7;
    color: #111827;
}

.abb-bubble-user {
    background: #2563eb;
    color: #ffffff;
}

/* Blobs inside one reply are spaced apart. */
.abb-column > * + * {
    margin-top: 10px;
}

.abb-typing-cursor::after {
    content: '|';
    margin-left: 2px;
    animation: abbBlink 0.9s infinite;
}

@keyframes abbBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Structured text inside the bot's bubbles: section titles, lists, labels, and notes. */
.abb-rich > * {
    margin: 0;
}

.abb-rich > * + * {
    margin-top: 10px;
}

/* Lines in the same paragraph stay close together. A blank line between paragraphs gives a gap. */
.abb-rich .abb-line + .abb-line {
    margin-top: 0;
}

.abb-gap {
    height: 0;
    margin: 0;
}

.abb-title {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #dbeafe;
    font-size: 1.04em;
    font-weight: 800;
    color: #0f172a;
}

.abb-title-badge {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #2563eb;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
}

.abb-list {
    list-style: none;
    padding: 0;
}

.abb-list li {
    position: relative;
    padding-left: 22px;
    margin: 6px 0;
}

.abb-list li::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 0.55em;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2563eb;
}

.abb-numbers {
    padding-left: 24px;
}

.abb-numbers li {
    margin: 4px 0;
}

.abb-numbers li::marker {
    color: #2563eb;
    font-weight: 800;
}

.abb-note {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-left: 4px solid #f59e0b;
    border-radius: 10px;
    padding: 10px 12px;
    color: #7c2d12;
    font-size: 0.96em;
}

/* Tip, warning and note boxes. Each one has its own colours; they come after .abb-note so they win. */
.abb-callout-tip {
    background: #ecfdf5;
    border-color: #a7f3d0;
    border-left-color: #10b981;
    color: #065f46;
}

.abb-callout-warning {
    background: #fef2f2;
    border-color: #fecaca;
    border-left-color: #ef4444;
    color: #991b1b;
}

.abb-callout-note {
    background: #eff6ff;
    border-color: #bfdbfe;
    border-left-color: #2563eb;
    color: #1e3a8a;
}

.abb-callout-label {
    font-weight: 800;
}

/* A quoted passage: one neutral card for all its lines. It is not a warning, so it has no orange. */
.abb-quote {
    margin: 0;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #2563eb;
    border-radius: 10px;
    color: #111827;
}

.abb-quote p {
    margin: 0;
}

.abb-quote p + p {
    margin-top: 6px;
}

/* Highlighted text, for the one line the visitor must not miss. */
.abb-mark {
    background: #fef08a;
    color: inherit;
    padding: 0 3px;
    border-radius: 4px;
}

/* Red text, from !!text!!. Used for the agreement text, and anything else that should stand out as serious. */
.abb-red-text {
    color: #b91c1c;
    font-weight: 600;
}

.abb-rich em {
    font-style: italic;
}

/* Guards against theme CSS resets (e.g. "strong, b { font-weight: inherit }") that would otherwise
   leave bold text, including auto-bolded dollar amounts, looking identical to normal text. */
.abb-rich strong {
    font-weight: 700;
}

/* Tables scroll sideways on a narrow screen rather than pushing the page wider. */
.abb-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.abb-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.94em;
}

.abb-table th,
.abb-table td {
    border: 1px solid #dbe3ee;
    padding: 6px 8px;
    text-align: left;
    vertical-align: top;
}

.abb-table th {
    background: #e8eef7;
    font-weight: 700;
    color: #0f172a;
}

/* The bar above the input: jump to the latest letter, copy it, or download it. */
.abb-letter-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    margin-top: 10px;
    border-top: 1px solid #eef2f7;
    background: #f8fafc;
    border-radius: 14px;
}

.abb-bar-btn {
    appearance: none;
    border: 1px solid #2563eb;
    background: #2563eb;
    color: #ffffff;
    border-radius: 999px;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.abb-bar-btn:hover {
    filter: brightness(0.92);
}

.abb-bar-btn-outline {
    background: #ffffff;
    color: #2563eb;
}

/* A reply that continues after a letter lines up under the bot's first message. */
.abb-row-continued {
    padding-left: 86px;
}

/* A letter sits in the middle of the chat box. */
.abb-letter-row {
    display: flex;
    justify-content: center;
    margin: 4px 0 16px;
}

.abb-letter-row .abb-letter {
    width: 100%;
    max-width: 760px;
}

/* Answer buttons under a question. The size and text size come from the settings. */
.abb-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0 6px;
}

.abb-quick-reply {
    appearance: none;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #111827;
    border-radius: 14px;
    padding: 0 12px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.04);
    transition: all 0.18s ease;
}

.abb-quick-reply:hover {
    border-color: #2563eb;
    color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.12);
}

.abb-quick-reply:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

/* The offer button. */
.abb-cta-wrap {
    margin-top: 10px;
}

.abb-cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #2563eb;
    color: #ffffff !important;
    text-decoration: none !important;
    border-radius: 999px;
    padding: 13px 20px;
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.22);
    transition: all 0.2s ease;
}

.abb-cta-button:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

/* The offer button where the offer link was in a sentence. */
.abb-rich .abb-cta-inline {
    display: inline-flex;
    margin: 2px 4px;
    padding: 9px 16px;
    font-size: 15px;
    vertical-align: middle;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.2);
}

/* A web link in the bot's text. */
.abb-link {
    color: #2563eb;
    text-decoration: underline;
    text-underline-offset: 3px;
    word-break: break-word;
}

/* The start screen: welcome bubble, then the large start button. */
/* While the start screen shows, the chat box is a column, so the welcome sits at the top and the button in the middle. */
.abb-messages.abb-is-welcome {
    position: relative;
    display: flex;
    flex-direction: column;
}

.abb-welcome-group {
    flex: 0 0 auto;
}

/* The start button is centred in the middle of the chat box, across the full width. */
.abb-start-row {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    justify-content: center;
    padding: 0 4px;
}

.abb-start {
    appearance: none;
    width: 100%;
    max-width: 560px;
    display: flex;
    align-items: center;
    gap: 18px;
    border: none;
    background: #2563eb;
    color: #ffffff;
    border-radius: 999px;
    padding: 12px 26px 12px 12px;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.25);
}

.abb-start:hover {
    background: #1d4ed8;
}

.abb-start:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.abb-start-icon {
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #ffffff;
    position: relative;
}

.abb-start-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 55%;
    transform: translate(-50%, -50%);
    border-left: 16px solid #2563eb;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
}

.abb-start-label {
    flex: 1;
    text-align: left;
}

.abb-start-arrow {
    font-size: 34px;
    line-height: 1;
}

/* A letter is one blob: its text and its buttons sit in the same box. */
.abb-letter {
    align-self: stretch;
    margin: 0;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 18px;
    overflow: hidden;
}

.abb-letter-text {
    padding: 16px 18px;
    font-size: 16px;
    line-height: 1.6;
    color: #111827;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.abb-letter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 18px;
    border-top: 1px solid #e5e7eb;
    background: #f8fafc;
}

.abb-letter-btn {
    appearance: none;
    border: 1px solid #2563eb;
    background: #2563eb;
    color: #ffffff;
    border-radius: 999px;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.abb-letter-btn:hover {
    filter: brightness(0.92);
}

.abb-letter-btn-outline {
    background: #ffffff;
    color: #2563eb;
}

.abb-typing .abb-bubble {
    color: #64748b;
}

.abb-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 15px;
    margin: 0 0 14px;
}

.abb-agree-row {
    display: flex;
    justify-content: center;
    margin: 6px 0 14px;
}

.abb-agree {
    appearance: none;
    border: none;
    background: #2563eb;
    color: #ffffff;
    border-radius: 999px;
    padding: 14px 30px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.25);
}

.abb-agree:hover {
    background: #1d4ed8;
}

.abb-input-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 10px 10px 10px 18px;
    background: #ffffff;
}

.abb-input {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    color: #111827;
    font-family: inherit;
    font-size: 17px;
    line-height: 1.4;
    min-width: 0;
    padding: 10px 0;
}

.abb-input:disabled {
    color: #9ca3af;
    cursor: not-allowed;
}

/* Until I agree, the chatbox looks disabled: the input row is greyed out. */
.abb-chat.abb-is-disabled .abb-input-row {
    background: #f1f5f9;
    border-color: #e2e8f0;
    opacity: 0.7;
}

.abb-send {
    appearance: none;
    border: none;
    background: #2563eb;
    color: #ffffff;
    border-radius: 14px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.abb-send:hover {
    background: #1d4ed8;
}

/* A picture replaces the word Send. The picture has no background of its own in any state, so no hover colour shows. */
.abb-chat .abb-send.abb-send-image,
.abb-chat .abb-send.abb-send-image:hover,
.abb-chat .abb-send.abb-send-image:focus,
.abb-chat .abb-send.abb-send-image:active,
.abb-chat .abb-send.abb-send-image:disabled {
    background: transparent !important;
    box-shadow: none;
    transform: none;
    border: none;
    padding: 0;
    line-height: 0;
}

.abb-chat .abb-send.abb-send-image img {
    display: block;
    height: 44px;
    width: auto;
    max-width: 96px;
    object-fit: contain;
    filter: drop-shadow(0 3px 5px rgba(15, 23, 42, 0.28));
}

.abb-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.abb-footer {
    margin: 12px 0 0;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

@media (max-width: 760px) {
    .abb-chat-inner {
        padding: 16px 12px 12px;
        border-radius: 18px;
        height: 80vh;
    }

    .abb-avatar {
        flex-basis: 48px;
        width: 48px;
        height: 48px;
        font-size: 20px;
    }

    .abb-row-continued {
        padding-left: 62px;
    }

    .abb-column {
        max-width: 88%;
    }

    .abb-bubble {
        font-size: 15px;
        padding: 12px 14px;
    }

    .abb-start {
        font-size: 17px;
        padding: 10px 18px 10px 10px;
    }

    .abb-start-icon {
        flex-basis: 42px;
        width: 42px;
        height: 42px;
    }

    .abb-letter-text {
        font-size: 15px;
        padding: 14px;
    }

    .abb-letter-actions {
        padding: 10px 14px;
    }

    .abb-send {
        padding: 10px 14px;
    }
}

/* A line of three or more dashes on its own becomes a divider between sections. Top margin only, to
   match the rest of .abb-rich: each element spaces itself from the one before, not the one after.
   Scoped under .abb-rich and marked important so a theme's own hr spacing cannot cancel it out,
   the same kind of override that silently defeated bold text until .abb-rich strong was added. */
.abb-rich hr.abb-divider {
    border: none !important;
    border-top: 1px solid #e5e7eb !important;
    margin: 10px 0 0 !important;
}
