/* =========================================================
   HOCLIEUHUB - TỐI ƯU RIÊNG TRANG CHỦ TRÊN ĐIỆN THOẠI
   Không tác động đến máy tính và các trang khác.
   ========================================================= */

@media (max-width: 680px) {
  /* Thanh trên cùng: đủ 5 nút nhưng thoáng hơn. */
  body .compact-navbar {
    min-height: 64px;
    padding: 8px 12px;
    gap: 8px;
  }

  body .compact-navbar-right,
  body .compact-navbar .user-mini {
    gap: 6px;
  }

  body .compact-navbar [data-user-area] .header-action-link[href="chat.html"],
  body .compact-navbar [data-user-area] .header-action-link[href="notifications.html"],
  body .compact-navbar .profile-link img {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  body .compact-navbar .header-action-link {
    font-size: 17px;
  }

  body .compact-menu-toggle {
    width: 42px;
    height: 42px;
    border-radius: 13px;
  }

  /* Phần giới thiệu đầu trang. */
  body .hero {
    gap: 22px;
    padding: 34px 16px 38px;
  }

  body .hero h1 {
    font-size: clamp(36px, 10vw, 44px);
    line-height: 1.12;
  }

  body .hero p {
    font-size: 17px;
    line-height: 1.65;
  }

  body .search-box {
    padding: 12px;
    border-radius: 20px;
  }

  body .search-box input,
  body .search-box button {
    min-height: 48px;
  }

  body .hero > div:first-child > .primary-link,
  body .hero > div:first-child > .secondary-link {
    min-height: 46px;
  }

  /* Bốn ô thống kê: giảm chiều cao nhưng vẫn dễ đọc. */
  body .home-stats {
    gap: 12px;
    margin-top: 20px;
    padding-inline: 16px;
  }

  body .home-stats > div {
    min-height: 136px;
    padding: 16px 10px;
    border-radius: 18px;
  }

  body .home-stats strong {
    margin: 6px 0;
    font-size: 28px;
  }

  body .home-stats span {
    font-size: 14px;
  }

  /* Tiêu đề các khu vực. */
  body .section-title h2 {
    font-size: clamp(32px, 9vw, 42px);
    line-height: 1.12;
  }

  /* Thành viên nổi bật: bớt khoảng trắng thừa. */
  body .top-members {
    padding: 32px 16px;
  }

  body .top-members-grid {
    gap: 14px !important;
  }

  body .top-member-card {
    max-width: none;
    padding: 18px 16px;
  }

  body .top-member-card img {
    width: 72px !important;
    height: 72px !important;
    margin-bottom: 8px;
  }

  body .top-member-card h3 {
    margin: 6px 0 3px;
    font-size: 20px;
  }

  body .top-member-card p {
    margin-bottom: 10px;
    font-size: 15px;
  }

  body .top-member-card .btn-primary {
    min-height: 42px;
    padding: 9px 12px;
    font-size: 14px;
  }

  /* Ba khối lớp nằm cân đối trên cùng một hàng. */
  body .grade-filter {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 22px 0 26px;
  }

  body .grade-card {
    min-width: 0;
    min-height: 94px;
    padding: 14px 6px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.25;
  }

  body .grade-card span {
    margin-top: 6px;
    white-space: nowrap;
  }

  /* Thẻ môn học gọn hơn. */
  body .subjects {
    padding-top: 34px;
    padding-bottom: 34px;
  }

  body .subject-grid {
    gap: 14px;
  }

  body .subject-card {
    min-height: 0;
    padding: 18px;
  }

  body .subject-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 12px;
    font-size: 28px;
  }

  body .subject-card h3 {
    margin-bottom: 6px;
    font-size: 21px;
  }

  body .subject-card p {
    font-size: 15px;
    line-height: 1.55;
  }

  /* Tài liệu nổi bật: tăng độ rõ thống kê, giảm chiều cao nút. */
  body .documents {
    padding-top: 34px;
    padding-bottom: 38px;
  }

  body .doc-grid {
    gap: 14px;
  }

  body .doc-card-body {
    padding: 16px;
  }

  body .doc-card .doc-title {
    margin-bottom: 8px;
    font-size: 19px;
  }

  body .doc-card .doc-description {
    margin-bottom: 12px;
    line-height: 1.5;
  }

  body .doc-card .doc-meta {
    margin-bottom: 13px;
  }

  body .doc-card-footer {
    padding-top: 12px;
  }

  body .doc-card .doc-stats {
    gap: 18px;
    margin-bottom: 10px;
    font-size: 16px;
  }

  body .doc-card .detail-btn,
  body .doc-card .download-btn {
    min-height: 42px;
    padding: 8px 10px;
    font-size: 14px;
  }
}

@media (max-width: 380px) {
  body .compact-navbar {
    padding-inline: 9px;
    gap: 6px;
  }

  body .compact-navbar-right,
  body .compact-navbar .user-mini {
    gap: 4px;
  }

  body .compact-navbar [data-user-area] .header-action-link[href="chat.html"],
  body .compact-navbar [data-user-area] .header-action-link[href="notifications.html"],
  body .compact-navbar .profile-link img {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  body .compact-menu-toggle {
    width: 40px;
    height: 40px;
  }

  body .grade-filter {
    gap: 7px;
  }

  body .grade-card {
    padding-inline: 3px;
    font-size: 14px;
  }
}
