﻿/* Professional color scheme */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --background-light: #f8f9fa;
    --border-color: #dee2e6;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
}

/* Loading state styling */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: var(--text-secondary);
}

    .loading-container h5 {
        color: var(--text-primary);
        margin-bottom: 2rem;
        font-weight: 300;
        font-size: 1.25rem;
    }

/* Main container styling */
.forensics-container {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 2rem;
    margin: 1rem 0;
}

/* Header styling */
.forensics-header {
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

    .forensics-header h3 {
        color: var(--primary-color);
        font-weight: 600;
        margin-bottom: 1rem;
    }

/* Search box styling */
.search-section {
    background-color: var(--background-light);
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 600px;
}

    .search-box label {
        color: var(--text-primary);
        font-weight: 500;
        white-space: nowrap;
    }

    .search-box input[type="search"] {
        flex: 1;
        padding: 0.5rem 1rem;
        border: 1px solid var(--border-color);
        border-radius: 4px;
        font-size: 1rem;
        transition: all 0.3s ease;
    }

        .search-box input[type="search"]:focus {
            outline: none;
            border-color: var(--secondary-color);
            box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
        }

    .search-box button {
        background-color: var(--secondary-color);
        color: white;
        border: none;
        padding: 0.5rem 1.5rem;
        border-radius: 4px;
        font-weight: 500;
        transition: all 0.3s ease;
        cursor: pointer;
    }

        .search-box button:hover {
            background-color: #2980b9;
            transform: translateY(-1px);
            box-shadow: 0 2px 4px rgba(0,0,0,0.2);
        }

/* Grid section styling */
.grid-section {
    margin-bottom: 2rem;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.grid-header {
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 1rem;
    font-weight: 500;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* QuickGrid customization */
.professional-grid {
    border: none !important;
    font-size: 0.9rem;
}

    .professional-grid thead {
        background-color: #f1f3f5;
        border-bottom: 2px solid var(--border-color);
    }

        .professional-grid thead th {
            color: var(--text-primary);
            font-weight: 600;
            padding: 0.75rem;
            text-transform: uppercase;
            font-size: 0.85rem;
            letter-spacing: 0.5px;
            border: none;
        }

    .professional-grid tbody tr {
        border-bottom: 1px solid #e9ecef;
        transition: background-color 0.2s ease;
    }

        .professional-grid tbody tr:hover {
            background-color: #f8f9fa;
        }

    .professional-grid tbody td {
        padding: 0.75rem;
        vertical-align: middle;
        color: var(--text-primary);
        border: none;
    }

    /* Alternating row colors */
    .professional-grid tbody tr:nth-child(even) {
        background-color: #fafbfc;
    }

/* Tech Hours table styling */
.tech-hours-table {
    width: 100%;
    border-collapse: collapse;
}

    .tech-hours-table thead {
        background-color: #f1f3f5;
    }

    .tech-hours-table th {
        padding: 0.75rem;
        text-align: left;
        color: var(--text-primary);
        font-weight: 600;
        font-size: 0.85rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        border-bottom: 2px solid var(--border-color);
    }

    .tech-hours-table td {
        padding: 0.75rem;
        border-bottom: 1px solid #e9ecef;
        color: var(--text-primary);
    }

    .tech-hours-table tr:hover {
        background-color: #f8f9fa;
    }

    .tech-hours-table .totals-row {
        background-color: #e3f2fd;
        font-weight: 600;
        border-top: 2px solid var(--secondary-color);
    }

/* Accordion styling */
.notes-accordion {
    margin: 1.5rem 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

/* Pagination styling */
.pagination-container {
    padding: 1rem;
    background-color: #f8f9fa;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

    .empty-state p {
        font-size: 1.1rem;
        margin-bottom: 0;
    }

/* Error message styling */
.error-container {
    margin-bottom: 1.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .search-box {
        flex-direction: column;
        align-items: stretch;
    }

    .forensics-container {
        padding: 1rem;
    }

    .professional-grid {
        font-size: 0.85rem;
    }

        .professional-grid thead th,
        .professional-grid tbody td {
            padding: 0.5rem;
        }
}
/* ============================================ */
/* PRINT STYLES - Fixed for multi-page support */
/* ============================================ */
@media print {
    /* Set page to landscape and adjust margins */
    @page {
        size: landscape;
        margin: 0.5in;
    }

    /* Hide non-essential elements */
    .search-section,
    .search-box,
    .pagination-container,
    .loading-container,
    button,
    input[type="search"],
    .bi-search,
    .spinner-border {
        display: none !important;
    }

    /* Remove height and overflow restrictions */
    body,
    html,
    .forensics-container,
    .grid-section,
    .professional-grid,
    .tech-hours-table,
    table,
    tbody,
    thead,
    tr,
    td,
    th,
    div {
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;
    }

    /* Ensure main container spans full width */
    .forensics-container {
        width: 100% !important;
        max-width: none !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        background: white !important;
    }

    /* Header adjustments */
    .forensics-header {
        padding: 0 0 10px 0 !important;
        margin-bottom: 15px !important;
        border-bottom: 2px solid #000 !important;
        page-break-after: avoid !important;
    }

        .forensics-header h3 {
            font-size: 18pt !important;
            margin: 0 !important;
            color: #000 !important;
        }

    /* FIXED: Grid section adjustments - allow page breaks */
    .grid-section {
        margin-bottom: 15px !important;
        border: 1px solid #000 !important;
        border-radius: 0 !important;
        /* REMOVED: page-break-inside: avoid !important; */
        page-break-inside: auto !important;
        background: white !important;
        display: block !important;
    }

    .grid-header {
        background-color: #f0f0f0 !important;
        color: #000 !important;
        padding: 5px 10px !important;
        font-size: 12pt !important;
        font-weight: bold !important;
        page-break-after: avoid !important;
        print-color-adjust: exact !important;
        -webkit-print-color-adjust: exact !important;
    }

    /* Ensure all grids and tables are visible */
    quickgrid,
    .quickgrid,
    .professional-grid,
    .tech-hours-table {
        display: table !important;
        width: 100% !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* FIXED: Table adjustments for print - allow page breaks */
    .professional-grid,
    .tech-hours-table,
    table {
        width: 100% !important;
        font-size: 8pt !important;
        border-collapse: collapse !important;
        /* CHANGED: Allow tables to break across pages */
        page-break-inside: auto !important;
        table-layout: auto !important;
        margin-bottom: 10px !important;
    }

        /* Table header styling - repeat on each page */
        .professional-grid thead,
        .tech-hours-table thead {
            display: table-header-group !important;
            background-color: #e0e0e0 !important;
            print-color-adjust: exact !important;
            -webkit-print-color-adjust: exact !important;
        }

            .professional-grid thead th,
            .tech-hours-table th {
                border: 1px solid #000 !important;
                padding: 3px 5px !important;
                font-size: 8pt !important;
                font-weight: bold !important;
                text-align: left !important;
                /* CHANGED: Allow headers to break if absolutely necessary */
                page-break-inside: auto !important;
                page-break-after: avoid !important;
                color: #000 !important;
                background-color: #e0e0e0 !important;
            }

        /* Table body styling */
        .professional-grid tbody,
        .tech-hours-table tbody {
            display: table-row-group !important;
        }

            /* FIXED: Row break settings - allow breaks between rows */
            .professional-grid tbody tr,
            .tech-hours-table tbody tr {
                page-break-inside: avoid !important;
                page-break-after: auto !important;
                page-break-before: auto !important;
                display: table-row !important;
                visibility: visible !important;
            }

            .professional-grid tbody td,
            .tech-hours-table td {
                border: 1px solid #ccc !important;
                padding: 3px 6px !important;
                font-size: 8pt !important;
                vertical-align: top !important;
                color: #000 !important;
                background: transparent !important;
                /* ADDED: Allow cell content to break if needed */
                page-break-inside: auto !important;
            }

            /* Maintain alternating row colors for readability */
            .professional-grid tbody tr:nth-child(even) {
                background-color: #f5f5f5 !important;
                print-color-adjust: exact !important;
                -webkit-print-color-adjust: exact !important;
            }

        /* Tech hours totals row */
        .tech-hours-table .totals-row {
            background-color: #e0e0e0 !important;
            font-weight: bold !important;
            border-top: 2px solid #000 !important;
            print-color-adjust: exact !important;
            -webkit-print-color-adjust: exact !important;
            /* ADDED: Keep totals with at least one data row */
            page-break-before: avoid !important;
        }

    /* FIXED: Accordion/Notes section - allow page breaks */
    .notes-accordion {
        margin: 10px 0 !important;
        border: 1px solid #000 !important;
        /* CHANGED: Allow notes to break across pages */
        page-break-inside: auto !important;
    }

        .notes-accordion pre {
            white-space: pre-wrap !important;
            word-wrap: break-word !important;
            font-size: 9pt !important;
            padding: 10px !important;
            color: #000 !important;
            /* ADDED: Allow long notes to break */
            page-break-inside: auto !important;
        }

    /* Empty state */
    .empty-state {
        padding: 20px !important;
        font-size: 11pt !important;
        page-break-inside: avoid !important;
    }

        .empty-state p {
            color: #000 !important;
        }

    /* FIXED: Ensure tables break properly across pages */
    table {
        page-break-before: auto !important;
        page-break-after: auto !important;
        page-break-inside: auto !important;
    }

    /* FIXED: Row break behavior - keep rows together but allow table breaks */
    tr {
        page-break-inside: avoid !important;
        page-break-after: auto !important;
        page-break-before: auto !important;
    }

    /* FIXED: Cell break behavior */
    td, th {
        page-break-inside: auto !important;
    }

    /* Text adjustments for better readability */
    .text-end {
        text-align: right !important;
    }

    /* Links should be underlined */
    a {
        text-decoration: underline !important;
        color: #000 !important;
    }

    /* Ensure all text is black */
    * {
        color: #000 !important;
        text-shadow: none !important;
        box-shadow: none !important;
    }

    /* Background colors only where needed */
    .grid-header,
    .professional-grid thead th,
    .tech-hours-table thead th {
        background-color: #e0e0e0 !important;
    }

    .professional-grid tbody tr:nth-child(even),
    .tech-hours-table tbody tr:nth-child(even) {
        background-color: #f5f5f5 !important;
    }

    /* Force visibility of all content */
    .grid-section,
    .professional-grid tbody,
    .tech-hours-table tbody,
    .professional-grid tbody tr,
    .tech-hours-table tbody tr,
    .professional-grid tbody td,
    .tech-hours-table tbody td {
        display: table !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: static !important;
        float: none !important;
        transform: none !important;
    }

    /* Override any height restrictions that might hide content */
    .professional-grid tbody,
    .tech-hours-table tbody,
    quickgrid tbody {
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
    }

    /* ADDED: Improved QuickGrid support for page breaks */
    .quickgrid,
    quickgrid {
        page-break-inside: auto !important;
        display: table !important;
    }

        /* Ensure QuickGrid content displays properly */
        .quickgrid tbody,
        .quickgrid tbody tr,
        .quickgrid tbody td,
        quickgrid tbody,
        quickgrid tbody tr,
        quickgrid tbody td {
            display: table-row-group !important;
            visibility: visible !important;
            height: auto !important;
            max-height: none !important;
            overflow: visible !important;
        }

            .quickgrid tbody tr,
            quickgrid tbody tr {
                display: table-row !important;
                page-break-inside: avoid !important;
                page-break-after: auto !important;
            }

            .quickgrid tbody td,
            quickgrid tbody td {
                display: table-cell !important;
                page-break-inside: auto !important;
            }

            /* ADDED: Force override any inline styles that might hide content */
            tbody tr[style*="display: none"],
            tbody tr[style*="visibility: hidden"],
            .quickgrid tbody tr[style*="display: none"],
            quickgrid tbody tr[style*="display: none"] {
                display: table-row !important;
                visibility: visible !important;
            }

    /* ADDED: Ensure pagination doesn't interfere with print */
    .quickgrid-pagination,
    .pagination,
    [class*="pagination"] {
        display: none !important;
    }

    /* Bootstrap icon adjustments */
    i[class^="bi-"],
    i[class*=" bi-"] {
        color: #000 !important;
    }

    /* ADDED: Special handling for very long tables */
    .professional-grid tbody tr:nth-child(20n) {
        page-break-after: auto !important;
    }

    /* ADDED: Ensure proper spacing between sections when they break */
    .grid-section + .grid-section {
        margin-top: 20px !important;
    }
}