/* ========================================= */
/* =====     DRUCK-STYLES (KORRIGIERT)   ===== */
/* ========================================= */

@media print {
    
    /* 1. Alles ausblenden, was nicht der Ergebnis-Container ist */
    body > * {
        display: none;
    }

    /* 2. Den Hauptcontainer (und NUR den) sichtbar machen */
    body > .container {
        display: block;
    }
    
    /* 3. Im Container den Header und alles im Content-Bereich AUSSER #results ausblenden */
    .container > .header,
    .container > .content > :not(#results) {
        display: none;
    }

    /* 4. Den Ergebnis-Block selbst anzeigen */
    .container > .content > #results {
        display: block !important;
    }
    
    /* 5. Alle Inhalte von #results standardmäßig sichtbar machen */
    #results * {
        visibility: visible;
    }
    
    /* 6. Print-spezifische Formatierungen */
    body {
        background: #fff;
        color: #000;
        font-size: 10pt;
        line-height: 1.3;
    }

    .container, .content {
        box-shadow: none;
        border: none;
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0;
    }

    /* BUGFIX: Den Print-Button explizit ausblenden */
    #printButton {
        display: none !important;
        visibility: hidden !important;
    }

    /* NEU: Druck-Zusammenfassung anzeigen und formatieren */
    .print-only {
        display: block !important;
        visibility: visible !important;
        background: #f9f9f9;
        border: 1px solid #ccc;
        padding: 15px;
        margin-bottom: 20px;
        page-break-after: auto; /* Erlaubt Umbruch nach der Box */
    }
    .print-only h2 {
        color: #000;
        border-bottom: 2px solid #000;
        font-size: 14pt;
        padding-bottom: 5px;
        margin-top: 0;
    }
    .print-summary-grid {
        display: grid;
        grid-template-columns: 1fr 1fr; /* Zwei Spalten */
        gap: 20px;
        margin-top: 10px;
    }
    .print-summary-grid h4 {
        margin-top: 0;
        margin-bottom: 5px;
        border-bottom: 1px solid #ccc;
        padding-bottom: 3px;
    }
    .print-summary-grid ul {
        list-style-type: disc;
        padding-left: 20px;
        font-size: 9pt;
        margin: 0;
    }
    .print-summary-grid .calc-params-print ul {
        list-style-type: none;
        padding-left: 0;
    }
    .print-summary-grid .calc-params-print li {
        display: flex;
        justify-content: space-between;
        border-bottom: 1px dotted #ccc;
        padding: 2px 0;
    }
    .print-summary-grid .calc-params-print li span:first-child {
        font-weight: 600;
    }


    /* Formatierung der eigentlichen Ergebnisse */
    .section h2 {
        border-bottom: 2px solid #000;
        color: #000;
        page-break-before: always; /* Ergebnisse auf neuer Seite beginnen */
        padding-top: 20px;
    }
    /* ...außer dem ersten H2 (das der Zusammenfassung) */
    .print-only h2 {
        page-break-before: auto;
        padding-top: 0;
    }

    .result-card {
        box-shadow: none;
        border: 1px solid #ccc;
        padding: 15px;
        margin-bottom: 20px;
        page-break-inside: avoid;
    }

    .result-card h3, .result-value, .alert,
    .cashflow-table th, .cashflow-table td {
        color: #000 !important;
        background: #fff !important;
    }
    
    .result-item {
        display: flex;
        justify-content: space-between;
        border-bottom: 1px solid #eee;
    }

    .cashflow-table {
        font-size: 9pt;
        border-collapse: collapse;
    }
    .cashflow-table th, .cashflow-table td {
        border: 1px solid #ccc;
        padding: 4px;
    }
}