/* ===================================
   CHATBOT STYLES
   Olas Realtor Consulting Ltd
   =================================== */

/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: 'Inter', sans-serif;
}

/* Chatbot Toggle Button */
.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #006B3C 0%, #580F0F 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 107, 60, 0.4);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(0, 107, 60, 0.6);
}

.chatbot-toggle i {
    color: white;
    font-size: 28px;
    transition: transform 0.3s ease;
}

.chatbot-toggle.active i.fa-comment-dots {
    transform: rotate(90deg) scale(0);
}

.chatbot-toggle.active i.fa-times {
    transform: rotate(0deg) scale(1);
}

.chatbot-toggle i.fa-times {
    position: absolute;
    transform: rotate(-90deg) scale(0);
}

/* Notification Badge */
.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #580F0F;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(88, 15, 15, 0.7);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(88, 15, 15, 0);
    }
}

/* Chatbot Window */
.chatbot-window {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 550px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow: hidden;
}

.chatbot-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
}

/* Chatbot Header */
.chatbot-header {
    background: linear-gradient(135deg, #006B3C 0%, #580F0F 100%);
    color: white;
    padding: 20px;
    border-radius: 20px 20px 0 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chatbot-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.chatbot-info {
    flex: 1;
}

.chatbot-title {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 2px;
}

.chatbot-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Chatbot Messages */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Message Bubbles */
.message {
    display: flex;
    gap: 10px;
    animation: slideInMessage 0.3s ease;
}

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

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

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #006B3C 0%, #580F0F 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: #e2e8f0;
    color: #006B3C;
}

.message-content {
    max-width: 75%;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.bot .message-bubble {
    background: white;
    color: #2d3748;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #006B3C 0%, #008F4F 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: #718096;
    margin-top: 4px;
    padding: 0 4px;
}

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

.typing-dot {
    width: 8px;
    height: 8px;
    background: #cbd5e0;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Quick Replies */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.quick-reply-btn {
    padding: 8px 14px;
    background: white;
    border: 2px solid #006B3C;
    color: #006B3C;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-reply-btn:hover {
    background: #006B3C;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 107, 60, 0.3);
}

/* Chatbot Input */
.chatbot-input-area {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 24px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}

.chatbot-input:focus {
    border-color: #006B3C;
    box-shadow: 0 0 0 3px rgba(0, 107, 60, 0.1);
}

.chatbot-input::placeholder {
    color: #a0aec0;
}

.chatbot-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #006B3C 0%, #008F4F 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 107, 60, 0.4);
}

.chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: scale(1);
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 20px;
}

.welcome-message h3 {
    color: #006B3C;
    margin-bottom: 8px;
    font-size: 18px;
}

.welcome-message p {
    color: #718096;
    font-size: 14px;
}

/* Mobile Responsive - Right Side Popup */
@media (max-width: 768px) {
    .chatbot-container {
        position: fixed;
        bottom: 15px;
        right: 10px;
        z-index: 10000;
    }

    .chatbot-toggle {
        width: 56px;
        height: 56px;
    }

    .chatbot-toggle i {
        font-size: 24px;
    }

    /* Right-side popup on mobile - properly sized */
    .chatbot-window {
        position: fixed;
        bottom: 80px;
        right: 10px;
        width: 90vw;
        max-width: 360px;
        height: 70vh;
        max-height: 500px;
        border-radius: 16px;
    }

    .chatbot-header {
        padding: 16px;
    }

    .chatbot-messages {
        padding: 12px;
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .message-bubble {
        font-size: 13px;
        max-width: 85%;
    }

    .quick-reply-btn {
        font-size: 12px;
        padding: 7px 12px;
    }
    
    .chatbot-input-area {
        padding: 16px 12px !important;
        background: #e2e8f0 !important;
        border-top: 3px solid #cbd5e0 !important;
        flex-shrink: 0 !important;
        display: flex !important;
        gap: 10px !important;
        align-items: center !important;
        min-height: 70px !important;
    }
    
    .chatbot-input {
        flex: 1 !important;
        font-size: 16px !important;
        padding: 14px 18px !important;
        border: 3px solid #006B3C !important;
        background: white !important;
        border-radius: 25px !important;
        color: #2d3748 !important;
        min-height: 48px !important;
    }
    
    .chatbot-input:focus {
        border-color: #006B3C !important;
        box-shadow: 0 0 0 4px rgba(0, 107, 60, 0.2) !important;
        outline: none !important;
    }
    
    .chatbot-input::placeholder {
        color: #718096 !important;
        font-size: 14px !important;
    }
    
    .chatbot-send-btn {
        width: 48px !important;
        height: 48px !important;
        flex-shrink: 0 !important;
        background: linear-gradient(135deg, #006B3C 0%, #008F4F 100%) !important;
        border: none !important;
    }
}

/* Accessibility */
.chatbot-toggle:focus,
.chatbot-send-btn:focus,
.quick-reply-btn:focus {
    outline: 3px solid #006B3C;
    outline-offset: 2px;
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .chatbot-window {
        background: #1a202c;
    }

    .chatbot-messages {
        background: #2d3748;
    }

    .message.bot .message-bubble {
        background: #4a5568;
        color: #e2e8f0;
    }

    .chatbot-input-area {
        background: #1a202c;
        border-top-color: #4a5568;
    }

    .chatbot-input {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }

    .quick-reply-btn {
        background: #2d3748;
        border-color: #008F4F;
        color: #4ade80;
    }
}
