/* EduBook — tối ưu giao diện đợt 2 (2026-11-05). Chỉ thêm lớp mới, nạp sau pc-ui.20261105.css.
   Nguyên tắc: bớt khoảng thừa nhưng giữ khoảng cách tối thiểu ~8px giữa các nhóm, không đổi cỡ chữ nhỏ hơn 10px. */

/* ---------- Nút Đăng ký ở header ---------- */
#register-btn { padding: 8px 12px; border-radius: 12px; background: #2563eb; border: 2px solid #1d4ed8; color: #fff; font-weight: 800; font-size: 12px; line-height: 1.25; cursor: pointer; }
#register-btn:hover { background: #1d4ed8; }
#register-btn:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }

/* ---------- Máy tính / máy tính bảng (≥768px): thu gọn khoảng thừa vừa phải ---------- */
@media (min-width: 768px) {
  body header > div:first-child { padding-top: 8px; padding-bottom: 8px; }
  body #student-app-wrapper { padding-top: 16px; padding-bottom: 20px; }
  body #student-app-wrapper > * + * { margin-top: 16px !important; }
  body #section-explore > * + * { margin-top: 14px !important; }
  body #dynamic-hero-banner { padding: 20px 28px !important; }
  body #dynamic-hero-banner .grid { gap: 16px; }
  body #dynamic-hero-banner .space-y-3 > * + * { margin-top: 8px !important; }
  body #section-explore > div:first-child { padding: 16px 20px !important; }
  body #section-explore > div:first-child > * + * { margin-top: 12px !important; }
  body #section-explore > div:first-child > div + div { padding-top: 12px !important; }
  body #books-grid { gap: 16px; }
  body .book-card { padding: 14px !important; }
  body .book-card .mt-3\.5 { margin-top: 10px !important; }
  body .book-card .mt-4.pt-3 { margin-top: 12px !important; padding-top: 10px !important; }
  body .book-card .mt-4.pt-3 > * + * { margin-top: 10px !important; }
  body .book-card > div:first-child > div:first-child { padding-top: 16px !important; padding-bottom: 10px !important; }
  .books-pager { margin: 20px 0 4px; }
}

/* ---------- Điện thoại (≤767px) ---------- */
@media (max-width: 767px) {
  /* Dải thông báo + thanh tối phía trên: gọn lại */
  #ui-demo-notice { padding: 4px 12px !important; font-size: 11px !important; line-height: 1.35 !important; }
  body > div.bg-gradient-to-r:first-of-type, body > #ui-demo-notice + div.bg-gradient-to-r { display: none; }

  /* Header không dính trên đỉnh trên điện thoại: tiết kiệm ~165px chiều cao màn hình */
  body header { position: static !important; }

  /* Header 2 hàng: logo + nút, rồi ô tìm kiếm */
  body header > div:first-child { padding: 8px 12px 6px !important; gap: 8px !important; }
  body header > div:first-child > a { gap: 8px !important; }
  body header > div:first-child > a > div:first-child { width: 36px !important; height: 36px !important; border-radius: 12px !important; border-bottom-width: 3px !important; }
  body header > div:first-child > a .font-display { font-size: 18px !important; }
  body header > div:first-child > a .rounded-full { display: none; }
  body header > div:first-child > div:last-child { gap: 6px !important; flex-wrap: nowrap !important; margin-left: auto; }
  body header > div:first-child > div:last-child > button { padding: 7px 9px !important; font-size: 11.5px !important; white-space: nowrap; }
  body header > div:first-child > div:last-child > #btn-view-library { padding: 7px 8px !important; }
  #mobile-search-wrap { padding: 0 12px 8px !important; }
  #mobile-search { padding-top: 8px !important; padding-bottom: 8px !important; }

  /* Khung chính */
  body #student-app-wrapper { padding: 10px 12px 14px; }
  body #student-app-wrapper > * + * { margin-top: 12px !important; }
  body #section-explore > * + * { margin-top: 12px !important; }

  /* Banner chỉ còn ~1/3: nhãn + tiêu đề + mô tả ngắn */
  body #dynamic-hero-banner { padding: 12px 14px !important; border-radius: 16px !important; border-bottom-width: 3px !important; }
  #dynamic-hero-banner > .relative.z-10 > div:nth-child(2) { display: none; }
  #hero-curriculum-tag, #hero-desc ~ div { display: none; }
  #dynamic-hero-banner .space-y-3 > * + * { margin-top: 6px !important; }
  #hero-badge { padding: 3px 10px; font-size: 11px; }
  #hero-title { font-size: 19px !important; line-height: 1.25 !important; }
  #hero-desc { font-size: 12.5px !important; line-height: 1.45 !important; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

  /* Bảng chọn lớp / môn */
  body #section-explore > div:first-child { padding: 12px !important; border-radius: 16px !important; }
  body #section-explore > div:first-child > * + * { margin-top: 10px !important; }
  body #section-explore > div:first-child > div + div { padding-top: 10px !important; }
  #section-explore .w-9.h-9.bg-amber-100, #section-explore .w-7.h-7.bg-blue-100 { display: none; }
  #section-explore h2 + p, #subject-bar-badge, #curriculum-note { display: none; }
  #section-explore h2 { font-size: 15px !important; }
  #subject-bar-title { font-size: 13.5px !important; }

  /* Cấp học: lưới 2x2 cân đối, không có nút lẻ loi */
  div:has(> #lvl-all) { display: grid !important; grid-template-columns: 1fr 1fr; gap: 4px !important; padding: 4px !important; }
  div:has(> #lvl-all) > button { white-space: nowrap; padding: 6px 4px !important; font-size: 12px !important; text-align: center; }

  /* Khối lớp: 7 cột x 2 hàng, thấy đủ 13 nút, không cuộn */
  #grade-buttons-grid { grid-template-columns: repeat(7, minmax(0, 1fr)) !important; gap: 4px !important; }
  #grade-buttons-grid > button { padding: 5px 0 !important; border-radius: 10px !important; border-width: 1.5px !important; min-width: 0; }
  #grade-buttons-grid > button > span:first-child { font-size: 12px !important; line-height: 1.25; }
  #grade-buttons-grid > button > span:last-child { font-size: 9px !important; line-height: 1.2; }
  #grade-buttons-grid > button[aria-pressed="true"] { transform: none !important; }

  /* Môn học & bộ sách: một hàng cuộn ngang, có mờ dần ở mép phải báo còn nữa */
  #subject-buttons-row, #series-buttons-row { gap: 6px !important; padding-bottom: 2px; padding-right: 24px; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
  #subject-buttons-row > button { padding: 6px 10px !important; border-radius: 12px !important; gap: 6px !important; }
  #subject-buttons-row > button .text-base { font-size: 14px !important; }
  #series-buttons-row > button { padding: 5px 10px !important; }
  #section-explore #price-filter-select { flex: 1 1 auto; min-width: 0; padding-top: 7px; padding-bottom: 7px; }
  #section-explore #price-filter-select ~ button { padding-top: 7px; padding-bottom: 7px; }
  #section-explore > div:first-child > div:last-child > div:last-child { flex-wrap: nowrap; width: 100%; }

  /* Tiêu đề kết quả */
  #current-filter-heading { font-size: 16px !important; line-height: 1.3; }
  #book-count-pill { padding: 3px 10px; font-size: 11px; }
  #section-explore > div:nth-of-type(2) { gap: 6px; }

  /* Thẻ sách dạng ngang: bìa bên trái, thông tin bên phải */
  #books-grid { gap: 10px; }
  body .book-card { padding: 10px !important; border-radius: 16px !important; }
  .book-card > div:first-child { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 10px; align-items: start; }
  .book-card > div:first-child > div:first-child { padding: 8px 6px 6px !important; border-radius: 12px !important; }
  .book-card > div:first-child > div:first-child > span:nth-of-type(2) { display: none; }
  .book-card > div:first-child > div:first-child > span:first-of-type { top: 4px !important; left: 4px !important; padding: 1px 6px !important; border-radius: 8px !important; font-size: 10px !important; }
  .book-card .flat-book { width: 84px !important; height: 110px !important; }
  .book-card .wooden-shelf { height: 6px; }
  .book-card .mt-3\.5 { margin-top: 0 !important; }
  .book-card .mt-3\.5 > * + * { margin-top: 6px !important; }
  .book-card h4 { min-height: 0 !important; font-size: 14px !important; }
  .book-card .mt-4.pt-3 { margin-top: 8px !important; padding-top: 8px !important; }
  .book-card .mt-4.pt-3 > * + * { margin-top: 8px !important; }
  .book-card .mt-4.pt-3 .grid button { padding-top: 8px !important; padding-bottom: 8px !important; }
  .books-pager { margin: 14px 0 0; }
  .books-pager button { min-width: 36px; height: 36px; padding: 0 8px; }
}

/* Chân trang gọn */
body > footer { padding-top: 14px !important; padding-bottom: 14px !important; }
