
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.header p {
    opacity: 0.9;
    font-size: 1.1rem;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    min-height: 600px;
}

.upload-section, .chat-section {
    padding: 40px;
}

.upload-section {
    border-right: 1px solid #e5e7eb;
    background: #f8fafc;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #1f2937;
}

.upload-area {
    border: 3px dashed #d1d5db;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: white;
}

.upload-area:hover, .upload-area.dragover {
    border-color: #4f46e5;
    background: #fafbff;
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: #4f46e5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.upload-text {
    font-size: 1.1rem;
    color: #6b7280;
    margin-bottom: 10px;
}

.file-info {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
    border: 1px solid #e5e7eb;
    display: none;
}

.documents-list h3 {
    margin-bottom: 15px;
    color: #1f2937;
}

.document-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.document-info {
    flex: 1;
}

.document-name {
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 5px;
}

.document-meta {
    font-size: 0.9rem;
    color: #6b7280;
}

.delete-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.delete-btn:hover {
    background: #dc2626;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 500px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
    border-bottom: 1px solid #e5e7eb;
}

.message {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 12px;
    max-width: 85%;
    animation: fadeIn 0.3s ease-in;
}

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

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

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

.message-content {
    line-height: 1.6;
    /* white-space: pre-wrap; */
}

.sources {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #d1d5db;
    font-size: 0.9rem;
}

.source-item {
    background: rgba(255, 255, 255, 0.5);
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.source-meta {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 5px;
}

.source-content {
    font-size: 0.85rem;
    color: #374151;
}

.chat-input-container {
    display: flex;
    gap: 10px;
    padding-top: 20px;
}

.chat-input {
    flex: 1;
    padding: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    resize: none;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.chat-input:focus {
    outline: none;
    border-color: #4f46e5;
}

.send-btn {
    background: #4f46e5;
    color: white;
    border: none;
    padding: 15px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 80px;
}

.send-btn:hover:not(:disabled) {
    background: #4338ca;
    transform: translateY(-1px);
}

.send-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #6b7280;
    font-style: italic;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #4f46e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
}

.success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .upload-section {
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        padding: 30px 20px;
    }
    
    .chat-section {
        padding: 30px 20px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .upload-area {
        padding: 30px 15px;
    }
    
    .document-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .delete-btn {
        align-self: flex-end;
    }
}
.document-item {
    cursor: pointer;
    transition: all 0.3s ease;
}

.document-item:hover {
    background: #f9fafb;
    transform: translateX(2px);
}

.document-item.selected {
    background: #eff6ff;
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.document-item.selected .document-name {
    color: #2563eb;
    font-weight: 600;
}

#selectedDocumentDisplay {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}