/* Google Font for premium feel */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600&display=swap');

:root {
    --primary-bg: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    --accent-color: #6366f1;
    --msg-ai-bg: #ffffff;
    --msg-user-bg: #4f46e5;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --border-glass: rgba(255, 255, 255, 0.3);
}

#ai-chat-wrapper {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999999;
    font-family: 'Outfit', sans-serif;
}

/* Floating Action Button with pulsing effect */
#ai-chat-toggle {
    width: 65px;
    height: 65px;
    background: var(--primary-bg);
    border-radius: 50%;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: white;
    position: relative;
}

#ai-chat-toggle::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--accent-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.4); opacity: 0; }
}

#ai-chat-toggle svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

#ai-chat-toggle:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 30px rgba(15, 23, 42, 0.6);
}

/* Chat Container with Glassmorphism */
#ai-chat-container {
    width: 400px;
    height: 600px;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 28px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.2);
    overflow: hidden;
    position: absolute;
    bottom: 85px;
    right: 0;
    display: none;
    flex-direction: column;
    border: 1px solid var(--border-glass);
    animation: premiumFadeIn 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

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

#ai-chat-header {
    background: var(--primary-bg);
    color: #fff;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

#ai-chat-header .header-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

#ai-chat-header .status-dot {
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 50%;
    position: relative;
}

#ai-chat-header .status-dot::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: #10b981;
    border-radius: 50%;
    animation: statusPulse 1.5s infinite;
}

@keyframes statusPulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(3); opacity: 0; }
}

#ai-chat-header h3 {
    margin: 0;
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

#ai-chat-close {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

#ai-chat-close:hover { opacity: 1; }

#ai-chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: rgba(241, 245, 249, 0.4);
}

/* Messages Styling with Micro-animations */
.ai-msg, .user-msg {
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 15px;
    line-height: 1.6;
    max-width: 85%;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    animation: msgSlideIn 0.3s ease-out forwards;
}

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

.ai-msg {
    background: white;
    color: #0f172a;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.user-msg {
    background: var(--msg-user-bg);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 8px 16px -4px rgba(79, 70, 229, 0.3);
}

/* Typing Indicator */
.typing-indicator {
    padding: 12px 18px;
    background: white;
    border-radius: 20px;
    width: fit-content;
    display: none;
    border: 1px solid #e2e8f0;
}
.typing-indicator span {
    height: 8px;
    width: 8px;
    background: #818cf8;
    display: inline-block;
    border-radius: 50%;
    margin-right: 4px;
    animation: bounce 1.3s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

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

/* Input Area */
#ai-chat-input-area {
    padding: 20px;
    background: white;
    display: flex;
    align-items: center;
    gap: 12px;
    border-top: 1px solid rgba(0,0,0,0.05);
}

#ai-input-container {
    flex: 1;
    background: #f1f5f9;
    border-radius: 16px;
    padding: 6px 14px;
    transition: all 0.2s;
    border: 2px solid transparent;
}

#ai-input-container:focus-within {
    background: white;
    border-color: #e2e8f0;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

#ai-user-msg {
    width: 100%;
    border: none;
    background: transparent;
    padding: 10px 0;
    font-size: 15px;
    outline: none;
    color: #1e293b;
    font-family: inherit;
}

#ai-send-btn {
    background: var(--primary-bg);
    color: white;
    border: none;
    border-radius: 14px;
    width: 48px;
    height: 48px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

#ai-send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(15, 23, 42, 0.3);
}

/* Custom Scrollbar */
#ai-chat-box::-webkit-scrollbar { width: 4px; }
#ai-chat-box::-webkit-scrollbar-track { background: transparent; }
#ai-chat-box::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
