/* General styles for the main content area */
.page-index {
  background: var(--background, #08160F); /* Use custom background color */
  color: var(--text-main, #F2FFF6); /* Use custom main text color */
  font-family: Arial, sans-serif;
  line-height: 1.6;
}

/* HERO Chủ đề chính */
.page-index__hero-section {
  position: relative;
  padding-bottom: 0;
  padding-left: 0;
  padding-right: 0;
  padding-top: 10px; /* shared đã cấp cho body khoảng trống: khoảng 10px */
  margin-top: 0;
  width: 100%;
  box-sizing: border-box;
}

.page-index__hero-container {
  position: relative;
  margin: 0 auto;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.page-index__hero-image {
  width: 100%;
  margin: 0;
}

.page-index__hero-image img {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
}

/* Desktop: banner có thể dùng cover; Mobile: cấm cover + tỉ lệ cố định cắt hai bên */
@media (min-width: 850px) {
  .page-index__hero-image img {
    aspect-ratio: 16/5;
    object-fit: cover;
  }
}

/* 🚨 Mobile: chống cắt xén ảnh chính (quan trọng): cấm kết hợp aspect-ratio + object-fit:cover + max-height */
@media (max-width: 849px) {
  .page-index__hero-section {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  .page-index__hero-image img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    aspect-ratio: unset !important;
    object-fit: contain !important;
    max-height: none !important;
    display: block !important;
  }
}

/* 🚨 Mobile: thiết kế đáp ứng (phải tuân thủ nghiêm ngặt) */
@media (max-width: 768px) {
  .page-index__hero-section {
    padding-bottom: 0;
    padding-left: 0;
    padding-right: 0;
    padding-top: 10px !important;
    margin-top: 0;
  }
}

/* Khu vực hiển thị sản phẩm */
.page-index__products-section {
  width: 100%;
  padding: 60px 20px;
  box-sizing: border-box;
  background: var(--background, #08160F); /* Đảm bảo nền tối */
}

.page-index__products-container {
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  max-width: 100%; /* Để đáp ứng nhất quán */
  box-sizing: border-box;
}

.page-index__products-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(6, 1fr); /* Desktop: 6 cột một hàng */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.page-index__product-card {
  width: 100%;
  max-width: 300px;
  border-radius: 0;
  overflow: hidden;
  background: transparent;
  box-shadow: none;
  transition: transform 0.3s ease;
}

.page-index__product-card:hover {
  transform: translateY(-3px);
}

.page-index__product-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.page-index__product-card-image {
  width: 100%;
  max-width: 300px;
  overflow: hidden;
}

.page-index__product-card-image img {
  max-width: 100%;
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0; /* Đảm bảo không có border-radius */
  box-shadow: none; /* Đảm bảo không có box-shadow */
}

@media (max-width: 768px) {
  .page-index__products-section {
    padding: 40px 15px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  .page-index__products-container,
  .page-index__products-grid {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  .page-index__products-grid {
    grid-template-columns: repeat(2, 1fr); /* Mobile: 2 cột × 3 hàng */
    gap: 15px;
  }
  .page-index__product-card,
  .page-index__product-card-image {
    max-width: 100%; /* Điều chỉnh cho lưới di động */
  }
  .page-index__product-card-image img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }
}

/* Tiêu đề chính trang trí căn giữa */
.page-index__section-title-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  max-width: 100%;
  padding: 24px 12px;
  box-sizing: border-box;
  text-align: center;
  background: var(--background, #08160F); /* Đảm bảo nền tối */
}

.page-index__section-title {
  margin: 0;
  font-size: clamp(1.1rem, 4.5vw, 1.75rem);
  line-height: 1.35;
  color: var(--text-main, #F2FFF6); /* Sử dụng màu văn bản chính tùy chỉnh */
  font-weight: bold;
}

.page-index__section-title-line {
  flex: 1;
  max-width: 80px;
  height: 2px;
  background: var(--divider, #1E3A2A); /* Sử dụng màu phân cách tùy chỉnh */
  opacity: 0.6;
}

@media (max-width: 768px) {
  .page-index__section-title-line {
    max-width: 40px;
  }
  .page-index__section-title {
    font-size: clamp(1rem, 6vw, 1.5rem); /* Điều chỉnh kích thước font cho màn hình nhỏ hơn */
  }
  .page-index__section-title-wrap {
    padding: 20px 10px;
  }
}

/* Nội dung SEO dài */
.page-index__article-body {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 12px 48px;
  box-sizing: border-box;
  overflow-x: hidden;
  background: var(--background, #08160F); /* Đảm bảo nền tối */
  color: var(--text-main, #F2FFF6); /* Sử dụng màu văn bản chính tùy chỉnh */
}

.page-index__article-body h2 {
  margin: 2rem 0 1rem;
  color: var(--text-main, #F2FFF6); /* Sử dụng màu văn bản chính tùy chỉnh */
  font-size: 1.8em;
  font-weight: bold;
}

.page-index__article-body h3 {
  margin: 1.25rem 0 0.75rem;
  color: var(--text-main, #F2FFF6); /* Sử dụng màu văn bản chính tùy chỉnh */
  font-size: 1.4em;
  font-weight: 600;
}

.page-index__article-body p,
.page-index__article-body ul li {
  margin-bottom: 1em;
  color: var(--text-secondary, #A7D9B8); /* Sử dụng màu văn bản phụ tùy chỉnh cho đoạn văn */
}

.page-index__article-body ul {
  list-style: disc inside;
  padding-left: 1.5em;
  margin-bottom: 1em;
}

.page-index__article-body a {
  color: var(--glow, #57E38D); /* Sử dụng màu phát sáng tùy chỉnh cho liên kết */
  text-decoration: underline;
}

.page-index__article-figure {
  margin: 1.5rem auto;
  max-width: 800px;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.page-index__article-figure img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 8px; /* Bo tròn nhẹ các góc cho ảnh bài viết */
}

.page-index__article-figure figcaption {
  font-style: italic;
  font-size: 0.9em;
  margin-top: 0.5em;
  color: var(--text-secondary, #A7D9B8); /* Sử dụng màu văn bản phụ tùy chỉnh */
}

.page-index__article-quote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--border, #2E7A4E); /* Sử dụng màu viền tùy chỉnh */
  background: var(--card-bg, #11271B); /* Sử dụng màu nền thẻ tùy chỉnh */
  color: var(--text-main, #F2FFF6); /* Sử dụng màu văn bản chính tùy chỉnh */
  border-radius: 4px;
}
.page-index__article-quote p {
  color: var(--text-main, #F2FFF6); /* Màu văn bản chính cho nội dung trích dẫn */
}

/* Định kiểu liên kết cụ thể cho liên kết văn bản trong phần thân bài viết */
.page-index__btn-text-link {
    color: var(--glow, #57E38D); /* Sử dụng màu phát sáng tùy chỉnh cho liên kết văn bản */
    text-decoration: underline;
    font-weight: bold;
}

/* Định kiểu đáp ứng chung cho ảnh và vùng chứa trên di động */
@media (max-width: 768px) {
  .page-index__article-body {
    padding: 0 12px 32px;
    font-size: 16px;
  }
  .page-index__article-body h2 {
    font-size: clamp(1.25rem, 5vw, 1.5rem);
    margin: 1.5rem 0 0.75rem;
  }
  .page-index__article-body h3 {
    font-size: clamp(1.1rem, 4.5vw, 1.3em);
    margin: 1rem 0 0.5rem;
  }
  .page-index__article-figure {
    padding: 0 10px; /* Thêm một số padding để ngăn ảnh chạm vào các cạnh */
  }
  .page-index__article-figure img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }

  /* Tất cả ảnh trong khu vực nội dung */
  .page-index img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }
  
  /* Tất cả các phần và vùng chứa nội dung */
  .page-index__section,
  .page-index__card,
  .page-index__container,
  .page-index__products-section,
  .page-index__products-container,
  .page-index__products-grid,
  .page-index__article-body,
  .page-index__hero-section,
  .page-index__hero-container,
  .page-index__section-title-wrap {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Định kiểu nút cụ thể cho di động (nếu có bất kỳ nút nào trong nội dung chính, mà chúng có trong phần thân bài viết) */
  .page-index__btn-text-link {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    display: inline-block; /* Hoặc block, tùy thuộc vào ngữ cảnh */
    text-align: center;
  }
}

/* Bảo vệ độ tương phản màu (đã tích hợp với màu tùy chỉnh) */
/* Giả sử nền body là tối từ shared.css (var(--bg-dark)) */
.page-index {
  color: var(--text-main, #F2FFF6); /* Màu văn bản mặc định cho trang */
}

/* Đảm bảo văn bản trong các phần tử giống thẻ có độ tương phản tốt */
.page-index__product-card {
  background: transparent; /* Không có nền cho thẻ sản phẩm */
  color: var(--text-main, #F2FFF6); /* Màu văn bản cho bất kỳ văn bản tiềm năng nào */
}

/* Nút (nếu có khác liên kết văn bản) */
.page-index__btn-primary { /* Ví dụ cho nút chính */
  background: linear-gradient(180deg, #2AD16F 0%, #13994A 100%);
  color: #ffffff; /* Văn bản trắng trên gradient xanh lá cây */
  padding: 12px 25px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: bold;
  display: inline-block;
  transition: opacity 0.3s ease;
}
.page-index__btn-primary:hover {
  opacity: 0.9;
}

/* Đáp ứng nút trên di động */
@media (max-width: 768px) {
  .page-index__btn-primary {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    padding-left: 15px;
    padding-right: 15px;
    display: block; /* Đảm bảo các nút xếp chồng */
    margin-bottom: 10px; /* Khoảng cách giữa các nút xếp chồng */
  }
}