/* --- Global Reset & Base Styles --- */
body {
    margin: 0;
    font-family: 'Open Sans', sans-serif; /* A common, clean sans-serif font */
    color: #333;
}

/* --- Styles for the Floating Chat Bubble --- */
#lex-chat-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    width: 60px; /* Slightly larger bubble */
    height: 60px; /* Slightly larger bubble */
    background-color: #7B68EE; /* Main purple from your site */
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 60px; /* Vertically center content */
    font-size: 2em; /* Larger icon/text */
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25); /* More prominent shadow */
    transition: background-color 0.3s ease, transform 0.2s ease;
    user-select: none;
    display: flex; /* Use flex for perfect centering of icon */
    align-items: center;
    justify-content: center;
}

#lex-chat-bubble:hover {
    background-color: #6A5ACD; /* Darker purple on hover */
    transform: translateY(-3px); /* Subtle lift effect */
}

#lex-chat-bubble .bubble-text {
    display: none; /* Icon only */
}


/* --- Styles for the Main Chat Container (Window) --- */
#lex-chat-container {
    position: fixed;
    bottom: 90px; /* Position above the bubble */
    right: 20px; /* Align with the bubble */
    z-index: 1000;

    background-color: #fff; /* White background for the chat window */
    border: none; /* No border, let shadow define it */
    width: 350px; /* Slightly wider chat window */
    max-width: 90%;
    height: 550px; /* Slightly taller chat window */
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2); /* More prominent shadow */
    display: flex;
    flex-direction: column;
    border-radius: 12px; /* More rounded corners */
    overflow: hidden;
    font-family: 'Open Sans', sans-serif;

    /* --- Initially Hidden State --- */
    visibility: hidden;
    opacity: 0;
    transform: translateY(30px); /* Slide up for animation */
    transition: opacity 0.3s cubic-bezier(0.25, 0.1, 0.25, 1), transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1), visibility 0.3s ease;
}

/* --- Styles for the Open Chat Container State --- */
#lex-chat-container.open {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}


/* --- Styles for the Chat Header --- */
#lex-chat-header {
    background-color: #7B68EE; /* Main purple from your site */
    color: white;
    padding: 15px 20px; /* More padding */
    border-bottom: none; /* No border */
    font-weight: 600; /* Bolder text */
    font-size: 1.1em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

#lex-chat-close {
    font-size: 1.5em; /* Larger close icon */
    cursor: pointer;
    padding: 0 8px;
    transition: color 0.2s ease;
    color: rgba(255, 255, 255, 0.8); /* Slightly faded white */
}

#lex-chat-close:hover {
    color: white; /* Pure white on hover */
}


/* --- Styles for Chatbox, Input, Send --- */
#lex-chatbox {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px;
    background-color: #f8f8f8; /* Very light gray chat background */
    display: flex;
    flex-direction: column;
    gap: 10px; /* Space between messages */
}

/* Base style for all message containers within chatbox */
#lex-chatbox > div {
    max-width: 80%; /* Slightly less wide for better wrapping */
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); /* Subtle shadow for messages */
}

/* Style for user messages */
#lex-chatbox .user-message {
    align-self: flex-end;
    background-color: #9370DB; /* Lighter purple for user */
    color: white;
    border-radius: 18px 18px 3px 18px; /* More modern bubble shape */
    padding: 10px 14px;
    margin-left: auto; /* Push to the right */
}
#lex-chatbox .user-message p {
    margin: 0; /* Remove default paragraph margin */
}


/* Style for bot messages */
#lex-chatbox .bot-message {
    align-self: flex-start;
    background-color: #ffffff; /* White background for bot messages */
    color: #333;
    border: 1px solid #e0e0e0; /* Very light border */
    border-radius: 18px 18px 18px 3px; /* More modern bubble shape */
    padding: 10px 14px;
    margin-right: auto; /* Push to the left */
}
#lex-chatbox .bot-message p {
    margin: 0; /* Remove default paragraph margin */
}


#lex-input-area {
    display: flex;
    border-top: 1px solid #eee; /* Lighter border */
    background-color: #fff;
    padding: 10px 15px; /* More padding */
    flex-shrink: 0;
    gap: 8px; /* Space between input and button */
}

#lex-chat-input {
    flex-grow: 1;
    padding: 10px 12px; /* More padding */
    border: 1px solid #ccc;
    border-radius: 20px; /* Rounded input field */
    outline: none;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#lex-chat-input:focus {
    border-color: #7B68EE; /* Purple border on focus */
    box-shadow: 0 0 0 3px rgba(123, 104, 238, 0.2); /* Soft purple shadow on focus */
}


#lex-chat-send {
    padding: 10px 18px; /* More padding for button */
    background-color: #25D366; /* Keep WhatsApp green for consistency and recognition */
    color: white;
    border: none;
    border-radius: 20px; /* Rounded button */
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: background-color 0.2s ease, transform 0.1s ease;
    flex-shrink: 0;
}

#lex-chat-send:hover {
    background-color: #128C7E; /* Darker green on hover */
    transform: translateY(-1px); /* Subtle lift */
}

#lex-chat-send:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
}


/* --- Styles for Response Card --- */
.response-card {
    background-color: #F8F8F8; /* Light gray background for the card */
    border: 1px solid #e0e0e0;
    border-radius: 12px; /* Match container rounding */
    padding: 15px;
    margin-top: 8px; /* Space between text and card */
    clear: both;
    display: flex; /* Use flexbox for layout inside card */
    flex-direction: column;
    align-items: flex-start; /* Align content to the left */
}

.response-card h4 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1.05em;
    color: #333;
    font-weight: 600;
}

.response-card p {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 0.9em;
    color: #555;
}

.whatsapp-button {
    display: inline-block;
    padding: 10px 20px;
    background-color: #25D366; /* WhatsApp Green */
    color: white !important;
    text-decoration: none;
    border-radius: 20px; /* Rounded button */
    font-weight: bold;
    text-align: center;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15); /* Subtle shadow for the button */
}

.whatsapp-button:hover {
    background-color: #128C7E;
    transform: translateY(-1px);
}


/* --- Media Query for smaller screens --- */
@media (max-width: 500px) {
    #lex-chat-container {
        right: 15px; /* Adjust from right */
        bottom: 85px; /* Position above the bubble */
        width: calc(100% - 30px); /* Take up more width */
        height: 70vh; /* Use viewport height */
        max-height: calc(100% - 100px); /* Ensure it doesn't cover too much */
    }

    #lex-chat-bubble {
        bottom: 15px;
        right: 15px;
        width: 55px;
        height: 55px;
        line-height: 55px;
        font-size: 1.8em;
    }
}