/* ============================================================
 * Bài tập — exercise hub + quiz player (/bai-tap/)
 * ============================================================ */
.pbt, .pbt-quiz { max-width: 1240px; margin: 0 auto; padding: 16px 22px 48px; color: #0f172a; font-family: 'Plus Jakarta Sans', system-ui, sans-serif; }

/* ---------- Header ---------- */
.pbt-top { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; margin-bottom: 16px; }
.pbt-h1 { font-size: 1.55rem; font-weight: 900; letter-spacing: -0.025em; margin: 0; }
.pbt-sub { color: #64748b; font-size: 13px; margin: 2px 0 0; }
.pbt-search { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #e2e8f0; border-radius: 11px; padding: 9px 14px; color: #94a3b8; max-width: 420px; width: 100%; justify-self: center; transition: border-color 120ms, box-shadow 120ms; }
.pbt-search:focus-within { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(59,130,246,0.12); }
.pbt-search input { border: none; outline: none; background: transparent; font: inherit; font-size: 13.5px; color: #0f172a; width: 100%; }
.pbt-btn { display: inline-flex; align-items: center; gap: 7px; background: #fff; border: 1px solid #e2e8f0; padding: 9px 14px; border-radius: 10px; font: inherit; font-size: 13px; font-weight: 700; color: #0f172a; cursor: pointer; transition: all 120ms; }
.pbt-btn:hover { background: #f8fafc; }
.pbt-btn.on { background: #2563eb; border-color: #2563eb; color: #fff; }

/* ---------- Filter bar ---------- */
.pbt-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.pbt-tabs { display: flex; flex-wrap: wrap; gap: 4px; background: #f1f5f9; padding: 4px; border-radius: 11px; }
.pbt-tab { display: inline-flex; align-items: center; gap: 5px; padding: 8px 14px; border: none; background: transparent; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 700; color: #64748b; cursor: pointer; transition: all 120ms; }
.pbt-tab:hover { color: #0f172a; }
.pbt-tab-on { background: #fff; color: #2563eb; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.pbt-tab-n { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11px; font-weight: 700; opacity: 0.7; }
.pbt-bar-r { display: flex; gap: 8px; }
.pbt-sel { background: #fff; border: 1px solid #e2e8f0; padding: 8px 12px; border-radius: 9px; font: inherit; font-size: 12.5px; font-weight: 600; color: #0f172a; cursor: pointer; }

/* ---------- Type groups ---------- */
.pbt-groups { display: flex; flex-direction: column; gap: 18px; }
.pbt-group { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 16px 18px; }
.pbt-group[hidden] { display: none !important; }
.pbt-group-h { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.pbt-gicon { width: 30px; height: 30px; border-radius: 8px; background: #f1f5f9; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.pbt-gname { font-size: 13px; font-weight: 800; letter-spacing: 0.03em; }
.pbt-gcnt { font-size: 11.5px; color: #94a3b8; font-weight: 600; margin-left: auto; }
/* per-type accent */
.pbt-group[data-type="trac-nghiem"]  .pbt-gname { color: #7c3aed; }
.pbt-group[data-type="trac-nghiem"]  .pbt-gicon { background: #f5f3ff; }
.pbt-group[data-type="dien-tu"]      .pbt-gname { color: #db2777; }
.pbt-group[data-type="dien-tu"]      .pbt-gicon { background: #fdf2f8; }
.pbt-group[data-type="noi-tu"]       .pbt-gname { color: #059669; }
.pbt-group[data-type="noi-tu"]       .pbt-gicon { background: #ecfdf5; }
.pbt-group[data-type="dich-cau"]     .pbt-gname { color: #d97706; }
.pbt-group[data-type="dich-cau"]     .pbt-gicon { background: #fffbeb; }
.pbt-group[data-type="chia-dong-tu"] .pbt-gname { color: #2563eb; }
.pbt-group[data-type="chia-dong-tu"] .pbt-gicon { background: #eff6ff; }

/* ---------- Table ---------- */
.pbt-table { }
.pbt-thead, .pbt-row { display: grid; grid-template-columns: 1.4fr 2fr 0.7fr 0.7fr 1fr 0.9fr; gap: 12px; align-items: center; }
.pbt-thead { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; font-size: 10.5px; font-weight: 800; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; }
.pbt-rows { display: flex; flex-direction: column; }
.pbt-row { padding: 11px 10px; border-bottom: 1px solid #f1f5f9; transition: background 100ms; }
.pbt-row:last-child { border-bottom: none; }
.pbt-row:hover { background: #fafbfc; }
.pbt-row[hidden] { display: none !important; }

.pbt-c-topic { display: flex; align-items: center; gap: 9px; min-width: 0; }
.pbt-row-ic { width: 28px; height: 28px; border-radius: 8px; background: #f8fafc; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.pbt-topic-name { font-size: 13px; font-weight: 700; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pbt-c-title { font-size: 13px; color: #334155; font-weight: 500; }
.pbt-lv { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10.5px; font-weight: 800; padding: 2px 8px; border-radius: 6px; }
.pbt-lv-a1 { background: #dbeafe; color: #1e40af; }
.pbt-lv-a2 { background: #d1fae5; color: #065f46; }
.pbt-lv-b1 { background: #fef3c7; color: #92400e; }
.pbt-lv-b2 { background: #fee2e2; color: #991b1b; }
.pbt-c-count { font-size: 12.5px; color: #64748b; font-weight: 600; }

.pbt-c-status { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: #94a3b8; }
.pbt-st-dot { width: 9px; height: 9px; border-radius: 999px; border: 2px solid #cbd5e1; flex-shrink: 0; }
.pbt-c-status.is-done { color: #059669; }
.pbt-c-status.is-done .pbt-st-dot { background: #059669; border-color: #059669; }
.pbt-c-status.is-progress { color: #d97706; }
.pbt-c-status.is-progress .pbt-st-dot { background: #f59e0b; border-color: #f59e0b; }

.pbt-c-act { display: flex; justify-content: flex-start; }
.pbt-do { display: inline-flex; align-items: center; gap: 4px; padding: 6px 13px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; font-size: 12.5px; font-weight: 700; color: #2563eb; text-decoration: none; transition: all 120ms; }
.pbt-do:hover { background: #2563eb; border-color: #2563eb; color: #fff; text-decoration: none; }
.pbt-do.is-progress { background: #fffbeb; border-color: #fde68a; color: #b45309; }
.pbt-do.is-progress:hover { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.pbt-do.is-done { background: #f0fdf4; border-color: #bbf7d0; color: #059669; }
.pbt-do.is-done:hover { background: #059669; border-color: #059669; color: #fff; }

.pbt-empty { text-align: center; padding: 30px 16px; color: #94a3b8; }
.pbt-empty p { font-weight: 700; margin: 6px 0 0; }

.pbt-seeall { display: flex; align-items: center; gap: 6px; width: fit-content; margin: 12px auto 0; padding: 8px 16px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 9px; font: inherit; font-size: 12.5px; font-weight: 700; color: #2563eb; cursor: pointer; transition: all 120ms; }
.pbt-seeall:hover { background: #eff6ff; }
.pbt-seeall.pbt-open svg { transform: rotate(180deg); }
.pbt-seeall svg { transition: transform 200ms; }

/* ============================================================
 * QUIZ PLAYER
 * ============================================================ */
.pq-top { margin-bottom: 14px; }
.pq-crumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #94a3b8; font-weight: 600; margin-bottom: 8px; }
.pq-crumb a { color: #94a3b8; text-decoration: none; }
.pq-crumb a:hover { color: #2563eb; }
.pq-headrow { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.pq-titlerow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pq-title { font-size: 1.4rem; font-weight: 900; letter-spacing: -0.02em; margin: 0; }
.pq-badge { font-size: 11.5px; font-weight: 700; color: #7c3aed; background: #f5f3ff; border: 1px solid #ddd6fe; padding: 3px 10px; border-radius: 999px; }
.pq-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: 12.5px; color: #64748b; font-weight: 600; }
.pq-exit { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid #e2e8f0; padding: 9px 14px; border-radius: 10px; font-size: 13px; font-weight: 700; color: #475569; text-decoration: none; white-space: nowrap; transition: all 120ms; }
.pq-exit:hover { background: #fef2f2; border-color: #fecaca; color: #dc2626; text-decoration: none; }

.pq-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.pq-progress { flex: 1; height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.pq-progress-fill { height: 100%; background: linear-gradient(90deg, #2563eb, #3b82f6); border-radius: 999px; width: 0%; transition: width 300ms; }
.pq-counter { font-size: 13px; font-weight: 800; color: #0f172a; white-space: nowrap; font-family: 'JetBrains Mono', ui-monospace, monospace; }

.pq-layout { display: grid; grid-template-columns: 1fr 280px; gap: 16px; align-items: start; }

/* Question card */
.pq-main { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 24px; min-height: 320px; }
.pq-qnum { font-size: 12px; font-weight: 800; color: #2563eb; letter-spacing: 0.02em; margin-bottom: 6px; }
.pq-qtext { font-size: 1.18rem; font-weight: 800; color: #0f172a; line-height: 1.45; margin-bottom: 20px; }
.pq-qtext .pq-blank { color: #2563eb; }

.pq-options { display: flex; flex-direction: column; gap: 10px; }
.pq-opt { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1.5px solid #e2e8f0; border-radius: 12px; background: #fff; font: inherit; font-size: 14px; font-weight: 600; color: #0f172a; cursor: pointer; text-align: left; transition: all 120ms; }
.pq-opt:hover { border-color: #93c5fd; background: #f8fbff; }
.pq-opt-radio { width: 20px; height: 20px; border-radius: 999px; border: 2px solid #cbd5e1; flex-shrink: 0; position: relative; transition: all 120ms; }
.pq-opt-sel { border-color: #2563eb; background: #eff6ff; }
.pq-opt-sel .pq-opt-radio { border-color: #2563eb; }
.pq-opt-sel .pq-opt-radio::after { content: ''; position: absolute; inset: 3px; border-radius: 999px; background: #2563eb; }
.pq-opt-correct { border-color: #10b981; background: #ecfdf5; color: #065f46; }
.pq-opt-correct .pq-opt-radio { border-color: #10b981; background: #10b981; }
.pq-opt-correct .pq-opt-radio::after { content: '✓'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 800; }
.pq-opt-wrong { border-color: #ef4444; background: #fef2f2; color: #991b1b; }
.pq-opt-wrong .pq-opt-radio { border-color: #ef4444; background: #ef4444; }
.pq-opt-wrong .pq-opt-radio::after { content: '✕'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 800; }
.pq-opt[disabled] { cursor: default; }
.pq-opt[disabled]:hover { border-color: #e2e8f0; background: #fff; }
.pq-opt-correct[disabled]:hover { border-color: #10b981; background: #ecfdf5; }
.pq-opt-wrong[disabled]:hover { border-color: #ef4444; background: #fef2f2; }

/* Fill input */
.pq-fill { display: flex; gap: 10px; flex-wrap: wrap; }
.pq-fill-input { flex: 1; min-width: 200px; padding: 13px 16px; border: 1.5px solid #e2e8f0; border-radius: 12px; font: inherit; font-size: 15px; font-weight: 600; color: #0f172a; outline: none; transition: all 120ms; }
.pq-fill-input:focus { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(59,130,246,0.12); }
.pq-fill-input.is-correct { border-color: #10b981; background: #ecfdf5; color: #065f46; }
.pq-fill-input.is-wrong { border-color: #ef4444; background: #fef2f2; color: #991b1b; }
.pq-check { padding: 13px 22px; background: #2563eb; border: none; border-radius: 12px; font: inherit; font-size: 14px; font-weight: 700; color: #fff; cursor: pointer; transition: background 120ms; }
.pq-check:hover { background: #1d4ed8; }
.pq-check[disabled] { opacity: 0.5; cursor: default; }
.pq-hint { margin-top: 12px; font-size: 12.5px; color: #94a3b8; }
.pq-hint b { color: #64748b; }

/* Feedback line */
.pq-feedback { margin-top: 16px; padding: 12px 14px; border-radius: 10px; font-size: 13px; font-weight: 600; display: none; }
.pq-feedback.show { display: block; }
.pq-feedback.ok { background: #ecfdf5; color: #065f46; }
.pq-feedback.no { background: #fef2f2; color: #991b1b; }
.pq-feedback .pq-ans { font-weight: 800; }

/* Nav */
.pq-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; }
.pq-prev, .pq-next { display: inline-flex; align-items: center; gap: 7px; padding: 11px 18px; border-radius: 10px; font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; transition: all 120ms; border: 1px solid #e2e8f0; background: #fff; color: #475569; }
.pq-prev:hover { background: #f8fafc; }
.pq-prev[disabled] { opacity: 0.4; cursor: default; }
.pq-next { background: #2563eb; border-color: #2563eb; color: #fff; }
.pq-next:hover { background: #1d4ed8; }

/* Match board */
.pq-match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pq-match-col { display: flex; flex-direction: column; gap: 8px; }
.pq-match-h { font-size: 11px; font-weight: 800; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }
.pq-mitem { padding: 12px 14px; border: 1.5px solid #e2e8f0; border-radius: 10px; background: #fff; font-size: 14px; font-weight: 700; cursor: pointer; text-align: left; transition: all 120ms; }
.pq-mitem:hover { border-color: #93c5fd; }
.pq-mitem.sel { border-color: #2563eb; background: #eff6ff; }
.pq-mitem.matched { border-color: #10b981; background: #ecfdf5; color: #065f46; cursor: default; opacity: 0.7; }
.pq-mitem.mwrong { animation: pqShake 320ms; border-color: #ef4444; background: #fef2f2; }
@keyframes pqShake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }
.pq-match-fi .pq-mitem { font-family: inherit; color: #0f172a; }

/* Sidebar */
.pq-side { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 16px; position: sticky; top: 16px; }
.admin-bar .pq-side { top: 46px; }
.pq-side-h { font-size: 11px; font-weight: 800; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 12px; }
.pq-dots { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.pq-dotbtn { width: 38px; height: 38px; border-radius: 10px; border: 1.5px solid #e2e8f0; background: #fff; font: inherit; font-size: 13px; font-weight: 800; color: #64748b; cursor: pointer; display: flex; align-items: center; justify-content: center; position: relative; transition: all 120ms; }
.pq-dotbtn:hover { border-color: #93c5fd; }
.pq-dotbtn.cur { border-color: #2563eb; background: #2563eb; color: #fff; }
.pq-dotbtn.done { border-color: #10b981; background: #ecfdf5; color: #059669; }
.pq-dotbtn.wrong { border-color: #ef4444; background: #fef2f2; color: #dc2626; }
.pq-dotbtn.done::after { content: '✓'; position: absolute; top: -5px; right: -5px; width: 16px; height: 16px; background: #10b981; color: #fff; border-radius: 999px; font-size: 9px; display: flex; align-items: center; justify-content: center; }

.pq-legend { border-top: 1px solid #f1f5f9; padding-top: 12px; }
.pq-legend-h { font-size: 11px; font-weight: 800; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.pq-leg { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #475569; font-weight: 600; padding: 3px 0; }
.pq-dot { width: 13px; height: 13px; border-radius: 999px; border: 2px solid #cbd5e1; flex-shrink: 0; }
.pq-dot-done { background: #10b981; border-color: #10b981; }
.pq-dot-wrong { background: #ef4444; border-color: #ef4444; }
.pq-dot-cur { background: #2563eb; border-color: #2563eb; }

/* Result */
.pq-result { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 40px 24px; text-align: center; }
.pq-result-emoji { font-size: 56px; margin-bottom: 10px; }
.pq-result h2 { font-size: 1.4rem; font-weight: 900; margin: 0 0 6px; }
.pq-result-score { font-size: 2.4rem; font-weight: 900; margin: 10px 0; }
.pq-result-score b { color: #2563eb; }
.pq-result p { color: #64748b; font-size: 13.5px; margin: 0 0 18px; }
.pq-result-acts { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.pq-rbtn { display: inline-flex; align-items: center; gap: 6px; padding: 11px 20px; border-radius: 10px; font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; text-decoration: none; transition: all 120ms; }
.pq-rbtn-primary { background: #2563eb; color: #fff; border: none; }
.pq-rbtn-primary:hover { background: #1d4ed8; color: #fff; text-decoration: none; }
.pq-rbtn-ghost { background: #fff; color: #475569; border: 1px solid #e2e8f0; }
.pq-rbtn-ghost:hover { background: #f8fafc; color: #0f172a; text-decoration: none; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
	.pq-layout { grid-template-columns: 1fr; }
	.pq-side { position: static; }
}
@media (max-width: 820px) {
	.pbt-top { grid-template-columns: 1fr; gap: 10px; }
	.pbt-search { max-width: none; }
	.pbt-thead { display: none; }
	.pbt-row { grid-template-columns: 1fr auto; grid-template-areas: "topic act" "title act" "meta act"; gap: 4px 12px; }
	.pbt-c-topic { grid-area: topic; }
	.pbt-c-title { grid-area: title; font-size: 12px; color: #64748b; }
	.pbt-c-level { grid-area: meta; display: inline-flex; gap: 8px; }
	.pbt-c-count, .pbt-c-status { display: none; }
	.pbt-c-act { grid-area: act; }
}
@media (max-width: 560px) {
	.pq-match { grid-template-columns: 1fr; }
	.pq-headrow { flex-direction: column; }
}
