/**
 * Datei: css/print.css
 * 
 * Allgemeine Print-Styles für alle Seiten der Anwendung.
 * Diese Datei wird automatisch eingebunden und enthält grundlegende
 * Druckstile, die auf allen Seiten gelten.
 */

/* ==========================================================================
   ALLGEMEINE PRINT-REGELN
   ========================================================================== */
@media print {
    /* Seiteneinstellungen */
    @page {
        margin: 1.5cm 1cm;
        size: auto;
    }

    /* Body & Container */
    body {
        font-size: 11pt;
        line-height: 1.4;
        color: #000;
        background: #fff;
    }

    .container,
    .container-fluid {
        max-width: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* === VERSTECKEN: UI-Elemente === */
    /* Navigation, Footer, Modals */
    nav, .navbar,
    footer, .footer,
    .no-print,
    .modal, .modal-backdrop {
        display: none !important;
    }

    /* Buttons, Formulare, Filterkontrollen */
    button, .btn,
    input[type="button"],
    input[type="submit"],
    input[type="reset"],
    .form-control,
    .form-select,
    select,
    textarea,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="date"],
    input[type="number"],
    input[type="search"],
    .form-check,
    .radio,
    .checkbox {
        display: none !important;
    }

    /* DataTables-Controls */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate,
    .dataTables_wrapper .row.mb-3,
    .dataTables_wrapper .row.mt-3 {
        display: none !important;
    }

    /* === CARDS === */
    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }

    .card-header {
        background-color: #f8f9fa !important;
        color: #000 !important;
        border-bottom: 1px solid #ddd !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* === TABELLEN === */
    table {
        width: 100%;
        border-collapse: collapse;
        font-size: 10pt;
    }

    table th,
    table td {
        padding: 0.25rem 0.35rem !important;
        border: 1px solid #999 !important;
    }

    table thead {
        display: table-header-group; /* Kopfzeile auf jeder Seite wiederholen */
    }

    table thead th {
        background-color: #e9ecef !important;
        color: #000 !important;
        font-weight: 700;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    table tbody tr {
        page-break-inside: avoid;
    }

    /* Zebra-Streifen für bessere Lesbarkeit */
    table tbody tr:nth-child(even) {
        background-color: #f8f9fa !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* === BADGES === */
    .badge {
        border: 1px solid #000 !important;
        padding: 0.15em 0.4em;
        font-weight: 600 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    /* Badge-Farben mit besserem Kontrast */
    .badge.bg-success {
        background-color: #28a745 !important;
        color: #fff !important;
        border-color: #1e7e34 !important;
    }
    .badge.bg-danger {
        background-color: #dc3545 !important;
        color: #fff !important;
        border-color: #bd2130 !important;
    }
    .badge.bg-warning {
        background-color: #ffc107 !important;
        color: #000 !important;
        border-color: #d39e00 !important;
    }
    .badge.bg-primary {
        background-color: #0d6efd !important;
        color: #fff !important;
        border-color: #0a58ca !important;
    }
    .badge.bg-secondary {
        background-color: #6c757d !important;
        color: #fff !important;
        border-color: #545b62 !important;
    }
    .badge.bg-info {
        background-color: #0dcaf0 !important;
        color: #000 !important;
        border-color: #0aa2c0 !important;
    }

    /* === LINKS === */
    a {
        text-decoration: none;
        color: #000;
    }

    /* URLs nicht als Text hinter Links drucken */
    a[href]::after {
        content: none !important;
    }

    /* === SEITENUMBRÜCHE === */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }

    /* Keine Umbrüche innerhalb wichtiger Elemente */
    .no-break,
    .keep-together {
        page-break-inside: avoid;
    }

    /* === FARBEN FÜR DRUCK OPTIMIEREN === */
    /* Bootstrap-Farben druckfreundlich machen */
    .text-primary { color: #0d6efd !important; }
    .text-success { color: #198754 !important; }
    .text-danger { color: #dc3545 !important; }
    .text-warning { color: #856404 !important; }
    .text-info { color: #055160 !important; }

    .bg-primary { background-color: #b8daff !important; color: #004085 !important; }
    .bg-success { background-color: #c3e6cb !important; color: #155724 !important; }
    .bg-danger { background-color: #f5c6cb !important; color: #721c24 !important; }
    .bg-warning { background-color: #ffe69c !important; color: #856404 !important; }
    .bg-info { background-color: #bee5eb !important; color: #0c5460 !important; }

    /* === BILDER & ICONS === */
    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }

    /* Icons eventuell verkleinern */
    .bi, .fa, .fas, .far {
        font-size: 0.9em;
    }

    /* === UTILITIES === */
    /* Margins/Paddings reduzieren für Druck */
    .mb-4, .mb-5, .my-4, .my-5 {
        margin-bottom: 1rem !important;
    }

    .mt-4, .mt-5, .my-4, .my-5 {
        margin-top: 1rem !important;
    }

    .p-4, .p-5, .px-4, .px-5, .py-4, .py-5 {
        padding: 0.5rem !important;
    }
}
