/* Julien RAG Manager - Custom Styles */

/* Root variables for theming */
:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --info-color: #0dcaf0;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --secondary-color: #6c757d;
    --light-bg: #f8f9fa;
    --dark-bg: #212529;
}

/* Body and layout */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--light-bg);
}

main {
    flex: 1;
}

/* Footer */
.footer {
    margin-top: auto;
    border-top: 1px solid #dee2e6;
}

/* Navigation */
.navbar-brand {
    font-weight: bold;
    font-size: 1.25rem;
}

.nav-link {
    transition: all 0.3s ease;
}

.nav-link:hover {
    transform: translateY(-2px);
}

.nav-link.active {
    font-weight: bold;
}

/* Cards */
.card {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
    border: none;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.card-header {
    font-weight: bold;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table thead th {
    border-top: none;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

/* Buttons */
.btn {
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Status badges */
.badge {
    padding: 0.35em 0.65em;
    font-weight: 600;
}

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

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background-color: #fff;
    max-height: calc(100vh - 350px);
}

.chat-message {
    margin-bottom: 1rem;
    display: flex;
    gap: 0.75rem;
}

.chat-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
}

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

.chat-message.assistant .message-avatar {
    background-color: var(--success-color);
}

.chat-message.assistant.error .message-avatar {
    background-color: var(--danger-color);
}

.message-body {
    max-width: 85%;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 1rem;
    padding: 0.75rem 1rem;
    position: relative;
}

.chat-message.user .message-body {
    background: rgba(13, 110, 253, 0.08);
    border-color: rgba(13, 110, 253, 0.2);
}

.chat-message.assistant.error .message-body {
    background: rgba(220, 53, 69, 0.1);
    border-color: rgba(220, 53, 69, 0.3);
}

.message-header {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.message-actions {
    display: flex;
    gap: 0.25rem;
}

.message-actions button {
    border: none;
    background: transparent;
    color: var(--secondary-color);
    padding: 0.1rem 0.25rem;
    border-radius: 0.25rem;
}

.message-actions button:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--dark-bg);
}

.message-text {
    font-size: 0.95rem;
    line-height: 1.55;
    word-wrap: break-word;
}

.message-text pre {
    background: #1e1e1e;
    color: #f8f9fa;
    padding: 0.75rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    font-size: 0.85rem;
}

.message-text code {
    background: rgba(9, 30, 66, 0.08);
    padding: 0.1rem 0.25rem;
    border-radius: 0.25rem;
    font-size: 0.85rem;
}

.message-text pre code {
    background: transparent;
    padding: 0;
}

/* Citations panel */
#citationsPanel {
    background-color: #fff;
}

#citationsPanel .card {
    border: 1px solid #dee2e6;
}

/* Filter rows */
.filter-row {
    background-color: #f8f9fa;
}

/* Metadata container */
#metadataContainer .row {
    background-color: #f8f9fa;
    border-radius: 0.25rem;
}

/* Progress bars */
.progress {
    height: 1.5rem;
}

.progress-bar {
    font-size: 0.875rem;
}

/* Upload progress */
#uploadProgress {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 0.375rem;
}

/* Empty states */
#emptyState {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Loading spinners */
.spinner-border {
    width: 3rem;
    height: 3rem;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Code blocks */
pre {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 0.375rem;
    border: 1px solid #dee2e6;
    font-size: 0.875rem;
}

code {
    background-color: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
    color: #d63384;
}

/* Modal improvements */
.modal-header {
    border-bottom: 2px solid #dee2e6;
}

.modal-footer {
    border-top: 2px solid #dee2e6;
}

/* Form improvements */
.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #495057;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.form-text {
    font-size: 0.875rem;
    color: #6c757d;
}

/* Toast notifications */
.toast-container {
    z-index: 9999;
}

.toast {
    min-width: 300px;
}

.toast-body {
    font-size: 0.9rem;
}

/* Lucide icons */
.lucide {
    vertical-align: middle;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .chat-container {
        height: auto;
        min-height: 400px;
    }

    .chat-history {
        max-height: 400px;
    }

    .message-content {
        max-width: 90%;
    }

    .card-body {
        padding: 0.75rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    .btn-sm {
        padding: 0.2rem 0.4rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1rem;
    }

    .nav-link {
        font-size: 0.9rem;
    }

    .table {
        font-size: 0.875rem;
    }

    .card-header h5,
    .card-header h6 {
        font-size: 0.95rem;
    }
}

/* Utility classes */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cursor-pointer {
    cursor: pointer;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

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

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

/* Dashboard cards */
.dashboard-card {
    transition: transform 0.2s ease;
}

.dashboard-card:hover {
    transform: translateY(-5px);
}

/* Collapsible sections */
.collapse {
    transition: height 0.3s ease;
}

/* File input styling */
.form-control[type="file"] {
    padding: 0.375rem 0.75rem;
}

.form-control[type="file"]::file-selector-button {
    padding: 0.375rem 0.75rem;
    margin-right: 0.75rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
}

.form-control[type="file"]::file-selector-button:hover {
    background-color: #0b5ed7;
}

/* Dark mode support (optional, for future enhancement) */
@media (prefers-color-scheme: dark) {
    /* Can add dark mode styles here if desired */
}

/* Print styles */
@media print {
    .navbar,
    .footer,
    .btn,
    .modal {
        display: none !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}
