/* assets/css/frontend.css */

/* Chat Button */
.ai-property-chat-button {
    position: fixed;
    z-index: 999999;
    background: linear-gradient(135deg, #FFD700 0%, #FFC107 100%); /* golden gradient */
    color: white;
    padding: 12px 20px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.ai-property-chat-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0,0,0,0.3);
}

.chat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-label {
    font-weight: 600;
    font-size: 14px;
}

/* Chat Container */
.ai-property-chat-container {
    position: fixed;
    z-index: 999998;
    width: 400px;
    max-width: 90vw;
    max-height: 80vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.ai-property-chat-container.open {
    display: flex;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.close-chat {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 80%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-message {
    align-self: flex-end;
}

.user-message .message-content {
    background: #667eea;
    color: white;
    border-radius: 18px 18px 4px 18px;
    padding: 12px 16px;
}

.assistant-message {
    align-self: flex-start;
}

.assistant-message .message-content {
    background: white;
    color: #333;
    border-radius: 18px 18px 18px 4px;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.error-message .message-content {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Chat Input Area */
.chat-input-area {
    border-top: 1px solid #e9ecef;
    padding: 16px;
    background: white;
}

.input-wrapper {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 24px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.chat-input:focus {
    outline: none;
    border-color: #667eea;
}

.send-button, .voice-button {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 24px;
    padding: 0 20px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.send-button:hover, .voice-button:hover {
    background: #5a6fd8;
}

.voice-button {
    width: 48px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-button.listening {
    background: #dc3545;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Quick Suggestions */
.quick-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-suggestion {
    background: #f1f3f5;
    border: 1px solid #dee2e6;
    border-radius: 16px;
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-suggestion:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Clarification Questions */
.clarification-questions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.clarification-question {
    background: #e7f5ff;
    border: 1px solid #a5d8ff;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    color: #1971c2;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.clarification-question:hover {
    background: #d0ebff;
    border-color: #74c0fc;
}

/* Property Cards */
.property-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin-bottom: 16px;
    border: 1px solid #e9ecef;
}

.property-image {
    position: relative;
    height: 180px;
    overflow: hidden;
}

.property-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.luxury-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.property-info {
    padding: 16px;
}

.property-info h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #333;
}

.property-location {
    color: #666;
    font-size: 14px;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.property-description {
    color: #666;
    font-size: 13px;
    line-height: 1.4;
    margin: 0 0 12px 0;
}

.property-details {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.property-details .detail {
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    color: #495057;
}

.property-details .price {
    background: #e7f5ff;
    color: #1971c2;
    font-weight: 600;
}

.property-actions {
    display: flex;
    gap: 8px;
}

.property-actions button {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-details {
    background: #f8f9fa;
    color: #495057;
}

.view-details:hover {
    background: #e9ecef;
}

.whatsapp-enquire {
    background: #25d366;
    color: white;
}

.whatsapp-enquire:hover {
    background: #1da851;
}

/* Service Cards */
.service-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #e9ecef;
    margin-bottom: 12px;
}

.service-card h4 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 16px;
}

.service-description {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 16px;
}

.service-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.service-link-button {
    flex: 1;
    background: #f8f9fa;
    color: #495057;
    text-decoration: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    border: 2px solid #e9ecef;
    transition: all 0.2s ease;
}

.service-link-button:hover {
    background: #e9ecef;
    border-color: #667eea;
    color: #667eea;
}

.service-whatsapp-button {
    flex: 1;
    background: #25d366;
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.service-whatsapp-button:hover {
    background: #1da851;
}

/* Contact Options */
.contact-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.contact-button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.contact-button.whatsapp {
    background: #25d366;
    color: white;
}

.contact-button.whatsapp:hover {
    background: #1da851;
}

.contact-button.phone {
    background: #f8f9fa;
    color: #495057;
}

.contact-button.phone:hover {
    background: #e9ecef;
}

/* Mobile Responsive Fix */
@media (max-width: 768px) {
    /* Chat container fits mobile nicely with small margins */
    .ai-property-chat-container {
        position: fixed;
        z-index: 999998;
        width: 400px;
        max-width: 90vw;
        max-height: 80vh;
        background: white;
        border-radius: 16px;
        box-shadow: 0 10px 40px rgba(0,0,0,0.2);
        display: none; /* Hidden until open */
        flex-direction: column;
        overflow: hidden;
        height: auto; /* Allow height to grow with messages */
    }

    /* Chat button position */
    .ai-property-chat-button {
        bottom: 30px;
        right: 20px;
    }

    /* Chat header padding */
    .chat-header {
        padding: 12px 16px;
        justify-content: space-between;
    }

    /* Close button always visible */
    .close-chat {
        position: relative;
        z-index: 1000;
        width: 28px;
        height: 28px;
        font-size: 20px;
        line-height: 1;
        top: 0;
        right: 0;
    }

    /* Chat messages padding */
    .chat-messages {
        padding: 20px;
        overflow-y: auto;
        background: #f8f9fa;
        display: flex;
        flex-direction: column;
        gap: 12px;
        max-height: 60vh; /* Prevent it from growing too tall */
    }

    /* Input area adjustment */
    .chat-input-area {
        padding: 10px 12px;
    }

    /* Quick suggestions wrap nicely */
    .quick-suggestions {
        flex-wrap: wrap;
        gap: 6px;
    }

    /* Service actions stack on mobile */
    .service-actions {
        flex-direction: column;
        gap: 8px;
    }

    /* Reduce font size for mobile */
    .chat-header h3 {
        font-size: 14px;
    }

    .chat-input {
        font-size: 13px;
        padding: 10px 12px;
    }

    .send-button, .voice-button {
        padding: 0 16px;
    }
}


/* Bot bounce animation */
.chat-icon svg {
    animation: botBounce 1.5s infinite;
}

/* Bounce keyframes */
@keyframes botBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* Blinking eyes */
.bot-eye {
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 10%, 20%, 30%, 100% { r: 4; } /* open */
    15%, 25% { r: 1; } /* closed */
}


@keyframes botBounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
    60% { transform: translateY(-3px); }
}