/*
|--------------------------------------------------------------------------
| Nairobi Water SACCO Chatbot
| Version 9
|--------------------------------------------------------------------------
*/

:root {
    --nw-blue: #075aaa;
    --nw-blue-dark: #043e78;
    --nw-blue-light: #eaf4ff;
    --nw-text: #172033;
    --nw-muted: #718096;
    --nw-border: #e4e9f0;
    --nw-white: #ffffff;
    --nw-bg: #f5f8fc;
}


/*
|--------------------------------------------------------------------------
| Launcher
|--------------------------------------------------------------------------
*/

#nw-chat-launcher {
    position: fixed;
    right: 25px;
    bottom: 25px;

    width: 64px;
    height: 64px;

    border: 0;
    border-radius: 50%;

    background: var(--nw-blue);
    color: white;

    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.20);

    cursor: pointer;

    z-index: 999998;

    display: flex;
    align-items: center;
    justify-content: center;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}


#nw-chat-launcher:hover {
    transform: translateY(-3px) scale(1.03);

    box-shadow:
        0 16px 35px rgba(0, 0, 0, 0.25);
}


.nw-launcher-icon {
    font-size: 28px;
}


#nw-chat-launcher.nw-hidden {
    display: none;
}


/*
|--------------------------------------------------------------------------
| Main Widget
|--------------------------------------------------------------------------
*/

#nw-chat-widget {
    position: fixed;

    right: 25px;
    bottom: 25px;

    width: 390px;
    max-width: calc(100vw - 30px);

    height: 650px;
    max-height: calc(100vh - 40px);

    background: white;

    border-radius: 22px;

    overflow: hidden;

    box-shadow:
        0 25px 70px rgba(15, 23, 42, 0.25);

    display: flex;
    flex-direction: column;

    z-index: 999999;

    opacity: 0;
    visibility: hidden;

    transform:
        translateY(25px)
        scale(0.97);

    transition:
        opacity 0.2s ease,
        transform 0.2s ease,
        visibility 0.2s ease;
}


#nw-chat-widget.nw-open {

    opacity: 1;

    visibility: visible;

    transform:
        translateY(0)
        scale(1);
}


/*
|--------------------------------------------------------------------------
| Header
|--------------------------------------------------------------------------
*/

.nw-chat-header {

    min-height: 82px;

    padding: 15px 17px;

    background:
        linear-gradient(
            135deg,
            var(--nw-blue-dark),
            var(--nw-blue)
        );

    color: white;

    display: flex;

    align-items: center;

    justify-content: space-between;
}


.nw-brand {

    display: flex;

    align-items: center;

    min-width: 0;
}


.nw-brand-logo {

    width: 47px;
    height: 47px;

    border-radius: 14px;

    background: rgba(255, 255, 255, 0.15);

    border:
        1px solid
        rgba(255, 255, 255, 0.25);

    display: flex;

    align-items: center;
    justify-content: center;

    font-size: 15px;
    font-weight: 800;

    letter-spacing: 0.5px;

    margin-right: 11px;
}


.nw-brand-text {
    min-width: 0;
}


.nw-brand-title {

    font-size: 17px;

    font-weight: 800;

    letter-spacing: 0.5px;

    white-space: nowrap;
}


.nw-brand-subtitle {

    margin-top: 4px;

    font-size: 11px;

    opacity: 0.90;

    display: flex;

    align-items: center;

    gap: 5px;
}


.nw-online-dot {

    display: inline-block;

    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: #4ade80;

    box-shadow:
        0 0 0 3px
        rgba(74, 222, 128, 0.15);
}


.nw-header-actions {

    display: flex;

    gap: 5px;
}


.nw-header-actions button {

    width: 34px;
    height: 34px;

    border: 0;

    border-radius: 10px;

    background:
        rgba(255, 255, 255, 0.12);

    color: white;

    font-size: 19px;

    cursor: pointer;

    transition:
        background 0.2s ease;
}


.nw-header-actions button:hover {

    background:
        rgba(255, 255, 255, 0.22);
}


/*
|--------------------------------------------------------------------------
| Chat area
|--------------------------------------------------------------------------
*/

.nw-chat-box {

    flex: 1;

    overflow-y: auto;

    padding: 18px 16px;

    background:
        linear-gradient(
            180deg,
            #f8fbff 0%,
            #f4f7fb 100%
        );

    scroll-behavior: smooth;
}


.nw-chat-box::-webkit-scrollbar {
    width: 6px;
}


.nw-chat-box::-webkit-scrollbar-thumb {

    background: #cbd5e1;

    border-radius: 10px;
}


/*
|--------------------------------------------------------------------------
| Welcome
|--------------------------------------------------------------------------
*/

.nw-welcome {

    text-align: center;

    padding:
        28px
        18px
        22px;

    color: var(--nw-text);
}


.nw-welcome-icon {

    width: 58px;
    height: 58px;

    margin:
        0
        auto
        13px;

    border-radius: 18px;

    background: var(--nw-blue-light);

    display: flex;

    align-items: center;
    justify-content: center;

    font-size: 28px;
}


.nw-welcome h3 {

    margin:
        0
        0
        8px;

    font-size: 18px;

    font-weight: 800;
}


.nw-welcome p {

    margin: 0;

    color: var(--nw-muted);

    font-size: 13px;

    line-height: 1.6;
}


.nw-welcome-note {

    margin-top: 14px;

    color: var(--nw-blue);

    font-size: 12px;

    font-weight: 600;
}


/*
|--------------------------------------------------------------------------
| Messages
|--------------------------------------------------------------------------
*/

.nw-message {

    margin-bottom: 15px;

    display: flex;

    animation:
        nwMessageIn
        0.2s
        ease;
}


@keyframes nwMessageIn {

    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }

}


.nw-user-message {

    justify-content: flex-end;

    flex-direction: column;

    align-items: flex-end;
}


.nw-bot-message {

    align-items: flex-start;

    gap: 9px;
}


.nw-bot-avatar {

    flex: 0 0 34px;

    width: 34px;
    height: 34px;

    border-radius: 11px;

    background:
        linear-gradient(
            135deg,
            var(--nw-blue-dark),
            var(--nw-blue)
        );

    color: white;

    display: flex;

    align-items: center;
    justify-content: center;

    font-size: 10px;

    font-weight: 800;
}


.nw-bot-content {

    max-width: calc(100% - 43px);
}


.nw-message-name {

    font-size: 10px;

    font-weight: 700;

    color: var(--nw-blue);

    margin:
        0
        0
        4px
        3px;
}


.nw-message-bubble {

    padding: 11px 13px;

    border-radius: 15px;

    font-size: 13px;

    line-height: 1.6;

    word-wrap: break-word;
}


.nw-user-message
.nw-message-bubble {

    background: var(--nw-blue);

    color: white;

    border-bottom-right-radius: 5px;
}


.nw-bot-message
.nw-message-bubble {

    background: white;

    color: var(--nw-text);

    border:
        1px solid
        var(--nw-border);

    border-bottom-left-radius: 5px;

    box-shadow:
        0 2px 8px
        rgba(15, 23, 42, 0.04);
}


.nw-message-time {

    margin-top: 4px;

    font-size: 9px;

    color: #98a2b3;
}


.nw-user-message .nw-message-time {

    margin-right: 3px;
}


/*
|--------------------------------------------------------------------------
| Answer source
|--------------------------------------------------------------------------
*/

.nw-answer-source {

    display: inline-block;

    margin-top: 6px;

    padding:
        3px
        7px;

    border-radius: 7px;

    background: #edf7ed;

    color: #237a3b;

    font-size: 9px;

    font-weight: 700;
}


.nw-answer-source::before {
    content: "●";
    margin-right: 4px;
}


.nw-typing-bubble {

    min-width: 58px;

    display: flex;

    align-items: center;

    gap: 4px;
}


.nw-typing-bubble span {

    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: #8b98aa;

    animation:
        nwTyping
        1.2s
        infinite ease-in-out;
}


.nw-typing-bubble span:nth-child(2) {
    animation-delay: 0.15s;
}


.nw-typing-bubble span:nth-child(3) {
    animation-delay: 0.30s;
}


@keyframes nwTyping {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }

    30% {
        transform: translateY(-4px);
        opacity: 1;
    }

}


/*
|--------------------------------------------------------------------------
| Quick Actions
|--------------------------------------------------------------------------
*/

.nw-quick-actions {

    display: flex;

    gap: 7px;

    padding:
        10px
        12px;

    border-top:
        1px solid
        var(--nw-border);

    overflow-x: auto;

    background: white;
}


.nw-quick-actions::-webkit-scrollbar {
    display: none;
}


.nw-quick-btn {

    flex: 0 0 auto;

    padding:
        8px
        11px;

    border:
        1px solid
        #dce5ef;

    border-radius: 20px;

    background: white;

    color: #36536e;

    font-size: 11px;

    font-weight: 600;

    cursor: pointer;

    transition:
        all 0.2s ease;
}


.nw-quick-btn:hover {

    background: var(--nw-blue-light);

    border-color:
        #bdd8f5;

    color: var(--nw-blue);
}


/*
|--------------------------------------------------------------------------
| Input
|--------------------------------------------------------------------------
*/

.nw-input-area {

    display: flex;

    align-items: flex-end;

    gap: 8px;

    padding:
        11px
        12px;

    background: white;

    border-top:
        1px solid
        var(--nw-border);
}


#nw-chat-input {

    flex: 1;

    min-height: 42px;
    max-height: 120px;

    resize: none;

    border:
        1px solid
        #dce3eb;

    border-radius: 14px;

    padding:
        11px
        12px;

    outline: none;

    font-family: inherit;

    font-size: 13px;

    color: var(--nw-text);

    background: #f9fafc;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}


#nw-chat-input:focus {

    border-color:
        #8dbce9;

    background: white;

    box-shadow:
        0 0 0 3px
        rgba(7, 90, 170, 0.08);
}


#nw-chat-input::placeholder {
    color: #9aa5b1;
}


#nw-send-btn {

    flex: 0 0 42px;

    width: 42px;
    height: 42px;

    border: 0;

    border-radius: 13px;

    background: var(--nw-blue);

    color: white;

    font-size: 18px;

    cursor: pointer;

    transition:
        transform 0.2s ease,
        background 0.2s ease;
}


#nw-send-btn:hover {

    background:
        var(--nw-blue-dark);

    transform:
        translateY(-1px);
}


#nw-send-btn:disabled {

    opacity: 0.55;

    cursor: not-allowed;

    transform: none;
}


/*
|--------------------------------------------------------------------------
| Footer
|--------------------------------------------------------------------------
*/

.nw-powered {

    text-align: center;

    padding:
        5px
        10px
        8px;

    background: white;

    color: #9aa5b1;

    font-size: 8px;

    letter-spacing: 0.2px;
}


/*
|--------------------------------------------------------------------------
| Mobile
|--------------------------------------------------------------------------
*/

@media (max-width: 600px) {

    #nw-chat-launcher {

        right: 17px;

        bottom: 17px;

        width: 58px;
        height: 58px;
    }


    #nw-chat-widget {

        right: 0;
        bottom: 0;

        width: 100%;
        max-width: 100%;

        height: 100%;
        max-height: 100%;

        border-radius: 0;
    }


    .nw-chat-header {

        min-height: 74px;
    }


    .nw-brand-title {

        font-size: 15px;
    }


    .nw-brand-subtitle {

        font-size: 10px;
    }

}


/*
|--------------------------------------------------------------------------
| Accessibility
|--------------------------------------------------------------------------
*/

button:focus-visible,
textarea:focus-visible {

    outline:
        3px solid
        rgba(7, 90, 170, 0.25);

    outline-offset: 2px;
}