/* ===========================
   Print Styles
   =========================== */

@media print {
    /* ===========================
       Base Print Styles
       =========================== */
    *,
    *::before,
    *::after {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
        margin: 0.5in;
    }

    /* ===========================
       Typography
       =========================== */
    h1 {
        font-size: 20pt;
        margin-top: 0;
        page-break-after: avoid;
    }

    h2 {
        font-size: 16pt;
        margin-top: 0.5in;
        page-break-after: avoid;
    }

    h3 {
        font-size: 14pt;
        page-break-after: avoid;
    }

    h4, h5, h6 {
        font-size: 12pt;
        page-break-after: avoid;
    }

    p {
        orphans: 3;
        widows: 3;
    }

    /* ===========================
       Hide Interactive Elements
       =========================== */
    nav,
    .navbar,
    .g-sidebar,
    .g-topbar,
    footer,
    .g-shell-footer,
    button,
    .btn,
    input,
    select,
    textarea,
    .form-control,
    .modal-backdrop,
    .toast-container,
    .pagination,
    .dropdown,
    .nav-tabs,
    .breadcrumb,
    [role="navigation"],
    [role="search"],
    [role="banner"],
    [role="contentinfo"] {
        display: none !important;
    }

    /* ===========================
       Links
       =========================== */
    a {
        text-decoration: underline;
        color: black;
    }

    /* Show URLs after links (except navigation) */
    a[href]:not(.nav-link):not(.btn):not([href^="#"])::after {
        content: " (" attr(href) ")";
        font-size: 10pt;
        color: #555;
    }

    /* Don't show URLs for internal links */
    a[href^="#"]::after,
    a[href^="javascript:"]::after {
        content: "";
    }

    /* ===========================
       Tables
       =========================== */
    table {
        width: 100%;
        border-collapse: collapse;
        margin: 1em 0;
        page-break-inside: auto;
    }

    thead {
        display: table-header-group;
        font-weight: bold;
    }

    tfoot {
        display: table-footer-group;
    }

    tbody {
        display: table-row-group;
    }

    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    th,
    td {
        border: 1px solid #ddd;
        padding: 8pt;
        text-align: left;
    }

    th {
        background: #f4f4f4 !important;
        font-weight: bold;
    }

    /* Zebra striping for readability */
    tbody tr:nth-child(even) {
        background: #f9f9f9 !important;
    }

    /* ===========================
       Page Breaks
       =========================== */
    .page-break {
        page-break-before: always;
    }

    .page-break-after {
        page-break-after: always;
    }

    .no-page-break {
        page-break-inside: avoid;
    }

    /* Avoid breaks after headings */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }

    /* Avoid breaks before headings */
    h2, h3, h4, h5, h6 {
        page-break-before: avoid;
    }

    /* Keep images with their captions */
    figure {
        page-break-inside: avoid;
    }

    /* ===========================
       Print-Only Utilities
       =========================== */
    .print-only {
        display: block !important;
    }

    .no-print,
    .hide-print {
        display: none !important;
    }

    /* ===========================
       Reports & Documents
       =========================== */
    .report-header {
        border-bottom: 2px solid black;
        padding-bottom: 0.5em;
        margin-bottom: 1em;
    }

    .report-title {
        font-size: 20pt;
        font-weight: bold;
        margin: 0;
    }

    .report-meta {
        font-size: 10pt;
        color: #555;
        margin-top: 0.5em;
    }

    .report-section {
        margin: 1.5em 0;
        page-break-inside: avoid;
    }

    .report-section-title {
        font-size: 14pt;
        font-weight: bold;
        border-bottom: 1px solid #ddd;
        padding-bottom: 0.25em;
        margin-bottom: 0.5em;
    }

    .report-footer {
        border-top: 1px solid #ddd;
        padding-top: 0.5em;
        margin-top: 2em;
        font-size: 10pt;
        text-align: center;
    }

    /* ===========================
       Forms (Show Values)
       =========================== */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    textarea,
    select {
        border: none;
        border-bottom: 1px solid #ddd;
        padding: 2pt;
    }

    input[type="checkbox"]::after {
        content: attr(checked) "☑" "☐";
    }

    input[type="radio"]::after {
        content: attr(checked) "◉" "○";
    }

    /* ===========================
       Cards & Panels
       =========================== */
    .card,
    .panel,
    .modal-content {
        border: 1px solid #ddd;
        padding: 1em;
        margin: 1em 0;
        page-break-inside: avoid;
    }

    .card-header {
        font-weight: bold;
        border-bottom: 1px solid #ddd;
        padding-bottom: 0.5em;
        margin-bottom: 0.5em;
    }

    /* ===========================
       Lists
       =========================== */
    ul, ol {
        margin: 0.5em 0;
        padding-left: 1.5em;
    }

    li {
        margin: 0.25em 0;
    }

    /* ===========================
       Images & Media
       =========================== */
    img {
        max-width: 100%;
        page-break-inside: avoid;
    }

    /* QR Codes and Barcodes - Print Friendly */
    .qr-code,
    .barcode {
        display: block;
        margin: 1em auto;
        max-width: 3in;
    }

    /* ===========================
       Grids & Layouts
       =========================== */
    .container,
    .g-content,
    .g-shell {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .row {
        display: block !important;
    }

    .col,
    [class*="col-"] {
        width: 100% !important;
        float: none !important;
    }

    /* ===========================
       Dashboard & KPIs
       =========================== */
    .kpi-card,
    .stat-card {
        border: 1px solid #ddd;
        padding: 0.5em;
        margin: 0.5em 0;
        page-break-inside: avoid;
    }

    .kpi-value {
        font-size: 18pt;
        font-weight: bold;
    }

    .kpi-label {
        font-size: 10pt;
        color: #555;
    }

    /* ===========================
       Charts (Show Alt Text)
       =========================== */
    canvas,
    svg {
        display: none !important;
    }

    canvas::after,
    svg::after {
        content: attr(aria-label);
        display: block;
        border: 1px solid #ddd;
        padding: 1em;
        background: #f9f9f9;
    }

    /* ===========================
       Pricing Tables
       =========================== */
    .pricing-card {
        border: 1px solid #ddd;
        padding: 1em;
        margin: 0.5em 0;
        page-break-inside: avoid;
    }

    .pricing-card .price {
        font-size: 16pt;
        font-weight: bold;
    }

    /* ===========================
       Signatures & Approvals
       =========================== */
    .signature-line {
        border-top: 1px solid black;
        width: 3in;
        margin: 2em 0 0.5em 0;
        page-break-inside: avoid;
    }

    .signature-label {
        font-size: 10pt;
        color: #555;
    }
}
