/* Custom styles for AI Chat */

/* Dark mode variables */
:root {
    --bg-light: #f3f4f6;
    --bg-dark: #111827;
    --text-light: #1f2937;
    --text-dark: #f9fafb;
    --border-light: #e5e7eb;
    --border-dark: #374151;
}

/* Smooth transitions */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Message bubbles */
.message-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    margin-bottom: 8px;
    word-wrap: break-word;
}

.message-user {
    background-color: #3b82f6;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.message-assistant {
    background-color: #f3f4f6;
    color: #1f2937;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.dark .message-assistant {
    background-color: #374151;
    color: #f9fafb;
}

/* Code blocks */
.message-bubble pre {
    background-color: #1f2937;
    color: #f9fafb;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.message-bubble code {
    background-color: #e5e7eb;
    color: #1f2937;
    padding: 2px 4px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.dark .message-bubble code {
    background-color: #4b5563;
    color: #f9fafb;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background-color: #f3f4f6;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 80px;
    margin-right: auto;
    margin-bottom: 8px;
}

.dark .typing-indicator {
    background-color: #374151;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #6b7280;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Scrollbar styling */
.overflow-y-auto::-webkit-scrollbar {
    width: 6px;
}

.overflow-y-auto::-webkit-scrollbar-track {
    background: transparent;
}

.overflow-y-auto::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.dark .overflow-y-auto::-webkit-scrollbar-thumb {
    background: #4b5563;
}

/* Auto-resize textarea */
#messageInput {
    min-height: 44px;
    max-height: 120px;
    resize: none;
    overflow-y: auto;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .w-64 {
        width: 100%;
        position: fixed;
        top: 0;
        left: -100%;
        height: 100vh;
        z-index: 40;
        transition: left 0.3s ease;
    }
    
    .w-64.mobile-open {
        left: 0;
    }
    
    .message-bubble {
        max-width: 90%;
    }
}

/* Button hover effects */
button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

/* Loading spinner */
.spinner {
    border: 2px solid #f3f3f6;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Message actions */
.message-actions {
    opacity: 0;
    transition: opacity 0.2s ease;
    margin-top: 4px;
    display: flex;
    gap: 8px;
}

.message-bubble:hover .message-actions {
    opacity: 1;
}

.action-btn {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 4px;
    border-radius: 4px;
}

.action-btn:hover {
    background-color: #e5e7eb;
    color: #374151;
}

.dark .action-btn:hover {
    background-color: #4b5563;
    color: #f9fafb;
}

/* File upload area */
.file-upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin: 8px 0;
    transition: border-color 0.3s ease;
}

.file-upload-area:hover {
    border-color: #3b82f6;
}

.dark .file-upload-area {
    border-color: #4b5563;
}

.dark .file-upload-area:hover {
    border-color: #3b82f6;
}

/* Token warning */
.token-warning {
    background-color: #fef3c7;
    color: #92400e;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 8px;
}

.dark .token-warning {
    background-color: #451a03;
    color: #fbbf24;
}

/* Chat session item */
.chat-session-item {
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.chat-session-item:hover {
    background-color: #f3f4f6;
}

.dark .chat-session-item:hover {
    background-color: #374151;
}

.chat-session-item.active {
    background-color: #dbeafe;
    color: #1d4ed8;
}

.dark .chat-session-item.active {
    background-color: #1e3a8a;
    color: #93c5fd;
}

