/* Global Styles */
body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
}

/* Chatbot Icon */
.chatbot-icon {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: #0056b3;
    color: white;
    width: 60px;
    height: 60px;
    display: flex !important; /* Ensure it's always visible */
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease-in-out;
    z-index: 9999; /* Ensure it's above everything */
}

.chatbot-icon i {
    margin: 0; /* Remove any unwanted margin */
    padding: 0;
    line-height: 1; /* Ensure proper alignment */
}

/* Chatbot Window */
.chatbot-container {
    position: fixed;
    bottom: 80px;
    left: 20px;
    width: 380px; /* Increased size */
    background: white;
    border-radius: 12px;
    box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: fadeIn 0.3s ease-in-out;
}

/* Header */
.chatbot-header {
    background: #0056b3;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-header .close-chat {
    cursor: pointer;
    font-size: 18px;
    transition: color 0.3s;
}

.chatbot-header .close-chat:hover {
    color: #ccc;
}

.chatbot-header .status {
    font-size: 14px;
    font-weight: normal;
    margin-left: 5px;
    color: #90ee90;
}

/* Chat Body */
.chatbot-body {
    padding: 15px;
    height: 320px; /* Increased height */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: #f9f9f9;
}

/* Messages */
.bot-message, .user-message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    font-size: 14px;
}

.bot-message {
    background: #e1e1e1;
    align-self: flex-start;
    color: #333;
    max-width: 80%; /* Limit the width of the message */
    word-wrap: break-word; /* Ensure the text wraps within the container */
    white-space: pre-wrap; /* Preserve spaces and line breaks */
    padding: 10px 15px; /* Add some padding inside the message box */
    border-radius: 10px; /* Optional: Adds rounded corners for a nicer look */
    margin-bottom: 10px; /* Add some space between messages */
    overflow-wrap: break-word; /* Force long words to break */
}

.user-message {
    background: #0056b3;
    color: white;
    align-self: flex-end;
}

/* Typing Indicator */
.typing-indicator {
    font-size: 14px;
    color: gray;
    padding: 10px;
    text-align: left;
    display: none;
    font-style: italic;
}

/* Footer */
.chatbot-footer {
    display: flex;
    border-top: 1px solid #ddd;
    padding: 10px;
    background: #fff;
}

.chatbot-footer input {
    flex: 1;
    padding: 10px;
    border: 2px solid grey; /* Default border color */
    font-size: 14px;
    outline: none;
    border-radius: 5px;
    background: #f4f4f4;
    transition: border-color 0.3s ease-in-out;
}

.chatbot-footer input:focus {
    border-color: black; /* Turns black on focus */
}

.chatbot-footer button {
    width: 45px; /* Square shape */
    height: 45px; /* Square shape */
    background: #0056b3;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
    margin-left: 8px;
    border-radius: 5px;
    transition: background 0.3s;
}

.chatbot-footer button:hover {
    background: #004095;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .chatbot-container {
        width: 90%;
        left: 5%;
    }
}

/* Chatbot Closes on Scroll for Large Screens */
@media (min-width: 769px) {
    body {
        overflow-x: hidden;
    }

    .chatbot-container {
        transition: opacity 0.3s, visibility 0.3s;
    }

    .chatbot-container.hidden {
        opacity: 0;
        visibility: hidden;
    }
}
