﻿
#chat-widget {
    position: fixed;
    bottom: 100px;
    /* right: 20px; */
    width: 350px;
    max-width: 90vw;
    max-height: 80vh;
    font-size: 13px;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    z-index: 9999;
    transition: transform 0.3s ease, opacity 0.3s ease;
    font-family: "Poppins", sans-serif;
}

.chatbox-hidden {
    display: none !important;
}

.chatbox-visible {
    display: block !important;
}

#chat-toggle-btn {
    position: fixed;
    bottom: 50px;
    /* right: 20px; */
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(45deg, #0c6de0, #9addf0);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    z-index: 1100;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

#unread-count {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: red;
    color: #fff;
    font-size: 12px;
    border-radius: 50%;
    text-align: center;
    line-height: 20px;
}

.chat-container {
    width: 100%;
    max-width: 800px;
    height: 60vh;
    background: white;
    border-radius: 0px !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(to right, #0e5fe7, #3ec7fd);
    color: white;
    padding: 5px;
    text-align: center;
}

    .chat-header h1 {
        font-size: 1.2rem;
        font-weight: 600;
    }

    .chat-header p {
        font-size: 0.9rem;
        opacity: 0.8;
        margin-top: 5px;
    }

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f9f9f9;
}


    .chat-messages::-webkit-scrollbar {
        width: 4px; /* thinner scrollbar */
    }

    .chat-messages::-webkit-scrollbar-thumb {
        background-color: #ccc;
        border-radius: 10px;
    }

        .chat-messages::-webkit-scrollbar-thumb:hover {
            background-color: #999;
        }

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.4;
    position: relative;
    animation: fadeIn 0.3s ease;
    word-break: break-word;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    align-self: flex-end;
    background: #4a6cf7;
    color: white;
    border-bottom-right-radius: 5px;
}

.ai-message {
    align-self: flex-start;
    background: #e9ecef;
    color: #333;
    border-bottom-left-radius: 5px;
}

.message-sender {
    font-size: 0.75rem;
    font-weight: bold;
    margin-bottom: 5px;
    opacity: 0.7;
}

.typing-indicator {
    align-self: flex-start;
    background: #e9ecef;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 5px;
    display: none;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #888;
    animation: typingAnimation 1.4s infinite ease-in-out;
}

    .typing-dot:nth-child(1) {
        animation-delay: 0s;
    }

    .typing-dot:nth-child(2) {
        animation-delay: 0.2s;
    }

    .typing-dot:nth-child(3) {
        animation-delay: 0.4s;
    }

@keyframes typingAnimation {
    0%,60%,100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-5px);
    }
}

.chat-input {
    display: flex;
    padding: 15px;
    background: white;
    border-top: 1px solid #eee;
}

    .chat-input input {
        flex: 1;
        padding: 12px 15px;
        border: 1px solid #ddd;
        border-radius: 30px;
        outline: none;
        font-size: 0.75rem;
        transition: border-color 0.3s;
    }

        .chat-input input:focus {
            border-color: #4a6cf7;
        }

    .chat-input button {
        background: #0c5ae5b8;
        color: white;
        border: none;
        border-radius: 50%;
        width: 50px;
        height: 50px;
        margin-left: 10px;
        cursor: pointer;
        display: flex;
        justify-content: center;
        align-items: center;
        transition: background 0.3s;
    }

        .chat-input button:hover {
            background: #3a5ce5;
        }

        .chat-input button:disabled {
            background: #a0a0a0;
            cursor: not-allowed;
        }

.api-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    font-size: 0.85rem;
    background: #f0f0f0;
    border-top: 1px solid #e0e0e0;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4CAF50;
}

    .status-indicator.offline {
        background: #f44336;
    }

@media(max-width:600px) {
    .chat-container {
        height: 70vh;
        border-radius: 10px;
    }

    .message {
        max-width: 90%;
    }
}
