/* Print styles */

@media print {
    body {
        padding: 0;
        background: white;
        margin: 0;
        font-family: Arial, sans-serif;
        color: #000 !important;
    }
    
    .container {
        max-width: 100%;
        box-shadow: none;
        border-radius: 0;
        margin: 0;
        padding: 10px;
    }
    
    /* Hide elements not needed in print */
    .sidebar,
    .tabs,
    .controls,
    .grid-tooltip,
    #sql-tab,
    #payroll-tab,
    #garnishments-tab,
    #employee-tax-rates-tab,
    #employer-tax-rates-tab,
    .btn-clear-top,
    .button-row,
    .nav-section,
    .nav-item {
        display: none !important;
    }
    
    /* Make main content full width when printing */
    .main-content {
        width: 100%;
        max-width: 100%;
    }
    
    /* Only show the active tab content when printing (default behavior) */
    .tab-content {
        display: none !important;
    }
    
    .tab-content.active {
        display: block !important;
        padding: 0;
        page-break-inside: avoid;
        margin: 0;
    }
    
    .tab-content h1 {
        font-size: 32px !important;
        margin: 0 0 6px 0 !important;
        color: #000 !important;
        font-weight: bold !important;
        border-bottom: 2px solid #000 !important;
        padding-bottom: 6px !important;
    }
    
    /* Multi-page printing: show both Step 1 and Step 2 */
    .print-complete-timesheet .tab-content {
        display: none !important;
    }
    
    .print-complete-timesheet #entry-tab,
    .print-complete-timesheet #sql-tab {
        display: block !important;
        padding: 5px;
    }
    
    .print-complete-timesheet #entry-tab {
        page-break-after: always;
    }
    
    .print-complete-timesheet #sql-tab {
        page-break-before: always;
    }
    
    /* Print titles are now handled by updating the h1 elements directly */
    
    /* Totals section */
    .totals-section {
        max-height: none;
        page-break-after: avoid;
        page-break-inside: avoid;
        break-inside: avoid;
        margin-bottom: 2px;
        border: 2px solid #333;
        padding: 3px;
        width: 100%;
    }
    
    .totals-table {
        font-size: 20px !important;
        width: 100%;
    }
    
    .totals-table th {
        background: #ddd !important;
        color: #000 !important;
        border: 1px solid #333 !important;
        font-size: 16px !important;
        padding: 3px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        font-weight: bold !important;
    }
    
    .totals-table td {
        border: 1px solid #333 !important;
        padding: 2px 3px;
        font-size: 16px !important;
        color: #000 !important;
        background: white !important;
    }
    
    .totals-table .weekly-total,
    .totals-table .summary-total {
        background: #eee !important;
        color: #000 !important;
        font-size: 22px !important;
        font-weight: bold !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    /* Grid container */
    .grid-container {
        max-height: none !important;
        overflow: visible !important;
        page-break-before: avoid;
        page-break-inside: auto;
        break-before: avoid;
        height: auto !important;
        position: relative !important;
        width: 100%;
        transform: scale(1.1,1.4);
        transform-origin: top left;
    }
    
    #timesheet-grid {
        font-size: 12px;
        transform: scale(1.1,1.1) !important;
        transform-origin: top left; 
        display: grid !important;
        position: relative !important;
        height: auto;
        width: auto;
        page-break-before: avoid;
        break-before: avoid;
        grid-auto-rows: 20px !important;
        grid-template-columns: 85px repeat(14, 79px) !important;
    }
    
    .grid-header,
    .day-header,
    .column-label,
    .time-label,
    .data-cell {
        border: 1px solid #333 !important;
        padding: 1px 4px !important;
        font-size: 13px !important;
        line-height: 20px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        color: #000 !important;
        min-height: 20px !important;
        height: 20px !important;
    }
    
    .grid-header {
        background: #ddd !important;
        color: #000 !important;
        font-weight: bold !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .day-header {
        background: #f0f0f0 !important;
        color: #000 !important;
        font-weight: bold !important;
        text-align: center !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .column-label {
        background: #e8e8e8 !important;
        color: #000 !important;
        font-weight: bold !important;
        text-align: center !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .time-label {
        background: #f8f8f8 !important;
        color: #000 !important;
        font-weight: bold !important;
        text-align: center !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .data-cell {
        background: white !important;
        color: #000 !important;
    }
    
    .data-cell.filled {
        background: #e3f2fd !important;
        color: #000 !important;
        font-weight: bold !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    /* Print timestamp styling */
    .print-timestamp {
        position: fixed;
        bottom: 15px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 24px;
        color: #000 !important;
        text-align: center;
        width: 100%;
        z-index: 1000;
        background: white;
        padding: 2px 0;
    }
    
    /* Page numbering for multi-page print */
    .print-complete-timesheet #entry-tab::after {
        content: "1 of 2";
        position: fixed;
        bottom: 15px;
        right: 20px;
        font-size: 24px;
        color: #000 !important;
        z-index: 1000;
        background: white;
        padding: 2px 4px;
    }
    
    .print-complete-timesheet #sql-tab::after {
        content: "2 of 2";
        position: fixed;
        bottom: 15px;
        right: 20px;
        font-size: 24px;
        color: #000 !important;
        z-index: 1000;
        background: white;
        padding: 2px 4px;
    }
    
    /* Single page numbering for regular print */
    .tab-content.active::after {
        content: "1 of 1";
        position: fixed;
        bottom: 15px;
        right: 20px;
        font-size: 10px;
        color: #000 !important;
        z-index: 1000;
        background: white;
        padding: 2px 4px;
    }
    
    /* Override single page numbering when printing complete timesheet */
    .print-complete-timesheet .tab-content.active::after {
        content: none;
    }
    
    /* Step 2 content styling for print */
    .print-complete-timesheet .timesheet-tables {
        margin-top: 20px !important;
        margin-bottom: 20px !important;
        page-break-inside: auto;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }
    
    .print-complete-timesheet .timesheet-table-container {
        margin-bottom: 40px !important;
        page-break-inside: avoid;
        page-break-after: auto;
        break-inside: avoid;
    }
    
    .print-complete-timesheet .timesheet-table {
        font-size: 14px !important;
        border-collapse: collapse !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 0 !important;
        margin-top: 0 !important;
        table-layout: fixed !important;
    }
    
    .print-complete-timesheet .timesheet-table th,
    .print-complete-timesheet .timesheet-table td {
        border: 2px solid #333 !important;
        padding: 4px 2px !important;
        text-align: center !important;
        vertical-align: middle !important;
        height: auto !important;
        font-size: 22px !important;
        line-height: 2 !important;
    }
    
    .print-complete-timesheet .timesheet-table th {
        background: #ddd !important;
        font-weight: bold !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .print-complete-timesheet .timesheet-table .row-label {
        text-align: left !important;
        background: #e9ecef !important;
        font-weight: bold !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .print-complete-timesheet .timesheet-table .date-cell {
        background: #2196F3 !important;
        color: white !important;
        font-weight: bold !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .print-complete-timesheet .timesheet-table .blank-cell {
        border: 2px solid #333 !important;
        background: white !important;
    }
    
    .print-complete-timesheet .timesheet-table .empty-time-cell {
        border: 2px solid #333 !important;
    }
    
    .print-complete-timesheet .timesheet-table-header {
        font-size: 28px !important;
        font-weight: bold !important;
        margin-top: 0 !important;
        margin-bottom: 12px !important;
        color: #000 !important;
        page-break-inside: avoid;
        page-break-after: avoid;
    }
    
    /* Hide Step 2 subtitle and buttons during print */
    .print-complete-timesheet #week-ending-subtitle,
    .print-complete-timesheet #back-to-entry,
    .print-complete-timesheet #save-to-db {
        display: none !important;
    }
    
    /* Hide the entire button container div in Step 2 */
    .print-complete-timesheet #sql-tab > div:first-of-type {
        display: none !important;
    }
    
    /* Hide SQL section in print */
    .print-complete-timesheet .sql-section {
        display: none !important;
    }
    
    /* Force print all content */
    * {
        overflow: visible !important;
    }
    
    /* Adjust body for print */
    body {
        margin: 0.5in 0.5in 0.5in 0.7in !important;
        padding: 0 !important;
    }
    
    /* Page setup */
    @page {
        margin: 0.5in 0.5in 0.5in 0.7in;
        size: letter;
    }
    
    /* Ensure main content uses full page */
    .main-content {
        padding: 0 !important;
        margin: 0 !important;
        width: calc(100% - 1.2in) !important;
        max-width: 100% !important;
    }
}