/* ==============================================================================
   CSS Cetak Kertas A4 Presisi - Sistem Penilaian KIK SMK (Kelas XI AK 3)
   ============================================================================== */

@page {
    size: A4 portrait;
    margin: 10mm 12mm 10mm 12mm;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: #1e293b;
    background-color: #f1f5f9;
    font-size: 11px;
    line-height: 1.35;
}

/* Floating Toolbar for Screen View */
.print-toolbar {
    background: #0f172a;
    color: #ffffff;
    padding: 12px 24px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.toolbar-content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.toolbar-info strong {
    display: block;
    font-size: 14px;
    color: #38bdf8;
}

.toolbar-info span {
    font-size: 12px;
    color: #94a3b8;
}

.toolbar-actions {
    display: flex;
    gap: 10px;
}

.btn-print {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
    transition: all 0.2s ease;
}

.btn-print:hover {
    background: linear-gradient(135deg, #047857, #059669);
    transform: translateY(-1px);
}

.btn-back {
    background: #334155;
    color: #e2e8f0;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: background 0.2s;
}

.btn-back:hover {
    background: #475569;
    color: #ffffff;
}

/* Paper Container */
.sheet-a4 {
    width: 210mm;
    min-height: 297mm;
    margin: 20px auto;
    background: #ffffff;
    padding: 12mm 15mm;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    border-radius: 2px;
    position: relative;
}

/* KOP SURAT DINAS */
.kop-surat {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-bottom: 6px;
}

.kop-logo .logo-circle {
    width: 60px;
    height: 60px;
    background: #0f766e;
    color: white;
    font-size: 16px;
    font-weight: 800;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px double #0d9488;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.kop-teks {
    text-align: center;
}

.kop-teks h3 {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #0f172a;
}

.kop-teks h4 {
    font-size: 11px;
    font-weight: 600;
    color: #334155;
}

.kop-teks h2 {
    font-size: 16px;
    font-weight: 800;
    color: #0f766e;
    letter-spacing: 1px;
    margin: 2px 0;
}

.kop-teks p {
    font-size: 9.5px;
    font-weight: 600;
    color: #475569;
}

.kop-teks .kop-sub {
    font-size: 8.5px;
    font-weight: 400;
    color: #64748b;
}

.kop-garis {
    border-top: 2.5px solid #0f172a;
    border-bottom: 1px solid #0f172a;
    height: 4px;
    margin-bottom: 10px;
}

/* Header Dokumen */
.doc-header {
    text-align: center;
    margin-bottom: 10px;
}

.doc-title {
    font-size: 12.5px;
    font-weight: 800;
    color: #0f172a;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.doc-sub {
    font-size: 10px;
    color: #475569;
    font-weight: 500;
    margin-top: 2px;
}

/* Info Kelompok */
.table-info {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    font-size: 10px;
}

.table-info td {
    padding: 4px 8px;
    border: 1px solid #e2e8f0;
}

.badge-product {
    color: #0f766e;
    font-size: 11px;
    font-weight: 700;
}

.status-passed {
    display: inline-block;
    background: #dcfce7;
    color: #166534;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 700;
    font-size: 9px;
}

.status-pending {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 700;
    font-size: 9px;
}

/* Section Header */
.section-title {
    background: #0f766e;
    color: white;
    font-size: 9.5px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 2px;
    margin: 8px 0 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tables */
.table-data {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 8px;
    font-size: 9.5px;
}

.table-data th {
    background: #f1f5f9;
    color: #0f172a;
    border: 1px solid #94a3b8;
    padding: 4px 6px;
    font-weight: 700;
    text-align: center;
}

.table-data td {
    border: 1px solid #cbd5e1;
    padding: 3.5px 6px;
    vertical-align: middle;
}

.table-data .row-subtotal td {
    background: #f8fafc;
    font-weight: 600;
}

.table-data .row-total td {
    background: #e2e8f0;
    font-weight: 800;
    font-size: 10px;
    color: #0f172a;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: #64748b; }

/* Rekap Final */
.rekap-container {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 10px;
    margin-bottom: 8px;
    align-items: stretch;
}

.rekap-calc {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    padding: 6px 10px;
    border-radius: 3px;
    font-size: 9.5px;
}

.formula-box {
    background: #e6fffa;
    color: #0d9488;
    border: 1px dashed #2dd4bf;
    padding: 4px 8px;
    margin: 4px 0;
    border-radius: 3px;
    font-size: 9px;
}

.table-mini {
    width: 100%;
    margin-top: 4px;
    font-size: 9.5px;
}

.table-mini td {
    padding: 2px 0;
}

.rekap-final-box {
    background: linear-gradient(135deg, #0f766e, #115e59);
    color: #ffffff;
    border-radius: 4px;
    padding: 6px 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.label-final {
    font-size: 8.5px;
    letter-spacing: 0.8px;
    opacity: 0.9;
    font-weight: 600;
}

.score-big {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
    margin: 2px 0;
    color: #ffffff;
}

.badge-grade {
    background: rgba(255,255,255,0.2);
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 700;
    display: inline-block;
    margin-bottom: 2px;
}

.badge-predicate {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #99f6e4;
}

/* Feedback Grid */
.feedback-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 9px;
}

.feedback-col strong {
    display: block;
    margin-bottom: 2px;
    color: #334155;
}

.feedback-box {
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    padding: 6px 8px;
    border-radius: 3px;
    min-height: 60px;
    font-size: 8.5px;
    line-height: 1.35;
    color: #334155;
}

.ai-box pre {
    white-space: pre-wrap;
    font-family: inherit;
    font-size: 8.5px;
    color: #0f766e;
}

/* Tanda Tangan */
.ttd-wrapper {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    page-break-inside: avoid;
}

.ttd-col {
    width: 42%;
    text-align: center;
    font-size: 9.5px;
}

.ttd-space {
    height: 48px;
}

.ttd-name {
    font-size: 10.5px;
    font-weight: 700;
    color: #0f172a;
}

.ttd-nip {
    font-size: 9px;
    color: #475569;
}

/* Media Print Rules */
@media print {
    body {
        background-color: #ffffff !important;
    }

    .no-print {
        display: none !important;
    }

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

    .section-title {
        background: #0f766e !important;
        color: white !important;
    }

    .table-data th {
        background: #f1f5f9 !important;
    }

    .rekap-final-box {
        background: #0f766e !important;
        color: white !important;
    }

    .row-total td {
        background: #e2e8f0 !important;
    }
}
