#askawa-chatbot {
    min-width: 96%;
    max-width: 96%;
    margin: 2rem auto;
    border: 1px solid #444;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    height: 80vh;
    background-color: #2d2d2d;
    font-family: sans-serif;
}

#askawa-chatbot-popup {
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    background-color: transparent !important;
    display: flex !important;
    flex-direction: column !important;
}

#askawa-messages {

    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}


#askawa-messages-popup {

    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Ensure askawa-messages-popup uses all available space above the form */
.askawa-popup-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}
#askawa-messages-popup {
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Keep the form visible at the bottom - prevent it from shrinking */
#askawa-form-popup {
    flex-shrink: 0;
    display: flex;
    padding: 12px 16px;
    background: rgba(45,45,45,0.98);
    border-top: 1px solid #444;
    box-sizing: border-box;
}


/* AskAwa Popup Styles */
.askawa-popup {
    position: fixed;
    right: 32px;
    bottom: 32px;
    z-index: 9999;
    background: #242424;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.25);
    border: 1px solid #444;
    width: 70vw;
    max-width: 70vw;
    min-height: 70vh;
    max-height: 90vh;
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.askawa-popup.show {
    display: flex;
}
.askawa-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1a1a1a;
    color: #fff;
    font-weight: 500;
    padding: 12px 20px 12px 16px;
    border-bottom: 1px solid #444;
    font-size: 1.1em;
}
.askawa-popup-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5em;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.askawa-popup-content {
    background: #242424;
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}


/* Ensure popup and chat use full height */
.askawa-popup {
    height: 90vh;
    max-height: 90vh;
    min-height: 70vh;
}
.askawa-popup-content {
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#askawa-chatbot-popup {
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#askawa-form-popup {
    flex-shrink: 0;
    display: flex;
    padding: 12px 16px;
    background: rgba(45,45,45,0.98);
    border-top: 1px solid #444;
    box-sizing: border-box;
}

/* Keep the form visible at the bottom - prevent it from shrinking */
#askawa-form {
    flex-shrink: 0;
    display: flex;
    padding: 12px 16px;
    background: rgba(45,45,45,0.98);
    border-top: 1px solid #444;
    box-sizing: border-box;
}


/* Ensure chat is full-height on mobile and input stays visible */
@media (max-width: 991px) {
    #askawa-chatbot {
        min-width: 96%;
        max-width: 96%;
        /* push below the header exactly */
        margin: calc(var(--site-header-height)) auto 0 auto;
        /* Make the chat fill available viewport area below header */
        max-height: 70vh;
        margin-bottom:32px;
        border-radius: 0; /* flush with edges */
        display: flex;
        flex-direction: column;
        overflow: hidden; /* contain internal scrolling to messages area */
    }

    /* Messages area: single scrollable box anchored above the form */
    #askawa-messages {
        padding: 12px 16px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        background: transparent;
        border: none;
        box-sizing: border-box;
        gap: 15px;
    }

    /* Keep the form visible at the bottom - prevent it from shrinking */
    #askawa-form {
        flex-shrink: 0;
        display: flex;
        padding: 12px 16px;
        background: rgba(45,45,45,0.98);
        border-top: 1px solid #444;
        box-sizing: border-box;
    }

    #askawa-input {
        flex-grow: 1;
        padding: 12px;
        border-radius: 6px;
        border: 1px solid #555;
        background: #333;
        color: #fff;
        font-size: 1rem;
    }

    #askawa-send {
        margin-left: 10px;
        padding: 10px 16px;
        border: none;
        border-radius: 6px;
        background-color: #007bff;
        color: white;
        cursor: pointer;
        font-size: 1rem;
    }

    /* Persona: remove any boxed styles coming from global .person-statement-block */
    #askawa-messages .askawa-person,
    #askawa-messages .person-statement-block,
    #askawa-messages .person-statement-block-row,
    #askawa-messages .person-statement-block-col1,
    #askawa-messages .person-statement-block-col2,
    #askawa-messages .person-statement-block-text {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Keep persona image small and inline with messages layout */
    #askawa-messages .person-statement-block-image-wrapper-small,
    #askawa-messages .person-statement-block-image-wrapper {
        width: 48px !important;
        height: 48px !important;
        margin-right: 12px !important;
        border-radius: 50% !important;
        overflow: hidden !important;
        display: inline-block !important;
        vertical-align: middle !important;
    }
    #askawa-messages .person-statement-block-image {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        display: block !important;
    }

    /* Layout persona as a single inline block at top of messages area */
    #askawa-messages .askawa-person {
        display: flex !important;
        gap: 12px !important;
        align-items: center !important;
        padding: 0 !important;
    }

    /* Make askawa-message and persona visually unified */
    #askawa-messages .askawa-message.bot,
    #askawa-messages .askawa-message.user {
        background-color: rgba(0,0,0,0.12);
        color: #e0e0e0;
        margin: 0;
        border-radius: 12px;
        padding: 10px 12px;
        max-width: 100%;
    }

    .askawa-popup {
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        min-width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        min-height: 100vh !important;
        border-radius: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
    }
}

/* end mobile adjustments */

.askawa-message {
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 80%;
    line-height: 1.5;
}

.askawa-message.user {
    background-color: #0056b3;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.askawa-message.bot {
    background-color: #3a3a3a;
    color: #e0e0e0;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.askawa-message.bot .sources {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #555;
}

.askawa-message.bot .sources-title {
    font-weight: bold;
    font-size: 0.9em;
    margin-bottom: 5px;
    color: #ccc;
}

.askawa-message.bot .source-link {
    display: block;
    font-size: 0.85em;
    color: #8ab4f8;
    text-decoration: none;
    margin-bottom: 3px;
}
.askawa-message.bot .source-link:hover {
    text-decoration: underline;
}

#askawa-form {
    display: flex;
    padding: 15px;
    border-top: 1px solid #444;
    flex-shrink: 0;
}

#askawa-input {
    flex-grow: 1;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #555;
    background: #333;
    color: #fff;
    font-size: 1rem;
}

#askawa-send {
    margin-left: 10px;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    font-size: 1rem;
}
#askawa-send:hover {
    background-color: #0056b3;
}

.typing-indicator {
    display: flex;
    align-items: center;
}
.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: #888;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: bounce 1.4s infinite both;
}
.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

.askawa-person {
    padding: 0;
    margin-bottom: 8px;
}


/* Popup-specific wrapper adjustments */
.askawa-popup-content #askawa-chatbot {
    margin: 0;
    border: none;
    border-radius: 0;
    height: 100%;
    max-height: none;
}
