/* =========================================================
   BIZNIVO — CENTRAL PROFESSIONAL PRINT SYSTEM
   File:
   C:\xampp2\htdocs\biznivo\css\js\dashboard\print.css
   ========================================================= */

/* ---------------------------------------------------------
   SCREEN PREVIEW
   --------------------------------------------------------- */

.print-only {
    display: none !important;
}

.print-document {
    width: 100%;
    max-width: 210mm;
    margin: 0 auto;
    background: #ffffff;
    color: #1f2937;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    line-height: 1.45;
    box-sizing: border-box;
}

.print-document *,
.print-document *::before,
.print-document *::after {
    box-sizing: border-box;
}

/* ---------------------------------------------------------
   BUSINESS HEADER
   --------------------------------------------------------- */

.print-business-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 14px;
    margin-bottom: 18px;
    border-bottom: 2px solid #1f8f5f;
}

.print-business-brand {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.print-business-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    display: block;
}

.print-business-name {
    margin: 0;
    color: #14532d;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.15;
}

.print-business-tagline {
    margin: 4px 0 0;
    color: #4b5563;
    font-size: 10px;
}

.print-business-contact {
    text-align: right;
    color: #374151;
    font-size: 10px;
    line-height: 1.55;
}

.print-business-contact strong {
    color: #111827;
}

/* ---------------------------------------------------------
   DOCUMENT TITLE
   --------------------------------------------------------- */

.print-document-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.print-document-title {
    margin: 0;
    color: #111827;
    font-size: 22px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.print-document-number {
    margin-top: 4px;
    color: #4b5563;
    font-size: 11px;
}

.print-document-meta {
    min-width: 180px;
    text-align: right;
    font-size: 10px;
}

.print-document-meta-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 3px 0;
    border-bottom: 1px solid #e5e7eb;
}

.print-document-meta-label {
    color: #6b7280;
}

.print-document-meta-value {
    color: #111827;
    font-weight: 600;
}

/* ---------------------------------------------------------
   CUSTOMER / SUPPLIER INFORMATION
   --------------------------------------------------------- */

.print-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 20px;
}

.print-party {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
}

.print-party-title {
    margin: 0 0 6px;
    color: #166534;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.print-party-name {
    margin: 0 0 3px;
    color: #111827;
    font-size: 13px;
    font-weight: 700;
}

.print-party-line {
    margin: 2px 0;
    color: #4b5563;
    font-size: 10px;
}

/* ---------------------------------------------------------
   TABLES
   --------------------------------------------------------- */

.print-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 18px;
    table-layout: auto;
}

.print-table thead {
    display: table-header-group;
}

.print-table tr {
    page-break-inside: avoid;
}

.print-table th {
    padding: 8px 7px;
    border: 1px solid #cbd5e1;
    background: #e8f5ed;
    color: #14532d;
    font-size: 10px;
    font-weight: 700;
    text-align: left;
    vertical-align: middle;
}

.print-table td {
    padding: 7px;
    border: 1px solid #d1d5db;
    color: #374151;
    font-size: 10px;
    vertical-align: top;
}

.print-table tbody tr:nth-child(even) td {
    background: #f9fafb;
}

.print-table .text-right {
    text-align: right;
}

.print-table .text-center {
    text-align: center;
}

.print-table .amount {
    text-align: right;
    white-space: nowrap;
}

/* ---------------------------------------------------------
   TOTALS
   --------------------------------------------------------- */

.print-summary {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.print-totals {
    width: 270px;
    max-width: 100%;
}

.print-total-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 5px 0;
    border-bottom: 1px solid #e5e7eb;
    font-size: 10px;
}

.print-total-label {
    color: #4b5563;
}

.print-total-value {
    color: #111827;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
}

.print-grand-total {
    margin-top: 5px;
    padding: 8px 0;
    border-top: 2px solid #166534;
    border-bottom: 2px solid #166534;
    font-size: 13px;
    font-weight: 700;
}

.print-grand-total .print-total-label,
.print-grand-total .print-total-value {
    color: #14532d;
}

/* ---------------------------------------------------------
   NOTES / TERMS
   --------------------------------------------------------- */

.print-notes-section {
    margin-top: 20px;
    page-break-inside: avoid;
}

.print-section-title {
    margin: 0 0 6px;
    color: #14532d;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.print-notes {
    min-height: 35px;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    color: #4b5563;
    font-size: 10px;
    white-space: pre-wrap;
}

.print-terms {
    margin-top: 15px;
    color: #4b5563;
    font-size: 9px;
    line-height: 1.5;
}

/* ---------------------------------------------------------
   SIGNATURE AREA
   --------------------------------------------------------- */

.print-signatures {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    margin-top: 35px;
    page-break-inside: avoid;
}

.print-signature {
    padding-top: 28px;
    border-top: 1px solid #6b7280;
    color: #374151;
    font-size: 9px;
}

/* ---------------------------------------------------------
   PAYMENT / STATUS BADGES
   --------------------------------------------------------- */

.print-status {
    display: inline-block;
    padding: 3px 7px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    color: #374151;
    font-size: 9px;
    font-weight: 600;
}

.print-paid {
    border-color: #86efac;
    color: #166534;
}

.print-pending {
    border-color: #fcd34d;
    color: #92400e;
}

.print-cancelled {
    border-color: #fca5a5;
    color: #991b1b;
}

/* ---------------------------------------------------------
   REPORT HEADER
   --------------------------------------------------------- */

.print-report-header {
    margin-bottom: 18px;
    text-align: center;
}

.print-report-title {
    margin: 0;
    color: #111827;
    font-size: 20px;
    font-weight: 700;
}

.print-report-period {
    margin-top: 4px;
    color: #6b7280;
    font-size: 10px;
}

/* ---------------------------------------------------------
   REPORT SUMMARY CARDS
   --------------------------------------------------------- */

.print-report-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 18px;
}

.print-report-card {
    padding: 9px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
}

.print-report-card-label {
    color: #6b7280;
    font-size: 8px;
    text-transform: uppercase;
}

.print-report-card-value {
    margin-top: 3px;
    color: #111827;
    font-size: 13px;
    font-weight: 700;
}

/* ---------------------------------------------------------
   FOOTER
   --------------------------------------------------------- */

.print-footer {
    margin-top: 25px;
    padding-top: 8px;
    border-top: 1px solid #d1d5db;
    text-align: center;
    color: #9ca3af;
    font-size: 8px;
}

.print-footer .powered-by {
    color: #6b7280;
    font-weight: 600;
}

/* ---------------------------------------------------------
   PRINT BUTTONS
   --------------------------------------------------------- */

.print-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.print-button {
    padding: 9px 15px;
    border: 0;
    border-radius: 5px;
    background: #166534;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.print-button:hover {
    background: #14532d;
}

.print-button.secondary {
    background: #2563eb;
}

.print-button.secondary:hover {
    background: #1d4ed8;
}

.print-button.warning {
    background: #ea580c;
}

.print-button.warning:hover {
    background: #c2410c;
}

/* ---------------------------------------------------------
   COMMON UTILITIES
   --------------------------------------------------------- */

.no-print {
    display: block;
}

.page-break-before {
    page-break-before: always;
}

.page-break-after {
    page-break-after: always;
}

.avoid-break {
    page-break-inside: avoid;
}

.print-muted {
    color: #6b7280;
}

.print-bold {
    font-weight: 700;
}

.print-small {
    font-size: 9px;
}

.print-large {
    font-size: 16px;
}

.print-green {
    color: #166534;
}

.print-blue {
    color: #1d4ed8;
}

.print-orange {
    color: #c2410c;
}

/* ---------------------------------------------------------
   PRINT MEDIA
   --------------------------------------------------------- */

@media print {

    @page {
        size: A4;
        margin: 12mm 12mm 14mm 12mm;
    }

    html,
    body {
        width: 210mm;
        min-height: 297mm;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
    }

    body {
        color: #111827 !important;
        font-family: Arial, Helvetica, sans-serif !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Hide application interface */
    .no-print,
    .print-actions,
    nav,
    aside,
    header.site-header,
    footer.site-footer,
    .sidebar,
    .topbar,
    .navbar,
    .dashboard-sidebar,
    .dashboard-header,
    .mobile-menu,
    .menu-toggle,
    button:not(.print-visible) {
        display: none !important;
    }

    /* Show print-only content */
    .print-only {
        display: block !important;
    }

    .print-document {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
    }

    .print-document,
    .print-document * {
        visibility: visible !important;
    }

    /* Remove screen containers */
    .container,
    .content,
    .main-content,
    .page-content,
    .dashboard-content,
    .card,
    .panel {
        box-shadow: none !important;
    }

    /* Preserve table headers on new pages */
    .print-table thead {
        display: table-header-group !important;
    }

    .print-table tfoot {
        display: table-footer-group !important;
    }

    .print-table tr {
        page-break-inside: avoid !important;
    }

    .print-table th {
        background: #e8f5ed !important;
        color: #14532d !important;
    }

    .print-table tbody tr:nth-child(even) td {
        background: #f9fafb !important;
    }

    .print-business-header,
    .print-document-heading,
    .print-parties,
    .print-summary,
    .print-notes-section,
    .print-signatures,
    .print-footer {
        page-break-inside: avoid !important;
    }

    a {
        color: inherit !important;
        text-decoration: none !important;
    }

    img {
        max-width: 100%;
    }

    .print-business-logo {
        width: 72px !important;
        height: 72px !important;
    }

    .print-footer {
        display: block !important;
    }
}

/* ---------------------------------------------------------
   SMALL SCREEN PREVIEW
   --------------------------------------------------------- */

@media screen and (max-width: 700px) {

    .print-business-header,
    .print-document-heading {
        flex-direction: column;
    }

    .print-business-contact {
        text-align: left;
    }

    .print-parties {
        grid-template-columns: 1fr;
    }

    .print-report-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .print-table {
        font-size: 9px;
    }

    .print-table th,
    .print-table td {
        padding: 5px 4px;
    }

    .print-summary {
        justify-content: stretch;
    }

    .print-totals {
        width: 100%;
    }
}