/* Base & page box */
@page { margin: 12mm; size: auto; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html, body { color: #000 !important; background: #fff !important; font: 12pt/1.35 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; }

/* Typography */
h1 { font-size: 20pt; margin: 0 0 10pt; }
h2 { font-size: 16pt; margin: 16pt 0 8pt; }
h3 { font-size: 13pt; margin: 12pt 0 6pt; }
p, li, td, th { font-size: 11pt; }
small { font-size: 9pt; }
a { color: #000 !important; text-decoration: underline; word-break: break-word; }
abbr[title] { text-decoration: none; border-bottom: 1px dotted; }

/* Layout containers — ensure content is printable */
.content, .page-wrapper, .page-root, .wrapper, .page, main, article, section {
  transform: none !important;
  overflow: visible !important;
  height: auto !important;
  visibility: visible !important;
}

/* Neutralize animations, filters, blend modes */
* {
  animation: none !important;
  transition: none !important;
  filter: none !important;
  mix-blend-mode: normal !important;
  backdrop-filter: none !important;
  -webkit-text-fill-color: currentColor !important; /* Safari visibility fix */
}
/* Pseudo elements often used for overlays or decorations */
.overlay::before, .overlay::after,
.modal::before, .modal::after,
.hero::before, .hero::after,
.banner::before, .banner::after { display:none !important; }


/* AOS / reveal-on-scroll safety */
[data-aos], .aos-init, .aos-animate {
  opacity: 1 !important;
  transform: none !important;
  visibility: visible !important;
}

/* Remove/flatten layers that could cover the page */
header, .header, nav, .main-nav, .topbar, .cookiebar, .overlay, .modal, .drawer,
.sticky, [role="dialog"], [role="banner"], [role="navigation"], [role="complementary"] {
  position: static !important;
  display: none !important;
}

#ajax-loader, .loader, .loading, .spinner, [aria-busy="true"] {
  display: none !important;
}

/* Images & media */
img, svg, video, canvas { max-width: 100% !important; height: auto !important; }
img { page-break-inside: avoid; }
figure { margin: 0 0 8pt; }
figcaption { font-size: 9pt; color: #000; }

/* Tables */
table { width: 100%; border-collapse: collapse; table-layout: auto; }
th, td { border: 1pt solid #000; padding: 4pt 6pt; vertical-align: top; }
thead { display: table-header-group; } /* repeat header on each page */
tfoot { display: table-footer-group; }
tr { break-inside: avoid; page-break-inside: avoid; }
th { font-weight: 600; background: transparent !important; }
caption { caption-side: top; text-align: left; font-size: 10pt; margin-bottom: 4pt; }

/* Lists */
ul, ol { padding-left: 18pt; margin: 6pt 0; }
li { margin: 2pt 0; }

/* Code blocks / preformatted */
pre, code, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
pre { white-space: pre-wrap; word-break: break-word; border: 1pt solid #000; padding: 6pt; }

/* Forms — hide interactive controls unless needed */
button, .btn, .button, input, select, textarea { border: 1pt solid #000; background: transparent; color: #000; }
form, .form, .search, .filters, .pagination { display: none !important; } /* Usually not needed on paper */

/* Utility helpers */
.no-print { display: none !important; }
.only-print { display: block !important; }

/* Page breaks helpers */
.break-before { break-before: page !important; page-break-before: always !important; }
.break-after  { break-after: page !important; page-break-after: always !important; }
.avoid-break  { break-inside: avoid !important; page-break-inside: avoid !important; }

/* Common content blocks (project-specific quick guesses) */
.banner, .hero, .swiper, .carousel, .marquee, .video-bg { display: none !important; }
.breadcrumbs, .path { display: none !important; }

/* FAQ / accordion — expand content */
.accordion .content, .accordion .panel, details[open] > * { display: block !important; }
details { open: open; }
summary { display: none !important; }

/* Links footnotes (optional): append URLs after link text when it helps on paper) */
a[href^="http"]:after {
  content: " (" attr(href) ")";
  font-size: 9pt;
  word-break: break-all;
}
/* Do not duplicate for obvious internal anchors or JS pseudo links */
a[href^="#"]:after, a[href^="javascript:"]:after { content: ""; }

/* --- Optymalizacja do druku: mniej marginesów i paddingów --- */
@page { margin: 10mm; }

body, .content, .page-root, main, article, section {
  margin: 0 !important;
  padding: 0 !important;
}

ÿ  l羜{
  margin: 0 0 4pt !important;  /* mniejsze odstępy */
  line-height: 1.3 !important;
}

h1, h2, h3 {
  margin: 6pt 0 4pt !important;
  page-break-after: avoid;
}

table, td, th {
  padding: 2pt 4pt !important;
}

.content, .page-wrapper, .page-root, .wrapper, .page, main, article, section {
  transform: none !important;
  overflow: visible !important;
  height: auto !important;
  visibility: visible !important;
  opacity: 1 !important; /* NOWE */
}

/* --- DOPISZ NA SAM DÓŁ print.css --- */
@media print {
  /* 1) Wymuś jasny schemat i czarny tekst wszędzie */
  :root { color-scheme: light; }
  html, body, body * {
    color: #000 !important;
    -webkit-text-fill-color: #000 !important;
  }

  /* 2) Usuń tła i cienie, zostaw granice tabel/przycisków jako cienkie linie */
  body * {
    background: transparent !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  /* 3) Typowe „karty/panele” – pokaż zawartość jak zwykłe bloki */
  .card, .panel, .box, .tile, .widget, .news, .home-col, .akt-item, .akt-link {
    background: transparent !important;
    border-color: #000 !important;
  }

  /* 4) Twarde „odceglanie” kontenerów (gdyby coś zawalczyło z naszym resetem) */
  .page-wrapper, main.content, #dynamic-content, .page-root, article, section {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    filter: none !important;
  }
}
@media print {
  :root { color-scheme: light; }
  html, body, body * { color: #000 !important; -webkit-text-fill-color: #000 !important; }
  body * { background: transparent !important; box-shadow: none !important; text-shadow: none !important; }

  /* Nie wycinaj globalnie ::before/::after — jeśli masz taką regułę, usuń ją.
     Zostaw tylko dla overlayów, np.: */
  .overlay::before, .overlay::after,
  .modal::before, .modal::after,
  .hero::before, .hero::after,
  .banner::before, .banner::after { display:none !important; }

  /* Twarde „odceglanie” kontenerów */
  .page-wrapper, main.content, #dynamic-content, .page-root, article, section {
    opacity: 1 !important; visibility: visible !important; transform: none !important; filter: none !important;
  }
}

@media print {
  html, body, body * { color:#000 !important; -webkit-text-fill-color:#000 !important; background:transparent !important; box-shadow:none !important; text-shadow:none !important; filter:none !important; }
  .page-wrapper, main.content, #dynamic-content, .page-root, article, section { opacity:1 !important; visibility:visible !important; transform:none !important; height:auto !important; overflow:visible !important; }
}

/* ======= Print compaction (1-kolumnowo, bez pustych stron) ======= */
@media print {
  /* 1) Jedna kolumna, bez siatek i gapów */
  .container, .wrap, .wrapper, .content, .page-root, main, section { max-width: 100% !important; }
  .row, .grid, .cols, .columns, [class*="grid"], [class*="row"] {
    display: block !important;
    gap: 0 !important; column-gap: 0 !important; row-gap: 0 !important;
  }
  [class*="col-"], .col, .column { width: 100% !important; max-width: 100% !important; float: none !important; }

  /* 2) Bez stałych wysokości – to najczęstsza przyczyna pustych przełamań */
  * { min-height: auto !important; height: auto !important; }

  /* 3) Marginesy/paddingi pod druk */
  @page { margin: 8mm; }
  body, .container, .wrap, .wrapper, .content, .page-root, main, section { margin: 0 !important; padding: 0 !important; }
  h1 { margin: 6pt 0 4pt !important; }
  h2, h3 { margin: 5pt 0 3pt !important; }
  p, li  { margin: 0 0 3pt !important; line-height: 1.25 !important; }

  /* 4) Kontrola podziałów stron – bez „pustych” kartek */
  /* – nagłówek nie zostaje sam na dole */
  h1, h2, h3 { break-after: avoid !important; page-break-after: avoid !important; }
  /* – karty/info-boxy nie są rozrywane na dwie strony */
  .card, .panel, .box, .tile, .widget, .news, .home-col, .akt-item { break-inside: avoid !important; page-break-inside: avoid !important; }
  /* – poziome linie/separatory nie wymuszają nowej strony */
  hr, .divider, .section-sep { break-after: avoid !important; page-break-after: auto !important; }
  /* – unikaj „samotnych” wierszy */
  p, li { orphans: 2; widows: 2; }

  /* 5) Usuń elementy, które robią puste połacie */
  .hero, .banner, .carousel, .marquee, .video-bg { display: none !important; }
  /* często „sticky footery” robią pustą ostatnią stronę */
  .sticky, .affix, .footer-sticky { position: static !important; display: none !important; }

  /* 6) Cienkie obramowania zamiast grubych kart (mniej tuszu, mniej przerw) */
  .card, .panel, .box, .tile, .widget {
    background: transparent !important;
    border: 1pt solid #000 !important;
    box-shadow: none !important;
    border-radius: 3pt !important;
    margin: 4pt 0 !important;
    padding: 4pt 6pt !important;
  }

  /* 7) Jeśli coś nadal wcina całe strony – wyłącz „page-break-before” globalnie */
  * { break-before: auto !important; page-break-before: auto !important; }
}

@media print {
  body[data-print-scope="1"] #dynamic-content * { display: none !important; }

  body[data-print-scope="1"] #dynamic-content .print-keep {
    display: block !important;
  }
  body[data-print-scope="1"] #dynamic-content .print-target,
  body[data-print-scope="1"] #dynamic-content .print-target * {
    display: block !important;
  }
}

