/**
 * Public-facing CSS for Real Estate AI Agent
 */

/* Chatbot Widget Container */
.reai-chatbot-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Position Classes */
.reai-chatbot-widget.reai-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.reai-chatbot-widget.reai-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

.reai-chatbot-widget.reai-position-top-right {
    top: 20px;
    right: 20px;
}

.reai-chatbot-widget.reai-position-top-left {
    top: 20px;
    left: 20px;
}

/* Toggle Button */
.reai-toggle-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.reai-toggle-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.reai-toggle-button:active {
    transform: scale(0.95);
}

.reai-toggle-icon {
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reai-unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    font-size: 12px;
    font-weight: bold;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Chat Window */
.reai-chat-window {
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    position: absolute;
    bottom: 80px;
    right: 0;
    overflow: hidden;
}

.reai-position-bottom-left .reai-chat-window {
    right: auto;
    left: 0;
}

.reai-position-top-right .reai-chat-window,
.reai-position-top-left .reai-chat-window {
    bottom: auto;
    top: 80px;
}

/* Header */
.reai-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px;
    flex-shrink: 0;
}

.reai-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reai-header-info {
    flex: 1;
}

.reai-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.reai-status {
    display: flex;
    align-items: center;
    margin-top: 4px;
    font-size: 12px;
    opacity: 0.9;
}

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

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(74, 222, 128, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
    }
}

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

.reai-header-actions button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.reai-header-actions button:hover {
    opacity: 1;
}

/* Messages Container */
.reai-messages-container {
    flex: 1;
    overflow-y: auto;
    background: #f9fafb;
    position: relative;
}

.reai-messages {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Messages */
.reai-message {
    display: flex;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

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

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

.reai-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.reai-message-user .reai-message-avatar {
    background: #dbeafe;
}

.reai-message-assistant .reai-message-avatar {
    background: #f3e8ff;
}

.reai-avatar-icon {
    font-size: 16px;
}

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

.reai-message-user .reai-message-content {
    align-items: flex-end;
    display: flex;
    flex-direction: column;
}

.reai-message-bubble {
    background: white;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.reai-message-user .reai-message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.reai-message-text {
    margin: 0;
    line-height: 1.5;
    word-wrap: break-word;
}

.reai-message-text a {
    color: #667eea;
    text-decoration: underline;
}

.reai-message-user .reai-message-text a {
    color: white;
}

.reai-message-time {
    font-size: 11px;
    color: #6b7280;
    margin-top: 4px;
    display: block;
}

/* Typing Indicator */
.reai-typing-indicator {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.reai-typing-dots span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

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

.reai-typing-text {
    font-size: 13px;
    color: #6b7280;
    font-style: italic;
}

/* Suggestions */
.reai-suggestions {
    padding: 12px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.reai-suggestion-chip {
    background: white;
    border: 1px solid #667eea;
    color: #667eea;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.reai-suggestion-chip:hover {
    background: #667eea;
    color: white;
}

/* GDPR Notice */
.reai-gdpr-notice {
    background: #fef3c7;
    border-top: 2px solid #f59e0b;
    padding: 12px;
    font-size: 13px;
}

.reai-gdpr-notice p {
    margin: 0 0 8px 0;
    color: #92400e;
}

.reai-gdpr-accept {
    background: #f59e0b;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.reai-gdpr-accept:hover {
    background: #d97706;
}

/* Input Area */
.reai-input-area {
    background: white;
    border-top: 1px solid #e5e7eb;
    padding: 12px;
    flex-shrink: 0;
}

.reai-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.reai-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    resize: none;
    font-family: inherit;
    line-height: 1.4;
    max-height: 120px;
    transition: border-color 0.2s;
}

.reai-input:focus {
    outline: none;
    border-color: #667eea;
}

.reai-input:disabled {
    background: #f3f4f6;
    cursor: not-allowed;
}

.reai-send-button {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.reai-send-button:hover:not(:disabled) {
    transform: scale(1.05);
}

.reai-send-button:active:not(:disabled) {
    transform: scale(0.95);
}

.reai-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.reai-input-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 11px;
    color: #6b7280;
}

.reai-char-count.reai-char-warning {
    color: #ef4444;
}

/* Accessibility */
.reai-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .reai-chat-window {
        width: 100vw;
        height: 100vh;
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        border-radius: 0;
        position: fixed;
    }
    
    .reai-toggle-button {
        width: 56px;
        height: 56px;
    }
    
    .reai-chatbot-widget.reai-position-bottom-right,
    .reai-chatbot-widget.reai-position-bottom-left {
        bottom: 16px;
    }
    
    .reai-chatbot-widget.reai-position-bottom-right {
        right: 16px;
    }
    
    .reai-chatbot-widget.reai-position-bottom-left {
        left: 16px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .reai-chat-window {
        background: #1f2937;
    }
    
    .reai-messages-container {
        background: #111827;
    }
    
    .reai-message-bubble {
        background: #1f2937;
        color: #f3f4f6;
    }
    
    .reai-input-area {
        background: #1f2937;
        border-top-color: #374151;
    }
    
    .reai-input {
        background: #111827;
        border-color: #374151;
        color: #f3f4f6;
    }
    
    .reai-suggestions {
        background: #1f2937;
        border-top-color: #374151;
    }
}