/**
 * Finance Module Print Styles
 * Professional print layouts for receipts and reports
 * Location: public/assets/finance/css/print.css
 * Part of Finance Module Usability Overhaul - Phase 3.5
 */

@media print {
    /* ==================== Reset & Base ==================== */
    
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
    
    body {
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        font-size: 10pt;
        line-height: 1.4;
        color: #000;
        background: #fff;
        margin: 0;
        padding: 0;
    }
    
    /* ==================== Hide Non-Print Elements ==================== */
    
    /* Navigation & UI */
    nav,
    header,
    footer,
    aside,
    .sidebar,
    .finance-context-sidebar,
    .kt-menu,
    .kt-header,
    .kt-sidebar,
    .app-sidebar,
    .breadcrumb,
    .pagination,
    .bulk-operations-bar,
    .filter-chips-container,
    .command-palette,
    .command-palette-backdrop {
        display: none !important;
    }
    
    /* Interactive Elements */
    button:not(.print-visible),
    .kt-btn:not(.print-visible),
    input[type="checkbox"],
    input[type="radio"],
    select,
    .form-control,
    .form-select,
    .dropdown,
    .modal,
    .toast,
    [data-kt-menu],
    .smart-selection-dropdown {
        display: none !important;
    }
    
    /* Utility Classes */
    .no-print,
    .hide-print,
    [aria-hidden="true"] {
        display: none !important;
    }
    
    /* ==================== Layout ==================== */
    
    .kt-container-fixed,
    .app-container,
    .container {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .kt-card {
        border: none !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .kt-card-header {
        border-bottom: 2px solid #000 !important;
        padding: 0 0 8pt 0 !important;
        margin-bottom: 12pt !important;
    }
    
    .kt-card-body {
        padding: 0 !important;
    }
    
    /* ==================== Typography ==================== */
    
    h1, .page-heading {
        font-size: 16pt;
        font-weight: bold;
        margin: 0 0 8pt 0;
    }
    
    h2, .kt-card-title {
        font-size: 14pt;
        font-weight: bold;
        margin: 0 0 6pt 0;
    }
    
    h3 {
        font-size: 12pt;
        font-weight: bold;
        margin: 0 0 4pt 0;
    }
    
    p {
        margin: 0 0 6pt 0;
    }
    
    /* ==================== Tables ==================== */
    
    .kt-table,
    table {
        width: 100%;
        border-collapse: collapse;
        font-size: 9pt;
        page-break-inside: auto;
    }
    
    .kt-table th,
    .kt-table td,
    table th,
    table td {
        border: 1px solid #000;
        padding: 4pt 6pt;
        text-align: left;
        vertical-align: top;
    }
    
    .kt-table th,
    table th {
        background: #f0f0f0 !important;
        font-weight: bold;
    }
    
    .kt-table tr,
    table tr {
        page-break-inside: avoid;
    }
    
    /* Alternate row colors */
    .kt-table tbody tr:nth-child(even),
    table tbody tr:nth-child(even) {
        background: #f9f9f9 !important;
    }
    
    /* Hide checkbox column */
    .kt-table th:first-child:has(input[type="checkbox"]),
    .kt-table td:first-child:has(input[type="checkbox"]) {
        display: none !important;
    }
    
    /* ==================== Receipt Specific ==================== */
    
    .receipt-container {
        max-width: 80mm;
        margin: 0 auto;
        padding: 10mm;
        font-size: 9pt;
    }
    
    .receipt-header {
        text-align: center;
        border-bottom: 1px dashed #000;
        padding-bottom: 8pt;
        margin-bottom: 8pt;
    }
    
    .receipt-logo {
        max-width: 50mm;
        max-height: 20mm;
        margin-bottom: 4pt;
    }
    
    .receipt-title {
        font-size: 14pt;
        font-weight: bold;
        margin: 4pt 0;
    }
    
    .receipt-subtitle {
        font-size: 8pt;
        color: #666;
    }
    
    .receipt-body {
        margin: 8pt 0;
    }
    
    .receipt-row {
        display: flex;
        justify-content: space-between;
        padding: 2pt 0;
        border-bottom: 1px dotted #ccc;
    }
    
    .receipt-row:last-child {
        border-bottom: none;
    }
    
    .receipt-label {
        font-weight: normal;
    }
    
    .receipt-value {
        font-weight: bold;
        text-align: right;
    }
    
    .receipt-total {
        border-top: 2px solid #000;
        border-bottom: 2px solid #000;
        padding: 4pt 0;
        margin: 8pt 0;
        font-size: 12pt;
        font-weight: bold;
    }
    
    .receipt-footer {
        text-align: center;
        border-top: 1px dashed #000;
        padding-top: 8pt;
        margin-top: 8pt;
        font-size: 8pt;
    }
    
    .receipt-barcode {
        margin: 8pt auto;
        text-align: center;
    }
    
    .receipt-qr {
        width: 25mm;
        height: 25mm;
        margin: 4pt auto;
    }
    
    /* ==================== Report Specific ==================== */
    
    .report-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        border-bottom: 2px solid #000;
        padding-bottom: 12pt;
        margin-bottom: 16pt;
    }
    
    .report-logo {
        max-width: 60mm;
        max-height: 25mm;
    }
    
    .report-info {
        text-align: right;
    }
    
    .report-title {
        font-size: 18pt;
        font-weight: bold;
        text-align: center;
        margin: 16pt 0;
    }
    
    .report-subtitle {
        font-size: 12pt;
        text-align: center;
        color: #666;
        margin-bottom: 16pt;
    }
    
    .report-summary {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 8pt;
        margin-bottom: 16pt;
        padding: 8pt;
        background: #f5f5f5 !important;
        border: 1px solid #ddd;
    }
    
    .report-summary-item {
        text-align: center;
    }
    
    .report-summary-value {
        font-size: 14pt;
        font-weight: bold;
    }
    
    .report-summary-label {
        font-size: 8pt;
        color: #666;
    }
    
    .report-footer {
        margin-top: 24pt;
        padding-top: 12pt;
        border-top: 1px solid #ccc;
        font-size: 8pt;
        color: #666;
    }
    
    .report-signature {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 48pt;
        margin-top: 48pt;
    }
    
    .signature-line {
        border-top: 1px solid #000;
        padding-top: 4pt;
        text-align: center;
    }
    
    /* ==================== Page Breaks ==================== */
    
    .page-break-before {
        page-break-before: always;
    }
    
    .page-break-after {
        page-break-after: always;
    }
    
    .avoid-break {
        page-break-inside: avoid;
    }
    
    /* ==================== Status Badges ==================== */
    
    .status-verified,
    .status-success {
        background: #d4edda !important;
        color: #155724 !important;
        padding: 2pt 6pt;
        border-radius: 2pt;
    }
    
    .status-pending,
    .status-warning {
        background: #fff3cd !important;
        color: #856404 !important;
        padding: 2pt 6pt;
        border-radius: 2pt;
    }
    
    .status-invalid,
    .status-danger {
        background: #f8d7da !important;
        color: #721c24 !important;
        padding: 2pt 6pt;
        border-radius: 2pt;
    }
    
    /* ==================== Amounts & Numbers ==================== */
    
    .amount,
    .currency {
        font-family: 'Courier New', monospace;
        text-align: right;
    }
    
    .amount-positive {
        color: #155724 !important;
    }
    
    .amount-negative {
        color: #721c24 !important;
    }
    
    /* ==================== Page Setup ==================== */
    
    @page {
        size: A4;
        margin: 15mm;
    }
    
    @page :first {
        margin-top: 10mm;
    }
    
    /* Receipt page size */
    @page receipt {
        size: 80mm auto;
        margin: 5mm;
    }
    
    .receipt-container {
        page: receipt;
    }
    
    /* Landscape for wide reports */
    @page landscape {
        size: A4 landscape;
        margin: 10mm;
    }
    
    .report-landscape {
        page: landscape;
    }
}

/* ==================== Print Preview Styles (Screen) ==================== */

@media screen {
    .print-preview {
        background: #e0e0e0;
        padding: 20px;
        min-height: 100vh;
    }
    
    .print-preview .print-page {
        background: white;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        margin: 20px auto;
        padding: 15mm;
        max-width: 210mm;
        min-height: 297mm;
    }
    
    .print-preview .receipt-container {
        max-width: 80mm;
        min-height: auto;
        border: 1px dashed #ccc;
    }
    
    .print-preview-toolbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        background: #333;
        color: white;
        padding: 10px 20px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        z-index: 1000;
    }
    
    .print-preview-toolbar button {
        background: #4a90d9;
        color: white;
        border: none;
        padding: 8px 16px;
        border-radius: 4px;
        cursor: pointer;
    }
    
    .print-preview-toolbar button:hover {
        background: #357abd;
    }
}
