/* Smart Real Estate Chatbot CSS */

/* Floating Button - ChatGPT Style */
.chatbot-toggler {
    position: fixed;
    bottom: 30px;
    right: 30px;
    outline: none;
    border: none;
    height: 60px;
    width: 60px;
    display: flex;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #10a37f 0%, #1a7f64 100%);
    transition: all 0.3s ease;
    z-index: 9999;
    box-shadow: 0 4px 20px rgba(16, 163, 127, 0.4);
    animation: chatbot-pulse 3s infinite;
}

.chatbot-toggler:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(16, 163, 127, 0.6);
}

/* ChatGPT SVG Icon */
.chatbot-toggler .chatgpt-icon {
    width: 32px;
    height: 32px;
    color: #fff;
    fill: #fff; /* Explicit white fill */
    transition: all 0.3s ease;
}

.chatbot-toggler .close-icon {
    position: absolute;
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    opacity: 0;
    transition: all 0.3s ease;
}

body.show-chatbot .chatbot-toggler .chatgpt-icon {
    opacity: 0;
    transform: rotate(90deg);
}

body.show-chatbot .chatbot-toggler .close-icon {
    opacity: 1;
}

@keyframes chatbot-pulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(16, 163, 127, 0.4);
    }
    50% {
        box-shadow: 0 4px 30px rgba(16, 163, 127, 0.7);
    }
}

/* Chatbot Window */
.chatbot {
    position: fixed;
    right: 30px;
    bottom: 100px;
    width: 400px;
    background: #fff;
    border-radius: 15px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.5);
    transform-origin: bottom right;
    box-shadow: 0 0 128px 0 rgba(0,0,0,0.1),
                0 32px 64px -48px rgba(0,0,0,0.5);
    transition: all 0.1s ease;
    z-index: 9998;
    /* iOS fixes */
    -webkit-overflow-scrolling: touch;
}

body.show-chatbot .chatbot {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

/* Prevent iOS zoom and jumping */
body.show-chatbot {
    position: fixed;
    width: 100%;
    overflow: hidden;
}

/* Header */
.chatbot header {
    padding: 16px 0;
    position: relative;
    text-align: center;
    color: #fff;
    background: #2c3e50;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.chatbot header h2 {
    font-size: 1.2rem;
    margin: 0;
    font-family: 'Cairo', sans-serif;
}

.chatbot header span {
    position: absolute;
    right: 15px;
    top: 50%;
    display: none;
    cursor: pointer;
    transform: translateY(-50%);
}

/* Chatbox */
.chatbot .chatbox {
    overflow-y: auto;
    height: 400px;
    padding: 30px 20px 100px;
    background: #f8f9fa;
}

.chatbot :where(.chatbox, textarea)::-webkit-scrollbar {
    width: 6px;
}

.chatbot :where(.chatbox, textarea)::-webkit-scrollbar-track {
    background: #fff;
    border-radius: 25px;
}

.chatbot :where(.chatbox, textarea)::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 25px;
}

.chatbox .chat {
    display: flex;
    list-style: none;
    margin-bottom: 20px;
}

.chatbox .outgoing {
    justify-content: flex-end;
}

.chatbox .incoming span {
    width: 32px;
    height: 32px;
    color: #fff;
    cursor: default;
    text-align: center;
    line-height: 32px;
    align-self: flex-end;
    background: #2c3e50;
    border-radius: 4px;
    margin: 0 10px 7px 0;
}

.chatbox .chat p {
    white-space: pre-wrap;
    padding: 12px 16px;
    border-radius: 10px 10px 0 10px;
    max-width: 75%;
    color: #fff;
    font-size: 0.95rem;
    background: #2c3e50;
    font-family: 'Cairo', sans-serif;
    line-height: 1.5;
}

.chatbox .incoming p {
    border-radius: 10px 10px 10px 0;
    color: #000;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* Chat Input */
.chatbot .chat-input {
    display: flex;
    gap: 5px;
    position: absolute;
    bottom: 0;
    width: 100%;
    background: #fff;
    padding: 10px 20px;
    border-top: 1px solid #ddd;
}

.chat-input textarea {
    height: 55px;
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    max-height: 180px;
    padding: 15px 15px 15px 0;
    font-size: 0.95rem;
    font-family: 'Cairo', sans-serif;
}

.chat-input span {
    align-self: flex-end;
    color: #2c3e50;
    cursor: pointer;
    height: 55px;
    display: flex;
    align-items: center;
    visibility: hidden;
    font-size: 1.35rem;
}

.chat-input textarea:valid ~ span {
    visibility: visible;
}

/* Property Card in Chat */
.chat-property-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 280px;
    transition: transform 0.2s;
}

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

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

.chat-property-card .details {
    padding: 10px;
}

.chat-property-card h4 {
    font-size: 0.9rem;
    margin: 0 0 5px;
    color: #333;
}

.chat-property-card .price {
    color: #2c3e50;
    font-weight: bold;
    font-size: 0.95rem;
}

.chat-property-card .meta {
    font-size: 0.8rem;
    color: #666;
    margin: 5px 0;
}

.chat-property-card .btn-view {
    display: block;
    text-align: center;
    background: #2c3e50;
    color: #fff;
    padding: 6px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.85rem;
    margin-top: 8px;
}

/* Options Buttons */
.chat-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.chat-option-btn {
    background: #fff;
    border: 1px solid #2c3e50;
    color: #2c3e50;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: 'Cairo', sans-serif;
    transition: all 0.2s;
}

.chat-option-btn:hover {
    background: #2c3e50;
    color: #fff;
}

/* Mobile Responsiveness */
@media (max-width: 490px) {
    .chatbot {
        right: 10px;
        bottom: 90px;
        height: 500px;
        max-height: 70vh;
        border-radius: 15px;
        width: calc(100% - 20px);
        position: fixed;
    }
    .chatbot .chatbox {
        height: calc(100% - 140px);
        padding: 15px 10px 15px;
    }
    .chatbot .chat-input {
        padding: 10px 15px;
        position: absolute;
        bottom: 0;
        width: 100%;
    }
    .chatbot .chat-input textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
    }
    .chatbot header {
        padding: 15px 0;
    }
    .chatbot header span {
        display: block;
    }
    .chatbot-toggler {
        bottom: 20px;
        right: 20px;
    }
}
