/* ===============================================
   Accounting Document Extractor - Custom Styles
   =============================================== */

/* Root Variables */
:root {
    --primary-color: #2563eb;
    --primary-light: rgba(37, 99, 235, 0.1);
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 60px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: #f1f5f9;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* Layout Wrapper */
.wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    height: var(--header-height);
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    color: white;
}

.sidebar-brand i {
    color: #60a5fa;
    font-size: 1.5rem;
}

.sidebar-nav {
    padding: 1rem 0;
    flex-grow: 1;
    margin: 0;
}

.sidebar-item {
    margin: 2px 8px;
}

.sidebar-link {
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    border-radius: 8px;
    text-decoration: none;
}

.sidebar-link:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-item.active .sidebar-link {
    color: white;
    background-color: var(--primary-color);
}

.sidebar-link i {
    width: 20px;
    margin-right: 0.75rem;
    text-align: center;
}

.sidebar-link .badge {
    margin-left: auto;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 1rem 1.25rem;
}

/* Submenu */
.sidebar-submenu {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.sidebar-submenu li a {
    display: block;
    padding: 0.5rem 1rem 0.5rem 3rem;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.2s;
    border-radius: 6px;
    margin: 2px 8px;
}

.sidebar-submenu li a:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.05);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

/* Main Content */
.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* Sidebar Collapsed State */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-brand span,
.sidebar.collapsed .sidebar-link span,
.sidebar.collapsed .sidebar-link .badge,
.sidebar.collapsed .sidebar-link .fa-chevron-down,
.sidebar.collapsed .sidebar-submenu,
.sidebar.collapsed .sidebar-footer .flex-grow-1 {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 0;
}

.sidebar.collapsed .sidebar-link {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar.collapsed .sidebar-link i {
    margin-right: 0;
    font-size: 1.2rem;
}

.sidebar.collapsed .sidebar-footer {
    justify-content: center;
    padding: 1rem 0.5rem;
}

.sidebar.collapsed .sidebar-footer .avatar {
    margin-right: 0 !important;
}

.sidebar.collapsed + .main {
    margin-left: var(--sidebar-collapsed-width);
}

/* Sidebar Toggle Icon Rotation */
.sidebar-toggle i {
    transition: transform 0.3s ease;
}

.sidebar.collapsed ~ .main .sidebar-toggle i {
    transform: rotate(180deg);
}

/* Top Navbar */
.navbar {
    height: var(--header-height);
    padding: 0 1.5rem;
}

.sidebar-toggle {
    color: var(--secondary-color);
    padding: 0.5rem;
}

.sidebar-toggle:hover {
    color: var(--primary-color);
}

.input-group-search {
    width: 300px;
}

.input-group-search .form-control {
    border-radius: 20px;
    border: 1px solid #e5e7eb;
    background-color: #f8fafc;
}

.input-group-search .form-control:focus {
    background-color: white;
    border-color: var(--primary-color);
    box-shadow: none;
}

.input-group-search .input-group-text {
    border-radius: 20px 0 0 20px;
    border: 1px solid #e5e7eb;
    border-right: none;
}

/* Content Area */
.content {
    flex: 1;
    padding: 1.5rem;
}

/* Footer */
.footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: white;
}

/* Cards */
.card {
    border-radius: 12px;
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-header {
    background: white;
    border-bottom: 1px solid #f3f4f6;
    padding: 1rem 1.25rem;
}

/* Stat Cards */
.stat-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

/* Confidence Indicators */
.confidence-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
}

.confidence-circle.high,
.confidence-high {
    background: linear-gradient(135deg, #10b981, #059669);
}

.confidence-circle.medium,
.confidence-medium {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.confidence-circle.low,
.confidence-low {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.confidence-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.confidence-badge.high {
    background-color: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.confidence-badge.medium {
    background-color: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.confidence-badge.low {
    background-color: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

/* Status Badges */
.badge {
    font-weight: 500;
    padding: 0.4em 0.6em;
}

/* Tables */
.table > :not(caption) > * > * {
    padding: 1rem 0.75rem;
}

.table-hover tbody tr:hover {
    background-color: rgba(37, 99, 235, 0.05);
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
}

/* Form Controls */
.form-control, .form-select {
    border-radius: 8px;
    padding: 0.625rem 1rem;
    border-color: #e5e7eb;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Upload Dropzone */
.upload-dropzone {
    border: 2px dashed #d1d5db;
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background-color: #fafbfc;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.05);
}

.upload-dropzone.has-file {
    border-style: solid;
    border-color: var(--success-color);
    background-color: rgba(16, 185, 129, 0.05);
}

.upload-dropzone i {
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.upload-dropzone:hover i {
    opacity: 1;
}

/* PDF Viewer */
.pdf-viewer {
    background-color: #1e293b;
    border-radius: 8px;
    overflow: auto;
    position: relative;
}

.pdf-viewer img {
    display: block;
    margin: 0 auto;
}

/* Page Thumbnails */
.page-thumbnail {
    width: 60px;
    height: 80px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.page-thumbnail:hover {
    border-color: var(--primary-color);
}

.page-thumbnail.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.page-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.page-thumbnail .page-number {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
}

/* Document Editor */
.document-viewer {
    background-color: #f3f4f6;
    max-height: 70vh;
    overflow: auto;
    padding: 1rem;
    border-radius: 8px;
}

.document-viewer img {
    max-width: 100%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

/* Field Confidence */
.field-confidence {
    display: inline-flex;
    align-items: center;
    margin-left: 0.5rem;
}

.field-confidence-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.25rem;
}

/* Notifications */
.notification-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s ease;
}

.notification-item:hover {
    background-color: #f9fafb;
}

.notification-item.unread {
    background-color: rgba(37, 99, 235, 0.05);
}

.notification-dot {
    width: 8px;
    height: 8px;
    background-color: var(--primary-color);
    border-radius: 50%;
}

/* Progress Bars */
.progress {
    border-radius: 10px;
    background-color: #e5e7eb;
}

.progress-bar {
    border-radius: 10px;
}

/* Alerts */
.alert {
    border: none;
    border-radius: 10px;
}

/* Modal Styles */
.modal-content {
    border: none;
    border-radius: 16px;
}

.modal-header {
    border-bottom: 1px solid #f3f4f6;
}

.modal-footer {
    border-top: 1px solid #f3f4f6;
}

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #f3f4f6;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty States */
.empty-state {
    padding: 3rem;
    text-align: center;
}

.empty-state i {
    font-size: 4rem;
    color: #d1d5db;
    margin-bottom: 1rem;
}

/* Responsive Adjustments */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 767.98px) {
    .content-wrapper {
        padding: 1rem;
    }

    .card {
        margin-bottom: 1rem;
    }

    .stat-card {
        margin-bottom: 0.5rem;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .top-navbar,
    .btn,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}

/* Toastr Customization */
.toast-success {
    background-color: var(--success-color) !important;
}

.toast-error {
    background-color: var(--danger-color) !important;
}

.toast-warning {
    background-color: var(--warning-color) !important;
}

.toast-info {
    background-color: var(--info-color) !important;
}

/* DataTables Customization */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    padding: 0.5rem 0.75rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 6px !important;
    margin: 0 2px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: white !important;
}

/* SweetAlert2 Customization */
.swal2-popup {
    border-radius: 16px !important;
}

.swal2-confirm {
    border-radius: 8px !important;
}

.swal2-cancel {
    border-radius: 8px !important;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

