/* Chatbot Styles */
.chatbot-widget {
    position: fixed;
    bottom: 40px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    pointer-events: auto;
    visibility: visible;
    opacity: 1;
}

.chat-button {
    position: relative;
    background: linear-gradient(135deg, #1a6fa8 0%, #d4a45a 100%);
    color: white;
    border: 2px solid rgba(212, 164, 90, 0.5);
    border-radius: 50px;
    padding: 15px 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(26, 111, 168, 0.3);
    transition: all 0.3s ease;
    pointer-events: auto;
    visibility: visible;
    opacity: 1;
    font-weight: 600;
    font-size: 14px;
    animation: pulse 2s infinite;
}

.chat-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 111, 168, 0.4);
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.chat-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #E41F07;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
}

.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 400px;
    height: 550px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 999998;
    pointer-events: auto;
    visibility: visible;
    opacity: 1;
    border: 2px solid #1a6fa8;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 140px);
}

.chat-window.open {
    display: flex;
}

.chat-header {
    background: linear-gradient(135deg, #1a6fa8 0%, #d4a45a 100%);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.chat-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.chat-title h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-status {
    font-size: 12px;
    opacity: 0.9;
}

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

.chat-minimize, .chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease;
}

.chat-minimize:hover, .chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.message {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    animation: messageSlide 0.3s ease;
}

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

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    color: white;
}

.message.bot .message-avatar {
    background: linear-gradient(135deg, #1a6fa8 0%, #d4a45a 100%);
}

.message.user .message-avatar {
    background: #4a5568;
}

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

.message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    max-width: 100%;
    display: block;
    width: fit-content;
    min-width: 50px;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 400px;
}

.message.bot .message-bubble {
    background: white;
    color: #2d3748;
    border: 1px solid #e2e8f0;
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #1a6fa8 0%, #d4a45a 100%);
    color: white;
}

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

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e0;
}

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

.typing-dots span:nth-child(1) {
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation: typing 1.4s infinite;
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation: typing 1.4s infinite;
    animation-delay: 0.4s;
}

.lead-capture-form {
    padding: 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.lead-form-header h5 {
    margin: 0 0 8px 0;
    color: #2d3748;
    font-size: 16px;
}

.lead-form-header p {
    margin: 0 0 15px 0;
    color: #718096;
    font-size: 14px;
}

.lead-capture-form .form-group {
    margin-bottom: 12px;
}

.lead-capture-form input {
    width: 100%;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
}

.lead-capture-form button {
    margin-right: 8px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.chat-input-container {
    padding: 15px;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input-wrapper input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
}

.chat-input-wrapper input:focus {
    border-color: #1a6fa8;
}

.chat-send-btn {
    background: linear-gradient(135deg, #1a6fa8 0%, #d4a45a 100%);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s ease;
    color: white;
}

.chat-send-btn:hover {
    transform: scale(1.1);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .chatbot-widget {
        bottom: 10px;
        right: 10px;
    }

    .chat-window {
        width: 300px;
        height: 400px;
        right: 0;
        bottom: 55px;
        max-width: calc(100vw - 25px);
        max-height: calc(100vh - 100px);
    }

    .property-ai-btn {
        padding: 10px 14px;
        font-size: 12px;
    }

    .chat-header {
        padding: 10px;
    }

    .chat-avatar svg {
        width: 30px;
        height: 30px;
    }

    .chat-title h4 {
        font-size: 13px;
    }

    .chat-status {
        font-size: 10px;
    }

    .prop-result-card {
        flex-direction: column;
        align-items: flex-start;
        min-height: auto;
    }

    .prop-result-img {
        width: 100%;
        height: 80px;
    }

    .prop-result-view {
        width: 100%;
        text-align: center;
        margin-top: 6px;
    }

    .message-bubble {
        max-height: 280px;
    }

    .property-quick-options {
        padding: 8px !important;
    }

    .property-quick-options p {
        font-size: 9px !important;
        margin-bottom: 5px !important;
    }

    .prop-chip {
        padding: 3px 8px;
        font-size: 9px;
    }
}

@media (max-width: 480px) {
    .chatbot-widget {
        bottom: 8px;
        right: 8px;
    }

    .chat-window {
        width: calc(100vw - 16px);
        height: 50vh;
        right: 0;
        bottom: 50px;
        max-width: calc(100vw - 16px);
        max-height: calc(100vh - 80px);
    }

    .property-ai-btn {
        padding: 8px 12px;
        font-size: 11px;
        width: auto;
        justify-content: center;
        border-radius: 25px;
    }

    .chat-header {
        padding: 8px;
    }

    .chat-avatar svg {
        width: 28px;
        height: 28px;
    }

    .chat-title h4 {
        font-size: 12px;
    }

    .chat-status {
        font-size: 9px;
    }

    .chat-actions button {
        width: 22px;
        height: 22px;
    }

    .prop-chip {
        padding: 3px 6px;
        font-size: 8px;
    }

    .message-bubble {
        font-size: 12px !important;
        padding: 8px 10px !important;
        max-height: 250px;
    }

    .prop-result-card {
        padding: 5px;
    }

    .prop-result-img {
        height: 65px;
    }

    .property-quick-options {
        padding: 6px !important;
    }

    .property-quick-options p {
        font-size: 8px !important;
        margin-bottom: 4px !important;
    }

    .chat-input-wrapper input {
        font-size: 12px;
        padding: 8px 12px;
    }

    .chat-send-btn {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 360px) {
    .chatbot-widget {
        bottom: 6px;
        right: 6px;
    }

    .chat-window {
        width: calc(100vw - 12px);
        height: 45vh;
        right: 0;
        bottom: 45px;
        max-width: calc(100vw - 12px);
        max-height: calc(100vh - 70px);
    }

    .property-ai-btn {
        padding: 6px 10px;
        font-size: 10px;
    }

    .chat-header {
        padding: 6px;
    }

    .chat-avatar svg {
        width: 24px;
        height: 24px;
    }

    .chat-title h4 {
        font-size: 11px;
    }

    .chat-status {
        font-size: 8px;
    }

    .chat-actions button {
        width: 20px;
        height: 20px;
    }

    .prop-chip {
        padding: 2px 5px;
        font-size: 7px;
    }

    .message-bubble {
        font-size: 11px !important;
        padding: 6px 8px !important;
        max-height: 220px;
    }

    .prop-result-card {
        padding: 4px;
    }

    .prop-result-img {
        height: 55px;
    }

    .property-quick-options {
        padding: 4px !important;
    }

    .property-quick-options p {
        font-size: 7px !important;
        margin-bottom: 3px !important;
    }

    .chat-input-wrapper input {
        font-size: 11px;
        padding: 6px 10px;
    }

    .chat-send-btn {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 320px) {
    .chatbot-widget {
        bottom: 4px;
        right: 4px;
    }

    .chat-window {
        width: calc(100vw - 8px);
        height: 40vh;
        right: 0;
        bottom: 40px;
        max-width: calc(100vw - 8px);
        max-height: calc(100vh - 60px);
    }

    .property-ai-btn {
        padding: 5px 8px;
        font-size: 9px;
    }

    .chat-header {
        padding: 5px;
    }

    .chat-avatar svg {
        width: 20px;
        height: 20px;
    }

    .chat-title h4 {
        font-size: 10px;
    }

    .chat-status {
        font-size: 7px;
    }

    .chat-actions button {
        width: 18px;
        height: 18px;
    }

    .prop-chip {
        padding: 2px 4px;
        font-size: 6px;
    }

    .message-bubble {
        font-size: 10px !important;
        padding: 5px 7px !important;
        max-height: 200px;
    }

    .prop-result-card {
        padding: 3px;
    }

    .prop-result-img {
        height: 50px;
    }

    .property-quick-options {
        padding: 3px !important;
    }

    .property-quick-options p {
        font-size: 6px !important;
        margin-bottom: 2px !important;
    }

    .chat-input-wrapper input {
        font-size: 10px;
        padding: 5px 8px;
    }

    .chat-send-btn {
        width: 24px;
        height: 24px;
    }
}
