/* ProjectPal Main CSS */

/* Custom colors */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
}

/* General styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

/* Card styling */
.card {
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

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

.card-header {
    background-color: rgba(0, 123, 255, 0.1);
    border-bottom: 1px solid rgba(0, 123, 255, 0.2);
}

/* Button styling */
.btn {
    border-radius: 4px;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #0069d9;
    border-color: #0062cc;
}

.btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

.btn-danger {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

/* Form styling */
.form-control {
    border-radius: 4px;
    border: 1px solid #ced4da;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Table styling */
.table {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
}

.table thead th {
    background-color: rgba(0, 123, 255, 0.1);
    border-bottom: 2px solid rgba(0, 123, 255, 0.2);
}

/* Alert container */
#alert-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    min-width: 300px;
    max-width: 80%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Animation for all alert messages */
.alert {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    animation: floatAndDisappear 10s forwards;
    margin: 0;
}

@keyframes floatAndDisappear {
    0% {
        opacity: 0;
        transform: translateY(0);
    }
    5% {
        opacity: 1;
        transform: translateY(0);
    }
    90% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-50px);
    }
}

/* Notification styling */
.notification {
    position: relative;
    padding-right: 35px;
}

.notification.fade-out {
    animation: fadeOut 0.5s forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Login page */
.login-card {
    max-width: 400px;
    margin: 100px auto;
}

/* Dashboard */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .dashboard-header h1 {
        margin-bottom: 15px;
    }
}

/* File upload styling */
.file-drop-zone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    transition: all 0.3s ease;
    height: 100%;
    padding: 2px;
}

.file-drop-zone.dragover {
    background-color: rgba(0, 123, 255, 0.15) !important;
    box-shadow: inset 0 0 0 2px var(--primary-color);
    border-color: var(--primary-color);
    border-style: dashed;
    border-radius: 8px;
}

.file-list-container {
    height: calc(100vh - 320px);
    max-height: calc(100% - 80px);
    overflow-y: auto;
    padding: 0 2px;
    scrollbar-width: thin; /* For Firefox */
    scrollbar-color: rgba(0, 123, 255, 0.5) transparent; /* For Firefox */
}

/* Scrollbar styling for WebKit browsers */
.file-list-container::-webkit-scrollbar,
#chat-history-list::-webkit-scrollbar,
.chat-window::-webkit-scrollbar {
    width: 6px;
}

.file-list-container::-webkit-scrollbar-track,
#chat-history-list::-webkit-scrollbar-track,
.chat-window::-webkit-scrollbar-track {
    background: transparent;
}

.file-list-container::-webkit-scrollbar-thumb,
#chat-history-list::-webkit-scrollbar-thumb,
.chat-window::-webkit-scrollbar-thumb {
    background-color: rgba(0, 123, 255, 0.5);
    border-radius: 6px;
}

.file-list-container::-webkit-scrollbar-thumb:hover,
#chat-history-list::-webkit-scrollbar-thumb:hover,
.chat-window::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 123, 255, 0.7);
}

/* Chat window styling */
.chat-window {
    scrollbar-width: thin; /* For Firefox */
    scrollbar-color: rgba(0, 123, 255, 0.5) transparent; /* For Firefox */
    height: calc(100vh - 240px) !important;
    max-height: calc(100vh - 180px) !important;
}

/* Chat card styling */
.col-md-6 .card {
    max-height: calc(100vh - 180px);
}

/* File list styling */
#file-list .list-group-item {
    transition: background-color 0.2s ease;
    margin: 4px;
    width: calc(100% - 8px);
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#file-list .list-group-item:hover {
    background-color: rgba(0, 123, 255, 0.08);
    transform: translateY(-1px);
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.15);
}

#file-list .list-group-item.active {
    background-color: rgba(0, 123, 255, 0.15);
    border-color: rgba(0, 123, 255, 0.5);
}


/* Upload progress styling */
.upload-progress {
    height: 5px;
    margin-top: 5px;
    border-radius: 3px;
    overflow: hidden;
}

.upload-progress .progress-bar {
    transition: width 0.3s ease;
}

/* Ensure the file list takes up all available space */
#fileListCol .card {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: calc(100vh - 180px);
}

#fileListContent {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#fileListContent .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
}

/* Chat history container styling */
#chatHistoryCol .card {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: calc(100vh - 180px);
}

#chatHistoryContent {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#chatHistoryContent .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
}

/* Chat history styling to match file list */
#chat-history-list {
    max-height: calc(100vh - 240px);
    height: calc(100vh - 240px);
    overflow-y: auto;
}

#chat-history-list .list-group-item {
    transition: background-color 0.2s ease;
    margin: 4px;
    width: calc(100% - 8px);
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#chat-history-list .list-group-item:hover {
    background-color: rgba(0, 123, 255, 0.08);
    transform: translateY(-1px);
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.15);
}

/* Fix for selected chat styling */
#chat-history-list .list-group-item.active {
    background-color: #007bff;
    border-color: #007bff;
    color: #ffffff; /* White text on blue background */
}

#chat-history-list .list-group-item.active h6 {
    color: #ffffff; /* White title text */
    font-weight: 600;
}

#chat-history-list .list-group-item.active small {
    color: rgba(255, 255, 255, 0.8) !important; /* Slightly dimmed white for date */
}

/* Native tooltip styling */
[title] {
    cursor: help;
    border-bottom: 1px dotted #ccc;
    position: relative;
}

/* Citation styling for RAG */
.citation {
    background-color: rgba(23, 162, 184, 0.1);
    color: #17a2b8;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9em;
    cursor: pointer;
    border-bottom: 1px dotted #17a2b8;
    margin: 0 2px;
    display: inline-block;
}

.citation:hover {
    background-color: rgba(23, 162, 184, 0.2);
    text-decoration: none;
}

/* Tooltip for citations */
.tooltip-inner {
    max-width: 300px;
    padding: 8px 12px;
    background-color: #343a40;
    font-size: 0.9em;
    text-align: left;
}