/* AI Chatbot Widget Styles */
.ai-widget-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

/* Floating Button */
.ai-widget-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    border: none;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-widget-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.ai-widget-btn:active {
    transform: scale(0.95);
}

/* Chat Window */
.ai-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 550px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.ai-chat-window.d-none {
    display: none !important;
}

/* Dark Mode Support */
[data-bs-theme="dark"] .ai-chat-window,
body.dark .ai-chat-window {
    background: #171a1f;
    border-color: #262b33;
}

/* Header */
.ai-chat-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

[data-bs-theme="dark"] .ai-chat-header,
body.dark .ai-chat-header {
    background: #121418;
    border-bottom-color: #262b33;
    color: #dce2ef;
}

/* Body */
.ai-chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fff;
    /* Hide scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.ai-chat-body::-webkit-scrollbar {
    display: none;
}

[data-bs-theme="dark"] .ai-chat-body,
body.dark .ai-chat-body {
    background: #171a1f;
}

/* Messages */
.ai-message {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

.ai-message.ai-message-user {
    flex-direction: row-reverse;
}

.ai-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e0e7ff;
    color: #6366f1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.ai-message-user .ai-avatar {
    background: #f3f4f6;
    color: #4b5563;
}

[data-bs-theme="dark"] .ai-avatar,
body.dark .ai-avatar {
    background: #312e81;
    color: #818cf8;
}

[data-bs-theme="dark"] .ai-message-user .ai-avatar,
body.dark .ai-message-user .ai-avatar {
    background: #374151;
    color: #9ca3af;
}

.ai-content {
    background: #f8fafc;
    padding: 10px 14px;
    border-radius: 12px;
    border-top-left-radius: 2px;
    font-size: 14px;
    line-height: 1.5;
    max-width: 80%;
    color: #334155;
}

[data-bs-theme="dark"] .ai-content,
body.dark .ai-content {
    background: #121418;
    color: #dce2ef;
    border: 1px solid #262b33;
}

.ai-message-user .ai-content {
    background: #6366f1;
    color: white;
    border-radius: 12px;
    border-top-right-radius: 2px;
    border: none;
}

/* Footer */
.ai-chat-footer {
    padding: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: #fff;
}

[data-bs-theme="dark"] .ai-chat-footer,
body.dark .ai-chat-footer {
    background: #121418;
    border-top-color: #262b33;
}

.ai-input-group {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#ai-chat-input {
    resize: none;
    border-radius: 20px;
    padding: 10px 15px;
    max-height: 100px;
    font-size: 14px;
    background-color: #fff;
    color: #334155;
    border: 1px solid #e2e8f0;
}

[data-bs-theme="dark"] #ai-chat-input,
body.dark #ai-chat-input {
    background-color: #171a1f;
    color: #dce2ef;
    border-color: #262b33;
}

[data-bs-theme="dark"] #ai-chat-input::placeholder,
body.dark #ai-chat-input::placeholder {
    color: #94a3b8;
}

#ai-chat-send {
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typing Indicator */
.typing-indicator span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #ccc;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
    margin: 0 2px;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Markdown Styles in Chat */
.ai-content ul,
.ai-content ol {
    margin-bottom: 0;
    padding-left: 20px;
}

.ai-content p:last-child {
    margin-bottom: 0;
}

.ai-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 0.9em;
}

.ai-content pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 10px;
    border-radius: 8px;
    overflow-x: auto;
    margin-top: 8px;
    margin-bottom: 8px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .ai-widget-container {
        bottom: 20px;
        right: 20px;
    }

    .ai-widget-btn {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }

    .ai-chat-window {
        width: calc(100vw - 40px);
        right: 0;
        bottom: 75px;
    }
}