/* Chat Widget Container */
#gemini-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Toggle Button */
#gemini-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #0073aa; /* Default, overridden by JS */
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

#gemini-chat-toggle:hover {
    transform: scale(1.05);
}

#gemini-chat-toggle svg {
    width: 30px;
    height: 30px;
    fill: currentColor;
}

/* Chat Window */
#gemini-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px; /* Reduced width for better mobile view */
    max-width: 90vw; /* Responsive width */
    height: 500px;
    max-height: 80vh; /* Responsive height */
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    display: none; /* Hidden by default */
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#gemini-chat-window.open {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

/* Header */
.gemini-chat-header {
    padding: 15px;
    background-color: #0073aa; /* Default, overridden by JS */
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gemini-chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

#gemini-chat-close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 20px;
    padding: 0;
    line-height: 1;
}

/* Messages Area */
#gemini-chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gemini-chat-message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.gemini-chat-message.user {
    align-self: flex-end;
    background-color: #0073aa; /* Default, overridden by JS */
    color: #fff;
    border-bottom-right-radius: 2px;
}

.gemini-chat-message.bot {
    align-self: flex-start;
    background-color: #e5e5ea;
    color: #000;
    border-bottom-left-radius: 2px;
}

.gemini-chat-message.error {
    align-self: center;
    background-color: #ffdddd;
    color: #d8000c;
    border: 1px solid #d8000c;
}

/* Input Area */
.gemini-chat-input-area {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex; /* Use flexbox for input area layout */
    gap: 10px;
    background-color: #fff;
}

#gemini-chat-input {
    flex: 1; /* Input takes available space */
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

#gemini-chat-input:focus {
    border-color: #0073aa;
}

#gemini-chat-send {
    background: none;
    border: none;
    cursor: pointer;
    color: #0073aa; /* Default */
    padding: 0 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#gemini-chat-send svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

#gemini-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Markdown Styles in Messages */
.gemini-chat-message p {
    margin: 0 0 8px 0;
}
.gemini-chat-message p:last-child {
    margin-bottom: 0;
}
.gemini-chat-message ul, .gemini-chat-message ol {
    margin: 0 0 8px 20px;
    padding: 0;
}
.gemini-chat-message strong {
    font-weight: 600;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 15px;
    background-color: #e5e5ea;
    border-radius: 15px;
    border-bottom-left-radius: 2px;
    align-self: flex-start;
    width: fit-content;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 200ms; }
.typing-dot:nth-child(2) { animation-delay: 300ms; }
.typing-dot:nth-child(3) { animation-delay: 400ms; }

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}
