/* Smart Real Estate Chatbot - Frontend Styles */

/* ========================================
   Reset & Base
   ======================================== */

#srecf-chatbot-wrapper,
#srecf-chatbot-wrapper * {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.5;
}

/* ========================================
   Floating Chat Button
   ======================================== */

#srecf-chat-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #0066ff, #0052cc);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 102, 255, 0.4);
    z-index: 99999;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: srecf-pulse 2s infinite;
}

#srecf-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(0, 102, 255, 0.5);
}

#srecf-chat-button.srecf-hidden {
    display: none;
}

@keyframes srecf-pulse {
    0% { box-shadow: 0 4px 20px rgba(0, 102, 255, 0.4); }
    50% { box-shadow: 0 4px 30px rgba(0, 102, 255, 0.6), 0 0 0 10px rgba(0, 102, 255, 0.1); }
    100% { box-shadow: 0 4px 20px rgba(0, 102, 255, 0.4); }
}

/* ========================================
   Chat Window
   ======================================== */

#srecf-chat-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    max-height: 560px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: srecf-slideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* ========================================
   Chat Header
   ======================================== */

#srecf-chat-header {
    background: linear-gradient(135deg, #0066ff, #0052cc);
    color: #fff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.srecf-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.srecf-avatar {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.srecf-header-title {
    font-size: 15px;
    font-weight: 600;
}

.srecf-header-status {
    font-size: 12px;
    opacity: 0.85;
}

.srecf-header-status::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #4ade80;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}

#srecf-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

#srecf-chat-close:hover {
    opacity: 1;
}

/* ========================================
   Chat Body
   ======================================== */

#srecf-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    max-height: 400px;
    min-height: 200px;
    background: #f7f8fa;
    scroll-behavior: smooth;
}

#srecf-chat-body::-webkit-scrollbar {
    width: 4px;
}

#srecf-chat-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

/* ========================================
   Chat Bubbles
   ======================================== */

.srecf-msg {
    margin-bottom: 12px;
    display: flex;
    animation: srecf-fadeIn 0.4s ease;
}

@keyframes srecf-fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.srecf-msg-bot {
    justify-content: flex-start;
}

.srecf-msg-user {
    justify-content: flex-end;
}

.srecf-bubble {
    max-width: 80%;
    padding: 10px 16px;
    border-radius: 18px;
    font-size: 14px;
    word-wrap: break-word;
}

.srecf-msg-bot .srecf-bubble {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.srecf-msg-user .srecf-bubble {
    background: linear-gradient(135deg, #0066ff, #0052cc);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* ========================================
   Options Buttons
   ======================================== */

.srecf-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    animation: srecf-fadeIn 0.4s ease 0.2s both;
}

.srecf-option-btn {
    background: #fff;
    border: 2px solid #0066ff;
    color: #0066ff;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.srecf-option-btn:hover {
    background: #0066ff;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 102, 255, 0.3);
}

.srecf-option-btn:active {
    transform: translateY(0);
}

/* ========================================
   Typing Indicator
   ======================================== */

.srecf-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    margin-bottom: 12px;
}

.srecf-typing-dot {
    width: 8px;
    height: 8px;
    background: #bbb;
    border-radius: 50%;
    animation: srecf-typingBounce 1.2s ease-in-out infinite;
}

.srecf-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.srecf-typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes srecf-typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ========================================
   Input Area
   ======================================== */

#srecf-chat-input-area {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-top: 1px solid #eee;
    background: #fff;
    gap: 8px;
    flex-shrink: 0;
}

#srecf-user-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#srecf-user-input:focus {
    border-color: #0066ff;
}

#srecf-send-btn {
    width: 40px;
    height: 40px;
    background: #0066ff;
    color: #fff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    flex-shrink: 0;
}

#srecf-send-btn:hover {
    background: #0052cc;
    transform: scale(1.05);
}

/* ========================================
   Thank You Popup
   ======================================== */

#srecf-thank-you-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: srecf-fadeIn 0.3s ease;
}

#srecf-thank-you-popup {
    background: #fff;
    border-radius: 16px;
    padding: 40px 32px;
    text-align: center;
    max-width: 360px;
    width: 90%;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    animation: srecf-scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes srecf-scaleIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.srecf-ty-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #4ade80, #22c55e);
    color: #fff;
    border-radius: 50%;
    font-size: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

#srecf-thank-you-popup h3 {
    font-size: 22px;
    margin: 0 0 8px;
    color: #333;
}

#srecf-thank-you-popup p {
    color: #666;
    margin: 0 0 20px;
    font-size: 15px;
}

#srecf-ty-close {
    background: #0066ff;
    color: #fff;
    border: none;
    padding: 10px 32px;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

#srecf-ty-close:hover {
    background: #0052cc;
}

/* ========================================
   WhatsApp Suggestion
   ======================================== */

.srecf-whatsapp-offer {
    margin-top: 8px;
}

.srecf-whatsapp-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #25d366;
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.srecf-whatsapp-btn:hover {
    background: #1fba59;
    transform: translateY(-1px);
}

/* ========================================
   Mobile Responsive
   ======================================== */

@media (max-width: 480px) {
    #srecf-chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
        height: 100vh;
    }

    #srecf-chat-body {
        max-height: calc(100vh - 130px);
    }

    #srecf-chat-button {
        bottom: 16px;
        right: 16px;
        width: 54px;
        height: 54px;
    }

    .srecf-bubble {
        max-width: 88%;
    }
}
