
/* ============================================================
   BOTVIET CONTENT V8.2
   Sửa 2 vùng theo ảnh:
   1) Header + dải thống kê giữa: đều 4 cột, bo góc chuẩn
   2) Nội dung gần đây: không vỡ khung, bo góc đều, table không tràn
   Chỉ áp dụng /app/content
   ============================================================ */

body.bv-content-v82 {
  --bv82-radius: 16px;
  --bv82-radius-sm: 12px;
  --bv82-border: rgba(47, 166, 230, .40);
  --bv82-line: rgba(71, 158, 213, .22);
  --bv82-panel: rgba(3, 25, 51, .96);
  --bv82-panel-2: rgba(4, 31, 61, .94);
}

/* Cùng một chuẩn width cho các khung chính */
body.bv-content-v82 .bv-v82-page-head,
body.bv-content-v82 .bv-v82-stats,
body.bv-content-v82 .bv-v82-recent {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  box-sizing: border-box !important;

  border: 1px solid var(--bv82-border) !important;
  border-radius: var(--bv82-radius) !important;
  background: linear-gradient(180deg, rgba(4,33,64,.98), rgba(3,24,48,.98)) !important;

  overflow: hidden !important;
  clip-path: inset(0 round var(--bv82-radius)) !important;
}

/* ---------- HEADER "Nội dung & Đăng bài" ---------- */
body.bv-content-v82 .bv-v82-page-head {
  padding: clamp(.95rem, 1.2vw, 1.25rem) clamp(1rem, 1.4vw, 1.4rem) !important;
}

body.bv-content-v82 .bv-v82-page-head > * {
  min-width: 0 !important;
  max-width: 100% !important;
}

/* ---------- DẢI THỐNG KÊ GIỮA ---------- */
body.bv-content-v82 .bv-v82-stats {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 0 !important;
  padding: 0 !important;
  align-items: stretch !important;
}

body.bv-content-v82 .bv-v82-stat-item {
  min-width: 0 !important;
  min-height: 4.4rem !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  padding: .7rem clamp(.7rem, 1vw, 1.1rem) !important;
  box-sizing: border-box !important;

  position: relative !important;
  overflow: hidden !important;
}

body.bv-content-v82 .bv-v82-stat-item + .bv-v82-stat-item {
  border-left: 1px solid var(--bv82-line) !important;
}

/* Nếu source cũ có divider tuyệt đối, vô hiệu để không bị lệch */
body.bv-content-v82 .bv-v82-stat-item::before,
body.bv-content-v82 .bv-v82-stat-item::after {
  max-height: 100% !important;
}

body.bv-content-v82 .bv-v82-stat-item > * {
  min-width: 0 !important;
  max-width: 100% !important;
}

/* Đảm bảo chữ/icon trong 4 ô không tràn */
body.bv-content-v82 .bv-v82-stat-item :is(span, div, strong, small, p) {
  overflow-wrap: break-word !important;
  word-break: normal !important;
}

@media (max-width: 58rem) {
  body.bv-content-v82 .bv-v82-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.bv-content-v82 .bv-v82-stat-item:nth-child(3) {
    border-left: 0 !important;
    border-top: 1px solid var(--bv82-line) !important;
  }

  body.bv-content-v82 .bv-v82-stat-item:nth-child(4) {
    border-top: 1px solid var(--bv82-line) !important;
  }
}

/* ---------- NỘI DUNG GẦN ĐÂY ---------- */
body.bv-content-v82 .bv-v82-recent {
  padding: .75rem 1rem .45rem !important;
}

/* Thanh tiêu đề + tabs + search + filter */
body.bv-content-v82 .bv-v82-recent-toolbar {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;

  display: flex !important;
  align-items: center !important;
  gap: .65rem !important;
  flex-wrap: wrap !important;

  padding: 0 0 .55rem !important;
  box-sizing: border-box !important;
}

body.bv-content-v82 .bv-v82-recent-toolbar > * {
  min-width: 0 !important;
  max-width: 100% !important;
}

/* Group tabs co giãn tự nhiên */
body.bv-content-v82 .bv-v82-recent-tabs {
  flex: 1 1 32rem !important;
  min-width: 20rem !important;
  max-width: 100% !important;

  display: flex !important;
  align-items: center !important;
  gap: 0 !important;

  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: thin !important;

  border-radius: 10px !important;
}

/* Search/filter không đẩy vỡ card */
body.bv-content-v82 .bv-v82-recent-search {
  flex: 0 1 15rem !important;
  min-width: 10rem !important;
  max-width: 18rem !important;
}

body.bv-content-v82 .bv-v82-recent-filter {
  flex: 0 0 auto !important;
}

/* Table wrapper nằm gọn hoàn toàn trong card */
body.bv-content-v82 .bv-v82-table-wrap {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;

  overflow-x: auto !important;
  overflow-y: hidden !important;

  border-radius: 10px !important;
  box-sizing: border-box !important;
  scrollbar-width: thin !important;
}

/* Table không vượt ra ngoài bo góc */
body.bv-content-v82 .bv-v82-table-wrap table {
  width: 100% !important;
  min-width: 48rem !important;
  max-width: none !important;

  table-layout: fixed !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

/* Header table sạch và đều */
body.bv-content-v82 .bv-v82-table-wrap thead th {
  background: rgba(8, 48, 82, .94) !important;
  border-bottom: 1px solid var(--bv82-line) !important;

  padding: .55rem .65rem !important;
  vertical-align: middle !important;

  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* Row đều, line dừng trong wrapper */
body.bv-content-v82 .bv-v82-table-wrap tbody td {
  padding: .62rem .65rem !important;
  vertical-align: middle !important;

  border-bottom: 1px solid rgba(61, 141, 194, .20) !important;

  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

body.bv-content-v82 .bv-v82-table-wrap tbody tr:last-child td {
  border-bottom: 0 !important;
}

/* Các cell nội dung dài không làm nổ cột */
body.bv-content-v82 .bv-v82-table-wrap td :is(span, div, p, small, strong) {
  max-width: 100% !important;
  overflow-wrap: break-word !important;
  word-break: normal !important;
}

/* Cột thao tác không bị kéo quá rộng */
body.bv-content-v82 .bv-v82-table-wrap th:last-child,
body.bv-content-v82 .bv-v82-table-wrap td:last-child {
  width: clamp(4.5rem, 7vw, 6rem) !important;
  text-align: center !important;
}

/* Cột trạng thái */
body.bv-content-v82 .bv-v82-table-wrap th:nth-last-child(2),
body.bv-content-v82 .bv-v82-table-wrap td:nth-last-child(2) {
  width: clamp(9rem, 15vw, 13rem) !important;
}

/* Tránh ảnh/icon thumbnail làm hàng bị phình */
body.bv-content-v82 .bv-v82-table-wrap img,
body.bv-content-v82 .bv-v82-table-wrap video {
  max-width: 100% !important;
  height: auto !important;
  object-fit: cover !important;
}

/* Đồng bộ khoảng cách giữa các khung chính */
body.bv-content-v82 .bv-v82-page-head + .bv-v82-stats,
body.bv-content-v82 .bv-v82-stats + * {
  margin-top: .75rem !important;
}

/* Mobile/tablet */
@media (max-width: 46rem) {
  body.bv-content-v82 .bv-v82-recent {
    padding-inline: .65rem !important;
  }

  body.bv-content-v82 .bv-v82-recent-search {
    flex: 1 1 100% !important;
    max-width: none !important;
  }

  body.bv-content-v82 .bv-v82-recent-tabs {
    flex-basis: 100% !important;
    min-width: 0 !important;
  }
}
