/* Marhamah Toys Chatbot - Professional & Modern Design */

/* Main Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 480px;
    height: 720px;
    background: #ffffff;
    border-radius: 28px;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    z-index: 10000;
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.chatbot-container.active {
    transform: translateY(0);
    opacity: 1;
}

.chatbot-container.minimized {
    height: 90px;
    width: 360px;
}

.chatbot-container.minimized .chatbot-body,
.chatbot-container.minimized .chatbot-input-container {
    display: none;
}

/* Chatbot Header - Professional Design */
.chatbot-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #1d4ed8 100%);
    color: white;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
    border-radius: 24px 24px 0 0;
}

.chatbot-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="white" stroke-width="0.5" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.2;
}

.chatbot-avatar {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    position: relative;
    z-index: 2;
    animation: gentlePulse 3s infinite;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes gentlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.chatbot-info {
    flex: 1;
    position: relative;
    z-index: 2;
}

.chatbot-info h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.status {
    margin: 4px 0 0 0;
    font-size: 0.9rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.status::before {
    content: '';
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 50%;
    animation: statusBlink 2s infinite;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

@keyframes statusBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.4; }
}

.chatbot-controls {
    display: flex;
    gap: 12px;
    position: relative;
    z-index: 2;
}

.minimize-btn,
.close-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.minimize-btn:hover,
.close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

/* Chatbot Body - Clean & Professional */
.chatbot-body {
    flex: 1;
    padding: 28px;
    overflow-y: auto;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 0;
}

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

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

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

.chatbot-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Welcome Message - Enhanced */
.welcome-message {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    animation: slideInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.welcome-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.4rem;
    flex-shrink: 0;
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.welcome-content {
    background: white;
    padding: 24px;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    flex: 1;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.welcome-content h4 {
    margin: 0 0 12px 0;
    color: #1e293b;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.welcome-content p {
    margin: 0 0 12px 0;
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.6;
    font-weight: 500;
}

.welcome-content ul {
    margin: 12px 0;
    padding-left: 20px;
    color: #64748b;
    font-size: 0.9rem;
}

.welcome-content li {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* Message Styles - Professional */
.message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    animation: messageSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    font-weight: 600;
}

.message.bot .message-avatar {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.message-content {
    max-width: 85%;
    padding: 18px 24px;
    border-radius: 22px;
    position: relative;
    word-wrap: break-word;
    line-height: 1.7;
    font-size: 0.98rem;
}

.message.bot .message-content {
    background: white;
    color: #1e293b;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border-bottom-left-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.message.user .message-content {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

.message-content p {
    margin: 0;
    line-height: 1.6;
    font-size: 0.95rem;
    font-weight: 500;
}

.message-content ul {
    margin: 12px 0;
    padding-left: 20px;
}

.message-content li {
    margin-bottom: 6px;
    line-height: 1.5;
}

/* Product Cards in Messages */
.product-card-message {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
    margin: 12px 0;
    display: flex;
    gap: 16px;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.product-image-message {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.6rem;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.product-info-message {
    flex: 1;
}

.product-name-message {
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 6px;
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.product-code-message {
    color: #64748b;
    font-size: 0.85rem;
    margin-bottom: 6px;
    font-weight: 500;
}

.product-price-message {
    color: #3b82f6;
    font-weight: 700;
    font-size: 1rem;
}

/* Chatbot Input - Modern Design */
.chatbot-input-container {
    padding: 28px;
    background: white;
    border-top: 1px solid #e2e8f0;
    border-radius: 0 0 28px 28px;
    flex-shrink: 0;
}

.input-wrapper {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

#chat-input {
    flex: 1;
    padding: 18px 24px;
    border: 2px solid #e2e8f0;
    border-radius: 18px;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    background: #f8fafc;
    min-height: 24px;
    line-height: 1.5;
    resize: none;
}

#chat-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    background: white;
}

.send-btn {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border: none;
    border-radius: 18px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

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

/* Quick Actions - Enhanced */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.quick-btn {
    padding: 10px 18px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #475569;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
}

.quick-btn:hover {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

/* Typing Indicator - Professional */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
    animation: slideInUp 0.3s ease;
}

.typing-indicator.active {
    display: flex;
}

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

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

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

@keyframes typingDot {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.typing-indicator p {
    margin: 0;
    color: #64748b;
    font-size: 0.9rem;
    font-style: italic;
    font-weight: 500;
}

/* Chatbot Toggle Button - Modern */
.chatbot-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 68px;
    height: 68px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border: none;
    border-radius: 22px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    box-shadow: 0 12px 45px rgba(59, 130, 246, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10001;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 50px rgba(59, 130, 246, 0.6);
}

.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    animation: bounce 1s infinite;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
    60% { transform: translateY(-4px); }
}

/* Responsive Design - Enhanced for all platforms */
@media (max-width: 1024px) {
    .chatbot-container {
        width: 450px;
        height: 680px;
    }
}

@media (max-width: 768px) {
    .chatbot-container {
        width: calc(100vw - 30px);
        height: calc(100vh - 30px);
        bottom: 15px;
        right: 15px;
        left: 15px;
        max-width: 500px;
        max-height: 90vh;
    }
    
    .chatbot-toggle {
        bottom: 15px;
        right: 15px;
        width: 60px;
        height: 60px;
    }
    
    .quick-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .quick-btn {
        text-align: center;
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    
    .chatbot-header {
        padding: 20px;
    }
    
    .chatbot-body {
        padding: 24px;
    }
    
    .chatbot-input-container {
        padding: 24px;
    }
}

@media (max-width: 480px) {
    .chatbot-container {
        width: calc(100vw - 20px);
        height: calc(100vh - 20px);
        bottom: 10px;
        right: 10px;
        left: 10px;
        border-radius: 24px;
    }
    
    .chatbot-header {
        padding: 18px;
        border-radius: 24px 24px 0 0;
    }
    
    .chatbot-body {
        padding: 20px;
        gap: 20px;
    }
    
    .chatbot-input-container {
        padding: 20px;
        border-radius: 0 0 24px 24px;
    }
    
    .input-wrapper {
        gap: 10px;
        margin-bottom: 14px;
    }
    
    #chat-input {
        padding: 16px 20px;
        font-size: 0.95rem;
        border-radius: 16px;
    }
    
    .send-btn {
        width: 48px;
        height: 48px;
        border-radius: 16px;
        font-size: 1.1rem;
    }
    
    .message-content {
        padding: 16px 20px;
        border-radius: 20px;
        font-size: 0.95rem;
    }
}

/* Windows-specific optimizations */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    .chatbot-container {
        border: 2px solid #e2e8f0;
    }
    
    .chatbot-header {
        background: #1e3a8a;
    }
}

/* macOS-specific optimizations */
@media screen and (-webkit-min-device-pixel-ratio: 2) {
    .chatbot-container {
        backdrop-filter: blur(30px);
        -webkit-backdrop-filter: blur(30px);
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .chatbot-container {
        box-shadow: 0 30px 100px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.08);
    }
}

/* Professional Message Types */
.error-message {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 16px;
    margin: 12px 0;
    font-size: 0.9rem;
    font-weight: 500;
}

.success-message {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 16px;
    margin: 12px 0;
    font-size: 0.9rem;
    font-weight: 500;
}

.info-message {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 16px;
    margin: 12px 0;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Loading States */
.loading-dots {
    display: inline-block;
}

.loading-dots::after {
    content: '';
    animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Enhanced Animations */
.fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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