/* ================================================
   Belaws AI Advisor — Frontend Styles
   All values driven by CSS custom properties set
   inline on #baa-advisor from the admin settings.
   ================================================ */

/* Reset & scoping */
#baa-advisor,
#baa-advisor * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
.baa-msg.baa-msg-user, .baa-msg.baa-msg-ai {
    margin-right: 10px !important;
}
#baa-advisor {
    width: 100%;
    font-family: var(--baa-font, inherit);
    color: var(--baa-text, #275c86);
    -webkit-font-smoothing: antialiased;
}

/* Container */
#baa-advisor .baa-container {
    max-width: var(--baa-container-w, 1290px);
    margin: 0 auto;
    padding: 0 20px;
}

/* ── Header ── */
#baa-advisor .baa-header {
    text-align: center;
    margin-bottom: 32px;
    transition: all 0.4s ease;
}

#baa-advisor .baa-header.baa-collapsed {
    margin-bottom: 16px;
}

#baa-advisor .baa-header.baa-collapsed .baa-heading {
    font-size: calc(var(--baa-heading-size, 32px) * 0.55) !important;
    margin-bottom: 0;
}

#baa-advisor .baa-header.baa-collapsed .baa-subheading {
    display: none;
}

#baa-advisor .baa-heading {
    font-size: var(--baa-heading-size, 32px);
    font-weight: 700;
    color: var(--baa-text, #275c86);
    margin: 0 0 12px;
    line-height: 1.25;
    transition: font-size 0.4s ease;
}

#baa-advisor .baa-subheading {
    font-size: calc(var(--baa-body-size, 16px) + 1px);
    color: var(--baa-text-soft, #5a7b96);
    margin: 0 auto;
    max-width: 650px;
    line-height: 1.55;
}

/* ── Chat thread ── */
#baa-advisor .baa-chat {
    display: none;
    max-width: var(--baa-max-w, 740px);
    margin: 0 auto 20px;
    max-height: 60vh;
    overflow-y: auto;
    scroll-behavior: smooth;
    padding: 4px 0;
}

#baa-advisor .baa-chat::-webkit-scrollbar { width: 6px; }
#baa-advisor .baa-chat::-webkit-scrollbar-track { background: #f4f8fb; border-radius: 6px; }
#baa-advisor .baa-chat::-webkit-scrollbar-thumb { background: var(--baa-border, #C8D9E9); border-radius: 6px; }
#baa-advisor .baa-chat::-webkit-scrollbar-thumb:hover { background: var(--baa-blue, #3182ce); }

/* ── Message rows ── */
#baa-advisor .baa-msg {
    display: flex;
    margin-bottom: 14px;
    animation: baaFadeUp 0.3s ease both;
}

#baa-advisor .baa-msg-user {
    justify-content: flex-end;
}

#baa-advisor .baa-msg-ai {
    justify-content: flex-start;
    flex-direction: column;
    align-items: flex-start;
}

/* ── User bubble ── */
#baa-advisor .baa-bubble-user {
    background: var(--baa-navy, #275c86);
    color: #fff;
    border-radius: 20px 20px 4px 20px;
    padding: 12px 18px;
    font-size: var(--baa-body-size, 16px);
    line-height: 1.5;
    max-width: 85%;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── AI bubble ── */
#baa-advisor .baa-bubble-ai {
    background: var(--baa-bg-light, #f0f7fc);
    border-radius: 4px 20px 20px 20px;
    padding: 16px 20px;
    max-width: 100%;
    border-left: 3px solid var(--baa-blue, #3182ce);
    margin-bottom: 12px;
}

#baa-advisor .baa-bubble-summary {
    font-size: 15px;
    line-height: 1.65;
    color: var(--baa-text, #275c86);
    font-weight: 450;
    margin: 0;
}

#baa-advisor .baa-bubble-followup {
    font-size: 14px;
    color: var(--baa-text-soft, #5a7b96);
    margin-top: 10px;
    font-style: italic;
    font-weight: 400;
}

/* ── Thinking bubble ── */
#baa-advisor .baa-bubble-thinking {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
}

#baa-advisor .baa-thinking-label {
    font-size: 13px;
    color: var(--baa-text-soft, #5a7b96);
}

/* ── CTA bubble (schedule a call) ── */
#baa-advisor .baa-bubble-cta {
    padding: 4px 0 6px;
}

/* ── Follow-up prompt — sticky element just above the search bar ── */
#baa-advisor .baa-followup-prompt {
    max-width: var(--baa-max-w, 740px);
    margin: 0 auto 14px;
}

#baa-advisor .baa-followup-prompt:empty {
    display: none;
}

#baa-advisor .baa-bubble-question {
    background: #fffaf5;
    border: 1.5px solid var(--baa-orange, #e07b2e);
    border-radius: 16px 16px 16px 4px;
    padding: 14px 18px;
    animation: baaFadeUp 0.3s ease both;
    position: relative;
}

#baa-advisor .baa-bubble-question p {
    font-size: 15px;
    line-height: 1.6;
    color: var(--baa-text, #275c86);
    font-weight: 500;
    margin: 0;
}

#baa-advisor .baa-question-label {
    /*display: inline-block;*/
	display: none;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--baa-orange, #e07b2e);
    margin-bottom: 6px;
}
div#baa-followup-prompt {
    margin-bottom: 20px;
}
/* ── Error bubble ── */
#baa-advisor .baa-bubble-error {
    border-left-color: #e53e3e;
    background: #fff5f5;
}

#baa-advisor .baa-bubble-error p {
    color: #c53030;
    font-size: 14px;
    margin: 0;
}

/* ── Bubble action bar (expert CTA) ── */
#baa-advisor .baa-bubble-actions {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    margin-top: 4px;
    margin-bottom: 6px;
}

/* ── New conversation button ── */
#baa-advisor .baa-btn-new-convo {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1.5px solid var(--baa-border, #C8D9E9);
    border-radius: 50px;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--baa-text-soft, #5a7b96);
    cursor: pointer;
    font-family: var(--baa-font, inherit);
    transition: all 0.2s ease;
    max-width: var(--baa-max-w, 740px);
    margin: 0 auto 10px;
    width: fit-content;
}

#baa-advisor .baa-btn-new-convo:hover {
    border-color: var(--baa-blue, #3182ce);
    color: var(--baa-text, #275c86);
}

/* ── Search bar (idle state) ── */
#baa-advisor .baa-search-area {
    max-width: var(--baa-max-w, 740px);
    margin: 0 auto;
    transition: all 0.3s ease;
}

#baa-advisor .baa-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid var(--baa-border, #C8D9E9);
    border-radius: 50px;
    padding: 6px 6px 6px 22px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, border-radius 0.3s ease;
    box-shadow: 0 2px 12px rgba(39, 92, 134, 0.06);
}

#baa-advisor .baa-search-wrap:focus-within {
    border-color: var(--baa-blue, #3182ce);
    box-shadow: 0 4px 24px rgba(49, 130, 206, 0.12);
}

#baa-advisor .baa-wrap-error {
    border-color: #e53e3e !important;
}

/* ── Chat mode: search wrap transforms to chat input ── */
#baa-advisor .baa-search-wrap.baa-chat-mode {
    border-radius: 20px;
    align-items: flex-end;
    padding: 10px 6px 10px 16px;
}

#baa-advisor .baa-search-wrap.baa-chat-mode .baa-search-icon {
    display: none;
}

#baa-advisor .baa-search-icon {
    flex-shrink: 0;
    margin-right: 10px;
    color: var(--baa-border, #C8D9E9);
    transition: color 0.3s ease;
}

#baa-advisor .baa-search-wrap:focus-within .baa-search-icon {
    color: var(--baa-blue, #3182ce);
}

/* ── Input (textarea) ── */
#baa-advisor .baa-input {
    flex: 1;
    border: none !important;
    background: transparent !important;
    font-size: var(--baa-body-size, 16px);
    color: var(--baa-text, #275c86);
    font-family: var(--baa-font, inherit);
    padding: 10px 12px 10px 0;
    min-width: 0;
    outline: none !important;
    box-shadow: none !important;
    resize: none;
    overflow: hidden;
    line-height: 1.5;
}

#baa-advisor .baa-input::placeholder {
    color: #93afc8;
}

/* ── Submit button ── */
#baa-advisor .baa-submit {
    flex-shrink: 0;
    background: var(--baa-orange, #e07b2e);
    color: #fff !important;
    border: none;
    border-radius: 50px;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--baa-font, inherit);
    white-space: nowrap;
    line-height: 1.3;
}

#baa-advisor .baa-submit.baa-submit-icon {
    padding: 10px 16px;
    font-size: 18px;
    border-radius: 14px;
    line-height: 1;
    align-self: flex-end;
}

#baa-advisor .baa-submit:hover:not(:disabled) {
    filter: brightness(0.9);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(224, 123, 46, 0.3);
}

#baa-advisor .baa-submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── Input inline error ── */
#baa-advisor .baa-input-error {
    color: #e53e3e;
    font-size: 14px;
    margin-top: 6px;
    padding: 0 8px;
    animation: baaFadeUp 0.2s ease;
}

/* ── Example chips ── */
#baa-advisor .baa-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    justify-content: center;
    animation: baaFadeUp 0.25s ease;
}

#baa-advisor .baa-examples:empty { display: none; }

#baa-advisor .baa-chip {
    display: inline-block;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #d6e4f0;
    border-radius: 20px;
    font-size: 13px;
    color: var(--baa-text-soft, #5a7b96);
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.4;
    font-family: var(--baa-font, inherit);
}

#baa-advisor .baa-chip:hover {
    background: #edf5fc;
    border-color: var(--baa-blue, #3182ce);
    color: var(--baa-text, #275c86);
}

/* ── Disclaimer ── */
#baa-advisor .baa-disclaimer {
    max-width: var(--baa-max-w, 740px);
    margin: 16px auto 0;
    text-align: center;
    font-size: 12px;
    line-height: 1.55;
    color: var(--baa-text-soft, #5a7b96);
    opacity: 0.8;
    padding: 0 10px;
    transition: opacity 0.3s ease;
}

#baa-advisor .baa-disclaimer a {
    color: var(--baa-blue, #3182ce);
    text-decoration: underline;
}

/* ── Thinking dots ── */
#baa-advisor .baa-dots {
    display: flex;
    gap: 5px;
}

#baa-advisor .baa-dots span {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--baa-blue, #3182ce);
    animation: baaPulse 1.2s ease-in-out infinite;
}

#baa-advisor .baa-dots span:nth-child(2) { animation-delay: 0.2s; }
#baa-advisor .baa-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ── Service cards grid (inside chat messages) ── */
#baa-advisor .baa-cards {
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    margin-bottom: 6px;
}

#baa-advisor .baa-cards.baa-single-card {
    grid-template-columns: 1fr;
}

#baa-advisor .baa-card {
    background: #fff;
    border: 1.5px solid var(--baa-border, #C8D9E9);
    border-radius: var(--baa-radius, 25px);
    padding: 20px 24px;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none !important;
    display: block;
    color: inherit;
    animation: baaFadeUp 0.35s ease both;
}

#baa-advisor .baa-card:hover {
    border-color: var(--baa-blue, #3182ce);
    box-shadow: 0 4px 20px rgba(49, 130, 206, 0.12);
    transform: translateY(-2px);
}

#baa-advisor .baa-card.baa-primary {
    border-color: var(--baa-orange, #e07b2e);
    background: linear-gradient(135deg, #fffaf5 0%, #ffffff 100%);
}

#baa-advisor .baa-card.baa-primary:hover {
    border-color: var(--baa-orange, #e07b2e);
    box-shadow: 0 4px 20px rgba(224, 123, 46, 0.15);
}

#baa-advisor .baa-badge {
    display: inline-block;
    background: var(--baa-orange, #e07b2e);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 10px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

#baa-advisor .baa-card h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--baa-text, #275c86);
    margin: 0 0 6px;
    line-height: 1.3;
}

#baa-advisor .baa-card p {
    font-size: 13px;
    color: var(--baa-text-soft, #5a7b96);
    line-height: 1.5;
    margin: 0 0 12px;
}

#baa-advisor .baa-card-cta {
    font-size: 13px;
    font-weight: 600;
    color: var(--baa-blue, #3182ce);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

#baa-advisor .baa-card.baa-primary .baa-card-cta {
    color: var(--baa-orange, #e07b2e);
}

/* ── Expert button ── */
#baa-advisor .baa-btn-expert {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--baa-navy, #275c86);
    color: #fff !important;
    border-radius: 50px;
    padding: 9px 20px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    font-family: var(--baa-font, inherit);
    line-height: 1.3;
}

#baa-advisor .baa-btn-expert:hover {
    filter: brightness(0.85);
}

/* ── Animations ── */
@keyframes baaPulse {
    0%, 100% { opacity: 0.3; transform: scale(0.85); }
    50%       { opacity: 1;   transform: scale(1.15); }
}

@keyframes baaFadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 768px) {
    #baa-advisor .baa-heading {
        font-size: calc(var(--baa-heading-size, 32px) * 0.75) !important;
    }

    #baa-advisor .baa-subheading {
        font-size: var(--baa-body-size, 16px);
    }

    #baa-advisor .baa-search-wrap {
        flex-wrap: wrap;
        border-radius: 20px;
        padding: 12px 12px 12px 18px;
        gap: 10px;
    }

    #baa-advisor .baa-search-wrap.baa-chat-mode {
        flex-wrap: nowrap;
        align-items: flex-end;
        padding: 10px 8px 10px 14px;
    }

    #baa-advisor .baa-search-icon { display: none; }

    #baa-advisor .baa-input {
        width: 100%;
        flex: 1 1 100%;
        padding: 6px 0;
        font-size: 16px;
    }

    #baa-advisor .baa-search-wrap.baa-chat-mode .baa-input {
        flex: 1;
    }

    #baa-advisor .baa-submit {
        width: 100%;
        text-align: center;
        padding: 14px 20px;
        font-size: 16px;
        border-radius: 14px;
    }

    #baa-advisor .baa-submit.baa-submit-icon {
        width: auto;
        padding: 10px 14px;
    }

    #baa-advisor .baa-examples { gap: 6px; }

    #baa-advisor .baa-chip {
        font-size: 12px;
        padding: 6px 12px;
    }

    #baa-advisor .baa-cards {
        grid-template-columns: 1fr !important;
    }

    #baa-advisor .baa-bubble-ai { padding: 14px 16px; }
    #baa-advisor .baa-card      { padding: 16px 18px; }
}

@media (max-width: 480px) {
    #baa-advisor .baa-container { padding: 0 15px; }
    #baa-advisor .baa-heading   { font-size: 22px !important; }
    #baa-advisor .baa-examples  { display: none; }

    #baa-advisor .baa-chat {
        max-height: 55vh;
    }
}
