/* =============================================
   STAMPA — Bootstrap 5
   ============================================= */

*, *::before, *::after {
    background: transparent !important;
    background-image: none !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

/* ---- PAGINA ---- */
@page {
    size: 210mm 297mm;
    margin: 30mm 5mm 35mm; /* top generoso per non sovrapporre header, bottom per footer fisso */
}

/* Prima pagina: margine top maggiore per eventuale intestazione/logo */
@page :first {
    margin-top: 50mm; /* regola in base all'altezza del tuo header */
}

html, body {
    height: auto;
    min-height: 100%;
}

body {
    font-size: 10pt;
    line-height: 1.2;
    padding-top: 0 !important;
    margin: 0;
    min-width: 992px !important;
}

.container,
.container-fluid {
    min-width: 992px !important;
    padding: 0 !important;
}

/* ---- HEADER ---- */
header .logo {
    max-width: 120px;
    height: auto;
    margin-left: 15px;
    display: inline-block;
    margin-right: 30px;
}

/* ---- FOOTER SU OGNI PAGINA ---- */
/* position:fixed in @media print = ripetuto su ogni foglio */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30mm; /* regola in base al contenuto del footer */
    padding: 3mm 5mm;
    font-size: 10pt;
    border-top: 1px solid #ccc;
    /* Assicura che non venga nascosto dal reset del colore */
    background: #fff !important;
}

.cornicefattura {
    /* Il padding-bottom deve essere almeno = all'altezza del footer */
    padding-bottom: 35mm;
    position: relative;
}

/* ---- LINK ---- */
a, a:visited {
    text-decoration: none;
}

a[href]::after,
a[href^="javascript:"]::after,
a[href^="#"]::after {
    display: none;
}

abbr[title]::after {
    content: " (" attr(title) ")";
}

/* ---- TIPOGRAFIA ---- */
h1, h2, h3, h4, h5, h6 {
    break-after: avoid;
}

p, h2, h3 {
    orphans: 3;
    widows: 3;
}

h1 { font-size: 1.75rem; }
.grande { font-size: 1.1rem; }
.text-center { text-align: center; }

/* ---- IMMAGINI ---- */
img {
    max-width: 100% !important;
    height: auto !important;
    break-inside: avoid;
    object-fit: contain !important;
}

.gallery-cont,
.gallery-img {
    max-width: 100% !important;
    height: auto !important;
    break-inside: avoid;
}

/* ---- BLOCCHI ---- */
pre, blockquote {
    border: 1px solid #999;
    break-inside: avoid;
}

.print-nobreak,
.scheda-mappa {
    break-inside: avoid;
}

tr, iframe {
    break-inside: avoid;
}

/* ---- FORM ---- */
.input-group,
.mb-3 {
    break-inside: avoid;
}

input, textarea, select, .form-control, .form-select {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    padding: 0 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    pointer-events: none;
}

select option,
.form-select option { display: none !important; }
select option:checked,
.form-select option:checked { display: block !important; }

.print-select {
    display: inline-block !important;
    white-space: normal !important;
    border: none !important;
    background: transparent !important;
}

/* ---- TABELLE ---- */
table {
    max-width: 100%;
    margin-bottom: 20px;
    border-collapse: collapse !important;
    border: 1px solid #808080 !important;
}

th, td {
    border: 1px solid #808080 !important;
    padding: 4px 6px;
    background-color: #fff !important;
}

thead {
    display: table-header-group; /* ripete thead su ogni pagina */
}

.table-dark {
    color: inherit;
}

.table-dark th,
.table-dark td,
.table-dark thead th {
    border-color: #dee2e6 !important;
    background-color: #fff !important;
    color: #000 !important;
}

/* ---- COMPONENTI BS5 ---- */

/* Tab: mostra tutti i pannelli */
.tab-content > .tab-pane {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Accordion / Collapse: espandi tutto */
.accordion-collapse,
.collapse,
.collapsing {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Rimuovi lo stile "chiuso" dell'accordion header */
.accordion-button::after {
    display: none !important;
}

.accordion-button {
    break-after: avoid;
}

.accordion-item {
    break-inside: avoid;
    border: 1px solid #808080 !important;
    margin-bottom: 4px;
}

/* Boxoverlay */
.boxoverlay .boxcontent {
    position: relative;
    z-index: 1;
    top: unset;
    left: unset;
    height: auto;
    width: 100%;
}

.slidetop-cont .titolohover {
    position: relative;
}

/* ---- NASCONDI ELEMENTI ---- */
.noprint,
.d-print-none,
.socialbar,
.parallaxBg,
.segnapagine,
.boxlink,
.owl-next,
.owl-prev,
.navbar,
.modal,
.offcanvas,
.tooltip,
.popover {
    display: none !important;
}

#print,
.only4print {
    display: block !important;
}

/* ---- UTILITY BS5 ---- */
.d-print-block  { display: block !important; }
.d-print-flex   { display: flex !important; }
.d-print-inline-block { display: inline-block !important; }

/* ---- GRID BS5 IN STAMPA (flexbox-safe) ---- */
.row {
    display: flex !important;
    flex-wrap: wrap !important;
}

[class*="col-"] {
    flex: 0 0 auto;
    float: none;
}

/* col-* generiche (senza breakpoint) */
.col-1  { width: 8.3333% }
.col-2  { width: 16.6667% }
.col-3  { width: 25% }
.col-4  { width: 33.3333% }
.col-5  { width: 41.6667% }
.col-6  { width: 50% }
.col-7  { width: 58.3333% }
.col-8  { width: 66.6667% }
.col-9  { width: 75% }
.col-10 { width: 83.3333% }
.col-11 { width: 91.6667% }
.col-12 { width: 100% }

/* col-sm-* */
.col-sm-1  { width: 8.3333% }
.col-sm-2  { width: 16.6667% }
.col-sm-3  { width: 25% }
.col-sm-4  { width: 33.3333% }
.col-sm-5  { width: 41.6667% }
.col-sm-6  { width: 50% }
.col-sm-7  { width: 58.3333% }
.col-sm-8  { width: 66.6667% }
.col-sm-9  { width: 75% }
.col-sm-10 { width: 83.3333% }
.col-sm-11 { width: 91.6667% }
.col-sm-12 { width: 100% }

/* col-md-* */
.col-md-1  { width: 8.3333% }
.col-md-2  { width: 16.6667% }
.col-md-3  { width: 25% }
.col-md-4  { width: 33.3333% }
.col-md-5  { width: 41.6667% }
.col-md-6  { width: 50% }
.col-md-7  { width: 58.3333% }
.col-md-8  { width: 66.6667% }
.col-md-9  { width: 75% }
.col-md-10 { width: 83.3333% }
.col-md-11 { width: 91.6667% }
.col-md-12 { width: 100% }

/* col-lg-* */
.col-lg-1  { width: 8.3333% }
.col-lg-2  { width: 16.6667% }
.col-lg-3  { width: 25% }
.col-lg-4  { width: 33.3333% }
.col-lg-5  { width: 41.6667% }
.col-lg-6  { width: 50% }
.col-lg-7  { width: 58.3333% }
.col-lg-8  { width: 66.6667% }
.col-lg-9  { width: 75% }
.col-lg-10 { width: 83.3333% }
.col-lg-11 { width: 91.6667% }
.col-lg-12 { width: 100% }

/* col-xl-* */
.col-xl-1  { width: 8.3333% }
.col-xl-2  { width: 16.6667% }
.col-xl-3  { width: 25% }
.col-xl-4  { width: 33.3333% }
.col-xl-5  { width: 41.6667% }
.col-xl-6  { width: 50% }
.col-xl-7  { width: 58.3333% }
.col-xl-8  { width: 66.6667% }
.col-xl-9  { width: 75% }
.col-xl-10 { width: 83.3333% }
.col-xl-11 { width: 91.6667% }
.col-xl-12 { width: 100% }

.col, .col-auto {
    width: auto;
    flex: 1 1 auto;
}

.col-md, .col-lg, .col-xl {
    flex: 1 1 auto;
    width: auto;
}
