.ai-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--brand-primary), #a855f7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.4);
    z-index: 5000;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.ai-fab:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.6);
}

@keyframes pulse-glow {
    0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}
.ai-fab.idle { animation: pulse-glow 2s infinite; }

.ai-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 500px;
    background: rgba(15, 15, 19, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 4999;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
}

.ai-window.open {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

.ai-header {
    padding: 15px 20px;
    background: linear-gradient(90deg, rgba(99,102,241,0.2), transparent);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ai-title { font-weight: 800; font-size: 1rem; letter-spacing: 1px; color: white; display: flex; gap: 8px; align-items: center; }
.ai-status-dot { width: 8px; height: 8px; background: #4ade80; border-radius: 50%; box-shadow: 0 0 10px #4ade80; }

.ai-close { background: none; border: none; color: #888; cursor: pointer; font-size: 1rem; }
.ai-close:hover { color: white; }

.ai-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ai-msg {
    max-width: 85%;
    padding: 10px 15px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.ai-msg.bot {
    align-self: flex-start;
    background: #27272a;
    color: #e4e4e7;
    border-bottom-left-radius: 2px;
    border: 1px solid #3f3f46;
}

.ai-msg.user {
    align-self: flex-end;
    background: var(--brand-primary);
    color: white;
    border-bottom-right-radius: 2px;
}

.typing-indicator {
    align-self: flex-start;
    background: #27272a;
    padding: 10px 15px;
    border-radius: 12px;
    display: flex; gap: 4px;
    display: none;
}
.typing-dot { width: 6px; height: 6px; background: #888; border-radius: 50%; animation: bounce 1.4s infinite ease-in-out both; }
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

.ai-footer {
    padding: 15px;
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex;
    gap: 10px;
    align-items: center;
    background: rgba(0,0,0,0.2);
}

#ai-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #3f3f46;
    border-radius: 25px;
    padding: 12px 18px;
    color: white;
    outline: none;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

#ai-input::placeholder { color: #666; }

#ai-input:focus {
    border-color: #6366f1;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.1);
}

.ai-send {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
    border: none;
    width: 42px; height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: 0.2s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.ai-send:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.4);
}

@media (max-width: 480px) {
    .ai-window { width: 100%; height: 100%; bottom: 0; right: 0; border-radius: 0; }
    .ai-fab { bottom: 20px; right: 20px; }
}