/* 🚨 Tổng quan: Tất cả các quy tắc CSS đều sử dụng BEM và tiền tố .page-index__ */

/* 智能文字颜色选择器 - Mặc định cho nền sáng */
.page-index {
  color: #333333; /* Văn bản màu tối cho nền sáng mặc định */
  background-color: #FFFFFF; /* Đảm bảo nền body là màu trắng */
}

/* Quy tắc màu cho các phần cụ thể */
.page-index__dark-bg {
  background-color: #017439; /* Nền tối (màu chủ đạo) */
  color: #ffffff; /* Văn bản màu sáng */
}

.page-index__light-bg {
  background-color: #ffffff; /* Nền sáng */
  color: #333333; /* Văn bản màu tối */
}

/* Chính văn và tiêu đề */
.page-index p,
.page-index li {
  color: #333333;
  line-height: 1.6;
}

.page-index h1,
.page-index h2,
.page-index h3 {
  color: #017439;
  margin-top: 1.5em;
  margin-bottom: 0.8em;
  line-height: 1.3;
}

.page-index__heading-2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  color: #017439;
}

.page-index__heading-3 {
  font-size: clamp(1.2rem, 3.5vw, 1.6rem);
  font-weight: 600;
  color: #017439;
}

/* Các nút */
.page-index__btn-primary,
.page-index__btn-secondary {
  display: inline-block;
  padding: 12px 25px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: bold;
  text-align: center;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
  box-sizing: border-box; /* Đảm bảo padding không làm tràn */
  white-space: normal; /* Cho phép văn bản nút xuống dòng */
  word-wrap: break-word;
}

.page-index__btn-primary {
  background-color: #C30808; /* Màu đỏ cho Đăng Ký */
  color: #FFFF00; /* Màu vàng cho chữ */
  border: 2px solid #C30808;
}

.page-index__btn-primary:hover {
  background-color: #a30606;
  border-color: #a30606;
}

.page-index__btn-secondary {
  background-color: #017439; /* Màu xanh lá cho Đăng Nhập */
  color: #FFFF00; /* Màu vàng cho chữ */
  border: 2px solid #017439;
}

.page-index__btn-secondary:hover {
  background-color: #005a2d;
  border-color: #005a2d;
}

.page-index__btn-large {
  padding: 15px 30px;
  font-size: 1.1rem;
}

.page-index__call-to-action {
  text-align: center;
  margin-top: 40px;
  margin-bottom: 40px;
}

/* 🚨 HERO主图区域样式（必须严格遵守） */
.page-index__hero-section {
  position: relative;
  padding-bottom: 0;
  padding-left: 0;
  padding-right: 0;
  padding-top: 10px; /* shared đã cho body khoảng trắng: khoảng 10px; nếu shared chưa cho body khoảng trắng thì thay bằng var(--header-offset, 120px) */
  margin-top: 0;
  background-color: #FFFFFF; /* Đảm bảo nền sáng cho hero section */
}

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

.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 ngang */
@media (min-width: 850px) {
  .page-index__hero-image img {
    aspect-ratio: 16/5;
    object-fit: cover;
  }
}

/* 🚨 Mobile HERO chống cắt (bắt buộc đọc): cấm aspect-ratio + object-fit:cover + max-height giới hạn chiều cao */
@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 responsive design (bắt buộc tuân thủ) */
@media (max-width: 768px) {
  .page-index__hero-section {
    padding-bottom: 0;
    padding-left: 0;
    padding-right: 0;
    padding-top: 10px !important;
    margin-top: 0;
  }
}

/* 🚨 Sản phẩm hiển thị khu vực (phải chứa, sau khu vực HERO chính) */
.page-index__products-section {
  width: 100%;
  padding: 60px 20px;
  box-sizing: border-box;
  background-color: #017439; /* Nền tối cho phần này */
  color: #ffffff; /* Chữ trắng */
}

.page-index__products-container {
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.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ó bo tròn */
}

@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%;
  }
}

/* 🚨 Module 3: Tiêu đề chính trang trí căn giữa (h1 duy nhất trên trang) */
.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-color: #017439; /* Nền tối (màu chủ đạo) */
  color: #ffffff; /* Chữ trắng */
}
.page-index__section-title {
  margin: 0; font-size: clamp(1.1rem, 4.5vw, 1.75rem); line-height: 1.35;
  color: inherit; /* Kế thừa màu từ cha */
}
.page-index__section-title-line {
  flex: 1; max-width: 80px; height: 2px; opacity: 0.6;
  background-color: currentColor; /* Kế thừa màu từ cha */
}
@media (max-width: 768px) {
  .page-index__section-title-line { max-width: 40px; }
  .page-index__section-title-wrap {
    padding: 20px 10px;
  }
}

/* 🚨 Module 4: Thân bài SEO dài (Article Body) */
.page-index__article-body {
  width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 12px 48px;
  box-sizing: border-box; overflow-x: hidden;
  background-color: #ffffff; /* Nền trắng */
  color: #333333; /* Chữ đen */
}
.page-index__article-body h2 {
  margin: 2rem 0 1rem;
  color: #017439;
}
.page-index__article-body h3 {
  margin: 1.25rem 0 0.75rem;
  color: #017439;
}
.page-index__article-figure {
  margin: 1.5rem auto; max-width: 800px; text-align: center;
}
.page-index__article-figure img {
  width: 100%; max-width: 100%; height: auto; display: block;
  border-radius: 8px; /* Thêm bo tròn nhẹ cho hình ảnh bài viết */
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.page-index__article-figure figcaption {
  font-size: 0.9em;
  color: #666;
  margin-top: 8px;
}
.page-index__article-quote {
  margin: 1.5rem 0; padding: 1rem 1.25rem; border-left: 4px solid #017439;
  background-color: #f8f8f8;
  color: #333333;
  border-radius: 4px;
}

/* Liên kết trong bài viết */
.page-index__article-body a {
  color: #017439;
  text-decoration: underline;
}
.page-index__article-body a:hover {
  color: #005a2d;
}

@media (max-width: 768px) {
  .page-index__article-body {
    padding: 0 12px 32px; font-size: 16px;
    width: 100%; max-width: 100%; overflow-x: hidden; box-sizing: border-box;
  }
  .page-index__article-body h2 { font-size: clamp(1.25rem, 5vw, 1.5rem); }
  .page-index__article-body h3 { font-size: clamp(1.1rem, 4vw, 1.3rem); }
  .page-index__article-figure {
    max-width: 100%;
  }
}

/* 🚨 Mobile responsive for general images and containers (bắt buộc tuân thủ) */
.page-index img {
  max-width: 100%;
  height: auto;
  display: block;
}

@media (max-width: 768px) {
  .page-index img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }
  
  .page-index__section,
  .page-index__card,
  .page-index__container {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding-left: 15px;
    padding-right: 15px;
  }
  /* Đảm bảo các phần tử cha của hình ảnh cũng không tràn */
  .page-index__hero-container, .page-index__products-container, .page-index__article-body {
    overflow-x: hidden !important;
  }
}

/* 🚨 Mobile responsive for buttons (bắt buộc tuân thủ) */
.page-index__cta-button,
.page-index__btn-primary,
.page-index__btn-secondary,
.page-index a[class*="button"],
.page-index a[class*="btn"] {
  max-width: 100%;
  box-sizing: border-box;
  white-space: normal;
  word-wrap: break-word;
}

.page-index__cta-buttons,
.page-index__button-group,
.page-index__btn-container {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

@media (max-width: 768px) {
  .page-index__cta-button,
  .page-index__btn-primary,
  .page-index__btn-secondary,
  .page-index a[class*="button"],
  .page-index a[class*="btn"] {
    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;
  }
  
  .page-index__cta-buttons,
  .page-index__button-group,
  .page-index__btn-container {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding-left: 15px;
    padding-right: 15px;
    flex-wrap: wrap !important;
    gap: 10px;
  }
  
  .page-index__cta-buttons {
    display: flex;
    flex-direction: column; /* Mobile xếp dọc */
  }
}