/* Marshall Spain Chat Widget Styles - CI Color: #0f5a64 */
#imova-chat-container {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#imova-chat-container.chat-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

#imova-chat-container.chat-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

#imova-chat-toggle {
    position: relative;
    cursor: pointer;
    user-select: none;
}

.chat-bubble {
    width: 60px;
    height: 60px;
    background: #0f5a64;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 32px rgba(15, 90, 100, 0.3);
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

.chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(15, 90, 100, 0.4);
}

@keyframes pulse {
    0% { box-shadow: 0 8px 32px rgba(15, 90, 100, 0.3), 0 0 0 0 rgba(15, 90, 100, 0.7); }
    70% { box-shadow: 0 8px 32px rgba(15, 90, 100, 0.3), 0 0 0 20px rgba(15, 90, 100, 0); }
    100% { box-shadow: 0 8px 32px rgba(15, 90, 100, 0.3), 0 0 0 0 rgba(15, 90, 100, 0); }
}

#imova-chat-widget {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: 90vw;
    height: 520px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.chat-hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8) translateY(20px);
}

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

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

.chat-title .logo {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 2px;
}

.chat-title .subtitle {
    font-size: 11px;
    opacity: 0.8;
    color: #0f5a64;
}

#imova-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

#imova-chat-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
    background: white;
    min-height: 0;
}

.message {
    margin-bottom: 16px;
    display: flex;
    align-items: flex-end;
}

.bot-message {
    justify-content: flex-start;
}

.user-message {
    justify-content: flex-end;
}

.message-content {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
}

.bot-message .message-content {
    background: #f3f4f6;
    color: #1f2937;
    border-bottom-left-radius: 6px;
}

.user-message .message-content {
    background: #0f5a64;
    color: white;
    border-bottom-right-radius: 6px;
}

.quick-messages {
    padding: 15px 20px 10px;
    border-top: 1px solid #f3f4f6;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: white;
    flex-shrink: 0;
}

.quick-message-btn {
    padding: 10px 15px;
    background: #c3def0;
    border: 1px solid #c3def0;
    color: #1f2937;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
}

.quick-message-btn:hover {
    background: #a8cde8;
    border-color: #a8cde8;
    transform: translateY(-1px);
}

.chat-input-area {
    padding: 20px;
    background: white;
    border-top: 1px solid #f3f4f6;
    flex-shrink: 0;
}

.chat-input-container {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 8px 12px;
    background: #f9fafb;
    border-radius: 25px;
    border: 1px solid #e5e7eb;
    transition: border-color 0.2s;
}

.chat-input-container:focus-within {
    border-color: #0f5a64;
    box-shadow: 0 0 0 3px rgba(15, 90, 100, 0.1);
}

#imova-chat-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 0;
    font-size: 14px;
    color: #1f2937;
    resize: none;
    min-height: 20px;
    max-height: 120px;
    line-height: 1.4;
    font-family: inherit;
}

#imova-chat-input:focus {
    outline: none;
}

#imova-chat-input::placeholder {
    color: #9ca3af;
}

#imova-chat-send {
    width: 36px;
    height: 36px;
    background: #0f5a64;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 16px;
    flex-shrink: 0;
}

#imova-chat-send:hover:not(:disabled) {
    background: #083d45;
    transform: scale(1.05);
}

#imova-chat-send:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
}

.chat-status {
    text-align: center;
    padding: 12px 20px;
    font-size: 11px;
    color: #6b7280;
    background: #f9fafb;
    border-top: 1px solid #f3f4f6;
}

.error-message .message-content {
    background: #fef2f2 !important;
    color: #dc2626 !important;
    border: 1px solid #fecaca;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6b7280;
}

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

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #0f5a64;
    animation: typing-bounce 1.4s ease-in-out infinite both;
}

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

@keyframes typing-bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.property-recommendations {
    margin-top: 10px;
    padding: 15px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.property-card {
    background: white;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.property-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #0f5a64;
}

.property-card h4 {
    margin: 0 0 8px 0;
    color: #1f2937;
    font-size: 14px;
    font-weight: 600;
}

.property-card p {
    margin: 0 0 4px 0;
    color: #6b7280;
    font-size: 12px;
}

.property-price {
    color: #0f5a64;
    font-weight: 600;
    font-size: 14px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #imova-chat-widget {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        bottom: 0;
        right: 0;
        left: 0;
    }
    
    #imova-chat-container.chat-position-bottom-left,
    #imova-chat-container.chat-position-bottom-right {
        bottom: 0;
        left: 0;
        right: 0;
    }
    
    .chat-messages {
        padding: 15px;
    }
    
    .chat-input-area {
        padding: 15px;
        padding-bottom: 25px;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .chat-bubble {
        border: 2px solid white;
    }
    
    .message-content {
        border: 1px solid currentColor;
    }
}