/* =============================================================
   OBD-Finder — Print-Stylesheet (A4)
   Wird via <link rel="stylesheet" media="print"> eingebunden.
   Optimiert für: Detail-Ansicht in der Garage ausdrucken.
   ============================================================= */

@page {
    size: A4 portrait;
    margin: 12mm 14mm 14mm 14mm;
}

@media print {

    /* ---------- Globale Reset-Regeln ----------------------------- */
    *,
    *::before,
    *::after {
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
        filter: none !important;
        animation: none !important;
        transition: none !important;
    }

    html, body {
        background: #fff !important;
        color: #000 !important;
        font-family: Georgia, "Times New Roman", serif !important;
        font-size: 12pt;
        line-height: 1.45;
        margin: 0;
        padding: 0;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* ---------- Theme-Chrome verstecken -------------------------- */
    header,
    footer,
    nav,
    aside,
    .site-header,
    .site-footer,
    .site-navigation,
    .main-navigation,
    .secondary-navigation,
    .menu-toggle,
    .breadcrumbs,
    .sidebar,
    .widget-area,
    .cookie-banner,
    #cookie-notice,
    #wpadminbar,
    .skip-link,
    .screen-reader-text,
    .sof-attribution {
        display: none !important;
    }

    /* ---------- Plugin-spezifisch ausblenden --------------------- */
    .sof-search,
    .sof-search-form,
    .sof-search-input,
    .sof-suggestions,
    .sof-filter,
    .sof-filter-bar,
    .sof-cat-tabs,
    .sof-related,
    .sof-corr-form,
    .sof-corr-toggle,
    .sof-photo-uploader,
    .sof-adapter-rec,
    .sof-faq,
    .sof-brand-grid,
    .sof-back,
    .sof-share,
    .sof-print-button,
    button,
    input,
    select,
    textarea {
        display: none !important;
    }

    /* ---------- Hauptbereich groß rendern ------------------------ */
    #sof-app,
    .sof-detail,
    .sof-print-area {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
    }

    /* ---------- Kopfzeile ---------------------------------------- */
    .sof-print-header {
        display: block !important;
        border-bottom: 2px solid #000;
        padding-bottom: 6mm;
        margin-bottom: 8mm;
    }

    .sof-print-header h1,
    .sof-detail h1,
    .sof-detail-title {
        font-size: 22pt !important;
        font-weight: bold !important;
        margin: 0 0 4mm !important;
        line-height: 1.15 !important;
    }

    .sof-detail-meta,
    .sof-print-meta {
        font-size: 11pt !important;
        color: #333 !important;
        margin: 0 0 2mm !important;
    }

    /* ---------- Bild groß und zentriert -------------------------- */
    .sof-detail-image,
    .sof-print-image,
    figure {
        display: block !important;
        text-align: center !important;
        margin: 0 auto 8mm !important;
        page-break-inside: avoid;
    }

    .sof-detail-image img,
    .sof-print-image img,
    figure img,
    img.sof-image {
        max-width: 100% !important;
        max-height: 110mm !important;
        width: auto !important;
        height: auto !important;
        display: block !important;
        margin: 0 auto !important;
        border: 1px solid #000 !important;
        page-break-inside: avoid;
        filter: contrast(1.1) !important;
    }

    figcaption,
    .sof-image-caption {
        font-size: 10pt !important;
        font-style: italic;
        margin-top: 2mm !important;
        text-align: center;
    }

    /* ---------- Anleitungstext gut lesbar ------------------------ */
    .sof-detail-instructions,
    .sof-print-instructions {
        font-size: 13pt !important;
        line-height: 1.6 !important;
        margin: 0 0 8mm !important;
        page-break-inside: avoid;
    }

    .sof-detail-instructions h2,
    .sof-print-instructions h2 {
        font-size: 16pt !important;
        font-weight: bold !important;
        margin: 0 0 3mm !important;
        border-bottom: 1px solid #000;
        padding-bottom: 1mm;
    }

    .sof-detail-instructions p,
    .sof-print-instructions p {
        margin: 0 0 3mm !important;
    }

    .sof-detail-instructions ul,
    .sof-detail-instructions ol {
        margin: 0 0 3mm 6mm !important;
        padding: 0 !important;
    }

    .sof-detail-instructions li {
        margin: 0 0 2mm !important;
    }

    /* ---------- Steckertyp / Position als Box -------------------- */
    .sof-detail-position,
    .sof-print-position {
        border: 1.5pt solid #000 !important;
        padding: 4mm 5mm !important;
        margin: 0 0 6mm !important;
        page-break-inside: avoid;
    }

    .sof-detail-position dt {
        font-weight: bold !important;
        display: inline-block;
        min-width: 32mm;
    }

    .sof-detail-position dd {
        display: inline;
        margin: 0;
    }

    /* ---------- QR-Code-Platzhalter ------------------------------ */
    .sof-print-qr {
        display: block !important;
        position: fixed;
        bottom: 8mm;
        right: 14mm;
        width: 24mm;
        height: 24mm;
        border: 1pt solid #000 !important;
        text-align: center;
        font-size: 7pt;
        line-height: 24mm;
        color: #555 !important;
        background: repeating-linear-gradient(
            45deg,
            #fff,
            #fff 2px,
            #ddd 2px,
            #ddd 4px
        ) !important;
    }

    .sof-print-qr-caption {
        position: fixed;
        bottom: 4mm;
        right: 14mm;
        width: 24mm;
        text-align: center;
        font-size: 7pt;
        color: #555 !important;
    }

    /* ---------- Footer mit URL ----------------------------------- */
    .sof-print-footer {
        display: block !important;
        position: fixed;
        bottom: 4mm;
        left: 14mm;
        font-size: 8pt !important;
        color: #555 !important;
    }

    .sof-print-footer a {
        text-decoration: none !important;
    }

    /* ---------- Links: URL hinter dem Text ausgeben -------------- */
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 9pt;
        color: #555 !important;
        word-break: break-all;
    }
    a[href^="#"]:after,
    a[href^="javascript:"]:after,
    .sof-detail a[href]:after {
        content: "";
    }

    /* ---------- Page-Breaks zähmen ------------------------------- */
    h1, h2, h3 {
        page-break-after: avoid;
    }
    img, table, figure, .sof-detail-position {
        page-break-inside: avoid;
    }
    p, li, blockquote {
        orphans: 3;
        widows: 3;
    }
}
