/**
 * worksheet-print.css
 * A4-Layout-Styles + @media print fuer Arbeitsblatt-Generierung
 */

/* ==================== A4 Container ==================== */

.worksheet-a4 {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    padding: 20mm 15mm;
    background: white;
    color: #1a1a1a;
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    font-size: 11pt;
    line-height: 1.5;
    box-sizing: border-box;
}

/* ==================== Header ==================== */

.worksheet-header {
    border-bottom: 2px solid #333;
    padding-bottom: 8mm;
    margin-bottom: 8mm;
}

.worksheet-title {
    font-size: 18pt;
    font-weight: 700;
    margin: 0 0 2mm 0;
    color: #1a1a1a;
}

.worksheet-subtitle {
    font-size: 12pt;
    font-weight: 400;
    color: #555;
    margin: 0 0 4mm 0;
}

.worksheet-header-fields {
    display: flex;
    gap: 8mm;
    margin-top: 4mm;
}

.worksheet-header-field {
    flex: 1;
    display: flex;
    align-items: baseline;
    gap: 2mm;
}

.worksheet-header-field label {
    font-weight: 600;
    font-size: 10pt;
    white-space: nowrap;
}

.worksheet-header-field .field-line {
    flex: 1;
    border-bottom: 1px solid #999;
    min-width: 30mm;
    height: 1em;
}

.worksheet-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 3mm;
    font-size: 9pt;
    color: #666;
}

.worksheet-instructions {
    margin-top: 4mm;
    padding: 3mm 4mm;
    background: #f5f5f5;
    border-left: 3px solid #333;
    font-size: 10pt;
    font-style: italic;
}

/* ==================== Exercises ==================== */

.worksheet-exercises {
    margin-top: 5mm;
}

.worksheet-exercise {
    margin-bottom: 6mm;
    break-inside: avoid;
    page-break-inside: avoid;
}

.worksheet-exercise-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2mm;
}

.worksheet-exercise-number {
    font-weight: 700;
    font-size: 12pt;
}

.worksheet-exercise-points {
    font-size: 9pt;
    color: #666;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 1px 6px;
}

.worksheet-exercise-prompt {
    margin-bottom: 3mm;
    font-size: 11pt;
}

.worksheet-exercise-formula {
    text-align: center;
    margin: 3mm 0;
    font-size: 12pt;
}

/* ==================== Answer Lines ==================== */

.worksheet-answer-lines {
    margin-top: 3mm;
}

.worksheet-answer-line {
    border-bottom: 1px solid #bbb;
    height: 10mm;
    margin-bottom: 1mm;
}

/* ==================== Answer Box ==================== */

.worksheet-answer-box {
    border: 1px solid #bbb;
    margin-top: 3mm;
    min-height: 20mm;
}

/* ==================== Multiple Choice ==================== */

.worksheet-mc-options {
    list-style: none;
    padding: 0;
    margin: 3mm 0;
}

.worksheet-mc-option {
    display: flex;
    align-items: center;
    gap: 3mm;
    margin-bottom: 2mm;
    font-size: 11pt;
}

.worksheet-mc-checkbox {
    width: 4mm;
    height: 4mm;
    border: 1.5px solid #555;
    border-radius: 1px;
    flex-shrink: 0;
}

/* ==================== Tables ==================== */

.worksheet-table {
    width: 100%;
    border-collapse: collapse;
    margin: 3mm 0;
    font-size: 10pt;
}

.worksheet-table th,
.worksheet-table td {
    border: 1px solid #999;
    padding: 2mm 3mm;
    text-align: center;
}

.worksheet-table th {
    background: #f0f0f0;
    font-weight: 600;
}

.worksheet-table td.empty-cell {
    background: #fafafa;
    min-width: 15mm;
    min-height: 8mm;
}

/* ==================== Function Graph ==================== */

.worksheet-graph-container {
    margin: 3mm auto;
    text-align: center;
}

.worksheet-graph-container svg {
    max-width: 100%;
}

/* ==================== Coordinate Grid ==================== */

.worksheet-coordinate-grid {
    margin: 3mm auto;
    text-align: center;
}

/* ==================== Subtasks ==================== */

.worksheet-subtasks {
    margin-left: 5mm;
}

.worksheet-subtask {
    margin-bottom: 4mm;
    break-inside: avoid;
    page-break-inside: avoid;
}

.worksheet-subtask-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1mm;
}

.worksheet-subtask-label {
    font-weight: 600;
}

.worksheet-subtask-points {
    font-size: 8pt;
    color: #888;
}

/* ==================== Hints & Examples ==================== */

.worksheet-hints {
    margin-top: 3mm;
    padding: 2mm 4mm;
    background: #fffbe6;
    border-left: 2px solid #f0c000;
    font-size: 9pt;
}

.worksheet-hints strong {
    font-size: 9pt;
}

.worksheet-example {
    margin-top: 2mm;
    padding: 2mm 4mm;
    background: #e8f5e9;
    border-left: 2px solid #4caf50;
    font-size: 9pt;
}

/* ==================== Footer ==================== */

.worksheet-footer {
    margin-top: 10mm;
    padding-top: 3mm;
    border-top: 1px solid #ccc;
    font-size: 8pt;
    color: #999;
    text-align: right;
}

/* ==================== Print Styles ==================== */

@media print {
    body * {
        visibility: hidden;
    }

    .worksheet-print-container,
    .worksheet-print-container * {
        visibility: visible;
    }

    .worksheet-print-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }

    .worksheet-a4 {
        width: 100%;
        min-height: auto;
        padding: 0;
        margin: 0;
        box-shadow: none;
    }

    .worksheet-exercise {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .worksheet-subtask {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .worksheet-graph-container svg {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .worksheet-instructions {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .worksheet-table th {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .worksheet-hints,
    .worksheet-example {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}

/* ==================== Preview Modal Specific ==================== */

.worksheet-preview-wrapper {
    overflow-y: auto;
    max-height: 80vh;
    background: #e0e0e0;
    padding: 20px;
    border-radius: 8px;
}

.worksheet-preview-wrapper .worksheet-a4 {
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    border-radius: 2px;
}
