/* ==========================================================
   CBT KIBI V1.6.5 - Answer & Teaser Preview Styling (FULLY SYNCED)
   Integrasi UI V1.5 + Logika Teaser & Paywall V1.6
   ========================================================== */

/* ----------------------------------------------------------
   1. Container Utama & Watermark
   ---------------------------------------------------------- */
.preview-container {
    position: relative;
    max-width: 900px;
    margin: 20px auto;
    padding: 24px;
    background: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: #334155;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

/* Watermark Latar Belakang */
.watermark-bg {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-35deg);
    font-size: 75px;
    font-weight: 900;
    color: rgba(0, 0, 0, 0.035);
    pointer-events: none;
    z-index: 0;
    white-space: nowrap;
    user-select: none;
}

.preview-content-wrapper {
    position: relative;
    z-index: 1;
}

/* ----------------------------------------------------------
   2. Header & Kop Surat
   ---------------------------------------------------------- */
.kop-surat {
    display: flex;
    align-items: center;
    border-bottom: 2px solid #cbd5e1;
    padding-bottom: 16px;
    margin-bottom: 20px;
    gap: 16px;
}

.kop-logo {
    max-height: 60px;
    width: auto;
    object-fit: contain;
}

.kop-info {
    flex: 1;
}

.kop-info h2 {
    margin: 0 0 4px 0;
    font-size: 22px;
    color: #1e293b;
    font-weight: 700;
}

.kop-info h4 {
    margin: 0 0 4px 0;
    font-size: 15px;
    color: #475569;
    font-weight: 600;
}

.kop-info p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

/* ----------------------------------------------------------
   3. Kartu Identitas Peserta (Student Summary Card)
   ---------------------------------------------------------- */
.student-summary-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 20px;
    font-size: 13.5px;
    color: #334155;
}

.student-summary-card div strong {
    color: #1e293b;
}

/* ----------------------------------------------------------
   4. Action Bar & Filter Pembahasan
   ---------------------------------------------------------- */
.preview-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f1f5f9;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
}

.badge-preview {
    font-weight: 600;
    color: #334155;
    font-size: 13.5px;
}

.btn-print-preview {
    padding: 8px 16px;
    background: #475569;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s ease, transform 0.1s ease;
}

.btn-print-preview:hover {
    background: #334155;
}

.btn-print-preview:active {
    transform: scale(0.98);
}

/* ----------------------------------------------------------
   5. Card & Meta Soal Pembahasan
   ---------------------------------------------------------- */
.card-preview-soal {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.badge-meta-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.badge-meta {
    background: #e2e8f0;
    color: #334155;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.soal-text {
    font-size: 15px;
    color: #0f172a;
    line-height: 1.6;
    margin-bottom: 12px;
}

.soal-text img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    margin-top: 8px;
}

/* ----------------------------------------------------------
   6. Styling Detail Opsi Jawaban (Tipe 1A, 2A, 5A & Tabel 4A)
   ---------------------------------------------------------- */
.review-options-list {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.review-option-item {
    padding: 9px 12px;
    border-radius: 6px;
    font-size: 13.5px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #334155;
    line-height: 1.4;
}

/* Modifier Status Opsi */
.review-option-item.opt-correct {
    background: #dcfce7;
    border: 1.5px solid #16a34a;
    font-weight: 600;
    color: #14532d;
}

.review-option-item.opt-wrong {
    background: #fee2e2;
    border: 1.5px solid #dc2626;
    font-weight: 600;
    color: #7f1d1d;
}

.review-option-item.opt-selected {
    background: #eff6ff;
    border: 1.5px solid #2563eb;
    font-weight: 600;
    color: #1e40af;
}

/* Tabel Checklist Matriks (Tipe 4A) */
.table-4a-wrapper {
    overflow-x: auto;
    margin-top: 10px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
}

.table-4a {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.table-4a th {
    background: #f1f5f9;
    color: #334155;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    font-weight: 600;
}

.table-4a td {
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
}

.table-4a tr.row-correct {
    background: #f0fdf4;
}

.table-4a tr.row-wrong {
    background: #fef2f2;
}

/* ----------------------------------------------------------
   7. Box Jawaban Peserta & Pembahasan Text
   ---------------------------------------------------------- */
.box-jawaban {
    background: #f8fafc;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    margin-top: 12px;
    margin-bottom: 12px;
    border: 1px solid #e2e8f0;
    color: #334155;
}

.box-pembahasan-text {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    padding: 12px 14px;
    border-radius: 0 6px 6px 0;
    font-size: 14px;
    color: #1e3a8a;
    line-height: 1.5;
}

.box-pembahasan-text strong {
    color: #1d4ed8;
}

/* ----------------------------------------------------------
   8. Paywall Banner & Token Input
   ---------------------------------------------------------- */
.paywall-banner {
    background: #fefce8;
    border: 1px solid #fef08a;
    padding: 24px 20px;
    border-radius: 10px;
    text-align: center;
    margin-top: 25px;
}

.paywall-banner h3 {
    margin: 0 0 8px 0;
    color: #854d0e;
    font-size: 18px;
    font-weight: 700;
}

.paywall-banner p {
    margin: 0 0 16px 0;
    color: #a16207;
    font-size: 14px;
    line-height: 1.5;
}

.form-token-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.input-token {
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    width: 200px;
    text-transform: uppercase;
    text-align: center;
    font-weight: 700;
    letter-spacing: 1px;
    outline: none;
    transition: border-color 0.2s;
}

.input-token:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn-unlock {
    padding: 10px 20px;
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-unlock:hover {
    background: #1d4ed8;
}

.link-wa-admin {
    color: #16a34a;
    font-weight: 600;
    text-decoration: none;
    font-size: 14px;
    display: inline-block;
    transition: color 0.2s;
}

.link-wa-admin:hover {
    color: #15803d;
    text-decoration: underline;
}

/* ----------------------------------------------------------
   9. Respon Layar Kecil (Mobile Responsive)
   ---------------------------------------------------------- */
@media (max-width: 640px) {
    .preview-container {
        padding: 16px;
        margin: 10px auto;
        border-radius: 8px;
    }

    .kop-surat {
        flex-direction: column;
        text-align: center;
    }

    .kop-logo {
        margin-bottom: 6px;
    }

    .student-summary-card {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .preview-action-bar {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .form-token-group {
        flex-direction: column;
        width: 100%;
    }

    .input-token {
        width: 100%;
    }

    .btn-unlock {
        width: 100%;
    }
}

/* ----------------------------------------------------------
   10. Pengaturan Cetak (Media Print)
   ---------------------------------------------------------- */
@media print {
    header, footer, nav, .navbar, .cbt-header, .sidebar, #page-cbt,
    .preview-action-bar, .paywall-banner, .btn-print-preview {
        display: none !important;
    }

    body {
        background: #ffffff !important;
        margin: 0 !important;
        padding: 0 !important;
        color: #000000 !important;
    }

    .preview-container {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .card-preview-soal {
        page-break-inside: avoid;
        border: 1px solid #94a3b8 !important;
        box-shadow: none !important;
        margin-bottom: 12px !important;
    }

    .watermark-bg {
        color: rgba(0, 0, 0, 0.05) !important;
    }
}
