/* ===== Advanced Chatbot Widget ===== */
.chatbot-widget {
    position: fixed;
    right: 25px;
    bottom: 25px;
    z-index: 99999;
    font-family: 'Open Sans', sans-serif;
}

.chatbot-toggle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: 2px solid #D4AF37;
    overflow: hidden;
    color: white;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 3px 15px rgba(26, 95, 122, 0.3);
    transition: all 0.2s;
    position: relative;
}

.chatbot-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(26, 95, 122, 0.4);
}

.bot-girl {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bot-girl-svg {
    width: 55px;
    height: 55px;
    margin-top: 3px;
}

.waving-hand {
    transform-origin: 55px 60px;
}

.chatbot-toggle .close-icon {
    display: none;
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
}
.chatbot-toggle.active .bot-girl { display: none; }
.chatbot-toggle.active .close-icon {
    display: block;
    color: white;
}
.chatbot-toggle.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: var(--primary);
}

.chat-pulse { display: none; }
.chat-badge { display: none; }

.chatbot-window {
    display: none;
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 400px;
    max-height: calc(100vh - 140px);
    height: 580px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.25);
    overflow: hidden;
    animation: slideUp 0.3s ease;
    flex-direction: column;
    z-index: 99998;
}

.chatbot-window.active { display: flex; }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.chatbot-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 15px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.chatbot-avatar {
    width: 42px;
    height: 42px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    overflow: hidden;
}

.chatbot-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-info { flex: 1; }
.chatbot-info strong { display: block; font-size: 15px; font-weight: 600; }
.chatbot-status { font-size: 11px; opacity: 0.9; }
.chatbot-status i { font-size: 7px; color: #4ade80; margin-right: 4px; }

.chatbot-actions { display: flex; gap: 8px; }

.chatbot-action-btn, .chatbot-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-action-btn:hover, .chatbot-close:hover {
    background: rgba(255,255,255,0.25);
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f5f7fa;
    scroll-behavior: smooth;
}

.chat-message {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    animation: msgFadeIn 0.3s ease;
}

@keyframes msgFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-message.bot { align-items: flex-start; }
.chat-message.user { align-items: flex-end; }

.message-bubble {
    max-width: 85%;
    padding: 12px 15px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.chat-message.bot .message-bubble {
    background: #ffffff;
    color: #333333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
}

.chat-message.user .message-bubble {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 10px;
    color: var(--gray);
    margin-top: 4px;
    padding: 0 4px;
}

/* Property Cards in Chat */
.chat-property-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 15px rgba(0,0,0,0.1);
    margin: 8px 0;
    max-width: 280px;
    transition: transform 0.2s;
    border: 1px solid #e2e8f0;
}

.chat-property-card:hover { transform: translateY(-2px); }

.chat-property-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.chat-property-info { padding: 12px; }

.chat-property-info h5 {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 5px;
    color: #333333;
    line-height: 1.3;
}

.chat-property-info .location {
    font-size: 11px;
    color: var(--gray);
    margin-bottom: 6px;
}

.chat-property-info .location i { margin-right: 3px; }

.chat-property-info .price {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.chat-property-actions {
    display: flex;
    gap: 6px;
}

.chat-property-actions button {
    flex: 1;
    padding: 7px 10px;
    font-size: 11px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.chat-property-actions .view-btn {
    background: var(--light);
    color: var(--dark);
}

.chat-property-actions .view-btn:hover {
    background: var(--primary);
    color: white;
}

.chat-property-actions .enquire-btn {
    background: var(--accent);
    color: white;
}

.chat-property-actions .enquire-btn:hover {
    background: var(--accent-dark);
}

/* Quick Actions */
.chatbot-quick-actions {
    padding: 8px 12px;
    background: #f0f2f5;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    flex-shrink: 0;
}

.chatbot-quick-actions:empty { display: none; }

.quick-action-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.quick-action-chip:hover { transform: scale(1.03); }
.quick-action-chip i { font-size: 10px; }

/* Suggestions */
.chatbot-suggestions {
    padding: 8px 12px;
    background: #f0f2f5;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 85px;
    overflow-y: auto;
    flex-shrink: 0;
}

.chatbot-suggestions:empty { display: none; }

.suggestion-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    padding: 8px 14px;
    border-radius: 18px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: #ffffff;
    white-space: nowrap;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.suggestion-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* Input Area */
.chatbot-input {
    display: flex;
    padding: 12px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    gap: 8px;
    flex-shrink: 0;
}

.chatbot-input input {
    flex: 1;
    border: 2px solid #e2e8f0;
    border-radius: 22px;
    padding: 10px 16px;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
    background: #f5f7fa;
    color: #333333;
}

.chatbot-input input::placeholder { color: #9ca3af; }
.chatbot-input input:focus { border-color: var(--primary); }

.chatbot-input button {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    color: white;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.chatbot-input button:hover { transform: scale(1.05); }

/* Lead Form in Chat */
.chat-lead-form {
    background: white;
    border-radius: 12px;
    padding: 15px;
    margin: 8px 0;
    box-shadow: 0 3px 15px rgba(0,0,0,0.1);
    max-width: 280px;
}

.chat-lead-form h5 {
    font-size: 13px;
    margin: 0 0 12px;
    color: var(--dark);
}

.chat-lead-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 8px;
    box-sizing: border-box;
}

.chat-lead-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.chat-lead-form button {
    width: 100%;
    padding: 10px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-lead-form button:hover { background: var(--accent-dark); }

/* Budget Selector */
.chat-budget-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.budget-chip {
    padding: 8px 14px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.budget-chip:hover, .budget-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    width: fit-content;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* RERA Badge */
.rera-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    background: #dcfce7;
    color: #16a34a;
    font-size: 9px;
    font-weight: 600;
    border-radius: 4px;
    margin-left: 5px;
}

/* Mobile Responsive */
@media (max-width: 576px) {
    .chatbot-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .chatbot-widget {
        right: 15px;
        bottom: 15px;
    }

    .scroll-top-btn {
        bottom: 75px !important;
        right: 15px !important;
        width: 38px !important;
        height: 38px !important;
    }

    .chat-property-card { max-width: 100%; }
    .chat-lead-form { max-width: 100%; }
}

/* Responsive */
@media (max-width: 768px) {
    .chatbot-widget {
        right: 15px;
        bottom: 25px;
    }

    .scroll-top-btn {
        bottom: 85px !important;
        right: 20px !important;
        width: 40px !important;
        height: 40px !important;
    }
}
