/* ==== Navigation Buttons ==== */
.chuong-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #ccc;
  flex-wrap: wrap;
  gap: 10px;
}

.chuong-nav a {
  background: #0077b6;
  color: #fff;
  padding: 10px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: bold;
  font-size: 15px;
  flex: 1 1 calc(50% - 10px);
  text-align: center;
}

.chuong-nav a:hover {
  background: #023e8a;
}

@media (max-width: 600px) {
  .chuong-nav a {
    font-size: 14px;
    padding: 8px 12px;
  }
}

/* ==== Nút đọc tiếp ==== */
.btn-doc-tiep {
  display: inline-block;
  margin: 10px 0;
  padding: 10px 16px;
  background: #d62828;
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-weight: bold;
  font-size: 15px;
}

.btn-doc-tiep:hover {
  background: #a4161a;
}

@media (max-width: 767px) {
  .btn-doc-tiep {
    display: inline-block !important;
    font-size: 14px;
    padding: 8px 12px;
  }
}

/* ==== Khóa nội dung ==== */
.khoa-noi-dung {
  background: #fff3cd;
  border: 1px solid #ffeeba;
  padding: 16px;
  margin: 24px auto;
  max-width: 720px;
  text-align: center;
  font-size: 16px;
  border-radius: 8px;
  color: #856404;
}

.btn-mo-khoa {
  display: inline-block;
  margin-top: 12px;
  background: #ff6f00;
  color: #fff;
  padding: 10px 16px;
  font-size: 15px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: bold;
}

.btn-mo-khoa:hover {
  background: #e65100;
}

/* ==== Căn giữa nội dung chương truyện ==== */
.chuong-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 15px;
}

.noi-dung-chuong {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 15px;
  line-height: 1.8;
  font-size: 18px;
}

/* ==== Truyện Audio – Trang archive (ĐÃ CẬP NHẬT HOÀN CHỈNH) ==== */
.truyen-audio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
  margin: 20px auto;
  max-width: 1200px;
  padding: 0 16px;
}

.truyen-audio-item {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  text-align: center;
}

/* Biến thẻ link thành container để định vị nút play */
.truyen-audio-link {
  position: relative;
  display: block;
}

.truyen-audio-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.truyen-audio-item img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px 8px 0 0;
}

.truyen-title,
.truyen-audio-item h2 {
  font-size: 16px;
  margin: 10px;
  color: #333;
  font-weight: 600;
  line-height: 1.3;
}

/* Tạo hình tròn trắng bên ngoài - Luôn hiển thị */
.play-icon {
  /* Quan trọng: đảm bảo nút luôn hiển thị */
  display: flex !important;
  
  position: absolute;
  top: 45%; /* Căn giữa theo chiều dọc của ảnh, không tính tiêu đề */
  left: 50%;
  transform: translate(-50%, -50%);
  
  width: 50px;
  height: 50px;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  
  transition: all 0.3s ease;
  z-index: 10;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  align-items: center;
  justify-content: center;
}

/* Tạo hình tam giác đỏ bên trong */
.play-icon::after {
  content: '';
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 16px solid #d62828;
  margin-left: 3px;
}

/* Hiệu ứng khi di chuột qua thumbnail (chỉ áp dụng cho màn hình lớn) */
@media (min-width: 768px) {
  .truyen-audio-item:hover .play-icon {
    transform: translate(-50%, -50%) scale(1.1);
    background-color: #fff;
  }
}

@media (max-width: 768px) {
  .truyen-audio-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 0 12px;
  }

  .truyen-title {
    font-size: 14px;
    margin: 8px;
  }
  
  /* Điều chỉnh kích thước nút play trên điện thoại */
  .play-icon {
    width: 40px;
    height: 40px;
  }
  .play-icon::after {
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 13px solid #d62828;
    margin-left: 2px;
  }
}

@media (max-width: 480px) {
  .truyen-audio-grid {
    grid-template-columns: 1fr; /* Có thể đổi thành 2 cột nếu muốn: repeat(2, 1fr) */
    gap: 14px;
  }

  .truyen-audio-item {
    padding: 0;
  }
}


/* ==== Audio Player trong single-truyen_audio ==== */
.audio-player-frame {
  max-width: 768px;
  margin: 0 auto;
  padding: 20px;
  background-color: #f7f7f7;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.audio-player {
  margin: 24px 0;
  padding: 16px;
  background: #f8f9fa;
  border-left: 5px solid #0077b6;
  border-radius: 8px;
}

.audio-player audio {
  width: 100%;
}

/* ==== Danh sách truyện audio khác (nếu có) ==== */
.audio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.audio-item {
  background: #fff;
  padding: 12px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  text-align: center;
  transition: all 0.3s ease;
}

.audio-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.audio-thumbnail img {
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.audio-title {
  margin-top: 10px;
  font-size: 1rem;
  color: #333;
  font-weight: 600;
}

/* ==== Responsive Mobile: 2 cột danh sách truyện và phân trang ==== */
@media (max-width: 767px) {
  .truyen-list,
  .ct-loop,
  .blog-posts,
  .posts-grid,
  .wp-block-post-template {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    padding: 0 6px !important;
  }

  .entry-card {
    margin: 0;
    padding: 4px;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: auto;
  }

  .entry-card img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    border-radius: 4px;
  }

  .entry-title {
    font-size: 13px;
    line-height: 1.3;
    margin: 6px 0 0;
    height: 36px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    flex-grow: 1;
  }

  .entry-meta,
  .entry-excerpt {
    display: none !important;
  }

  .pagination {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    padding: 12px 0;
  }

  .pagination a,
  .pagination span {
    font-size: 13px;
    padding: 6px 10px;
  }
}

/* ==== Pagination (Chung) ==== */
.pagination {
  margin: 30px auto;
  padding: 10px 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  text-align: center;
}

.pagination a,
.pagination span {
  padding: 8px 14px;
  font-size: 14px;
  background: #f0f0f0;
  color: #333;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.3s;
  min-width: 40px;
}

.pagination a:hover {
  background: #ccc;
}

.pagination .current {
  background: #333;
  color: #fff;
  font-weight: bold;
}

/* ==== Căn giữa trang single-truyen (trang giới thiệu truyện) ==== */
.single-truyen .site-main {
  max-width: 900px;   /* Giới hạn chiều rộng */
  margin: 0 auto;     /* Căn giữa */
  padding: 0 15px;    /* Khoảng cách lề */
}

.single-truyen .truyen-noi-dung {
  line-height: 1.8;   /* Dễ đọc */
  font-size: 17px;    /* Cỡ chữ hợp lý */
}
/* ==== Giao diện trang nghe truyện audio (single-truyen_audio) ==== */

/* Căn giữa toàn bộ nội dung */
.truyen-audio-detail {
  max-width: 800px;
  margin: 0 auto 40px auto;
}

/* Tiêu đề chính của truyện */
.audio-main-title {
  text-align: center;
  font-size: 28px;
  margin-bottom: 24px;
  color: #222;
}

/* Khung chứa ảnh bìa */
.audio-cover-image {
  margin: 0 auto 24px auto;
  text-align: center;
  max-width: 400px;
  /* Giới hạn chiều rộng ảnh bìa */
}

.audio-cover-image img {
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  width: 100%;
  height: auto;
}

/* Khung chứa trình phát audio */
.audio-player-container {
  background-color: #f7f9fc;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
  border: 1px solid #e9ecef;
}

.audio-player-container figcaption {
  font-size: 14px;
  color: #6c757d;
  margin-bottom: 10px;
  font-style: italic;
}

/* Phần mô tả truyện */
.audio-content-description {
  line-height: 1.8;
  font-size: 17px;
  color: #343a40;
}

/* Phần truyện liên quan */
.related-audios {
  margin-top: 60px;
  padding-top: 40px;
  border-top: 1px solid #eee;
}

.related-title {
  text-align: center;
  font-size: 24px;
  margin-bottom: 30px;
  color: #333;
}
/* Ẩn thông báo chưa có file audio */
.no-audio-notice {
    display: none !important;
}
.btn-audio-truyen {
  display: block;
  background: #ff6f00;
  color: #fff;
  padding: 14px 18px;
  border-radius: 10px;
  text-align: center;
  font-weight: 600;
  margin: 12px auto;
  font-size: 17px;
  max-width: 320px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.15);
  transition: background 0.3s, transform 0.2s;
}
.btn-audio-truyen:hover {
  background: #e65100;
  transform: translateY(-2px);
}
@media (max-width: 768px) {
  .btn-audio-truyen {
    width: calc(100% - 40px);
    font-size: 18px;
  }
}
