body {
    font-family: sans-serif;
    margin: 0;
    padding-bottom: 100px; /* Ensure space for chat button */
}

#chat-widget-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

/* Utility class to hide elements */
.hidden {
    display: none !important; /* Use !important to ensure it overrides other display properties if needed */
}

#chat-open-button {
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s ease;
}

#chat-open-button:hover {
    background-color: #0056b3;
}

#chat-window {
    width: 350px;
    height: 500px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
    transform-origin: bottom right;
}

#chat-window.hidden {
    transform: scale(0);
    opacity: 0;
    height: 0;
    width: 0;
    /* visibility: hidden; */ /* Use transform/opacity for smooth transition */
}

#chat-header {
    background-color: #007bff;
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

#chat-close-button {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0 5px;
}

#chat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-message {
    padding: 8px 12px;
    border-radius: 15px;
    max-width: 80%;
    word-wrap: break-word;
    line-height: 1.4;
}

.chat-message.user {
    background-color: #007bff;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.chat-message.assistant {
    background-color: #e9e9eb;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
}

/* Typing Indicator Styles */
#chat-typing-indicator {
    padding: 10px 15px;
    display: flex;
    align-items: center;
}

#chat-typing-indicator.hidden {
    display: none;
}

#chat-typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: #aaa;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: typing-dots 1.4s infinite ease-in-out both;
}

#chat-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
#chat-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
#chat-typing-indicator span:nth-child(3) { animation-delay: 0s; }

@keyframes typing-dots {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}


#chat-input-area {
    display: flex;
    padding: 10px;
    border-top: 1px solid #eee;
    background-color: #fff;
}

#chat-input {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 10px;
    padding: 8px 15px;
    resize: none; /* Prevent manual resizing */
    overflow-y: auto; /* Allow scrolling if text wraps */
    max-height: 80px; /* Limit height expansion */
    margin-right: 10px;
    font-size: 16px;
    line-height: 1.4;
    font-family: sans-serif; /* Ensure consistent font */
}

/* Style the placeholder text */
#chat-input::placeholder {
    color: #aaa; /* Lighter gray for placeholder */
    opacity: 1; /* Ensure it's visible by default */
    transition: color 0.2s ease; /* Optional: smooth transition */
}

/* Hide placeholder on focus */
#chat-input:focus::placeholder {
    color: transparent; /* Make placeholder invisible on focus */
}


#chat-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 1px #007bff;
}

#chat-send-button {
    background-color: #007bff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0; /* Prevent button from shrinking */
}

#chat-send-button svg {
    fill: white;
}

#chat-send-button:hover {
    background-color: #0056b3;
}
