.container-single {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 30px;
  margin-bottom: 40px;
  padding: 0 20px;
}

/* Main Content */

.main-content-signle {
  min-width: 0;
}

.content-box {
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.category-label {
  display: inline-block;
  color: #3b82f6;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.post-title {
  font-size: 32px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 15px;
  line-height: 1.3;
}

.post-date {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #999;
  font-size: 14px;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid #333;
}

.post-date svg {
  color: #666;
}

.featured-image {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 30px;
}

.post-content {
  font-size: 16px;
  line-height: 1.8;
  color: #bebebe;
}

.post-content h2 {
  font-size: 24px;
  margin: 30px 0 15px;
  color: #ffffff;
}

.post-content p {
  margin-bottom: 20px;
  color: #bebebe;
}

.post-content ul,
.post-content ol {
  margin: 20px 0;
  padding-left: 30px;
}

.post-content li {
  margin-bottom: 10px;
  color: #bebebe;
}

.post-content strong {
  color: #fff;
  font-weight: 600;
}

/* Author Box */

.author-box {
  display: flex;
  gap: 20px;
  margin-top: 40px;
  padding: 25px;
  background: #222222;
  border-radius: 12px;
}

.author-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.author-info {
  flex: 1;
}

.author-badge {
  display: inline-block;
  color: white;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 8px;
}

.author-name {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 8px;
}

.author-bio {
  font-size: 14px;
  color: #b0b0b0;
  line-height: 1.6;
}

/* Share Section */

.share-section {
  margin-top: 30px;
  padding-top: 30px;
  border-top: 1px solid #333;
}

.share-title {
  font-size: 16px;
  font-weight: 600;
  color: #b0b0b0;
  margin-bottom: 15px;
}

.share-buttons {
  display: flex;
  gap: 20px;
}

.share-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  cursor: pointer;
  text-decoration: none;
  background: #2a2a2a;
}

.share-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
  background: #333333;
}

.share-btn svg {
  color: #ffffff;
  fill: #ffffff;
}

.share-facebook svg,
.share-twitter svg,
.share-telegram svg {
  color: #ffffff;
  fill: #ffffff;
}

/* Sidebar */

.sidebar {
  position: relative;
}

.sidebar-wrapper {
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  position: absolute;
  top: 0;
  width: 100%;
  transition: none;
}

/* Class này sẽ được thêm bởi JavaScript khi cần scroll cùng */

.sidebar-wrapper.scrolling {
  position: fixed;
  top: 20px;
  width: 350px;
}

.sidebar-wrapper.bottom-reached {
  position: absolute;
  top: auto;
  bottom: 0;
}

.sidebar-title {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #3b82f6;
}

.latest-posts {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.latest-post-item {
  display: flex;
  gap: 15px;
  cursor: pointer;
  transition: transform 0.3s;
}

.latest-post-item:hover {
  transform: translateX(5px);
}

.latest-post-thumbnail {
  width: 100px;
  height: 85px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.latest-post-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.latest-post-category {
  font-size: 11px;
  color: #3b82f6;
  font-weight: 600;
  text-transform: uppercase;
}

.latest-post-title {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.3s;
}

.latest-post-item:hover .latest-post-title {
  color: #3b82f6;
}

.latest-post-date {
  font-size: 12px;
  color: #888;
}

/* Related Posts Section - Nằm riêng bên ngoài */

.related-posts-section {
    padding: 40px 20px;
  margin-top: 40px;
}

.related-container {
  max-width: 1400px;
  margin: 0 auto;
}

.section-title {
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 2px solid #3b82f6;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px;
}

.related-post-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
  border-radius: 8px;
  overflow: hidden;
}

.related-post-card:hover {
  transform: translateY(-5px);
}

.related-post-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.3s;
}

.related-post-card:hover .related-post-image {
  transform: scale(1.05);
}

.related-post-content {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.related-post-category {
  font-size: 12px;
  color: #3b82f6;
  font-weight: 600;
  text-transform: uppercase;
}

.related-post-title {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.3s;
}

.related-post-card:hover .related-post-title {
  color: #3b82f6;
}

.related-post-date {
  font-size: 13px;
  color: #888;
  margin-top: auto;
}

/* ========================================================= */

/* Responsive */

/* 4K Display (3840x2160 and above) */

@media (min-width: 2560px) {
  .container-single {
    grid-template-columns: 1fr 400px;
  }
  .post-title {
    font-size: 42px;
  }
  .post-content {
    font-size: 18px;
  }
  .post-content h2 {
    font-size: 28px;
  }
  .related-container {
    max-width: 80%;
  }
  .related-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
  }
  .sidebar-wrapper.scrolling {
    width: 400px;
  }
  .related-post-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    transition: transform 0.3s;
    border-radius: 20px;
  }
}

/* 2K Display (2560x1440) */

@media (min-width: 1920px) and (max-width: 2559px) {
  .post-title {
    font-size: 36px;
  }
  .post-content {
    font-size: 17px;
  }
  .related-container {
    max-width: 1400px;
  }
}

/* iPad Pro Portrait (1024x1366) and Tablet */

@media (min-width: 768px) and (max-width: 1023px) {
  .container-single {
    grid-template-columns: 1fr;
    gap: 25px;
  }
  /* Sidebar lên trên trên tablet */
  .sidebar {
    order: 2;
  }
  .main-content-signle {
    order: 1;
  }
  .sidebar-wrapper {
    position: relative !important;
    top: auto !important;
    width: 100% !important;
  }
  .sidebar-wrapper.scrolling,
  .sidebar-wrapper.bottom-reached {
    position: relative !important;
    width: 100% !important;
  }
  .post-title {
    font-size: 28px;
  }
  .post-content {
    font-size: 16px;
  }
  .post-content h2 {
    font-size: 22px;
  }
  /* Related posts - 2 columns on tablet */
  .related-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  .related-container {
    padding: 0 15px;
  }
  /* Latest posts layout horizontal on tablet */
  .latest-posts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  .author-box {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }
}

/* iPhone 12 Pro and Mobile (390x844 and below 768px) */

@media (max-width: 767px) {
  .container-single {
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 20px;
  }
  /* Sidebar lên đầu trên mobile */
  .sidebar {
    order: 2;
  }
  .main-content-signle {
    order: 1;
  }
  .sidebar-wrapper {
    position: relative !important;
    top: auto !important;
    width: 100% !important;
    padding: 20px;
  }
  .sidebar-wrapper.scrolling,
  .sidebar-wrapper.bottom-reached {
    position: relative !important;
    width: 100% !important;
  }
  
  /* Featured image */
  .featured-image {
    margin-bottom: 20px;
    border-radius: 6px;
  }
  /* Author box */
  .author-box {
    flex-direction: column;
    padding: 20px;
    text-align: center;
    align-items: center;
    margin-top: 30px;
  }
  .author-avatar {
    width: 70px;
    height: 70px;
  }
  .author-name {
    font-size: 16px;
  }
  .author-bio {
    font-size: 13px;
  }
  /* Share section */
  .share-section {
    margin-top: 25px;
    padding-top: 25px;
  }
  .share-title {
    font-size: 15px;
    margin-bottom: 12px;
  }
  .share-buttons {
    gap: 15px;
    justify-content: center;
  }
  .share-btn {
    width: 44px;
    height: 44px;
  }
  .share-btn svg {
    width: 20px;
    height: 20px;
  }
  /* Sidebar */
  .sidebar-title {
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 12px;
  }
  .latest-posts {
    gap: 15px;
  }
  .latest-post-item {
    gap: 12px;
  }
  .latest-post-thumbnail {
    width: 90px;
    height: 65px;
  }
  .latest-post-title {
    font-size: 13px;
  }
  .latest-post-category {
    font-size: 10px;
  }
  .latest-post-date {
    font-size: 11px;
  }
  /* Related posts */
  .related-posts-section {
    padding: 30px 10px;
    margin-top: 20px;
  }
  .related-container {
    padding: 0 10px;
  }
  .section-title {
    font-size: 20px;
    margin-bottom: 20px;
    padding-bottom: 12px;
  }
  .related-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  .related-post-card {
    border-radius: 6px;
  }
  .related-post-image {
    height: 180px;
  }
  .related-post-content {
    padding: 15px;
  }
  .related-post-category {
    font-size: 11px;
  }
  .related-post-title {
    font-size: 15px;
  }
  .related-post-date {
    font-size: 12px;
  }
}

/* Extra small devices (iPhone SE, small phones) */

@media (max-width: 374px) {
  .post-title {
    font-size: 20px;
  }
  .share-buttons {
    gap: 12px;
  }
  .share-btn {
    width: 40px;
    height: 40px;
  }
}

/* FIX overflow mobile */
@media (max-width: 767px) {
  .post-content,
  .post-content * {
    max-width: 100% !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
  }

  /* Fix ảnh tràn */
  .post-content img {
    width: 100% !important;
    height: auto !important;
  }

  /* Fix table tràn */
  .post-content table {
    display: block;
    width: 100% !important;
    overflow-x: auto;
  }

  /* Fix pre/code tràn */
  .post-content pre,
  .post-content code {
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
  }
}

