/* 
 * Chatbot Styles for Tederash SACCO 
 * Provides a premium, floating chat interface.
 */

/* --- Chat Bubble (FAB) --- */
.tederash-chat-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #155fa8 0%, #0e4a85 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(21, 95, 168, 0.4);
    z-index: 100001;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s;
}

.tederash-chat-bubble:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 40px rgba(21, 95, 168, 0.5);
}

.tederash-chat-bubble i {
    transition: transform 0.3s;
}

.tederash-chat-bubble.active {
    display: none !important;
}

.tederash-chat-window {
    position: fixed;
    bottom: 0px;
    right: 20px;
    width: 320px;
    height: 520px;
    max-height: 85vh;
    background: #fff;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 100000;
    transform-origin: bottom right;
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
    border-bottom: none;
}

.tederash-chat-window.active {
    transform: scale(1);
    opacity: 1;
    pointer-events: all;
}

/* --- Chat Header --- */
.chat-header {
    background: linear-gradient(135deg, #155fa8 0%, #0a3566 100%);
    padding: 12px 20px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.chat-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255,255,255,0.1);
}

.header-avatar {
    width: 50px;
    height: 50px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: #155fa8;
}

.header-info h4 {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
}

.header-info span {
    font-size: 12px;
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 5px;
}

.header-info span::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-messages::-webkit-scrollbar { width: 5px; }
.chat-messages::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 10px; }

.message {
    max-width: 85%;
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.6;
    position: relative;
    animation: msgIn 0.3s ease-out;
}

@keyframes msgIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.bot {
    align-self: flex-start;
    background: #fff;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 15px rgba(15, 23, 42, 0.05);
}

.message.user {
    align-self: flex-end;
    background: #155fa8;
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(21, 95, 168, 0.2);
}

/* --- Suggested Topics --- */
.suggested-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.topic-btn {
    background: #f1f5f9;
    color: #155fa8;
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    border: 1px solid #e2e8f0;
}

.topic-btn:hover {
    background: #155fa8;
    color: #fff;
    border-color: #155fa8;
}

/* --- Chat Input --- */
.chat-input {
    padding: 20px;
    background: #fff;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 10px;
}

.chat-input input {
    flex: 1;
    border: 2px solid #f1f5f9;
    padding: 12px 15px;
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.chat-input input:focus {
    border-color: #155fa8;
}

.btn-send {
    width: 45px;
    height: 45px;
    background: #155fa8;
    color: #fff;
    border: none;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.3s;
}

.btn-send:hover {
    background: #0e4a85;
    transform: scale(1.05);
}

/* --- Typing Animation --- */
.typing {
    display: flex;
    gap: 5px;
    padding-top: 5px;
}

.typing span {
    width: 6px;
    height: 6px;
    background: #cbd5e1;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing span:nth-child(1) { animation-delay: -0.32s; }
.typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* --- Mobile Fixes --- */
@media (max-width: 991px) {
    .tederash-chat-window {
        width: 100%;
        right: 0;
        bottom: 0px; 
        height: auto;
        max-height: 85vh;
        border-radius: 20px 20px 0 0;
    }
    .tederash-chat-bubble {
        bottom: 20px; /* Standard bottom-right placement */
        right: 20px; 
        width: 55px; 
        height: 55px;
        font-size: 26px;
    }
}
