/* =========================
   FLOATING CHAT BUTTON
========================= */

#chat-launcher {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;

    /* SACCO BLUE */
    background: #0057a3;

    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 99999;
}

/* =========================
   CHAT WINDOW
========================= */

#chat-widget {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 520px;

    background: white;
    border-radius: 18px;

    display: none;
    flex-direction: column;

    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);

    z-index: 99999;
}

/* =========================
   HEADER
========================= */

#chat-header {
    background: #0057a3;
    color: white;
    padding: 15px;
    font-weight: bold;

    display: flex;
    justify-content: space-between;
    align-items: center;
}

#close-chat {
    background: transparent;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
}

/* =========================
   CHAT BOX (FIXED SCROLL)
========================= */

#chat-box {
    flex: 1;
    padding: 12px;

    overflow-y: auto;

    background: #f5f5f5;

    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* message alignment fix */
.user-msg {
    align-self: flex-end;
}

.bot-msg,
.typing {
    align-self: flex-start;
}

/* =========================
   MESSAGES
========================= */

.user-msg,
.bot-msg {
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
    position: relative;
}

.user-msg {
    background: #0057a3;
    color: white;
}

.bot-msg {
    background: white;
    color: #222;
    border: 1px solid #ddd;
}

/* timestamp */
.timestamp {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 5px;
}

/* typing */
.typing {
    display: inline-block;
    padding: 10px;
    background: white;
    border-radius: 10px;
    margin-bottom: 10px;
}

/* =========================
   SUGGESTIONS
========================= */

#suggestions {
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: #fafafa;
}

.quick-btn {
    border: none;
    background: #e6f0ff;
    color: #0057a3;
    padding: 8px 10px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
}

/* =========================
   INPUT AREA
========================= */

#chat-input-area {
    display: flex;
    padding: 10px;
    border-top: 1px solid #ddd;
    background: white;
}

#chat-input {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ccc;
}

#send-btn {
    margin-left: 8px;
    background: #0057a3;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
}

/* =========================
   DARK MODE
========================= */

body.dark-mode #chat-widget {
    background: #1f1f1f;
}

body.dark-mode #chat-box {
    background: #121212;
}

body.dark-mode .bot-msg {
    background: #2b2b2b;
    color: white;
    border: 1px solid #444;
}

body.dark-mode #chat-input-area {
    background: #1f1f1f;
}

body.dark-mode #chat-input {
    background: #2b2b2b;
    color: white;
    border: 1px solid #444;
}

/* =========================
   MOBILE RESPONSIVE
========================= */

@media(max-width: 600px) {

    #chat-widget {
        width: 95%;
        right: 2.5%;
        height: 85vh;
        bottom: 80px;
    }

    #chat-launcher {
        width: 55px;
        height: 55px;
    }
}
#chat-widget {
    display: flex;
    flex-direction: column;
}

/* FIX INPUT AREA ALWAYS VISIBLE */
#chat-input-area {
    position: sticky;
    bottom: 0;
    z-index: 10;
}

/* FIX CHAT SCROLLING AREA */
#chat-box {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* PREVENT BUTTON DISAPPEARING */
#suggestions {
    flex-shrink: 0;
}