/* Chatbot Widget - Scoped styles */
#chatbot-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
    outline: none;
}
#chatbot-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}
#chatbot-fab svg {
    width: 28px;
    height: 28px;
    fill: #ffffff;
}

#chatbot-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 120px);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    z-index: 9998;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
#chatbot-window.chatbot-open {
    display: flex;
}

/* Header */
#chatbot-header {
    padding: 14px 16px;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
#chatbot-header-logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.3);
}
#chatbot-header-info {
    flex: 1;
    min-width: 0;
}
#chatbot-header-name {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#chatbot-header-status {
    font-size: 12px;
    opacity: 0.85;
}
#chatbot-clear-btn {
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
#chatbot-clear-btn:hover {
    opacity: 1;
}
#chatbot-close-btn {
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    font-size: 22px;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}
#chatbot-close-btn:hover {
    opacity: 1;
}

/* Messages area */
#chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f8f9fa;
}
#chatbot-messages::-webkit-scrollbar {
    width: 5px;
}
#chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}
#chatbot-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* Message bubbles */
.chatbot-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.chatbot-msg.chatbot-user {
    align-self: flex-end;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}
.chatbot-msg.chatbot-assistant {
    align-self: flex-start;
    background: #ffffff;
    color: #333333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.chatbot-msg a {
    color: inherit;
    text-decoration: underline;
}
.chatbot-msg.chatbot-user a {
    color: #ffffff;
}
.chatbot-msg.chatbot-assistant a {
    color: #1a73e8;
}

/* Typing indicator */
.chatbot-typing {
    display: flex;
    gap: 5px;
    padding: 12px 16px;
    align-self: flex-start;
    background: #ffffff;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.chatbot-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: chatbot-bounce 1.4s infinite ease-in-out;
}
.chatbot-typing span:nth-child(1) { animation-delay: 0s; }
.chatbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatbot-bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Input area */
#chatbot-input-area {
    padding: 12px;
    border-top: 1px solid #e8e8e8;
    display: flex;
    gap: 8px;
    background: #ffffff;
    flex-shrink: 0;
}
#chatbot-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
    resize: none;
    transition: border-color 0.2s;
}
#chatbot-input:focus {
    border-color: #999;
}
#chatbot-input::placeholder {
    color: #aaa;
}
#chatbot-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
    transition: opacity 0.2s;
}
#chatbot-send-btn:hover {
    opacity: 0.9;
}
#chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
#chatbot-send-btn svg {
    width: 18px;
    height: 18px;
    fill: #ffffff;
}

/* Property cards */
.chatbot-property-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 10px 12px;
    margin-top: 4px;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    align-self: flex-start;
    max-width: 85%;
    text-decoration: none;
    display: block;
}
.chatbot-property-card:hover {
    background: #f0f4ff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.chatbot-property-card-title {
    font-weight: 600;
    font-size: 13px;
    color: #333;
    margin-bottom: 3px;
}
.chatbot-property-card-details {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}
.chatbot-property-card-price {
    font-weight: 600;
    font-size: 13px;
    margin-top: 3px;
}

/* Mobile responsive */
@media (max-width: 480px) {
    #chatbot-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    #chatbot-fab {
        bottom: 16px;
        right: 16px;
        width: 54px;
        height: 54px;
    }
    #chatbot-fab svg {
        width: 24px;
        height: 24px;
    }
}
