/* Modern AI Assistant - Flutterwave-Inspired Design */
/* Clean, professional, and conversational UI */

:root {
    /* Match homepage brand colors */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #4F46E5 0%, #10B981 100%);
    --chat-bg: #f8f9fb;
    --message-bot-bg: #ffffff;
    --message-user-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --text-primary: #0F172A;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.12);
}

/* AI Assistant Button - Floating Action */
.ai-assistant {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 10000;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-assistant:hover {
    transform: translateY(-4px);
}

.ai-bubble {
    background: var(--primary-gradient);
    color: white;
    padding: 16px 20px;
    border-radius: 50px;
    box-shadow: 0 8px 30px rgba(79, 70, 229, 0.35);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 15px;
    min-width: 60px;
    min-height: 60px;
    animation: gentle-pulse 3s ease-in-out infinite;
    backdrop-filter: saturate(180%) blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

@keyframes gentle-pulse {
    0%, 100% { 
        transform: scale(1); 
        box-shadow: 0 8px 30px rgba(79, 70, 229, 0.35);
    }
    50% { 
        transform: scale(1.05); 
        box-shadow: 0 12px 40px rgba(79, 70, 229, 0.45);
    }
}

.ai-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Chat Interface - Modern Card Design */
.chat-interface {
    position: fixed;
    bottom: 110px;
    right: 32px;
    width: 440px;
    max-width: calc(100vw - 64px);
    height: 680px;
    max-height: calc(100vh - 140px);
    background: #f8f9fb !important; /* Force light background - professional and user-friendly */
    border-radius: 24px;
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0, 0, 0, 0.05);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 10001;
    animation: slideUpFade 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.chat-interface.active {
    display: flex;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Chat Header - Clean and Professional */
.chat-header {
    padding: 24px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fb 100%) !important;
    border-bottom: 1px solid var(--border-color);
    color: #1a202c !important; /* Force dark text on light background */
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-header h3 {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}

.chat-header-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 4px;
}

.chat-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s ease;
}

.chat-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

/* Chat Messages - Smooth Scrolling Area */
.chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
    background: #f8f9fb !important; /* Force light background for message area */
}

/* Custom Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* Message Container - Natural Chat Flow */
.message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: messageSlide 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 90%;
}

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

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

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

/* Message Avatar - Professional Look */
.message-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.bot-message .message-avatar {
    background: linear-gradient(135deg, #f5770a 0%, #ff8c3a 100%);
    box-shadow: 0 4px 12px rgba(245, 119, 10, 0.25);
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

/* Message Content - Clean Bubbles */
.message-content {
    padding: 14px 18px;
    border-radius: 18px;
    line-height: 1.6;
    font-size: 14.5px;
    max-width: 100%;
    word-wrap: break-word;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.bot-message .message-content {
    background: #ffffff !important; /* Force white for bot messages */
    color: #1a202c !important; /* Force dark text */
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.user-message .message-content {
    background: var(--message-user-bg);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(245, 119, 10, 0.25);
}

/* Message Text Formatting */
.message-content strong {
    font-weight: 700;
}

.message-content em {
    font-style: italic;
}

.message-content br {
    content: "";
    display: block;
    margin: 8px 0;
}

/* Expand/Collapse Message Content */
.message-hidden.hidden {
    display: none;
}

.expand-message {
    background: transparent;
    border: none;
    color: #4F46E5;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    margin-top: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.expand-message:hover {
    background: rgba(79, 70, 229, 0.1);
}

/* Quick Replies - Interactive Chips */
.quick-replies-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0;
    padding: 0 12px;
    animation: fadeInUp 0.4s ease;
}

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

.quick-reply-btn {
    padding: 10px 18px;
    border: 2px solid #4F46E5;
    background: white;
    color: #4F46E5;
    border-radius: 20px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.quick-reply-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.3);
}

.quick-reply-btn:active {
    transform: translateY(0);
}

/* Typing Indicator - Smooth Animation */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    animation: fadeInUp 0.3s ease;
}

.typing-dots {
    display: flex;
    gap: 5px;
    padding: 14px 18px;
    background: white;
    border-radius: 18px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    border-bottom-left-radius: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e0;
    animation: typingBounce 1.4s ease-in-out infinite;
}

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

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

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

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        background: #cbd5e0;
    }
    30% {
        transform: translateY(-10px);
        background: #f5770a;
    }
}

/* Chat Input - Modern and Clean */
.chat-input {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: white !important; /* Force white background for input area */
    flex-shrink: 0;
}

.chat-input input[type="text"] {
    flex: 1;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    outline: none;
    font-size: 14.5px;
    transition: all 0.2s ease;
    background: #f8f9fb;
}

.chat-input input[type="text"]:focus {
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    background: white;
}

.chat-input input[type="text"]:disabled {
    background: #f1f5f9;
    color: var(--text-secondary);
    cursor: not-allowed;
}

.chat-input button {
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 14px 20px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.chat-input button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35);
}

.chat-input button:active:not(:disabled) {
    transform: translateY(0);
}

.chat-input button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive Design - Mobile Friendly */
@media (max-width: 768px) {
    .ai-assistant {
        bottom: 20px;
        right: 20px;
    }
    
    .ai-bubble {
        min-width: 56px;
        min-height: 56px;
        padding: 12px 16px;
    }
    
    .chat-interface {
        bottom: 90px;
        right: 20px;
        left: 20px;
        width: auto;
        max-width: none;
        height: calc(100vh - 120px);
        max-height: none;
        border-radius: 20px;
    }
    
    .chat-header {
        padding: 20px;
    }
    
    .chat-messages {
        padding: 16px;
        gap: 16px;
    }
    
    .message-content {
        font-size: 14px;
        padding: 12px 16px;
    }
    
    .chat-input {
        padding: 12px 16px;
    }
}

@media (max-width: 480px) {
    .ai-assistant {
        bottom: 16px;
        right: 16px;
    }
    
    .chat-interface {
        bottom: 80px;
        right: 16px;
        left: 16px;
        height: calc(100vh - 100px);
        border-radius: 16px;
    }
    
    .chat-header {
        padding: 16px;
    }
    
    .chat-header h3 {
        font-size: 17px;
    }
    
    .chat-messages {
        padding: 12px;
        gap: 14px;
    }
    
    .message {
        gap: 10px;
    }
    
    .message-avatar {
        width: 36px;
        height: 36px;
        min-width: 36px;
        font-size: 18px;
    }
    
    .message-content {
        font-size: 13.5px;
        padding: 11px 14px;
        border-radius: 16px;
    }
    
    .quick-reply-btn {
        padding: 9px 15px;
        font-size: 13px;
    }
    
    .chat-input {
        padding: 10px 12px;
        gap: 8px;
    }
    
    .chat-input input[type="text"] {
        padding: 12px 14px;
        font-size: 14px;
        border-radius: 12px;
    }
    
    .chat-input button {
        padding: 12px 16px;
        border-radius: 12px;
    }
}

/* Dark Mode Removed - Always use light, professional theme for business chat */
/* Professional businesses prefer light backgrounds for clarity and trust */

/* Accessibility Improvements */
.chat-interface:focus-within {
    outline: 2px solid #4F46E5;
    outline-offset: 2px;
}

.quick-reply-btn:focus,
.chat-input button:focus,
.chat-input input:focus {
    outline: 2px solid #4F46E5;
    outline-offset: 2px;
}

/* Smooth Transitions */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Print Styles */
@media print {
    .ai-assistant,
    .chat-interface {
        display: none !important;
    }
}
