/* Custom styles for RAG application */
:root {
    --bs-primary: #0d6efd;
    --bs-primary-rgb: 13, 110, 253;
    --bs-primary-hover: #0b5ed7;
    --bs-primary-light: #e9f7fe;
    --bs-primary-border: #0d6efd;
    --bs-secondary: #6c757d;
    --bs-secondary-rgb: 108, 117, 125;
    --bs-light: #f8f9fa;
    --bs-dark: #212529;
    --bs-body-bg: #ffffff;
    --bs-body-color: #212529;
    --bs-success: #198754;
    --bs-info: #0dcaf0;
    --bs-warning: #ffc107;
    --bs-danger: #dc3545;
    --transition-standard: all 0.3s ease;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    --border-radius-sm: 0.25rem;
    --border-radius: 0.375rem;
    --border-radius-lg: 0.5rem;
    --border-radius-xl: 1rem;
}

/* Base Elements */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--bs-body-color);
    background-color: var(--bs-body-bg);
    overflow-x: hidden;
}

.main-content {
    flex: 1;
    padding-bottom: 2rem;
}

/* Enhanced Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-bottom: 1rem;
}

a {
    text-decoration: none;
    transition: var(--transition-standard);
}

.text-footer {
    color: rgba(33, 37, 41, 0.7);
}

/* Navigation Bar */
.navbar {
    background-color: white;
    box-shadow: var(--shadow-sm);
    padding: 0.75rem 0;
    transition: var(--transition-standard);
}

.navbar-brand {
    font-weight: 700;
    color: var(--bs-primary);
    transition: var(--transition-standard);
}

.navbar-brand:hover {
    color: var(--bs-primary-hover);
}

.nav-link {
    color: var(--bs-dark);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: var(--transition-standard);
    border-radius: var(--border-radius);
}

.nav-link:hover {
    color: var(--bs-primary);
    background-color: rgba(13, 110, 253, 0.08);
}

.nav-link.active {
    color: var(--bs-primary);
    background-color: rgba(13, 110, 253, 0.08);
}

.login-btn {
    color: var(--bs-primary) !important;
    border: 1px solid var(--bs-primary);
}

.login-btn:hover {
    background-color: var(--bs-primary);
    color: white !important;
}

/* Avatar Circle */
.avatar-circle {
    width: 30px;
    height: 30px;
    background-color: var(--bs-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Enhanced Alerts */
.enhanced-alert {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow-sm);
}

.alert-icon {
    font-size: 1.25rem;
    margin-right: 0.75rem;
}

.alert-message {
    flex: 1;
}

/* Footer */
.footer {
    background-color: var(--bs-light);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1.5rem 0;
    margin-top: auto;
}

/* Query Interface */
.query-container {
    max-width: 100%;
    margin: 0 auto;
}

.query-form .card {
    border-radius: var(--border-radius-lg);
    transition: var(--transition-standard);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.query-form .card:hover {
    box-shadow: var(--shadow-md);
}

.query-form .form-control {
    border-radius: var(--border-radius);
    transition: var(--transition-standard);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.query-form .form-control:focus {
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.2);
    border-color: rgba(var(--bs-primary-rgb), 0.5);
}

.query-form .btn-primary {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    border-radius: var(--border-radius);
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    transition: var(--transition-standard);
}

.query-form .btn-primary:hover {
    background-color: var(--bs-primary-hover);
    border-color: var(--bs-primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* Response Styling */
.response-container {
    animation: fadeIn 0.5s ease;
}

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

.llm-response {
    padding: 1.5rem;
    border-radius: var(--border-radius);
    background-color: var(--bs-primary-light);
    border-left: 4px solid var(--bs-primary);
}

/* Enhanced Markdown Rendering */
.llm-response h1, 
.llm-response h2, 
.llm-response h3, 
.llm-response h4, 
.llm-response h5, 
.llm-response h6 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    color: #212529;
}

.llm-response h1 { font-size: 2rem; }
.llm-response h2 { font-size: 1.75rem; }
.llm-response h3 { font-size: 1.5rem; }
.llm-response h4 { font-size: 1.25rem; }
.llm-response h5 { font-size: 1.1rem; }
.llm-response h6 { font-size: 1rem; }

.llm-response p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.llm-response ul, 
.llm-response ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.llm-response li {
    margin-bottom: 0.5rem;
}

.llm-response code {
    background-color: #f0f0f0;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: monospace;
    font-size: 0.9em;
}

.llm-response pre {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 0.25rem;
    margin-bottom: 1rem;
    overflow-x: auto;
}

.llm-response pre code {
    background-color: transparent;
    padding: 0;
    font-size: 0.9em;
    color: #333;
}

.llm-response table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}

.llm-response table th,
.llm-response table td {
    padding: 0.5rem;
    border: 1px solid #dee2e6;
    text-align: left;
}

.llm-response table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.llm-response table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.llm-response blockquote {
    padding: 0.5rem 1rem;
    margin: 0 0 1rem;
    border-left: 0.25rem solid #dee2e6;
    color: #6c757d;
}

/* Mind Map Container */
#mindmap-container {
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition-standard);
}

#mindmap-frame-container {
    width: 100%;
    height: 100%;
}

/* Document Preview Modal */
.preview-iframe {
    width: 100%;
    height: 100%;
    min-height: 500px;
    border: none;
}

/* Document preview pane styling */
.preview-pane {
    position: relative;
    height: 100vh;
    margin-bottom: 2rem;
}

.card-header-custom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
    padding: 1rem;
    background-color: var(--bs-light);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.card-title {
    font-weight: 600;
    margin-bottom: 0;
}

/* Loading Spinner */
.loading-spinner {
    display: none;
    margin: 1rem auto;
    text-align: center;
    transition: var(--transition-standard);
}

/* Admin panels */
.admin-panel {
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
    background-color: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.collection-card {
    margin-bottom: 1rem;
    transition: var(--transition-standard);
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.collection-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.document-item {
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: var(--border-radius);
    background-color: var(--bs-light);
    transition: var(--transition-standard);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.document-item:hover {
    background-color: #f1f3f5;
}

/* Accessibility */
.btn:focus, 
.form-control:focus, 
a:focus {
    outline: 2px solid rgba(var(--bs-primary-rgb), 0.5);
    outline-offset: 2px;
}

/* Responsive Adjustments */
@media (max-width: 991.98px) {
    .query-container {
        max-width: 100%;
    }
    
    #mindmap-container {
        margin-top: 2rem;
    }
    
    .query-form .btn-primary {
        width: 100%;
    }
    
    .container-fluid.px-4 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}

@media (max-width: 767.98px) {
    .navbar-nav {
        padding: 0.5rem 0;
    }
    
    .nav-link {
        padding: 0.5rem 0;
    }
    
    .enhanced-alert {
        flex-direction: column;
        text-align: center;
    }
    
    .alert-icon {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
}

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

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

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

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.slide-in {
    animation: slideIn 0.5s ease forwards;
}

/* Upload Progress Styles */
.spin {
    display: inline-block;
    animation: spin 1.5s linear infinite;
}

.progress-step {
    transition: all 0.4s ease;
}

.progress-step.active {
    opacity: 1;
}

.progress-step.completed .step-icon {
    color: var(--bs-success) !important;
}

.progress-step.completed .progress-bar {
    background-color: var(--bs-success) !important;
}

.progress-step.active .step-icon {
    color: var(--bs-primary) !important;
}

.progress-step.active .progress-bar {
    background-color: var(--bs-primary) !important;
}

/* Transition Effects */
.btn, 
.form-control, 
.card, 
.nav-link,
.modal-content {
    transition: var(--transition-standard);
}