/* CSS cho trang Blog và Blog Detail */
:root {
  --blog-primary: #062f2b;
  --blog-secondary: #0d4b44;
  --blog-accent: #d2b26b;
  --blog-bg-light: #f4f7f6;
  --blog-text: #17312d;
  --blog-text-muted: #5e7a76;
}

body {
  background: #ffffff !important;
  color: var(--blog-text);
  font-family: var(--font-ui), sans-serif;
  margin: 0;
}

.blog-page,
.blog-detail-page {
  background: #ffffff !important;
}

.blog-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Hero Section */
.blog-hero {
  height: 550px;
  background-image: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)), url("../images/PNG/blog_s1_banner.png");
  background-size: cover;
  background-position: top center;
  display: flex;
  align-items: center;
  color: #ffffff;
}

.blog-hero__inner h1 {
  font-family: var(--font-display, serif);
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.1;
  margin: 0 0 20px;
  font-weight: 400;
}

.blog-hero__inner p {
  font-size: 18px;
  line-height: 1.6;
  margin-bottom: 30px;
  opacity: 0.9;
}

.breadcrumb {
  font-size: 14px;
  color: #ffffff;
  opacity: 0.8;
}

.breadcrumb a {
  color: #ffffff;
  text-decoration: none;
}

.breadcrumb span {
  font-weight: 700;
  color: var(--blog-accent);
}

/* Main Grid Layout */
.blog-main {
  padding: 80px 0;
}

.blog-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 60px;
}

/* Blog List Items */
.blog-list {
  display: grid;
  gap: 40px;
}

.blog-item {
  background: #ffffff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease;
}

.blog-item:hover {
  transform: translateY(-5px);
}

.blog-item__image {
  position: relative;
  height: 350px;
  overflow: hidden;
}

.blog-item__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blog-item__category {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--blog-primary);
  color: #ffffff;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.blog-item__date {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--blog-primary);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.blog-item__info {
  padding: 40px 30px 30px;
  background: linear-gradient(to bottom, transparent, #0d423b 35%);
  color: #ffffff;
  margin-top: -80px;
  position: relative;
  z-index: 2;
}

.blog-item__info h2 {
  margin: 0 0 15px;
  font-size: 24px;
  line-height: 1.3;
}

.blog-item__info h2 a {
  color: #ffffff;
  text-decoration: none;
}

.blog-item__info p {
  font-size: 15px;
  line-height: 1.6;
  opacity: 0.8;
  margin-bottom: 20px;
}

.blog-readmore {
  color: var(--blog-accent);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}

/* Pagination */
.pagination {
  display: flex;
  gap: 10px;
  margin-top: 50px;
}

.page-num,
.page-next {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  text-decoration: none;
  color: var(--blog-text);
  font-weight: 600;
}

.page-num.active {
  background: var(--blog-secondary);
  color: #ffffff;
  border-color: var(--blog-secondary);
}

/* Sidebar Widgets */
.blog-sidebar {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.sidebar-widget h3 {
  font-size: 18px;
  margin: 0 0 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--blog-secondary);
  color: var(--blog-secondary);
}

.search-box {
  display: flex;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

.search-box input {
  flex: 1;
  border: 0;
  padding: 12px 15px;
  outline: none;
}

.search-box button {
  background: var(--blog-secondary);
  border: 0;
  padding: 10px 15px;
  cursor: pointer;
}

.search-box button img {
  width: 20px;
  filter: brightness(0) invert(1);
}

.widget-categories ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.widget-categories li {
  margin-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.widget-categories li a {
  text-decoration: none;
  color: var(--blog-text);
  font-size: 15px;
}

.widget-categories li span {
  font-weight: 700;
  color: #999;
}

.featured-list {
  display: grid;
  gap: 20px;
}

.featured-item {
  display: flex;
  gap: 15px;
  align-items: center;
}

.featured-item img {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  object-fit: cover;
}

.featured-date {
  font-size: 12px;
  color: #999;
}

.featured-item__text h4 {
  margin: 5px 0 0;
  font-size: 14px;
  line-height: 1.3;
}

.featured-item__text h4 a {
  color: var(--blog-text);
  text-decoration: none;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-cloud a {
  background: var(--blog-bg-light);
  color: var(--blog-text-muted);
  padding: 6px 14px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 12px;
}

.tag-cloud a:hover {
  background: var(--blog-secondary);
  color: #ffffff;
}

.promo-banner {
  background: linear-gradient(to bottom, #114b43, #d9a47a);
  border-radius: 20px;
  padding: 30px;
  color: #ffffff;
  text-align: center;
}

.promo-title {
  font-weight: 800;
  font-size: 16px;
  margin-bottom: 5px;
}

.promo-subtitle {
  font-size: 11px;
  opacity: 0.8;
  margin-bottom: 20px;
}

.promo-img {
  width: 100%;
  max-width: 150px;
  margin-bottom: 20px;
}

.promo-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

/* Detail Page Specifics */
.blog-detail-page .blog-main {
  padding-top: 40px;
}

.blog-detail-page .breadcrumb {
  color: #666;
  margin-bottom: 30px;
}

.blog-detail-page .breadcrumb a {
  color: #666;
}

.post-header h1 {
  font-size: clamp(28px, 4vw, 42px);
  margin: 0 0 15px;
  color: #666;
}

.post-meta {
  color: #999;
  font-size: 14px;
  margin-bottom: 30px;
}

.post-featured-image {
  margin-bottom: 40px;
  border-radius: 20px;
  overflow: hidden;
}

.post-featured-image img {
  width: 100%;
  display: block;
}

.post-body {
  font-size: 17px;
  line-height: 1.8;
  color: #444;
}

.post-body img {
  max-width: 100% !important;
  height: auto !important;
}

.post-subtitle {
  font-size: 24px;
  color: var(--blog-secondary);
  margin: 40px 0 20px;
}

.post-conclusion {
  color: var(--blog-secondary);
  font-weight: 700;
  margin-top: 40px;
}

.post-share {
  display: flex;
  gap: 15px;
  margin: 40px 0;
  padding: 20px 0;
  border-top: 1px solid #eee;
  border-bottom: 1px solid #eee;
}

.share-btn img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--blog-bg-light);
  padding: 8px;
}

.author-box {
  background: #e9f7f4;
  padding: 30px;
  border-radius: 20px;
  display: flex;
  gap: 25px;
  margin-bottom: 60px;
}

.author-avatar img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}

.author-info h4 {
  margin: 0 0 10px;
  font-size: 18px;
}

.author-info p {
  margin: 0 0 15px;
  font-size: 15px;
  line-height: 1.5;
  color: #666;
}

.author-links {
  display: flex;
  justify-content: space-between;
}

.author-links a {
  font-size: 13px;
  font-weight: 700;
  color: var(--blog-secondary);
  text-decoration: none;
}

/* Comments */
.comments-section h3 {
  margin-bottom: 30px;
}

.comments-list {
  display: grid;
  gap: 30px;
  margin-bottom: 60px;
}

.comment-item {
  display: flex;
  gap: 20px;
}

.comment-item.reply {
  margin-left: 60px;
}

.comment-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
}

.comment-header {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.comment-date {
  font-size: 12px;
  color: #999;
}

.comment-reply {
  font-size: 12px;
  font-weight: 700;
  color: var(--blog-secondary);
  text-decoration: none;
}

.comment-content p {
  margin: 0;
  font-size: 15px;
  color: #666;
}

/* Comment Form */
.comment-form-box {
  background: #fafafa;
  padding: 40px;
  border-radius: 20px;
}

.comment-form textarea {
  width: 100%;
  height: 120px;
  padding: 15px;
  border: 1px solid #eee;
  border-radius: 10px;
  margin-bottom: 20px;
  resize: none;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 15px;
  margin-bottom: 20px;
}

.form-row input {
  padding: 12px;
  border: 1px solid #eee;
  border-radius: 8px;
}

.checkbox-label {
  display: block;
  font-size: 13px;
  color: #999;
  margin-bottom: 20px;
}

.btn-submit {
  background: var(--blog-secondary);
  color: #ffffff;
  border: 0;
  padding: 12px 30px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

/* Related Posts */
.related-posts {
  margin-top: 80px;
}

.related-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

.related-item {
  background: #ffffff;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.related-image {
  height: 200px;
}

.related-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.related-info {
  padding: 20px;
}

.related-info h4 {
  margin: 0 0 10px;
  font-size: 16px;
  line-height: 1.4;
}

.related-info .readmore {
  color: var(--blog-secondary);
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}

/* ========== RESPONSIVE SYSTEM ========== */

/* Tablet (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .blog-grid {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 30px;
  }

  .blog-hero {
    height: 400px;
  }
}

/* Mobile (< 767px) */
@media (max-width: 767px) {
  .blog-container {
    padding: 0 15px;
  }
  .blog-hero {
    height: 350px !important;
    padding: 60px 20px 40px !important;
    background-position: 80% center !important;
    background-size: cover !important;
    text-align: center !important;
  }

  .blog-hero__inner h1 {
    font-size: 40px !important;
  }

  .blog-hero__inner p {
    font-size: 16px !important;
  }

  .blog-hero__inner p br {
    display: none !important;
  }

  .blog-main {
    padding: 40px 0;
  }

  .blog-grid {
    grid-template-columns: 1fr;
    gap: 40px;
    position: relative;
  }

  /* Blog Sidebar Hamburger Toggle */
  .hamburger-toggle.blog-sidebar-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: auto !important;
    min-width: 50px;
    height: 50px;
    padding: 0 15px !important;
    background: #ffffff !important;
    color: #000000 !important;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    font-size: 20px;
    margin-bottom: 20px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    z-index: 960 !important; /* Lower than header menu (1000) */
    position: relative;
    font-weight: 700;
  }

  .hamburger-toggle.blog-sidebar-toggle .toggle-text-open {
    font-size: 14px;
    display: inline;
  }

  .hamburger-toggle.blog-sidebar-toggle .toggle-text-close {
    font-size: 14px;
    display: none;
  }

  .hamburger-toggle.blog-sidebar-toggle .hamburger-close {
    display: none;
  }

  .hamburger-toggle.blog-sidebar-toggle.is-open .hamburger-open,
  .hamburger-toggle.blog-sidebar-toggle.is-open .toggle-text-open {
    display: none !important;
  }

  .hamburger-toggle.blog-sidebar-toggle.is-open .hamburger-close,
  .hamburger-toggle.blog-sidebar-toggle.is-open .toggle-text-close {
    display: inline !important;
  }

  /* Mobile Sidebar Overlay */
  .blog-sidebar {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    width: 300px !important;
    height: 100vh !important;
    background: #ffffff !important;
    z-index: 950 !important; /* Lower than toggle (960) */
    padding: 80px 20px 30px !important;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1) !important;
    transform: translateX(100%) !important;
    transition: transform 0.3s ease, visibility 0.3s !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }

  .blog-sidebar.active {
    transform: translateX(0) !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  .blog-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 940 !important; /* Lowest */
    display: none;
    backdrop-filter: blur(4px);
  }

  .blog-sidebar-overlay.active {
    display: block;
  }

  .blog-item__image {
    height: 250px;
  }

  .blog-item__info {
    padding: 30px 20px 20px;
  }

  .blog-item__info h2 {
    font-size: 20px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .comment-item.reply {
    margin-left: 20px;
  }

  .related-grid {
    grid-template-columns: 1fr;
  }

  .comment-form-box {
    padding: 20px;
  }

  .author-box {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }

  .post-body {
    text-align: justify !important;
  }
}

/* Hide toggle on Desktop */
@media (min-width: 768px) {
  .hamburger-toggle.blog-sidebar-toggle {
    display: none !important;
  }
}
