/**
 * Print-specific styles for ReExpense Reports
 * Creates professional PDF/print output
 */

/* ============================================
   SCREEN STYLES - Hide print-only elements
   ============================================ */
@media screen {
    .print-report-header {
        display: none !important;
    }
    .print-summary-row {
        display: none !important;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    /* Color handling */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    /* Page setup */
    @page {
        size: letter;
        margin: 0.5in;
    }

    /* Base reset */
    body {
        background: white !important;
        color: black !important;
        font-size: 10pt !important;
        line-height: 1.4 !important;
    }

    /* ========================================
       HIDE ALL UI ELEMENTS
       ======================================== */

    /* Navigation */
    .navbar,
    .navbar-vertical,
    .navbar-expand-lg,
    nav,
    aside {
        display: none !important;
    }

    /* Page header/controls */
    .page-header,
    .page-wrapper > .alert,
    #beta-banner,
    #trial-banner {
        display: none !important;
    }

    /* Mobile UI */
    .mobile-bottom-nav,
    .mobile-menu-sheet,
    .offcanvas,
    .modal {
        display: none !important;
    }

    /* Footer */
    footer,
    .footer {
        display: none !important;
    }

    /* Report page specific */
    .report-type-card,
    .card:has(.report-type-card),
    .row:has(.report-type-card) {
        display: none !important;
    }

    /* Report options form */
    .card:has(#report-year),
    .card-header:has(.card-actions) {
        display: none !important;
    }

    /* YTD Summary and Charts */
    .card:has(#summary-miles),
    .card:has(#monthly-trend-chart),
    #monthly-trend-chart,
    .apexcharts-canvas {
        display: none !important;
    }

    /* Buttons and actions */
    .btn,
    .btn-list,
    .card-actions,
    #generate-report-btn,
    #download-report-btn {
        display: none !important;
    }

    /* Form elements */
    .form-control,
    .form-select,
    select,
    input[type="date"] {
        display: none !important;
    }

    /* ========================================
       SHOW REPORT CONTENT
       ======================================== */

    /* Main wrapper */
    .page-wrapper {
        margin: 0 !important;
        padding: 0 !important;
    }

    .page-body {
        padding: 0 !important;
        margin: 0 !important;
    }

    .container-xl {
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Report preview card */
    #report-preview-card {
        display: block !important;
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #report-preview-card > .card-header {
        display: none !important;
    }

    #report-preview-card > .card-body,
    #report-preview-content {
        padding: 0 !important;
        margin: 0 !important;
    }

    /* ========================================
       PRINT HEADER WITH BRANDING
       ======================================== */

    .print-report-header {
        display: block !important;
        text-align: center;
        padding-bottom: 15px;
        margin-bottom: 20px;
        border-bottom: 2px solid #333;
    }

    .print-report-header .brand-logo {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        margin-bottom: 5px;
    }

    .print-report-header .brand-icon {
        font-size: 28px;
        line-height: 1;
    }

    .print-report-header .brand-name {
        font-size: 22pt;
        font-weight: 700;
        color: #000;
        letter-spacing: -0.5px;
    }

    .print-report-header .brand-name .accent {
        color: #3B82F6;
    }

    .print-report-header .generated-info {
        font-size: 9pt;
        color: #666;
        margin-top: 3px;
    }

    /* ========================================
       REPORT TITLE SECTION
       ======================================== */

    .report-title-section {
        margin-bottom: 20px;
        padding-bottom: 10px;
        border-bottom: 1px solid #ddd;
    }

    .report-title-section h2 {
        font-size: 16pt !important;
        font-weight: 700 !important;
        margin: 0 0 5px 0 !important;
        color: #000 !important;
    }

    .report-title-section .date-range {
        font-size: 10pt;
        color: #555;
    }

    .report-title-section .irs-rate {
        font-size: 9pt;
        color: #555;
        text-align: right;
    }

    /* ========================================
       PRINT SUMMARY ROW
       ======================================== */

    .print-summary-row {
        display: flex !important;
        justify-content: space-between !important;
        margin-bottom: 25px !important;
        padding: 12px 15px !important;
        border: 1px solid #ccc !important;
        background: #f9f9f9 !important;
    }

    .print-summary-item {
        text-align: center !important;
        flex: 1 !important;
        border-right: 1px solid #ddd !important;
        padding: 0 15px !important;
    }

    .print-summary-item:last-child {
        border-right: none !important;
    }

    .print-summary-item .label {
        font-size: 8pt !important;
        color: #666 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
        margin-bottom: 3px !important;
    }

    .print-summary-item .value {
        font-size: 14pt !important;
        font-weight: 700 !important;
        color: #000 !important;
    }

    /* Hide screen-only summary cards */
    .row:has(.card-sm) {
        display: none !important;
    }

    /* ========================================
       TABLE STYLES
       ======================================== */

    .table-responsive {
        overflow: visible !important;
    }

    table,
    .table {
        width: 100% !important;
        border-collapse: collapse !important;
        font-size: 9pt !important;
        page-break-inside: auto !important;
        margin-bottom: 20px !important;
    }

    /* Repeat headers on each page */
    thead {
        display: table-header-group !important;
    }

    tfoot {
        display: table-footer-group !important;
    }

    /* Avoid breaking rows */
    tr {
        page-break-inside: avoid !important;
        page-break-after: auto !important;
    }

    th,
    td {
        border: 1px solid #bbb !important;
        padding: 5px 8px !important;
        text-align: left !important;
        background: white !important;
        color: #000 !important;
        vertical-align: top !important;
    }

    th {
        background: #e8e8e8 !important;
        font-weight: 600 !important;
        font-size: 8pt !important;
        text-transform: uppercase !important;
        letter-spacing: 0.3px !important;
    }

    /* Right-align numeric columns */
    .text-end,
    td.text-end,
    th.text-end {
        text-align: right !important;
    }

    /* Totals row */
    tr.totals-row,
    tr.fw-bold,
    tfoot tr {
        background: #f0f0f0 !important;
        font-weight: 700 !important;
    }

    tr.totals-row td,
    tr.fw-bold td,
    tfoot td {
        background: #f0f0f0 !important;
        font-weight: 700 !important;
        border-top: 2px solid #333 !important;
    }

    /* Remove striped styling */
    .table-striped tbody tr:nth-of-type(odd) {
        background: white !important;
    }

    .table-striped tbody tr:nth-of-type(odd) td {
        background: white !important;
    }

    /* ========================================
       SECTION HEADERS
       ======================================== */

    h3, h4 {
        font-size: 11pt !important;
        font-weight: 700 !important;
        color: #000 !important;
        margin: 20px 0 10px 0 !important;
        padding-bottom: 5px !important;
        border-bottom: 1px solid #ddd !important;
        page-break-after: avoid !important;
    }

    /* ========================================
       BADGES - Convert to plain text
       ======================================== */

    .badge,
    span.badge {
        background: transparent !important;
        color: #000 !important;
        border: 1px solid #999 !important;
        border-radius: 2px !important;
        padding: 1px 5px !important;
        font-weight: normal !important;
        font-size: 8pt !important;
    }

    /* Remove colored backgrounds */
    .bg-success-lt,
    .bg-primary-lt,
    .bg-warning-lt,
    .bg-secondary-lt,
    .bg-green-lt,
    .bg-yellow-lt,
    .bg-purple-lt,
    .bg-info-lt,
    .bg-light {
        background: transparent !important;
    }

    /* Text colors to black */
    .text-success,
    .text-primary,
    .text-warning,
    .text-secondary,
    .text-green,
    .text-purple,
    .text-muted,
    .text-info {
        color: #000 !important;
    }

    /* Keep deduction values slightly emphasized */
    td.text-success,
    .deduction-value {
        font-weight: 600 !important;
    }

    /* ========================================
       ALERTS AND NOTES
       ======================================== */

    .alert {
        background: #f5f5f5 !important;
        border: 1px solid #ccc !important;
        border-left: 4px solid #666 !important;
        color: #000 !important;
        padding: 10px 12px !important;
        margin-bottom: 15px !important;
        font-size: 9pt !important;
    }

    .alert-info {
        border-left-color: #3B82F6 !important;
    }

    .alert-warning {
        border-left-color: #f59e0b !important;
    }

    /* Notes list */
    .notes-section {
        margin-top: 20px !important;
        padding-top: 15px !important;
        border-top: 1px solid #ddd !important;
    }

    .notes-section h4 {
        border-bottom: none !important;
    }

    .notes-section ul {
        margin: 0 !important;
        padding-left: 20px !important;
    }

    .notes-section li {
        margin-bottom: 5px !important;
        font-size: 9pt !important;
    }

    /* ========================================
       PAGE BREAKS
       ======================================== */

    .print-page-break {
        page-break-before: always !important;
    }

    .print-no-break {
        page-break-inside: avoid !important;
    }

    /* Keep section headers with their content */
    h2, h3, h4 {
        page-break-after: avoid !important;
    }

    /* Break before expense details section */
    .expense-details-section {
        page-break-before: always !important;
    }

    /* ========================================
       CARDS - Remove styling
       ======================================== */

    .card {
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
        margin: 0 !important;
    }

    .card-header {
        display: none !important;
    }

    .card-body {
        padding: 0 !important;
    }

    /* ========================================
       TRUNCATED TEXT - Show full
       ======================================== */

    .text-truncate {
        overflow: visible !important;
        text-overflow: clip !important;
        white-space: normal !important;
        max-width: none !important;
    }

    /* ========================================
       SCHEDULE C SPECIFIC
       ======================================== */

    .schedule-c-line {
        font-weight: 600 !important;
    }

    .schedule-c-details {
        font-size: 8pt !important;
        color: #555 !important;
    }

    /* ========================================
       PROPERTY REPORT SPECIFIC
       ======================================== */

    .property-address {
        font-weight: 600 !important;
    }

    .property-city {
        font-size: 8pt !important;
        color: #555 !important;
    }

    /* ========================================
       UTILITIES
       ======================================== */

    .d-print-none {
        display: none !important;
    }

    .d-print-block {
        display: block !important;
    }

    .d-print-flex {
        display: flex !important;
    }

    /* Bootstrap responsive classes - make visible in print */
    .d-none.d-print-block {
        display: block !important;
    }

    .d-none.d-print-flex {
        display: flex !important;
    }

    /* Hide any remaining scrollbars */
    *::-webkit-scrollbar {
        display: none !important;
    }
}
