/* ==========================
   FINQNA CHAT
========================== */

.finqna-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #ffffff;
    padding: 8px 12px 3px 10px;
}

@media (max-width: 500px) {
    .finqna-input-wrapper {
        flex-wrap: nowrap; /* force button to stay inline */
    }
}

.finqna-textarea-container {
    position: relative;
    flex: 1; 
}

/* Container for chat block (home page) */
.finqna-block-form {
    width: 100%;
}

#finqna-input {
    flex: 1;
    width: 100%;
    min-height: 40px;
    max-height: 120px;
    padding: 2px 10px 8px 55px; /* left padding for icon */
    margin-bottom: 2px;
    box-sizing: border-box;
    font-size: 14px;
    border: none;
    outline: none;
    line-height: 1.4;
    resize: vertical;
}

.finqna-icon {
    position: absolute;
    top: 1px;
    width: 45px;
    height: 45px;
    pointer-events: none;
}

#finqna-submit {
    padding: 10px; 
    margin-left: 10px;
    border-radius: 6px;
    border: none;
    background-color: #074149;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    flex-shrink: 0; /* prevent shrinking */
    display: flex;
    align-items: center; /* vertical center text */
    justify-content: center;
}

#finqna-submit:hover {
    background-color: #04292e;
}

#finqna-submit svg {
    width: 25px;
    height: 25px;
}

#finqna-submit svg path {
    fill: #ffffff;
}

.finqna-right-controls {
    position: absolute;
    bottom: 6px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.finqna-mode-select {
    margin-left: 8px;
    padding: 13px 0;
    font-size: 0.85rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
}

/* Ask FinQnA page chat section */
#finqna-chat {
    max-width: 800px;
    margin: 0;
    position: relative;
}

#finqna-messages {
    padding: 16px;
    margin-left: -20px;
    margin-right: -20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-wrap-style: balance;
}

#finqna-messages:empty {
    padding: 0;
}

/* Message bubbles */
.finqna-msg {
    display: flex;
    align-items: flex-start;
    gap: 12px; 
    max-width: 100%;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.55;
    word-wrap: break-word;
}

/* Chatbot avatar */
.finqna-avatar {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    margin: 5px 0 0 -5px;
}

/* User bubble */
.finqna-msg.user {
    background: #3b9294;
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 4px;
    justify-content: flex-end;
    line-height: 1.6em;
}

/* Assistant bubble */
.finqna-msg.assistant {
    background: #f0f2f4;
    border: 1px solid #e5e7eb;
    box-sizing: border-box;
    width: 100%;
    margin-right: auto;
    padding: 10px 16px;
    border-bottom-left-radius: 4px;
    justify-content: flex-start;
    line-height: 1.6em;
}

/* Thinking bubble */
.finqna-msg.assistant.finqna-loading,
.finqna-msg.assistant.finqna-loading .finqna-content,
.finqna-msg.assistant.finqna-loading .finqna-thinking {
    width: 30%;          /* bubble width */
    box-sizing: border-box;
    opacity: 0.7;        /* faded appearance */
    font-style: italic;   /* italic text */
}

/* Ensure the dots animation looks consistent */
.finqna-msg.assistant.finqna-loading .dots {
    display: inline-block;
}

.finqna-msg.assistant p {
    text-wrap-style: pretty;
}

.finqna-msg.assistant table {
    border-collapse: collapse;
}

@media (max-width: 600px) {

.finqna-msg.assistant table {
        font-size: 90%;
    }
}

.finqna-msg.assistant td {
    background-color: #eaf6f6;
    border: 2px solid #074149;
    padding: 6px 10px;
}

.finqna-msg.assistant thead {
    background-color: #3c9294;
    border-bottom: none;
}

.finqna-msg.assistant th {
    border: 2px solid #074149;
    background-color: #3c9294;
    color: #fff;
    padding: 6px 10px; 
}

.finqna-msg.assistant td:first-child {
    background-color: #cfebeb;
    font-weight: bold;
}

/* Remove top margin from first paragraph */
.finqna-msg.assistant p:first-of-type {
    margin-top: 5px;
    text-wrap-style: pretty;
}

.finqna-msg.assistant ul {
    padding-left: 15px;
}

/* Suggestions section */
#finqna-suggestions {
    margin: 10px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.finqna-suggestions-title,
.finqna-related-title,
.finqna-products-title {
    font-size: 14px;
    font-weight: bold;
    padding: 6px 0;
    width: 100%;
    flex-basis: 100%;
}

.finqna-suggestion-btn,
.finqna-related-btn,
.finqna-product-btn {
    padding: 6px 14px;
    border: none;
    background: #f3f4f6;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    color: #111;
}

.finqna-suggestion-btn:hover,
.finqna-related-btn:hover,
.finqna-product-btn:hover {
    background: #e5e7eb;
    color: #111;
}

/* Disclaimer */
.finqna-disclaimer {
    margin-top: 15px;
    font-size: 12px;
    color: #6b7280;
}