/* Reset all backgrounds and colors for printing */
* {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    background: transparent !important;
    box-shadow: none !important;
    text-shadow: none !important;
    color: #000 !important;
}

/* Hide non-essential elements */
#preloader,
#backToTop,
.back-to-top,
.gold-animation,
.navbar,
.goldbar,
.footer,
button,
.alert,
[data-aos],
.no-print {
    display: none !important;
}

/* Basic page setup */
@page {
    margin: 2cm;
    size: A4;
}

body {
    font-family: "Times New Roman", Times, serif;
    line-height: 1.5;
    font-size: 12pt;
    background: #fff !important;
    color: #000 !important;
    margin: 0;
    padding: 0;
}

/* Typography */
h1 {
    font-size: 24pt;
    margin-bottom: 18pt;
}

h2 {
    font-size: 20pt;
    margin-bottom: 16pt;
}

h3 {
    font-size: 16pt;
    margin-bottom: 14pt;
}

h4,
h5,
h6 {
    font-size: 14pt;
    margin-bottom: 12pt;
}

p,
ul,
ol,
dl {
    margin-bottom: 12pt;
    orphans: 3;
    /* Minimum lines to keep at bottom of page */
    widows: 3;
    /* Minimum lines to keep at top of page */
}

/* Links */
a {
    text-decoration: underline;
    word-wrap: break-word;
}

/* Show URLs for external links */
a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 10pt;
    font-style: italic;
}

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

/* Images */
img {
    max-width: 100% !important;
    height: auto !important;
    page-break-inside: avoid;
    border: 1px solid #ddd;
    margin: 10pt 0;
}

/* Tables */
table {
    width: 100% !important;
    margin: 14pt 0;
    border-collapse: collapse;
    page-break-inside: avoid;
}

tr,
td,
th {
    page-break-inside: avoid;
    border: 1px solid #000;
    padding: 8pt;
}

th {
    font-weight: bold;
    text-align: left;
}

/* Bootstrap overrides */
.container,
.container-fluid {
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

.row {
    display: block !important;
    margin: 0 !important;
}

[class^="col-"] {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
}

/* Cards */
.card {
    border: 1px solid #000 !important;
    page-break-inside: avoid;
    margin: 14pt 0;
}

.card-body {
    padding: 14pt;
}

/* Lists */
ul,
ol {
    padding-left: 20pt;
}

li {
    page-break-inside: avoid;
}

/* Page breaks */
h1,
h2,
h3,
table,
figure,
.card,
.page-break {
    page-break-before: auto;
    page-break-after: avoid;
}

/* Header for each printed page */
.print-header {
    position: running(header);
    text-align: center;
    font-size: 10pt;
}

@page {
    @top-center {
        content: element(header);
    }
}

/* Footer with page numbers */
@page {
    @bottom-center {
        content: counter(page);
        font-size: 10pt;
    }
}

/* Custom print-only elements */
.print-only {
    display: none;
}

@media print {
    .print-only {
        display: block !important;
    }

    /* Add page title at the top of the first page */
    .content:before {
        content: "{{ PROJECT_NAME }}";
        font-size: 24pt;
        font-weight: bold;
        margin-bottom: 20pt;
        display: block;
    }
}

/* QR codes and barcodes */
.qr-code,
.barcode {
    page-break-inside: avoid;
    margin: 14pt 0;
}

/* Form elements */
input,
select,
textarea {
    border: 1px solid #000;
}

/* Accessibility */
@media speech {
    .print-only {
        display: none;
    }
}
