/* DocVerify Custom Styles */

/* Root Variables */
: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;
    
    --border-radius: 0.375rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Global Styles */
body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* Layout Styles */
.body-with-sidebar {
    margin-left: 250px;
    transition: margin-left 0.3s ease;
}

.body-collapsed {
    margin-left: 0;
}

/* Sidebar Styles */
.sidebar-wrapper {
    position: relative;
}

.sidebar {
    position: fixed;
    top: 0;
    left: -250px;
    width: 250px;
    height: 100vh;
    background-color: #343a40;
    transition: left 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.sidebar.show {
    left: 0;
}

.sidebar-content {
    padding: 1rem 0;
    padding-top: 70px; /* Account for top bar height */
}

.sidebar .nav {
    padding: 0;
}

.sidebar .nav-item {
    margin: 0;
}

.sidebar .nav-link {
    color: #adb5bd;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.sidebar .nav-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.sidebar .nav-link.active {
    color: #ffffff;
    background-color: var(--primary-color);
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
}

.nav-section-header {
    color: #6c757d;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 1rem 1.5rem 0.5rem 1.5rem;
    margin-top: 1rem;
    display: block;
}

.nav-section-header:first-child {
    margin-top: 0;
}

/* Collapsible Menu Styles */
.sidebar .nav-link[data-bs-toggle="collapse"] {
    position: relative;
}

.sidebar .nav-link[data-bs-toggle="collapse"] .fa-chevron-down {
    transition: transform 0.3s ease;
    font-size: 0.75rem;
}

.sidebar .nav-link[data-bs-toggle="collapse"]:not(.collapsed) .fa-chevron-down {
    transform: rotate(180deg);
}

.sidebar .collapse .nav-link {
    font-size: 0.9rem;
    padding-left: 2.5rem;
    padding-right: 1rem;
    color: #adb5bd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar .collapse .nav-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.05);
}

/* Prevent sidebar from closing when clicking submenu items */
.sidebar .collapse .nav-link {
    pointer-events: auto;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 999;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Top bar adjustments */
.top-bar {
    position: relative;
    z-index: 1001;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Main content adjustments */
.main-content {
    transition: margin-left 0.3s ease;
    margin-left: 0;
    min-height: calc(100vh - 56px); /* Account for top bar */
}

.main-content.with-sidebar {
    margin-left: 250px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .sidebar {
        width: 280px;
        left: -280px;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .body-with-sidebar {
        margin-left: 0 !important;
    }
}

/* Sidebar button styling */
#sidebarToggle {
    border: none;
    background: none;
    font-size: 1.1rem;
    padding: 0.5rem;
    line-height: 1;
}

#sidebarToggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
}

#sidebarToggle:focus {
    box-shadow: none;
    outline: none;
}

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

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

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

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

/* Login Page Styles */
.login-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.login-card {
    border: none;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.profile-photo-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-color: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

/* Card Enhancements */
.card {
    border: none;
    box-shadow: var(--box-shadow);
    border-radius: var(--border-radius);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: var(--box-shadow-lg);
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    background-color: rgba(0, 0, 0, 0.03);
}

/* Status Indicators */
.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* Document Cards */
.document-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.document-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.file-icon {
    font-size: 1.2rem;
}

/* Case Cards */
.case-item {
    transition: transform 0.2s ease-in-out;
}

.case-item:hover {
    transform: translateY(-1px);
}

.case-assignment-card {
    border-left: 4px solid var(--primary-color);
}

/* Upload Area */
.upload-area {
    border: 2px dashed #dee2e6;
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    transition: border-color 0.2s ease-in-out, background-color 0.2s ease-in-out;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background-color: rgba(0, 123, 255, 0.05);
}

.upload-area.highlight {
    border-color: var(--success-color);
    background-color: rgba(40, 167, 69, 0.1);
}

.upload-area input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.upload-text {
    pointer-events: none;
    color: #6c757d;
}

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

.nav-link {
    font-weight: 500;
    transition: color 0.15s ease-in-out;
}

.navbar-nav .nav-link:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* Notification Dropdown */
.notification-dropdown {
    min-width: 350px;
    max-height: 400px;
    overflow-y: auto;
}

.notification-count {
    font-size: 0.75rem;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Button Enhancements */
.btn {
    font-weight: 500;
    border-radius: var(--border-radius);
    transition: all 0.15s ease-in-out;
}

.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: var(--border-radius);
    border-bottom-left-radius: var(--border-radius);
}

.btn-group .btn:last-child {
    border-top-right-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}

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

.table th {
    border-top: none;
    font-weight: 600;
    color: var(--dark-color);
    background-color: var(--light-color);
}

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

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

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

.form-select {
    border-radius: var(--border-radius);
}

/* Badge Enhancements */
.badge {
    font-weight: 500;
    border-radius: 0.35rem;
}

/* Progress Bars */
.progress {
    border-radius: var(--border-radius);
    background-color: rgba(0, 0, 0, 0.1);
}

.progress-bar {
    border-radius: var(--border-radius);
}

/* Timeline Styles */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e9ecef;
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-marker {
    position: absolute;
    left: -23px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px #e9ecef;
}

.timeline-content {
    background: #fff;
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.timeline-title {
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.timeline-text {
    margin-bottom: 0.5rem;
}

/* Chat Styles */
.chat-container {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: var(--border-radius);
}

.chat-message {
    margin-bottom: 1rem;
}

.assistant-message {
    background: rgba(0, 123, 255, 0.05);
    padding: 1rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.user-message {
    background: rgba(40, 167, 69, 0.05);
    padding: 1rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--success-color);
}

.message-content {
    flex: 1;
}

/* Template Cards */
.template-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: pointer;
}

.template-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Tagged Items */
.tagged-item {
    border-left: 4px solid var(--primary-color);
    transition: all 0.2s ease-in-out;
}

.tagged-item[data-tag="important"] {
    border-left-color: var(--danger-color);
}

.tagged-item[data-tag="risk"] {
    border-left-color: var(--warning-color);
}

.tagged-item[data-tag="date"] {
    border-left-color: var(--info-color);
}

.tagged-item[data-tag="financial"] {
    border-left-color: var(--success-color);
}

/* Modal Enhancements */
.modal-content {
    border: none;
    border-radius: 10px;
    box-shadow: var(--box-shadow-lg);
}

.modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 10px 10px 0 0;
}

.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 0 0 10px 10px;
}

/* Alert Enhancements */
.alert {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--box-shadow);
}

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

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

.cursor-pointer {
    cursor: pointer;
}

.transition-all {
    transition: all 0.15s ease-in-out;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    border-radius: var(--border-radius);
}

/* Toast Notifications */
.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--success-color);
    color: white;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
    z-index: 9999;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        border-radius: var(--border-radius);
        margin-bottom: 2px;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .notification-dropdown {
        min-width: 300px;
    }
    
    .timeline {
        padding-left: 20px;
    }
    
    .timeline::before {
        left: 10px;
    }
    
    .timeline-marker {
        left: -18px;
        width: 12px;
        height: 12px;
    }
}

@media (max-width: 576px) {
    .display-6 {
        font-size: 1.75rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .btn-toolbar {
        flex-direction: column;
    }
    
    .btn-toolbar .btn-group {
        margin-bottom: 0.5rem;
        width: 100%;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .btn,
    .btn-group,
    .pagination {
        display: none !important;
    }
    
    .card {
        border: 1px solid #dee2e6 !important;
        box-shadow: none !important;
    }
    
    .table {
        font-size: 0.8rem;
    }
    
    .page-break {
        page-break-after: always;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    :root {
        --bs-body-bg: #1a1a1a;
        --bs-body-color: #e9ecef;
    }
    
    .card {
        background-color: #2d2d2d;
        color: #e9ecef;
    }
    
    .table {
        color: #e9ecef;
    }
    
    .table th {
        background-color: #3d3d3d;
        color: #e9ecef;
    }
    
    .form-control {
        background-color: #3d3d3d;
        border-color: #555;
        color: #e9ecef;
    }
    
    .form-control:focus {
        background-color: #3d3d3d;
        border-color: rgba(0, 123, 255, 0.5);
        color: #e9ecef;
    }
}

/* Animation Utilities */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

.bounce-in {
    animation: bounceIn 0.6s ease-out;
}

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

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

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Focus Indicators for Accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    outline: 2px solid rgba(0, 123, 255, 0.5);
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid #000;
    }
    
    .btn-outline-primary {
        border-width: 2px;
    }
    
    .table th {
        border-bottom: 2px solid #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
