﻿
#chat-widget {
    position: fixed;
    bottom: 100px;
    /* right: 20px; */
    width: 350px;
    max-width: 90vw;
    /* height: 450px; */
    max-height: 80vh;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    transition: transform 0.3s ease, opacity 0.3s ease;
    font-family: "Poppins", sans-serif;
}

.chatbox-hidden {
    transform: translateY(50px);
    opacity: 0;
    pointer-events: none;
    display: flex;
}

.chatbox-visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
    display: flex;
}

/* Header */
.chat-header {
    background: linear-gradient(45deg, #025add, #0c6de0);
    color: #fff;
    padding: 10px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
}

/* Body */
/* Chat-body Scrollbar */
.chat-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    background: #f5f5f5;
    height: 350px;
    overflow-y: scroll;
}

    /* Scrollbar for Webkit browsers */
    .chat-body::-webkit-scrollbar {
        width: 6px; /* scrollbar width */
    }

    .chat-body::-webkit-scrollbar-track {
        background: transparent; /* track background */
    }

    .chat-body::-webkit-scrollbar-thumb {
        background: rgba(0,0,0,0.2); /* thumb color */
        border-radius: 10px; /* rounded corners */
    }

        .chat-body::-webkit-scrollbar-thumb:hover {
            background: rgba(0,0,0,0.4); /* hover effect */
        }

/* Firefox scrollbar */
.chat-body {
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.2) transparent;
}


/* Messages */
.message {
    padding: 8px 12px;
    border-radius: 12px;
    /* max-width: 75%; */
    word-wrap: break-word;
}

    .message.user {
        background: #e1ffc7;
        align-self: flex-start;
    }

    .message.admin {
        background: #025add;
        align-self: flex-end;
        color: white;
    }

/* Input fixed at bottom */
.chat-input {
    display: flex;
    gap: 5px;
    padding: 5px;
    background: #eee;
    flex-shrink: 0;
    align-items: center;
    margin-top: auto; /* force it to bottom */
}

    .chat-input input {
        flex: 1;
        padding: 8px;
        border-radius: 5px;
        border: 1px solid #ccc;
    }

    .chat-input button {
        padding: 8px 12px;
        border-radius: 5px;
        border: none;
        background: linear-gradient(45deg, #025add, #0c6de0);
        color: #fff;
        cursor: pointer;
    }

/* Scrollbar */
.chat-body::-webkit-scrollbar {
    width: 6px;
}

.chat-body::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
}

/* Responsive */
@media(max-width:576px) {
    #chat-widget {
        width: 90vw;
        height: 59vh;
        bottom: 80px;
        right: 5%;
        overflow: scroll;
    }

    .chat-input input {
        padding: 10px;
    }

    .chat-input button {
        padding: 10px 15px;
    }

    /* Body */
    .chat-body {
        flex: 1; /* take all remaining space */
        padding: 10px;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        gap: 8px;
        background: #f5f5f5;
        height: 360px;
    }
}
