/* Góc Phiếu Bài Tập Bản In (PDF A4) — Đồng bộ thẩm mỹ Góc Học Tập */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #dff1ff 0%, #eef7ff 380px, #f7fbff 100%);
  color: #162642;
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  line-height: 1.6;
}
button, input, select { font-family: inherit; }
a { color: inherit; }

/* ---------- Header kính trắng ---------- */
.pbt-top {
  position: sticky;
  top: 0;
  z-index: 45;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px);
  border-bottom: 1.5px solid #d4e6ff;
  box-shadow: 0 4px 18px rgba(22, 104, 227, .07);
}
.pbt-top-in {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.pbt-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.pbt-brand svg { width: 40px; height: 40px; flex-shrink: 0; }
.pbt-brand b { display: block; font: 800 22px/1 'Baloo 2', 'Be Vietnam Pro', sans-serif; color: #10326b; }
.pbt-brand b i { color: #f97316; font-style: normal; }
.pbt-brand small { display: block; font: 700 10px/1.1 'Be Vietnam Pro', sans-serif; letter-spacing: .08em; color: #4f6792; margin-top: 2px; }
.pbt-nav { display: flex; align-items: center; gap: 5px; overflow-x: auto; scrollbar-width: none; }
.pbt-nav::-webkit-scrollbar { display: none; }
.pbt-nav a {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px 0 8px;
  border-radius: 999px; font: 700 13.5px/1 'Be Vietnam Pro', sans-serif; color: #203760;
  text-decoration: none; white-space: nowrap; flex-shrink: 0; transition: background .15s, color .15s;
}
.pbt-nav a:hover { background: #eef5ff; color: #1668e3; }
.pbt-nav a.active { background: linear-gradient(135deg, #2563eb, #3b82f6); color: #fff; box-shadow: 0 4px 12px rgba(37, 99, 235, .24); }
.pbt-nav-ic { width: 20px; height: 20px; display: inline-flex; flex-shrink: 0; }
.pbt-nav-ic svg { width: 100%; height: 100%; }

/* ---------- Khung chính ---------- */
.pbt-wrap {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 18px 48px;
}
.pbt-crumb { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: #53698f; margin-bottom: 12px; flex-wrap: wrap; }
.pbt-crumb a { color: #1668e3; font-weight: 700; text-decoration: none; }
.pbt-crumb a:hover { text-decoration: underline; }

/* ---------- Bảng điều khiển tạo phiếu ---------- */
.pbt-panel {
  background: #fff;
  border: 2px solid #cbe0ff;
  border-radius: 22px;
  padding: 20px 22px;
  margin-bottom: 20px;
  box-shadow: 0 10px 28px rgba(22, 104, 227, .08);
}
.pbt-panel h1 {
  margin: 0 0 6px;
  font: 800 clamp(22px, 2.8vw, 30px)/1.2 'Baloo 2', 'Be Vietnam Pro', sans-serif;
  color: #10326b;
}
.pbt-sub { margin: 0 0 16px; color: #475569; font-size: 14.5px; }
.pbt-type-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.pbt-type-btn {
  text-align: left;
  padding: 11px 13px;
  border-radius: 15px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  cursor: pointer;
  transition: all .14s;
}
.pbt-type-btn b { display: block; font-size: 14px; color: #0f172a; margin-bottom: 2px; }
.pbt-type-btn span { display: block; font-size: 12px; color: #64748b; }
.pbt-type-btn:hover { border-color: #60a5fa; background: #eff6ff; }
.pbt-type-btn.active {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-color: #2563eb;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .15);
}
.pbt-type-btn.active b { color: #1d4ed8; }

.pbt-controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1.5px dashed #dbeafe;
}
.pbt-field { display: flex; flex-direction: column; gap: 4px; min-width: 140px; }
.pbt-field label { font-size: 12.5px; font-weight: 700; color: #334155; }
.pbt-field select {
  height: 38px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  font-size: 14px;
  color: #0f172a;
}
.pbt-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.pbt-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.pbt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  color: #1e293b;
  font: 700 14px/1 'Be Vietnam Pro', sans-serif;
  cursor: pointer;
}
.pbt-btn:hover { background: #f1f5f9; }
.pbt-btn.primary {
  background: linear-gradient(135deg, #059669, #10b981);
  border-color: #059669;
  color: #fff;
  box-shadow: 0 4px 12px rgba(5, 150, 105, .24);
}
.pbt-btn.blue {
  background: linear-gradient(135deg, #1668e3, #2563eb);
  border-color: #1668e3;
  color: #fff;
}

/* ---------- Tờ A4 Preview trên màn hình ---------- */
.pbt-sheet {
  background: #fff;
  color: #111827;
  width: 100%;
  max-width: 210mm;
  margin: 0 auto 22px;
  padding: 14mm 15mm;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .08);
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
}
.pbt-a4-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 2px solid #1e293b;
  padding-bottom: 8px;
  margin-bottom: 10px;
}
.pbt-a4-head h2 { margin: 0 0 2px; font-size: 17px; font-weight: 800; text-transform: uppercase; color: #0f172a; }
.pbt-a4-head p { margin: 0; font-size: 12.5px; color: #334155; }
.pbt-a4-brand { font-size: 11.5px; font-weight: 700; color: #475569; text-align: right; white-space: nowrap; }
.pbt-meta-line {
  display: grid;
  grid-template-columns: 2fr 1fr 1.2fr 0.9fr;
  gap: 10px;
  font-size: 12.5px;
  padding: 6px 0 10px;
  border-bottom: 1px dashed #94a3b8;
  margin-bottom: 12px;
}

/* Toán nhẩm 30 câu */
.pbt-math-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 14px;
}
.pbt-math-item {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.pbt-math-item b { font-size: 12px; color: #475569; margin-right: 4px; }
.pbt-blank-box {
  display: inline-block;
  min-width: 44px;
  border-bottom: 1.4px dotted #475569;
  height: 18px;
}

/* Tiếng Việt & Luyện viết */
.pbt-block { margin-bottom: 12px; }
.pbt-block h3 { margin: 0 0 6px; font-size: 14px; font-weight: 800; color: #0f172a; }
.pbt-box-text {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px 11px;
  font-size: 13px;
  line-height: 1.55;
  background: #fafafa;
}
.pbt-q-row { margin-bottom: 8px; font-size: 13px; }
.pbt-q-opts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 3px; padding-left: 14px; }
.pbt-line {
  height: 22px;
  border-bottom: 1.2px dotted #64748b;
  margin-top: 3px;
}

/* Bảng cửu chương 1 trang A4 */
.pbt-mul-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.pbt-mul-card {
  border: 1px solid #94a3b8;
  border-radius: 6px;
  padding: 6px 8px;
}
.pbt-mul-card h4 {
  margin: 0 0 4px;
  font-size: 12.5px;
  text-align: center;
  padding-bottom: 3px;
  border-bottom: 1px solid #cbd5e1;
}
.pbt-mul-row { font-size: 11.8px; line-height: 1.48; display: flex; justify-content: space-between; }

/* Bảng từ vựng Tiếng Anh */
.pbt-en-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.8px;
}
.pbt-en-table th, .pbt-en-table td {
  border: 1px solid #94a3b8;
  padding: 6px 8px;
  text-align: left;
}
.pbt-en-table th { background: #f1f5f9; font-weight: 700; }

/* Đáp án & Footer phiếu */
.pbt-ans-sheet { page-break-before: always; break-before: page; }
.pbt-ans-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 12px;
  font-size: 12.5px;
}
.pbt-sheet-foot {
  margin-top: 14px;
  padding-top: 6px;
  border-top: 1px solid #cbd5e1;
  font-size: 11px;
  color: #64748b;
  display: flex;
  justify-content: space-between;
}

/* SEO guide & Footer web */
.pbt-seo {
  background: #fff;
  border: 1.5px solid #d5e6ff;
  border-radius: 22px;
  padding: 20px 24px;
  margin-top: 22px;
}
.pbt-seo h2 { margin: 0 0 8px; font: 800 21px/1.3 'Baloo 2', 'Be Vietnam Pro', sans-serif; color: #10326b; }
.pbt-seo p, .pbt-seo li { font-size: 14.5px; color: #334155; }
.pbt-foot { background: #072973; color: rgba(255, 255, 255, .88); padding: 18px 16px; text-align: center; font-size: 13.5px; }
.pbt-foot-nav { display: flex; justify-content: center; gap: 10px 20px; flex-wrap: wrap; margin-bottom: 6px; }
.pbt-foot-nav a { color: #93c5fd; text-decoration: none; font-weight: 600; }

@media (max-width: 860px) {
  .pbt-type-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pbt-math-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pbt-mul-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .pbt-sheet { padding: 14px; }
  .pbt-meta-line { grid-template-columns: 1fr 1fr; }
  .pbt-math-grid { grid-template-columns: 1fr; }
}

/* ---------- CHẾ ĐỘ IN PDF A4 ĐỨNG ---------- */
@page {
  size: A4 portrait;
  margin: 11mm 13mm;
}
@media print {
  body { background: #fff !important; }
  .no-print, .pbt-top, .pbt-crumb, .pbt-panel, .pbt-seo, .pbt-foot { display: none !important; }
  .pbt-wrap { max-width: none; padding: 0; margin: 0; }
  .pbt-sheet {
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .pbt-ans-sheet { margin-top: 0; padding-top: 0; }
}
