/* ============================================
   UNIFIED TABLE OF CONTENTS STYLES
   Áp dụng cho cả Provider Review & Blog Post
   ============================================ */

/* ===== Container Layout ===== */
.container,
.review-container {
  display: grid;
  grid-template-columns: 2.5fr 7.5fr;
  gap: 40px;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

/* ===== Sidebar Styles ===== */
.left-content,
.review-sidebar {
  position: sticky;
  top: 100px;
  align-self: start;
  max-height: calc(100vh - 120px); /* Giới hạn chiều cao */
  overflow-y: auto; /* Cho phép scroll */
  overflow-x: hidden;
}

/* ===== Ẩn scrollbar nhưng vẫn scroll được ===== */
.left-content,
.review-sidebar,
.left-content .toc,
.review-sidebar .toc {
  /* Ẩn scrollbar cho IE và Edge */
  -ms-overflow-style: none;
  /* Ẩn scrollbar cho Firefox */
  scrollbar-width: none;
}

/* Ẩn scrollbar cho Chrome, Safari, Edge (Webkit) */
.left-content::-webkit-scrollbar,
.review-sidebar::-webkit-scrollbar,
.left-content .toc::-webkit-scrollbar,
.review-sidebar .toc::-webkit-scrollbar {
  display: none;
}

/* TOC Container */
/* .toc {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
} */

.toc-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 8px;
  position: sticky;
  top: 0;
  background: inherit;
  padding-bottom: 10px;
  z-index: 1;
  background-color: #fff;
}

/* ===== Reset List Styles ===== */
#sidebar-menu,
#toc-list,
#toc-list-mobile {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

/* ===== H2 - Main Headings ===== */
#sidebar-menu li:not(.sidebar-sub):not(.toc-sub),
#toc-list li:not(.sidebar-sub):not(.toc-sub),
#toc-list-mobile li:not(.sidebar-sub):not(.toc-sub) {
  /* padding: 8px 0; */
  font-size: 15px;
  font-weight: 600;
}

#sidebar-menu li:not(.sidebar-sub):not(.toc-sub) a,
#toc-list li:not(.sidebar-sub):not(.toc-sub) a,
#toc-list-mobile li:not(.sidebar-sub):not(.toc-sub) a {
  display: block;
  text-decoration: none;
  transition:
    color 0.2s,
    background 0.2s;
  border-radius: 6px;
  padding: 4px 12px;
  color: #000;
  font-weight: 600;
  /* Text truncation */
  display: -webkit-box !important;
  -webkit-box-orient: vertical;
  overflow: hidden;
  -webkit-line-clamp: 2;
  word-break: break-word;
  /* line-height: 1.4; */
}

/* ===== H3 - Sub Headings ===== */
#sidebar-menu li.sidebar-sub,
#sidebar-menu li.toc-sub,
#toc-list li.sidebar-sub,
#toc-list li.toc-sub,
#toc-list-mobile li.sidebar-sub,
#toc-list-mobile li.toc-sub {
  /* padding-left: 16px; */
}

#sidebar-menu li.sidebar-sub a,
#sidebar-menu li.toc-sub a,
#toc-list li.sidebar-sub a,
#toc-list li.toc-sub a,
#toc-list-mobile li.sidebar-sub a,
#toc-list-mobile li.toc-sub a {
  padding: 4px 12px;
  color: #666;
  text-decoration: none;
  font-weight: 400;
  font-size: 14px;
  border-radius: 6px;
  transition: all 0.2s;
  display: block;
  /* Text truncation */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  -webkit-line-clamp: 2;
  word-break: break-word;
  /* line-height: 1.4; */
}

/* Icon for H3 */
#sidebar-menu li.sidebar-sub a::before,
#sidebar-menu li.toc-sub a::before,
#toc-list li.sidebar-sub a::before,
#toc-list li.toc-sub a::before,
#toc-list-mobile li.sidebar-sub a::before,
#toc-list-mobile li.toc-sub a::before {
  content: "└ ";
  color: #999;
  margin-right: 5px;
}

/* ===== Hover States ===== */
#sidebar-menu li:not(.sidebar-sub):not(.toc-sub) a:hover,
#toc-list li:not(.sidebar-sub):not(.toc-sub) a:hover,
#toc-list-mobile li:not(.sidebar-sub):not(.toc-sub) a:hover {
  background: #188ffe;
  color: #fff;
}

#sidebar-menu li.sidebar-sub a:hover,
#sidebar-menu li.toc-sub a:hover,
#toc-list li.sidebar-sub a:hover,
#toc-list li.toc-sub a:hover,
#toc-list-mobile li.sidebar-sub a:hover,
#toc-list-mobile li.toc-sub a:hover {
  background: #188ffe;
  color: #fff;
}

/* ===== Active State ===== */
#sidebar-menu a.active-reviews,
#toc-list a.active-reviews,
#toc-list-mobile a.active-reviews {
  background: #188ffe;
  color: #fff !important;
}

#sidebar-menu li.sidebar-sub a.active-reviews,
#sidebar-menu li.toc-sub a.active-reviews,
#toc-list li.sidebar-sub a.active-reviews,
#toc-list li.toc-sub a.active-reviews,
#toc-list-mobile li.sidebar-sub a.active-reviews,
#toc-list-mobile li.toc-sub a.active-reviews {
  background: #188ffe;
  color: #fff !important;
}

/* ===== Mobile TOC ===== */
.toc-mobile {
  display: none;
  margin: 20px 0;
}

.toc-toggle {
  background: white;
  color: black;
  border: 1px solid #e5e7eb;
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  text-align: center;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.toc-toggle:hover {
  background-color: #188ffe;
  color: white;
  border-color: #188ffe;
}

.toc-toggle i {
  font-size: 14px;
}

.toc-content {
  display: none;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 15px;
  margin-top: 10px;
  max-height: 400px;
  overflow-y: auto;
  /* Ẩn scrollbar cho mobile TOC */
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.toc-content::-webkit-scrollbar {
  display: none;
}

.toc-content.show {
  display: block;
}

/* ===== Smooth Scroll ===== */
html {
  scroll-behavior: smooth;
}

/* ===== Responsive ===== */
@media (max-width: 992px) {
  .container,
  .review-container {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 20px auto;
    padding: 0 20px;
  }

  .left-content,
  .review-sidebar {
    display: none;
  }

  .toc-mobile {
    display: block;
  }

  .right-content,
  .content-right {
    width: 100%;
    padding-top: 80px;
  }
}

@media (min-width: 992px) {
  .toc-mobile {
    display: none;
  }

  .left-content,
  .review-sidebar {
    display: block;
  }
}

/* ===== Content Heading Styles ===== */
.review-content h2,
.article-body h2 {
  font-size: 32px;
  font-weight: 510;
  margin: 15px 0;
  color: #1a1a1a;
  scroll-margin-top: 100px;
}

.review-content h3,
.article-body h3 {
  font-size: 24px;
  font-weight: 510;
  margin: 15px 0;
  color: #1a1a1a;
  scroll-margin-top: 100px;
}

.review-content h4,
.article-body h4 {
  font-size: 18px;
  font-weight: 510;
  margin: 15px 0;
  color: #1a1a1a;
}

/* ===== Content Paragraph Styles ===== */
.content-post p,
.article-body p {
  margin: 10px 0;
  line-height: 22px;
  font-size: 14px;
  font-weight: 300;
}

.content-post p strong,
.article-body p strong {
  font-weight: 510;
}

/* ============================================
   UNIFIED TABLE STYLES
   Áp dụng cho cả Provider Review & Blog Post
   ============================================ */
.content-post table,
.review-content table,
.article-body table {
  width: 100%;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  margin: 28px 0;
  font-size: 14px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
  border: 1px solid #e5e7eb !important;
  height: auto !important;
}

.content-post table thead tr,
.review-content table thead tr,
.article-body table thead tr {
  height: auto !important;
  background: transparent !important;
}

/* Gradient only on the first header row */
.content-post table thead tr:first-child,
.review-content table thead tr:first-child,
.article-body table thead tr:first-child {
  background: linear-gradient(135deg, #2b7fff 0%, #00b8db 100%) !important;
}

/* If all rows are inside <thead> (Classic Editor edge case), style non-header rows as body rows */
.content-post table thead tr:not(:first-child) td,
.review-content table thead tr:not(:first-child) td,
.article-body table thead tr:not(:first-child) td {
  color: #374151 !important;
  font-weight: 300 !important;
  background-color: transparent !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  border-bottom: 1px solid #f0f3f8 !important;
  height: auto !important;
  width: auto !important;
}

.content-post table thead tr:not(:first-child):nth-child(odd),
.review-content table thead tr:not(:first-child):nth-child(odd),
.article-body table thead tr:not(:first-child):nth-child(odd) {
  background: #f8faff !important;
}

.content-post table thead tr:not(:first-child):nth-child(even),
.review-content table thead tr:not(:first-child):nth-child(even),
.article-body table thead tr:not(:first-child):nth-child(even) {
  background: #ffffff !important;
}

.content-post table thead tr:not(:first-child) td:first-child,
.review-content table thead tr:not(:first-child) td:first-child,
.article-body table thead tr:not(:first-child) td:first-child {
  font-weight: 500 !important;
  color: #1a1a1a !important;
}

.content-post table thead th,
.review-content table thead th,
.article-body table thead th,
.content-post table thead td,
.review-content table thead td,
.article-body table thead td {
  color: #ffffff !important;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.4px;
  padding: 14px 18px;
  white-space: nowrap;
  border: none !important;
  background: transparent;
  height: auto !important;
  width: auto !important;
}

.content-post table thead th:first-child,
.review-content table thead th:first-child,
.article-body table thead th:first-child,
.content-post table thead td:first-child,
.review-content table thead td:first-child,
.article-body table thead td:first-child {
  border-radius: 12px 0 0 0;
}

.content-post table thead th:last-child,
.review-content table thead th:last-child,
.article-body table thead th:last-child,
.content-post table thead td:last-child,
.review-content table thead td:last-child,
.article-body table thead td:last-child {
  border-radius: 0 12px 0 0;
}

.content-post table tbody tr,
.review-content table tbody tr,
.article-body table tbody tr {
  transition: background 0.18s;
}

.content-post table tbody tr:nth-child(odd),
.review-content table tbody tr:nth-child(odd),
.article-body table tbody tr:nth-child(odd) {
  background: #f8faff !important;
}

.content-post table tbody tr:nth-child(even),
.review-content table tbody tr:nth-child(even),
.article-body table tbody tr:nth-child(even) {
  background: #ffffff !important;
}

.content-post table tbody tr:hover,
.review-content table tbody tr:hover,
.article-body table tbody tr:hover {
  background: #eef6ff !important;
}

.content-post table tbody td,
.review-content table tbody td,
.article-body table tbody td {
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 300;
  color: #374151 !important;
  background-color: transparent !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  border-bottom: 1px solid #f0f3f8 !important;
  vertical-align: middle;
  line-height: 1.5;
  height: auto !important;
  width: auto !important;
}

.content-post table tbody td:first-child,
.review-content table tbody td:first-child,
.article-body table tbody td:first-child {
  font-weight: 500;
  color: #1a1a1a !important;
}

.content-post table tbody tr:last-child td,
.review-content table tbody tr:last-child td,
.article-body table tbody tr:last-child td {
  border-bottom: none !important;
}

.content-post table tbody tr:last-child td:first-child,
.review-content table tbody tr:last-child td:first-child,
.article-body table tbody tr:last-child td:first-child {
  border-radius: 0 0 0 12px;
}

.content-post table tbody tr:last-child td:last-child,
.review-content table tbody tr:last-child td:last-child,
.article-body table tbody tr:last-child td:last-child {
  border-radius: 0 0 12px 0;
}

/* wp-block-table overrides (Gutenberg) */
.content-post .wp-block-table,
.review-content .wp-block-table,
.article-body .wp-block-table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 28px 0;
  border: none;
}

.content-post .wp-block-table table,
.review-content .wp-block-table table,
.article-body .wp-block-table table {
  margin: 0;
  min-width: 480px;
  border-collapse: separate;
  border-spacing: 0;
}

.content-post .wp-block-table td,
.content-post .wp-block-table th,
.review-content .wp-block-table td,
.review-content .wp-block-table th,
.article-body .wp-block-table td,
.article-body .wp-block-table th {
  border: none;
  border-bottom: 1px solid #f0f3f8;
  padding: 12px 18px;
}

.content-post .wp-block-table thead th,
.review-content .wp-block-table thead th,
.article-body .wp-block-table thead th {
  border-bottom: none;
}

.content-post .wp-block-table thead,
.review-content .wp-block-table thead,
.article-body .wp-block-table thead {
  border-bottom: none;
}

.content-post .wp-block-table tbody tr:last-child td,
.review-content .wp-block-table tbody tr:last-child td,
.article-body .wp-block-table tbody tr:last-child td {
  border-bottom: none;
}

/* Content links */
.content-post a,
.review-content a,
.article-body a {
  color: #188ffe;
  text-decoration: underline;
  font-weight: 700;
}

.content-post a:hover,
.review-content a:hover,
.article-body a:hover {
  opacity: 0.8;
}

/* Responsive tables */
@media (max-width: 768px) {
  .content-post table,
  .review-content table,
  .article-body table {
    font-size: 13px;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  .content-post table thead th,
  .review-content table thead th,
  .article-body table thead th {
    padding: 11px 14px;
    font-size: 12px;
  }

  .content-post table tbody td,
  .review-content table tbody td,
  .article-body table tbody td {
    padding: 10px 14px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .content-post table thead th,
  .review-content table thead th,
  .article-body table thead th {
    padding: 10px 12px;
  }

  .content-post table tbody td,
  .review-content table tbody td,
  .article-body table tbody td {
    padding: 9px 12px;
  }
}
