/* ===== RESET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: Arial, sans-serif;
    background: #525659;
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}
/* ===== COVER & BIODATA STYLES ===== */
.cover-frame {
    border: 4px solid #1e7e34;
    outline: 1px solid #1e7e34;
    outline-offset: -8px;
    height: 100%;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    text-align: center;
    position: relative;
}
.cover-title {
    font-family: 'Comic Sans MS', 'Chalkboard SE', sans-serif;
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 1px;
    margin-top: 20px;
}
.cover-logo {
    width: 90px;
    height: 100px;
    background: #fff;
    border: 2px solid #000;
    border-radius: 50% / 60% 60% 40% 40%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    box-shadow: 2px 3px 5px rgba(0,0,0,0.2);
    margin: 20px 0;
}
.cover-logo-inner {
    width: 60px;
    height: 60px;
    background: #6f42c1;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffd700;
    font-size: 8px;
}
.cover-declaration {
    font-family: 'Times New Roman', serif;
    font-size: 14px;
    line-height: 1.8;
    margin: 20px 0;
}
.cover-declaration h3 {
    font-family: 'Comic Sans MS', cursive;
    font-size: 16px;
    margin-bottom: 10px;
    text-decoration: underline;
}
.cover-declaration ul {
    list-style: none;
    text-align: left;
    display: inline-block;
    font-weight: bold;
    font-size: 13px;
}
.cover-declaration ul li::before { content: "👑 "; }
.cover-name-box {
    border: 2px solid #000;
    border-radius: 10px;
    padding: 10px 40px;
    font-family: 'Comic Sans MS', cursive;
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 30px;
    box-shadow: 2px 2px 0px rgba(0,0,0,0.1);
}
.bio-title {
    font-family: 'Comic Sans MS', 'Chalkboard SE', sans-serif;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 20px;
    text-transform: uppercase;
}
table.bio-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}
table.bio-table td {
    border: 1px dashed #888;
    padding: 6px 8px;
    vertical-align: middle;
}
table.bio-table tr td:nth-child(1) { width: 180px; }
table.bio-table tr td:nth-child(2) { width: 15px; text-align: center; }
.photo-box {
    width: 110px;
    height: 140px;
    border: 2px solid #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #666;
    text-align: center;
    margin-top: 15px;
}
/*==== BAR KONTROL ATAS ===== */
.control-bar {
    width: 210mm;
    background: #1a3c5e;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}
.control-info {
    font-size: 13px;
    line-height: 1.5;
}
.control-info b { color: #ffd700; }
.btn-save {
    background: #10b981;
    color: white;
    border: none;
    padding: 12px 22px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.btn-save:hover { background: #059669; transform: translateY(-1px); }
/* ===== SIMULASI KERTAS A4 ===== */
.page-sheet {
    width: 210mm;
    min-height: 297mm;
    max-height: 297mm;
    background: white;
    padding: 12mm 15mm;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}
/* ===== EFEK EDIT DI LAYAR ===== */
@media screen {
    [contenteditable="true"] {
        transition: background 0.2s, outline 0.2s;
        border-radius: 2px;
        padding: 0 2px;
    }
    [contenteditable="true"]:hover {
        background-color: #fff3cd;
    }
    [contenteditable="true"]:focus {
        background-color: #fff3cd;
        outline: 1px dashed #ffa500;
    }
    .check-cell {
        cursor: pointer;
        user-select: none;
    }
    .check-cell:hover {
        background-color: #d1e7dd !important;
    }
}
/* ===== HEADER KOTAK MELENGKUNG ===== */
.header-box {
    border: 2px solid #000;
    border-radius: 12px;
    padding: 8px 10px;
    text-align: center;
    margin-bottom: 12px;
}
.header-box h1 {
    font-family: 'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', sans-serif;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 1px;
    line-height: 1.3;
}
/* ===== STUDENT INFO ===== */
.student-info {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 6px;
}
.info-col { display: flex; flex-direction: column; gap: 4px; }
.info-row { display: flex; }
.info-label { width: 110px; }
.info-sep { width: 15px; text-align: center; }
.divider-thick {
    border-bottom: 2.5px solid #000;
    margin-bottom: 10px;
}
/* ===== SECTION TITLES ===== */
.section-title {
    font-family: 'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', sans-serif;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    margin: 8px 0 6px 0;
    text-transform: uppercase;
}
/* ===== TABEL UMUM ===== */
table.custom-table {
    width: 100%;
    border-collapse: collapse;
    border: 2px solid #000;
    font-size: 10.5px;
    margin-bottom: 6px;
}
table.custom-table th,
table.custom-table td {
    border: 1px solid #000;
    padding: 2.5px 5px;
    vertical-align: middle;
}
table.custom-table th {
    background-color: #b4c6e7 !important;
    font-weight: bold;
    text-align: center;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.col-no { width: 28px; text-align: center; font-weight: bold; }
.check-cell { width: 32px; text-align: center; font-weight: bold; font-size: 13px; }
.row-header {
    background-color: #b4c6e7 !important;
    font-weight: bold;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}
.sub-item { padding-left: 12px; }
/* ===== TABEL TAHFIDZ ===== */
table.tahfidz-table {
    width: 100%;
    border-collapse: collapse;
    border: 2px solid #000;
    font-size: 10.5px;
    margin-bottom: 5px;
}
table.tahfidz-table th,
table.tahfidz-table td {
    border: 1px solid #000;
    padding: 4px 4px;
}
table.tahfidz-table th {
    background-color: #ffffff;
    font-weight: bold;
    text-align: center;
}
table.tahfidz-table td:nth-child(1) { text-align: center; font-weight: bold; width: 35px; }
table.tahfidz-table td:nth-child(2) { font-weight: bold; }
/* ===== READING & ADDITIONAL PROGRAM ===== */
.grid-2col {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 10px;
    margin-bottom: 15px;
}
.prog-box { flex: 1; }
.prog-title { font-weight: bold; font-size: 13px; margin-bottom: 5px; }
table.prog-table {
    width: 100%;
    border-collapse: collapse;
    border: 2px solid #000;
    font-size: 11px;
}
table.prog-table th,
table.prog-table td {
    border: 1px solid #000;
    padding: 3.5px 6px;
    text-align: center;
}
table.prog-table td:nth-child(2) { text-align: left; }
/* ===== PROGRESS & ATTENDANCE ===== */
.prog-att-grid {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    font-size: 12px;
}
.progress-list { display: flex; flex-direction: column; gap: 4px; }
.progress-list .title { font-style: italic; font-weight: bold; margin-bottom: 2px; }

.attendance-box { width: 220px; }
.attendance-box .title { font-weight: bold; margin-bottom: 5px; }
table.att-table {
    width: 100%;
    border-collapse: collapse;
    border: 2px solid #000;
    font-size: 11px;
}
table.att-table td {
    border: 1px solid #000;
    padding: 3px 6px;
}
table.att-table td:nth-child(1) { text-align: center; font-weight: bold; width: 25px; }
table.att-table td:nth-child(3) { text-align: center; width: 40px; font-weight: bold; }
/* ===== MESSAGE FOR PARENT ===== */
.message-section { margin-bottom: 20px; }
.message-title {
    text-align: center;
    font-weight: bold;
    font-size: 13.5px;
    margin-bottom: 6px;
}
.message-box {
    border: 1.5px solid #000;
    border-radius: 15px;
    padding: 12px 18px;
    font-size: 12px;
    line-height: 1.5;
    text-align: justify;
    min-height: 90px;
}
/* ===== SIGNATURES ===== */
.signatures {
    display: grid;
    grid-template-columns: 1fr 1fr;
    row-gap: 30px;
    font-size: 12px;
    margin-top: 10px;
}
.sign-left { text-align: left; }
.sign-right { text-align: center; }
.sign-name {
    font-weight: bold;
    margin-top: 45px;
}
.underline { text-decoration: underline; }
.nuks-text { font-size: 10px; font-weight: bold; margin-top: 2px; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
/* ===== PRINT ===== */
@media print {
    @page {
        size: A4 portrait;
        margin: 0mm !important; 
    }
    body { 
        background: white; 
        padding: 0; 
        margin: 0;
        gap: 0;
    }
    .control-bar { 
        display: none !important;
    }
    .page-sheet {
        width: 210mm;
        height: 297mm;
        max-height: 297mm;
        padding: 12mm 15mm;
        box-shadow: none;
        margin: 0;
        border: none;
        page-break-after: always;
        break-after: page;
    }
    .page-sheet:last-child {
        page-break-after: avoid !important;
        break-after: avoid !important;
    }
    table.custom-table th,
    .row-header {
        background-color: #b4c6e7 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}