/* ======================================================
   Worksheets, progress, certificates, PDF viewer, verify page
   (shared by course.html, student/admin dashboards, verify.html)
   ====================================================== */

/* ---------- public worksheet list (course.html) ---------- */
.ws-list { display: grid; gap: 14px; max-width: 900px; margin: 0 auto; }
.ws-item {
    display: flex; align-items: center; gap: 16px;
    background: #fff; border: 1px solid #e5e9f2; border-radius: 12px;
    padding: 16px 18px; box-shadow: 0 2px 8px rgba(20,40,90,.04);
}
.ws-num {
    flex: 0 0 42px; height: 42px; border-radius: 10px;
    background: #eaf1ff; color: #2563eb; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.ws-main { flex: 1; min-width: 0; }
.ws-main h3 { margin: 0 0 4px; font-size: 16px; color: #1f2937; }
.ws-main p { margin: 0; font-size: 13px; color: #6b7280; }
.ws-badge {
    display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .4px;
    padding: 3px 8px; border-radius: 20px; margin-left: 8px; vertical-align: middle;
}
.ws-badge.free { background: #dcfce7; color: #166534; }
.ws-badge.locked { background: #f3f4f6; color: #4b5563; }
.ws-btn {
    border: none; border-radius: 8px; padding: 9px 16px; font-weight: 600;
    cursor: pointer; font-size: 14px; background: #2563eb; color: #fff;
}
.ws-btn:hover { background: #1d4ed8; }
.ws-btn.ghost { background: #eef2f7; color: #374151; }
.ws-btn.ghost:hover { background: #e2e8f0; }
.ws-btn:disabled { opacity: .55; cursor: not-allowed; }
.ws-empty, .ws-note {
    text-align: center; color: #6b7280; padding: 22px; background: #f8fafc;
    border: 1px dashed #d5dbe7; border-radius: 12px;
}
.ws-note { margin-top: 14px; font-size: 14px; }

/* ---------- protected PDF viewer ---------- */
.ssg-viewer {
    position: fixed; inset: 0; z-index: 99999; background: rgba(15,23,42,.92);
    display: none; flex-direction: column;
    -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.ssg-viewer.open { display: flex; }
.ssg-viewer-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 18px; background: #0f172a; color: #fff;
}
.ssg-viewer-bar h4 { margin: 0; font-size: 16px; font-weight: 600; }
.ssg-viewer-bar small { color: #94a3b8; display: block; font-weight: 400; margin-top: 2px; }
.ssg-viewer-close {
    border: none; background: #334155; color: #fff; border-radius: 8px;
    padding: 8px 16px; cursor: pointer; font-weight: 600;
}
.ssg-viewer-close:hover { background: #475569; }
.ssg-viewer-body { flex: 1; overflow: auto; padding: 18px 10px 40px; text-align: center; }
.ssg-viewer-body canvas {
    display: block; margin: 0 auto 16px; max-width: 100%; height: auto !important;
    background: #fff; box-shadow: 0 6px 24px rgba(0,0,0,.4); pointer-events: none;
}
.ssg-viewer-msg { color: #e2e8f0; padding: 60px 20px; font-size: 16px; }
@media print {
    body > *:not(.ssg-print-block) { display: none !important; }
    body::before {
        content: "Printing is disabled for course material.";
        display: block; padding: 40px; font: 18px Arial, sans-serif;
    }
}

/* ---------- admin: worksheet tab ---------- */
.ws-admin-row {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    background: #fff; border: 1px solid #e5e9f2; border-radius: 12px;
    padding: 14px 16px; margin-bottom: 12px;
}
.ws-admin-row .ws-main { flex: 1 1 260px; }
.ws-admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ws-admin-form { display: grid; gap: 12px; }
.ws-admin-form label { font-weight: 600; font-size: 14px; display: grid; gap: 6px; }
.ws-admin-form input[type="text"], .ws-admin-form input[type="file"] {
    padding: 10px; border: 1px solid #d5dbe7; border-radius: 8px; font-size: 14px;
}
.ws-check { display: flex !important; grid-auto-flow: column; align-items: center; gap: 8px !important; font-weight: 500 !important; }

/* ---------- student: learning + certificates ---------- */
.lrn-course-picker { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.lrn-chip {
    border: 1px solid #d5dbe7; background: #fff; padding: 9px 16px; border-radius: 22px;
    cursor: pointer; font-weight: 600; font-size: 14px; color: #374151;
}
.lrn-chip.active { background: #2563eb; border-color: #2563eb; color: #fff; }
.lrn-card {
    background: #fff; border: 1px solid #e5e9f2; border-radius: 14px;
    padding: 20px; margin-bottom: 18px; box-shadow: 0 2px 8px rgba(20,40,90,.04);
}
.lrn-card h3 { margin: 0 0 12px; font-size: 18px; }
.lrn-bar { height: 12px; background: #e8edf5; border-radius: 10px; overflow: hidden; margin: 8px 0 6px; }
.lrn-bar > span { display: block; height: 100%; background: linear-gradient(90deg,#2563eb,#22c55e); transition: width .3s; }
.lrn-topic {
    display: flex; align-items: center; gap: 12px; padding: 11px 6px;
    border-bottom: 1px solid #eef1f6; cursor: pointer; font-size: 15px;
}
.lrn-topic:last-child { border-bottom: none; }
.lrn-topic input { width: 18px; height: 18px; accent-color: #2563eb; }
.lrn-topic.done span { color: #6b7280; text-decoration: line-through; }
.lrn-locked { opacity: .75; cursor: not-allowed; }
.cert-status {
    display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 700;
}
.cert-status.REQUESTED { background: #fef3c7; color: #92400e; }
.cert-status.APPROVED  { background: #dcfce7; color: #166534; }
.cert-status.REJECTED  { background: #fee2e2; color: #991b1b; }
.cert-status.REVOKED   { background: #e5e7eb; color: #374151; }
.cert-code { font-family: Consolas, monospace; font-weight: 700; letter-spacing: 1px; }
.lrn-msg { padding: 10px 14px; border-radius: 8px; margin: 10px 0; font-size: 14px; }
.lrn-msg.error { background: #fee2e2; color: #991b1b; }
.lrn-msg.ok { background: #dcfce7; color: #166534; }

/* ---------- admin: certificates table ---------- */
.cert-table { width: 100%; border-collapse: collapse; background: #fff; }
.cert-table th, .cert-table td {
    padding: 11px 12px; text-align: left; border-bottom: 1px solid #e8edf5; font-size: 14px; vertical-align: top;
}
.cert-table th { background: #f6f8fc; font-weight: 700; }
.cert-filter { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.cert-filter button {
    border: 1px solid #d5dbe7; background: #fff; border-radius: 20px; padding: 7px 14px; cursor: pointer; font-weight: 600;
}
.cert-filter button.active { background: #2563eb; border-color: #2563eb; color: #fff; }
.cert-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.cert-actions button { border: none; border-radius: 6px; padding: 6px 12px; cursor: pointer; font-weight: 600; color: #fff; }
.cert-actions .approve { background: #16a34a; }
.cert-actions .reject  { background: #dc2626; }
.cert-actions .revoke  { background: #6b7280; }
.cert-actions .unrevoke { background: #0d9488; }

/* ---------- public verify page ---------- */
.vf-wrap { max-width: 640px; margin: 40px auto; padding: 0 16px; font-family: Arial, sans-serif; }
.vf-card { background: #fff; border-radius: 16px; padding: 28px; box-shadow: 0 8px 30px rgba(20,40,90,.10); border: 1px solid #e5e9f2; }
.vf-card h1 { margin: 0 0 6px; font-size: 24px; color: #14284f; }
.vf-card p.sub { margin: 0 0 20px; color: #6b7280; }
.vf-form { display: flex; gap: 10px; flex-wrap: wrap; }
.vf-form input { flex: 1 1 240px; padding: 12px; border: 1px solid #d5dbe7; border-radius: 8px; font-size: 16px; letter-spacing: 1px; text-transform: uppercase; }
.vf-form button { padding: 12px 22px; border: none; border-radius: 8px; background: #2563eb; color: #fff; font-weight: 700; cursor: pointer; font-size: 15px; }
.vf-result { margin-top: 22px; border-radius: 12px; padding: 20px; }
.vf-result.valid { background: #ecfdf3; border: 1px solid #86efac; }
.vf-result.invalid { background: #fef2f2; border: 1px solid #fca5a5; }
.vf-result.revoked { background: #f3f4f6; border: 1px solid #d1d5db; }
.vf-result h2 { margin: 0 0 12px; font-size: 20px; }
.vf-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid rgba(0,0,0,.07); font-size: 15px; }
.vf-row span:first-child { color: #6b7280; }
.vf-row span:last-child { font-weight: 700; text-align: right; }

/* ---------- small self-contained modal used by admin worksheet / certificate actions ---------- */
.ws-modal-back {
    position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 9000;
    display: none; align-items: center; justify-content: center; padding: 16px;
}
.ws-modal-back.open { display: flex; }
.ws-modal {
    background: #fff; border-radius: 14px; width: 100%; max-width: 480px; padding: 22px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.ws-modal h3 { margin: 0 0 14px; }
.ws-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* revoked certificate: reason + contact academy */
a.ws-btn { display: inline-block; text-decoration: none; }
.cert-revoked-box { background: #f9fafb; border: 1px solid #d1d5db; border-left: 4px solid #6b7280; border-radius: 10px; padding: 14px 16px; margin-top: 10px; }
.cert-revoked-box p { margin: 0 0 10px; }
.cert-contact { display: flex; flex-wrap: wrap; gap: 10px; }
.vf-contact { color: #2563eb; font-weight: 600; }
