/**
 * Post Interface - Custom Overrides & UI Enhancements
 * File: toplist-custom.css
 * Description: Tệp CSS tùy biến riêng cho layout, tiêu đề H1, sidebar và các thành phần giao diện.
 */

/* ==========================================================================
   0. CHUẨN HÓA FONT CHỮ TIẾNG VIỆT (CHỐNG LỖI VỠ FONT, LỖI DẤU TIẾNG VIỆT)
   ========================================================================== */

.ladigi-toplist-article-content,
.ladigi-author-page,
.ladigi-author-hero-card,
.ladigi-author-hero-name,
.ladigi-author-hero-pretitle,
.ladigi-author-hero-bio,
.ladigi-card-title,
.ladigi-hero-title,
.ladigi-section-title,
.ladigi-cat-title,
.ladigi-author-box,
.ladigi-author-name,
.entry-content-header .post-title.entry-title {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
  text-rendering: optimizeLegibility !important;
}

.ladigi-author-hero-name {
  font-weight: 700 !important;
  font-size: 28px !important;
  letter-spacing: -0.2px !important;
}

.ladigi-author-hero-pretitle {
  font-weight: 600 !important;
}

.ladigi-card-title,
.ladigi-hero-title,
.ladigi-section-title {
  font-weight: 700 !important;
}

/* ==========================================================================
   1. BỐ CỤC CHUNG & TỐI ƯU KHUNG BÀI VIẾT (LAYOUT & CONTAINER)
   ========================================================================== */

.content, .sidebar {
  padding-top: 20px !important;
}

.main_color div {
  border-color: #c0c0c0;
}

.content .entry-content-wrapper {
  padding-right: 20px;
}

div .av_one_fourth {
  margin-left: 2%;
  width: 23.5%;
}

.post-loop-1 .big-preview {
  position: relative;
  z-index: 4;
  display: none;
}

.related_posts {
  padding: 23px 0px 33px 0;
  margin-bottom: 0px;
}

body .av-special-heading.classic-quote > * {
  font-family: "arial", Georgia, Times, serif;
}

.ladigi-author-name a {
  font-family: auto;
}

/* Breadcrumbs điều hướng - Loại bỏ hoàn toàn padding-left và lùi dòng */
.ladigi-breadcrumbs-list,
.entry-content .ladigi-breadcrumbs-list,
ol.ladigi-breadcrumbs-list {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 6px !important;
  list-style: none !important;
  list-style-type: none !important;
  margin: 0 0 14px 0 !important;
  padding: 0 !important;
  padding-left: 0 !important;
}

.ladigi-breadcrumb-item,
.entry-content .ladigi-breadcrumb-item,
li.ladigi-breadcrumb-item {
  list-style: none !important;
  list-style-type: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Header menu dropdown */
#top #header .avia_mega_div > .sub-menu {
  padding: 0px 30px 30px;
}

/* ==========================================================================
   2. MỞ RỘNG PHẦN NỘI DUNG GIỮA & DUY TRÌ SIDEBAR (DESKTOP >= 1200px)
   ========================================================================== */

@media (min-width: 1200px) {
  /* 1. Mở rộng khung container toàn trang */
  .responsive .container {
    max-width: 1360px !important;
  }

  /* 2. Tăng tỷ lệ khung bài viết chính */
  .container .av-content-small.units {
    width: 75% !important;
  }

  /* 3. Đảm bảo Sidebar bên phải luôn hiển thị song song theo cơ chế BFC của theme */
  #top #main .sidebar {
    float: none !important;
    width: auto !important;
    overflow: hidden !important;
    display: block !important;
    clear: none !important;
  }

  /* 4. Tinh chỉnh tỷ lệ cột Mục lục và Phần giữa */
  .ladigi-toplist-layout-2col {
    display: grid !important;
    grid-template-columns: 240px minmax(0, 1fr) !important;
    gap: 24px !important;
    align-items: start !important;
  }
}

/* ==========================================================================
   2.1. STICKY MỤC LỤC TRÊN DESKTOP (PC & LAPTOP >= 992px)
   ========================================================================== */

/* Giải phóng các overflow của Enfold Theme chặn position: sticky */
html, body {
  overflow-x: clip !important;
  overflow-y: visible !important;
}

#wrap_all,
#main,
.container_wrap,
.template-blog .post .entry-content-wrapper,
.entry-content-wrapper,
.entry-content,
.post-entry,
main.content {
  overflow: visible !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
}

@media (min-width: 992px) {
  /* Cột bên trái chứa Mục lục bám dính khi cuộn trang */
  .ladigi-toplist-left-sidebar {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 30px !important;
    max-height: calc(100vh - 60px) !important;
    overflow-y: auto !important;
    z-index: 99 !important;
  }

  /* Box mục lục */
  .ladigi-sticky-toc-box {
    position: static !important;
    display: block !important;
    width: 100% !important;
  }
}

/* ==========================================================================
   3. TIÊU ĐỀ H1 CHUẨN PHONG CÁCH LUẬT CAO CẤP (TONE #ec3237)
   ========================================================================== */

.entry-content-header {
  margin-bottom: 28px !important;
  position: relative !important;
  padding-bottom: 16px !important;
  border-bottom: 2px solid #edf2f7 !important;
}

/* Thanh nhấn đỏ 90px trang trí nằm dưới đường viền */
.entry-content-header::after {
  content: "" !important;
  position: absolute !important;
  left: 0 !important;
  bottom: -2px !important;
  width: 90px !important;
  height: 3px !important;
  background: #ec3237 !important;
  border-radius: 2px !important;
}

.entry-content-header .post-title.entry-title {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
  font-size: 30px !important;
  line-height: 1.38 !important;
  font-weight: 800 !important;
  color: #111827 !important;
  position: relative !important;
  padding-left: 20px !important;
  margin: 0 !important;
  letter-spacing: -0.4px !important;
}

/* Thanh đứng màu đỏ #ec3237 điểm nhấn bên trái */
.entry-content-header .post-title.entry-title::before {
  content: "" !important;
  position: absolute !important;
  left: 0 !important;
  top: 3px !important;
  height: calc(100% - 6px) !important;
  width: 6px !important;
  background: #ec3237 !important;
  border-radius: 4px !important;
}

/* Ẩn icon mặc định cũ của theme */
.entry-content-header .post-format-icon {
  display: none !important;
}

/* ==========================================================================
   4. LÀM ĐẸP SIDEBAR PHẢI (TONE #ec3237 - PHONG CÁCH CARD HIỆN ĐẠI)
   ========================================================================== */

#top #main .sidebar {
  padding-left: 10px !important;
  border-left: 1px solid #f1f5f9 !important;
}

.sidebar .inner_sidebar {
  margin-left: 15px !important;
}

/* Từng Widget thành Card riêng biệt */
.sidebar .widget {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px !important;
  padding: 20px !important;
  margin-bottom: 24px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03) !important;
  transition: box-shadow 0.25s ease, transform 0.25s ease !important;
}

.sidebar .widget:hover {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06) !important;
}

/* Tiêu đề Widget */
.sidebar .widgettitle {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  position: relative !important;
  padding-bottom: 12px !important;
  margin: 0 0 16px 0 !important;
  border-bottom: 2px solid #f1f5f9 !important;
}

/* Thanh đỏ #ec3237 dưới tiêu đề Widget */
.sidebar .widgettitle::after {
  content: "" !important;
  position: absolute !important;
  left: 0 !important;
  bottom: -2px !important;
  width: 40px !important;
  height: 2px !important;
  background: #ec3237 !important;
  border-radius: 2px !important;
}

/* 4.1. Widget Dịch Vụ Nổi Bật (#text-7) */
#text-7 .textwidget p {
  margin-bottom: 10px !important;
}
#text-7 .textwidget p:last-child {
  margin-bottom: 0 !important;
}
#text-7 .textwidget a {
  display: flex !important;
  align-items: center !important;
  padding: 10px 14px !important;
  background: #f8fafc !important;
  border: 1px solid #edf2f7 !important;
  border-radius: 8px !important;
  color: #334155 !important;
  font-size: 14.5px !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  transition: all 0.2s ease !important;
}
#text-7 .textwidget a:hover {
  background: #fff5f5 !important;
  border-color: #fecdd3 !important;
  color: #ec3237 !important;
  transform: translateX(4px);
}
#text-7 .textwidget img.emoji {
  margin-right: 8px !important;
  width: 16px !important;
  height: 16px !important;
}

/* 4.2. Widget Tại Sao Nên Chọn Luật Nhân Dân (#text-5) */
#text-5 {
  background: linear-gradient(135deg, #fffafa 0%, #ffffff 100%) !important;
  border-color: #ffe4e6 !important;
}
#text-5 .widgettitle {
  color: #ec3237 !important;
}
#text-5 .textwidget p {
  position: relative !important;
  padding: 8px 0 8px 24px !important;
  margin: 0 !important;
  font-size: 14px !important;
  line-height: 1.55 !important;
  color: #475569 !important;
  border-bottom: 1px dashed #f1f5f9 !important;
}
#text-5 .textwidget p:last-child {
  border-bottom: none !important;
}
#text-5 .textwidget img.emoji {
  position: absolute !important;
  left: 0 !important;
  top: 10px !important;
  width: 15px !important;
  height: 15px !important;
}

/* 4.3. Widget Danh Sách Tin Tức / Bài Viết (.newsbox) */
.sidebar .news-wrap {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
}
.sidebar .news-wrap li {
  padding: 12px 0 !important;
  border-top: 1px solid #f1f5f9 !important;
  border-bottom: none !important;
  display: flex !important;
  gap: 12px !important;
  align-items: flex-start !important;
}
.sidebar .news-wrap li:first-child {
  border-top: none !important;
  padding-top: 0 !important;
}
.sidebar .news-thumb {
  border-radius: 6px !important;
  overflow: hidden !important;
  flex-shrink: 0 !important;
}
.sidebar .news-thumb img {
  width: 64px !important;
  height: 52px !important;
  object-fit: cover !important;
  border-radius: 6px !important;
  display: block !important;
}
.sidebar .news-link {
  font-size: 14px !important;
  line-height: 1.45 !important;
  font-weight: 600 !important;
  color: #1e293b !important;
  text-decoration: none !important;
  transition: color 0.2s ease !important;
}
.sidebar .news-link:hover {
  color: #ec3237 !important;
}
.sidebar .news-time {
  font-size: 12px !important;
  color: #94a3b8 !important;
  margin-top: 4px !important;
  display: block !important;
}

/* 4.4. Widget phụ khác */
img.attachment-portfolio.size-portfolio.wp-post-image {
  height: 200px;
}
.widget_recent_entries li a {
  font-family: "arial", "Times New Roman", Helvetica, Arial, sans-serif;
  font-size: 13px;
}
#top .news-wrap li,
#top .widget_nav_menu li {
  border-top-width: 1px;
  border-top-style: solid;
}

/* ==========================================================================
   5. RESPONSIVE MOBILE & TABLET
   ========================================================================== */

@media only screen and (max-width: 767px) {
  .responsive .template-blog .blog-meta {
    display: block !important;
    float: none;
    margin-right: 0;
    position: static;
  }

  .responsive .template-blog .blog-meta .small-preview {
    width: 100% !important;
    height: auto !important;
    margin-bottom: 20px;
  }

  .responsive .template-blog .blog-meta .small-preview img {
    width: 100%;
  }

  .responsive .content .entry-content-wrapper {
    display: block;
    float: none;
    width: 100%;
  }

  .entry-content-header .post-title.entry-title {
    font-size: 23px !important;
    padding-left: 14px !important;
  }
  .entry-content-header .post-title.entry-title::before {
    width: 4px !important;
  }
}
