@media print {
    /* Seitenkonfiguration für DIN A4 */
    @page {
        size: A4 portrait;
        margin: 10mm 15mm;
    }

    /* Allgemeine Einstellungen */
    * {
        box-sizing: border-box;
    }

    body {
        margin: 0;
        padding: 0;
        font-size: 9pt;
        line-height: 1.2;
        color: #000;
        background: #fff;
    }

    /* Container */
    .form-container {
        max-width: 100%;
        margin: 0;
        padding: 0;
    }

    /* Verstecke unnötige Elemente */
    button,
    .signature-clear,
    #print-button,
    nav,
    .no-print {
        display: none !important;
    }

    /* Überschrift */
    .heading-container {
        text-align: center;
        margin-bottom: 10px;
        page-break-after: avoid;
    }

    .heading-container h2,
    .heading-container h5 {
        margin: 3px 0;
        font-size: 13pt;
        font-weight: bold;
    }

    .heading-container img.logo {
        max-width: 120px;
        height: auto;
        display: block;
        margin: 0 auto 5px;
    }

    /* Formular-Elemente */
    form {
        margin: 0;
        padding: 0;
    }

    .form-row {
        display: flex;
        gap: 15px;
        margin-bottom: 6px;
        page-break-inside: avoid;
    }

    .form-row > div {
        flex: 1;
        min-width: 0;
    }

    .form-group {
        margin-bottom: 6px;
        page-break-inside: avoid;
    }

    /* Labels und Inputs */
    label {
        font-weight: bold;
        font-size: 8pt;
        display: block;
        margin-bottom: 1px;
    }

    input[type="text"],
    input[type="date"],
    input[type="email"],
    input[type="tel"],
    textarea,
    .form-control {
        width: 100%;
        padding: 2px 4px;
        border: 1px solid #333;
        background: #fff;
        font-size: 8pt;
        line-height: 1.2;
        margin: 0;
    }

    textarea {
        min-height: 40px;
        resize: none;
    }

    /* Checkboxen */
    input[type="checkbox"] {
        width: 12px;
        height: 12px;
        margin: 0;
        vertical-align: middle;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .checkbox-with-input {
        margin-bottom: 4px;
        page-break-inside: avoid;
    }

    .checkbox-with-input label {
        display: inline;
        font-weight: normal;
        margin: 0;
    }

    /* Section Title */
    .section-title {
        font-weight: bold;
        font-size: 9pt;
        margin-top: 8px;
        margin-bottom: 4px;
        border-bottom: 1px solid #333;
        padding-bottom: 2px;
        page-break-after: avoid;
    }

    /* Unterschriftenbereich */
    .signatures {
        display: flex;
        gap: 20px;
        margin-top: 10px;
        page-break-inside: avoid;
    }

    .signature-block {
        flex: 1;
        page-break-inside: avoid;
    }

    .signature-block label {
        font-size: 8pt;
        margin-bottom: 2px;
    }

    .signature-pad {
        border: 1px solid #333;
        background: #fff;
        min-height: 60px;
        margin-bottom: 3px;
        page-break-inside: avoid;
    }

    canvas {
        display: block;
        width: 100%;
        height: auto;
        min-height: 60px;
    }

    /* Datum und Ort */
    p strong {
        font-size: 9pt;
    }

    /* Verhindere Seitenumbrüche in kritischen Bereichen */
    section {
        page-break-inside: avoid;
    }

    /* Kompakte Darstellung */
    h1, h2, h3, h4, h5, h6 {
        margin: 5px 0;
        page-break-after: avoid;
    }

    p {
        margin: 3px 0;
    }

    /* Farbkorrektur für Druck */
    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Kleine Anpassungen für bessere Platznutzung */
    .form-row input,
    .form-row textarea {
        font-size: 8pt;
    }

    /* Verstecke Browser-Standard-Styles */
    input::-webkit-outer-spin-button,
    input::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }
}
