/* Custom CSS for Multi-Document AI Assistant */

:root {
    --primary-color: #2563eb;
    --primary-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --light-gray: #f8fafc;
    --border-color: #e2e8f0;
    --text-muted: #64748b;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--light-gray);
    height: 100vh;
    margin: 0;
}

/* Navbar Styling */
.bg-gradient-primary {
    background: var(--primary-gradient);
    box-shadow: var(--shadow-md);
}

.navbar-brand {
    font-size: 1.25rem;
    letter-spacing: -0.025em;
}

/* Sidebar Styling */
.sidebar {
    background: white !important;
    border-right: 1px solid var(--border-color) !important;
    height: calc(100vh - 76px);
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
}

/* Drop Zone Styling */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--light-gray);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.drop-zone-content i {
    transition: all 0.3s ease;
}

.drop-zone:hover .drop-zone-content i {
    color: var(--primary-color) !important;
    transform: scale(1.1);
}

/* Chat Container */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 76px);
}

.chat-header {
    box-shadow: var(--shadow-sm);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    background: white;
    scroll-behavior: smooth;
}

/* Welcome Message */
.welcome-message {
    padding: 3rem 1rem;
    opacity: 0.8;
}

/* Message Bubbles */
.message {
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.3s ease;
}

.message-user {
    display: flex;
    justify-content: flex-end;
}

.message-assistant {
    display: flex;
    justify-content: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 0.875rem 1.125rem;
    border-radius: 1rem;
    position: relative;
    box-shadow: var(--shadow-sm);
    line-height: 1.5;
}

.message-bubble-user {
    background: var(--primary-gradient);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.message-bubble-assistant {
    background: white;
    border: 1px solid var(--border-color);
    color: #1f2937;
    border-bottom-left-radius: 0.25rem;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 0.75rem;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.message-avatar-user {
    background: var(--primary-gradient);
    color: white;
}

.message-avatar-assistant {
    background: var(--light-gray);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Chat Input */
.chat-input {
    box-shadow: 0 -1px 3px 0 rgba(0, 0, 0, 0.1);
}

#messageInput {
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 0.875rem 1.125rem;
    resize: none;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

#messageInput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#sendButton {
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-gradient);
    border: none;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

#sendButton:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

#sendButton:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Document Select */
#documentSelect {
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    font-size: 0.875rem;
}

/* Loading States */
.loading-dots {
    display: inline-flex;
    gap: 0.25rem;
}

.loading-dots span {
    width: 0.375rem;
    height: 0.375rem;
    background: var(--text-muted);
    border-radius: 50%;
    animation: loadingDots 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Success/Error States */
.alert {
    border-radius: 0.75rem;
    border: none;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.alert-info {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        height: auto;
        border-right: none !important;
        border-bottom: 1px solid var(--border-color);
    }
    
    .chat-container {
        height: auto;
        min-height: 60vh;
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    .drop-zone {
        padding: 1.5rem 1rem;
    }
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--light-gray);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Code Blocks in Messages */
.message-bubble pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 0.75rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    font-size: 0.875rem;
    margin: 0.5rem 0;
}

.message-bubble code {
    background: rgba(0, 0, 0, 0.05);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

/* Document Viewer */
.document-content {
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    background: var(--light-gray);
    white-space: pre-wrap;
    word-wrap: break-word;
}

#documentViewer .card {
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

#documentViewer .card-header {
    background: var(--light-gray);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
}

#viewDocumentBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
