#gemini-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2147483647;
    font-family: inherit;
}

#gemini-chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

#gemini-chatbot-toggle:hover {
    transform: scale(1.05);
}

#gemini-chatbot-toggle svg {
    width: 32px;
    height: 32px;
}

#gemini-chatbot-window {
    display: none;
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    flex-direction: column;
}

/* Make it responsive for narrower screens */
@media (max-width: 600px) {
    #gemini-chatbot-container.chatbot-open {
        bottom: 0 !important;
        right: 0 !important;
        width: 100vw;
        height: 100vh;
        z-index: 2147483647;
    }
    #gemini-chatbot-container.chatbot-open #gemini-chatbot-toggle {
        display: none; /* Hide the floating button when full screen */
    }
    #gemini-chatbot-container.chatbot-open #gemini-chatbot-window {
        width: 100vw;
        height: 100vh;
        max-height: none;
        bottom: 0;
        right: 0;
        position: fixed;
        border-radius: 0;
    }
    #gemini-chatbot-header {
        padding-top: max(15px, env(safe-area-inset-top)); /* Safe area for phones */
    }
    #gemini-chatbot-messages {
        height: auto;
        padding-bottom: env(safe-area-inset-bottom);
    }
    #gemini-chatbot-input-area {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
}

#gemini-chatbot-header {
    color: #fff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 16px;
}

#gemini-chatbot-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

#gemini-chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 355px;
}

.message {
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
}

.user-message {
    background: var(--gemini-brand-color);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.bot-message {
    background: #eaeaea;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.bot-message a {
    color: var(--gemini-brand-color);
    text-decoration: underline;
}

.bot-message.error {
    background: #ffe5e5;
    color: #d8000c;
}

.typing {
    animation: blink 1s infinite alternate;
}

@keyframes blink {
    0% { opacity: .2; }
    100% { opacity: 1; }
}

#gemini-chatbot-input-area {
    display: flex;
    padding: 10px;
    background: #fff;
    border-top: 1px solid #ddd;
}

#gemini-chatbot-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

#gemini-chatbot-input:focus {
    border-color: var(--gemini-brand-color);
}

#gemini-chatbot-send {
    background: none;
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-left: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#gemini-chatbot-send:hover {
    opacity: 0.9;
}

.ai-listing-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 12px;
    margin: 10px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    font-size: 13px;
    line-height: 1.4;
    white-space: normal; /* Override pre-wrap for the card */
}
.ai-listing-card h4 {
    margin: 0 0 5px 0;
    font-size: 15px;
    color: var(--gemini-brand-color);
}
.ai-listing-meta {
    font-size: 11px;
    color: #666;
    margin-bottom: 8px;
}
.ai-listing-card p {
    margin: 0 0 10px 0;
    color: #444;
}
.ai-listing-card a.ai-btn {
    display: inline-block;
    background: var(--gemini-brand-color);
    color: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 12px;
    font-weight: bold;
}
.ai-listing-card a.ai-btn:hover {
    opacity: 0.9;
}
.bot-message {
    white-space: pre-wrap; /* allow markdown newlines to render naturally */
}
