/* =====================================
   AI CHAT WIDGET STYLES
   ===================================== */

/* Chat Bubble */
.ai-chat-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 9998;
}

.ai-chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.6);
}

.ai-chat-bubble.active {
    transform: scale(0.9);
    opacity: 0.8;
}

.ai-chat-bubble i {
    color: white;
    font-size: 28px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Notification Badge */
.chat-notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.ai-chat-bubble.notification-pulse {
    animation: bubblePulse 0.5s ease-in-out;
}

@keyframes bubblePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Chat Window */
.ai-chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 400px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 150px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 9999;
}

.ai-chat-window.active {
    transform: scale(1) translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Chat Header */
.ai-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-avatar {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.ai-avatar i {
    font-size: 22px;
    color: white;
}

.ai-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.ai-status {
    margin: 4px 0 0 0;
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.ai-chat-actions {
    display: flex;
    gap: 8px;
}

.ai-action-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.ai-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.ai-action-btn i {
    font-size: 14px;
}

/* Chat Body */
.ai-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
}

/* Custom Scrollbar */
.ai-chat-body::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-body::-webkit-scrollbar-track {
    background: transparent;
}

.ai-chat-body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.ai-chat-body::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Welcome Message */
.ai-welcome-message {
    text-align: center;
    padding: 20px;
}

.ai-avatar-large {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.ai-avatar-large i {
    font-size: 40px;
    color: white;
}

.ai-welcome-message h4 {
    margin: 0 0 12px 0;
    color: #111827;
    font-size: 18px;
}

.ai-welcome-message p {
    color: #6b7280;
    margin: 0 0 16px 0;
    font-size: 14px;
}

.ai-welcome-message ul {
    text-align: left;
    display: inline-block;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ai-welcome-message li {
    color: #4b5563;
    padding: 8px 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-welcome-message li:before {
    content: "✓";
    color: #667eea;
    font-weight: bold;
    font-size: 16px;
}

/* Chat Messages */
.ai-message {
    margin-bottom: 16px;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* User Message */
.user-message {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-left: auto;
    margin-right: 0;
    max-width: 80%;
    width: fit-content;
    align-self: flex-end;
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 16px 16px 4px 16px;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.user-message .message-time {
    color: #9ca3af;
    font-size: 11px;
    margin-top: 4px;
    padding: 0 8px;
}

/* AI Message */
.ai-message {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.ai-message-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-message-avatar i {
    font-size: 16px;
    color: white;
}

.message-wrapper {
    flex: 1;
}

.ai-message .message-content {
    background: white;
    color: #111827;
    padding: 12px 16px;
    border-radius: 4px 16px 16px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    line-height: 1.6;
}

.ai-message .message-content strong {
    color: #667eea;
}

.ai-message .message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.ai-message .message-content li {
    margin: 4px 0;
}

.ai-message .message-time {
    color: #9ca3af;
    font-size: 11px;
    margin-top: 4px;
    padding: 0 8px;
}

/* Typing Indicator */
.typing-indicator .typing-dots {
    background: white;
    padding: 12px 16px;
    border-radius: 4px 16px 16px 16px;
    display: inline-flex;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typingDot 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-8px); opacity: 1; }
}

/* Chat Footer */
.ai-chat-footer {
    padding: 16px;
    background: white;
    border-radius: 0 0 16px 16px;
    border-top: 1px solid #e5e7eb;
}

/* Quick Actions */
.ai-quick-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.quick-action-btn {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.quick-action-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
}

/* Input Container */
.ai-input-container {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.ai-chat-input {
    flex: 1;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    transition: all 0.2s;
}

.ai-chat-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ai-chat-input::placeholder {
    color: #9ca3af;
}

.ai-send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ai-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-send-btn:not(:disabled):hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ai-send-btn:not(:disabled):active {
    transform: scale(0.95);
}

.ai-send-btn i {
    font-size: 16px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .ai-chat-bubble {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }

    .ai-chat-bubble i {
        font-size: 24px;
    }

    .ai-chat-window {
        bottom: 90px;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: calc(100vh - 110px);
        border-radius: 16px 16px 0 0;
        margin: 0 auto;
    }

    .ai-chat-window.active {
        transform: scale(1) translateY(0);
    }

    .quick-action-btn {
        font-size: 11px;
        padding: 6px 10px;
    }
}

/* Animation for smooth transitions */
@media (prefers-reduced-motion: reduce) {
    .ai-chat-bubble,
    .ai-chat-window,
    .ai-message,
    .ai-action-btn,
    .ai-send-btn,
    .quick-action-btn {
        animation: none !important;
        transition: none !important;
    }
}
