/* Professional PDF Export Styles */

@media print {
    /* Reset and base styles */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
    
    /* Page setup */
    @page {
        size: A4;
        margin: 0;
    }
    
    @page:first {
        margin: 0;
    }
    
    /* Professional cover page */
    .print-cover-page {
        display: block !important;
        page-break-after: always;
        height: 100vh;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        color: white !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 2cm !important;
        position: relative !important;
    }
    
    .print-cover-page h1 {
        font-size: 48pt !important;
        font-weight: bold !important;
        margin-bottom: 20px !important;
        color: white !important;
    }
    
    .print-cover-page .subtitle {
        font-size: 18pt !important;
        color: rgba(255, 255, 255, 0.9) !important;
        margin-bottom: 40px !important;
    }
    
    .print-cover-page .date {
        position: absolute !important;
        bottom: 2cm !important;
        font-size: 12pt !important;
        color: rgba(255, 255, 255, 0.8) !important;
    }
    
    /* Body styling */
    body {
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        color: #1a1a1a !important;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
        font-size: 10pt !important;
        line-height: 1.6 !important;
    }
    
    /* Main container with margins */
    #app, .container, main {
        margin: 1.5cm !important;
        padding: 0 !important;
    }
    
    /* Hide unnecessary elements */
    #header,
    #theme-toggle,
    #print-button,
    #mobile-menu-btn,
    #prev-btn,
    #next-btn,
    #step-dots,
    #tab-navigation,
    .onboarding-overlay,
    .help-button,
    button:not(.print-show) {
        display: none !important;
    }
    
    /* Section headers */
    h1, h2, h3 {
        color: #1a1a1a !important;
        page-break-after: avoid !important;
        margin-top: 20px !important;
        margin-bottom: 10px !important;
    }
    
    h1 {
        font-size: 24pt !important;
        border-bottom: 3px solid #667eea !important;
        padding-bottom: 10px !important;
    }
    
    h2 {
        font-size: 18pt !important;
        color: #333 !important;
    }
    
    h3 {
        font-size: 14pt !important;
        color: #555 !important;
    }
    
    /* Professional section styling */
    .print-section {
        page-break-inside: avoid !important;
        margin-bottom: 30px !important;
        padding: 20px !important;
        background: #f8f9fa !important;
        border-left: 4px solid #667eea !important;
        border-radius: 0 8px 8px 0 !important;
    }
    
    /* KPI Dashboard */
    #kpi-dashboard {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
        margin: 30px 0 !important;
        padding: 20px !important;
        background: linear-gradient(135deg, #f6f8fb 0%, #e9ecef 100%) !important;
        border-radius: 12px !important;
        page-break-inside: avoid !important;
    }
    
    #kpi-dashboard > div {
        background: white !important;
        padding: 15px !important;
        border-radius: 8px !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    }
    
    /* Charts container */
    .chart-container {
        page-break-inside: avoid !important;
        margin: 20px 0 !important;
        padding: 20px !important;
        background: white !important;
        border: 1px solid #dee2e6 !important;
        border-radius: 8px !important;
    }
    
    /* Canvas charts */
    canvas {
        max-width: 100% !important;
        height: auto !important;
        display: block !important;
        margin: 0 auto !important;
        page-break-inside: avoid !important;
    }
    
    #cashflowChart {
        max-height: 250px !important;
        width: 100% !important;
    }
    
    #kostenstrukturChart {
        max-height: 200px !important;
        max-width: 200px !important;
        margin: 0 auto !important;
    }
    
    /* Results table */
    #results-section {
        width: 100% !important;
        page-break-before: always !important;
    }
    
    table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin: 20px 0 !important;
        font-size: 9pt !important;
    }
    
    th {
        background: #667eea !important;
        color: white !important;
        padding: 10px !important;
        text-align: left !important;
        font-weight: 600 !important;
    }
    
    td {
        padding: 8px 10px !important;
        border-bottom: 1px solid #dee2e6 !important;
    }
    
    tr:nth-child(even) {
        background: #f8f9fa !important;
    }
    
    /* Input fields display */
    input, select, textarea {
        border: none !important;
        background: transparent !important;
        font-weight: 600 !important;
        color: #1a1a1a !important;
        padding: 0 !important;
    }
    
    input[type="number"]:after,
    input[type="text"]:after {
        content: attr(value) !important;
    }
    
    /* Label styling */
    label {
        color: #666 !important;
        font-size: 9pt !important;
        font-weight: normal !important;
    }
    
    /* Value highlighting */
    .value-display {
        font-size: 14pt !important;
        font-weight: bold !important;
        color: #1a1a1a !important;
    }
    
    /* Profit indicators */
    .profit-positive {
        color: #28a745 !important;
        font-weight: bold !important;
    }
    
    .profit-negative {
        color: #dc3545 !important;
        font-weight: bold !important;
    }
    
    /* Warning boxes */
    .warning-box {
        background: #fff3cd !important;
        border-left: 4px solid #ffc107 !important;
        padding: 10px !important;
        margin: 10px 0 !important;
        page-break-inside: avoid !important;
    }
    
    /* Footer */
    .print-footer {
        display: block !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        padding: 10px 2cm !important;
        background: #f8f9fa !important;
        border-top: 1px solid #dee2e6 !important;
        font-size: 9pt !important;
        color: #666 !important;
    }
    
    /* Page numbers */
    .page-number:after {
        content: counter(page) !important;
        position: fixed !important;
        bottom: 1cm !important;
        right: 1cm !important;
        font-size: 10pt !important;
        color: #666 !important;
    }
    
    /* Force visibility for all main content ONLY IN PRINT */
    #calculator-tab,
    #cashflow-tab,
    #analysis-tab,
    #results-section,
    #warnings-container,
    #current-step-header,
    #input-fields-container,
    #step-fields,
    #important-metrics,
    #kostendetails,
    .hidden {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
    }
    
    /* Override Tailwind hidden class */
    .hidden {
        display: block !important;
    }
    
    /* Ensure tabs are visible */
    .tab-content {
        display: block !important;
        opacity: 1 !important;
    }
    
    /* Professional spacing between sections */
    #calculator-tab {
        page-break-after: always !important;
    }
    
    #cashflow-tab {
        page-break-before: always !important;
        page-break-after: always !important;
    }
    
    #analysis-tab {
        page-break-before: always !important;
    }
    
    /* Ensure proper chart rendering */
    .chartjs-render-monitor {
        animation: none !important;
    }
    
    /* ROI display in center of donut chart */
    #center-roi-value,
    .roi-display {
        color: #1a1a1a !important;
        font-size: 24pt !important;
        font-weight: bold !important;
    }
    
    /* Mini chart should be hidden in print */
    #miniKostenChart {
        display: none !important;
    }
    
    /* Gradient text for headers */
    .gradient-text {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        -webkit-background-clip: text !important;
        -webkit-text-fill-color: transparent !important;
        background-clip: text !important;
    }
}