/* AI Chat Box - Dashboard Theme */

/* Chat Button */
.ai-chat-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10001;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.4);
    transition: all 0.3s ease;
    display: none;
    align-items: center;
    justify-content: center;
}

.ai-chat-button.show {
    display: flex;
}

.ai-chat-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(139, 92, 246, 0.5);
}

.ai-chat-button:active {
    transform: translateY(0);
}

/* Chat Box Container */
.ai-chat-box {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    height: 600px;
    background: rgba(15, 23, 42, 0.92);
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(139, 92, 246, 0.22);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    z-index: 10002;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-chat-box.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Chat Header */
.ai-chat-header {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: white;
    padding: 20px;
    border-radius: 18px 18px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.12);
}

.ai-chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.ai-chat-title i {
    font-size: 20px;
}

.ai-chat-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.ai-chat-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Chat Messages */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: radial-gradient(1200px 800px at 30% 20%, rgba(99, 102, 241, 0.12), transparent 55%),
        radial-gradient(900px 600px at 80% 70%, rgba(139, 92, 246, 0.10), transparent 55%),
        #0b1224;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.5);
}

/* Message Bubbles */
.ai-message,
.user-message {
    max-width: 80%;
    animation: messageSlideIn 0.3s ease;
}

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

.message.user {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.92) 0%, rgba(99, 102, 241, 0.92) 100%);
    color: #ffffff;
    align-self: flex-end;
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: 0 10px 24px rgba(99, 102, 241, 0.18);
}

.message.ai {
    background: rgba(30, 41, 59, 0.72);
    color: #e2e8f0;
    align-self: flex-start;
    border: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.message {
    padding: 14px 16px;
    border-radius: 16px;
    line-height: 1.55;
    font-size: 14px;
    white-space: pre-wrap;
    word-break: break-word;
}

.message.user {
    border-bottom-right-radius: 8px;
}

.message.ai {
    border-bottom-left-radius: 8px;
}

.ai-content {
    line-height: 1.55;
}

.ai-content p {
    margin: 0 0 10px 0;
}

.ai-content p:last-child {
    margin-bottom: 0;
}

.ai-content strong {
    color: #ffffff;
    font-weight: 700;
}

.ai-content code {
    background: rgba(2, 6, 23, 0.65);
    border: 1px solid rgba(148, 163, 184, 0.18);
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 12px;
}

.ai-content pre {
    background: rgba(2, 6, 23, 0.75);
    border: 1px solid rgba(148, 163, 184, 0.18);
    padding: 12px;
    border-radius: 12px;
    overflow-x: auto;
}

.ai-content ul,
.ai-content ol {
    margin: 8px 0 10px 18px;
    padding: 0;
}

.ai-content li {
    margin: 6px 0;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #1e293b;
    border-radius: 12px;
    width: fit-content;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #8b5cf6;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Chat Input */
.ai-chat-input-wrapper {
    padding: 16px;
    background: rgba(15, 23, 42, 0.88);
    border-top: 1px solid rgba(139, 92, 246, 0.18);
    border-radius: 0 0 18px 18px;
    display: flex;
    gap: 8px;
}

.ai-chat-input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(2, 6, 23, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 24px;
    font-size: 14px;
    color: #e2e8f0;
    outline: none;
    transition: all 0.2s;
}

.ai-chat-input::placeholder {
    color: #64748b;
}

.ai-chat-input:focus {
    border-color: #8b5cf6;
    background: rgba(2, 6, 23, 0.72);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

.ai-chat-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 10px 22px rgba(99, 102, 241, 0.25);
}

.ai-chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.ai-chat-send:active {
    transform: scale(0.95);
}

.ai-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
    .ai-chat-box {
        width: calc(100vw - 32px);
        height: calc(100vh - 140px);
        right: 16px;
        bottom: 90px;
    }

    .ai-chat-button {
        right: 16px;
        bottom: 16px;
    }
}
