/* Màu sắc chung */
:root {
  --primary-color: #017439; /* Xanh lá cây */
  --secondary-color: #FFFFFF; /* Trắng */
  --register-button-bg: #C30808; /* Đỏ */
  --login-button-bg: #C30808; /* Đỏ */
  --button-font-color: #FFFF00; /* Vàng */
  --text-color-dark: #333333; /* Xám đậm */
  --text-color-light: #FFFFFF; /* Trắng */
  --line-color: rgba(1, 116, 57, 0.6); /* Màu xanh lá nhạt hơn cho đường kẻ */
  --bg-color-light: #FFFFFF; /* Nền trắng */
}

/* Base styles for page-index */
.page-index {
  font-family: Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-color-dark); /* Default text color for light body background */
  background: var(--bg-color-light); /* Default body background is light */
}

/* Module 1: HERO主图区域 */
.page-index__hero-section {
  position: relative;
  padding-bottom: 0;
  padding-left: 0;
  padding-right: 0;
  padding-top: 10px; /* Assuming shared handles body padding, use small top padding */
  margin-top: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden; /* Prevent overflow on resize */
}

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

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

.page-index__hero-image img {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
  object-fit: cover; /* Default for desktop */
}

@media (min-width: 850px) {
  .page-index__hero-image img {
    aspect-ratio: 16/5; /* Desktop banner aspect ratio */
  }
}

/* 🚨 移动端主图防裁切（必读）：禁止 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; /* Remove aspect ratio */
    object-fit: contain !important; /* Ensure image is fully visible */
    max-height: none !important; /* Remove max-height */
    display: block !important;
  }
}

/* 🚨 移动端响应式设计（必须严格遵守） */
@media (max-width: 768px) {
  .page-index__hero-section {
    padding-top: 10px !important; /* Ensure small padding on mobile */
  }
}


/* Module 2: Sản phẩm trưng bày (Product Showcase) */
.page-index__products-section {
  width: 100%;
  padding: 60px 20px;
  box-sizing: border-box;
  background: var(--bg-color-light);
}

.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 columns */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

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

.page-index__product-card:hover {
  transform: translateY(-3px); /* Slight lift on hover */
}

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

.page-index__product-card-image {
  width: 100%;
  max-width: 300px; /* Max width for image container */
  overflow: hidden;
}

.page-index__product-card-image img {
  max-width: 100%;
  width: 100%;
  height: auto; /* Maintain aspect ratio */
  display: block;
  border-radius: 0; /* No border-radius */
}

/* 🚨 移动端布局要求（必须严格遵守） */
@media (max-width: 768px) {
  .page-index__products-section {
    padding: 40px 15px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden; /* Prevent horizontal scroll */
    box-sizing: border-box;
  }
  .page-index__products-container,
  .page-index__products-grid {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden; /* Prevent horizontal scroll */
    box-sizing: border-box;
  }
  .page-index__products-grid {
    grid-template-columns: repeat(2, 1fr); /* Mobile: 2 columns x 3 rows */
    gap: 15px;
  }
  .page-index__product-card,
  .page-index__product-card-image {
    max-width: 100%; /* Ensure cards/images don't exceed container */
  }
}

/* Module 3: Tiêu đề chính được trang trí ở 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(--bg-color-light);
}
.page-index__section-title {
  margin: 0;
  font-size: clamp(1.1rem, 4.5vw, 1.75rem); /* Responsive font size for H1 */
  line-height: 1.35;
  color: var(--text-color-dark);
  font-weight: bold;
}
.page-index__section-title-line {
  flex: 1;
  max-width: 80px;
  height: 2px;
  background-color: var(--line-color);
  opacity: 0.6;
}
@media (max-width: 768px) {
  .page-index__section-title-line {
    max-width: 40px; /* Shorter lines on mobile */
  }
  .page-index__section-title-wrap {
    padding: 20px 10px;
  }
}

/* Module 4: Nội dung SEO dài (Long SEO Article Body) */
.page-index__article-body {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 48px; /* Adjusted padding for better visual */
  box-sizing: border-box;
  overflow-x: hidden; /* Prevent horizontal scroll */
  background: var(--bg-color-light);
}

.page-index__article-body h2 {
  margin: 2rem 0 1rem;
  color: var(--primary-color);
  font-size: 2em; /* Default desktop H2 size */
  font-weight: bold;
}

.page-index__article-body h3 {
  margin: 1.25rem 0 0.75rem;
  color: var(--primary-color);
  font-size: 1.5em; /* Default desktop H3 size */
  font-weight: bold;
}

.page-index__article-body p,
.page-index__article-body li {
  margin-bottom: 1em;
  color: var(--text-color-dark);
  font-size: 1em; /* Default paragraph font size */
}

.page-index__article-quote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--primary-color);
  background: rgba(1, 116, 57, 0.05); /* Light background for quote */
  color: var(--text-color-dark);
  font-style: italic;
}

.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: 5px; /* Slight rounded corners for article images */
}

.page-index__article-figure figcaption {
  font-size: 0.9em;
  color: #666;
  margin-top: 0.5em;
}

.page-index__article-body ul {
  list-style: disc;
  margin-left: 20px;
  padding-left: 0;
}

.page-index__article-body a {
  color: var(--primary-color);
  text-decoration: underline;
}

.page-index__article-body a:hover {
  color: #004d2c; /* Darken primary color */
}

/* 🚨 移动端响应式设计 for Article Body */
@media (max-width: 768px) {
  .page-index__article-body {
    padding: 0 15px 32px;
    font-size: 16px;
  }
  .page-index__article-body h2 {
    font-size: clamp(1.25rem, 5vw, 1.5rem);
    margin: 1.5rem 0 0.8rem;
  }
  .page-index__article-body h3 {
    font-size: clamp(1.1rem, 4.5vw, 1.25rem);
    margin: 1rem 0 0.6rem;
  }
  .page-index__article-quote {
    padding: 0.8rem 1rem;
    margin: 1rem 0;
  }
  .page-index__article-figure {
    margin: 1rem auto;
  }
  .page-index__article-body ul {
    margin-left: 15px;
  }
}

/* General Image Responsive Styles (Catch-all for content images) */
.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;
  }
  /* Ensure all content containers are responsive */
  .page-index__section,
  .page-index__card,
  .page-index__container,
  .page-index__article-body { /* Added article body here */
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding-left: 15px !important; /* Ensure padding on mobile */
    padding-right: 15px !important; /* Ensure padding on mobile */
  }
  /* Override padding for full-width sections if needed */
  .page-index__hero-section,
  .page-index__products-section {
    padding-left: 0px !important;
    padding-right: 0px !important;
  }
  .page-index__products-section .page-index__products-container {
    padding-left: 15px !important;
    padding-right: 15px !important;
  }
}

/* Button styles (using custom colors for register/login) */
.page-index__btn-primary {
  display: inline-block;
  padding: 12px 25px;
  background: var(--register-button-bg); /* Use custom color for register */
  color: var(--button-font-color); /* Use custom font color */
  text-decoration: none;
  border-radius: 5px;
  font-weight: bold;
  transition: background-color 0.3s ease, transform 0.3s ease;
  border: none;
  cursor: pointer;
  text-align: center;
  white-space: normal; /* Allow text wrap */
  word-wrap: break-word; /* Allow text wrap */
  box-sizing: border-box;
}

.page-index__btn-primary:hover {
  background: #9c0606; /* Darken on hover */
  transform: translateY(-2px);
}

.page-index__btn-secondary {
  display: inline-block;
  padding: 12px 25px;
  background: var(--secondary-color);
  color: var(--primary-color);
  text-decoration: none;
  border: 2px solid var(--primary-color);
  border-radius: 5px;
  font-weight: bold;
  transition: background-color 0.3s ease, color 0.3s ease, transform 0.3s ease;
  cursor: pointer;
  text-align: center;
  white-space: normal; /* Allow text wrap */
  word-wrap: break-word; /* Allow text wrap */
  box-sizing: border-box;
}

.page-index__btn-secondary:hover {
  background: var(--primary-color);
  color: var(--secondary-color);
  transform: translateY(-2px);
}

/* Button container responsive styles */
.page-index__cta-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 30px;
  flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  padding: 0 15px; /* Add padding to container */
}

/* 移动端强制适配所有按钮 */
@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 !important;
    padding-right: 15px !important;
  }
  
  /* 按钮容器移动端适配 */
  .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 !important;
    padding-right: 15px !important;
    flex-direction: column !important; /* Stack buttons vertically */
    gap: 10px !important;
  }
}

/* Color contrast fixes - general */
.page-index__dark-bg {
  color: var(--text-color-light); /* Deep background, light text */
  background: var(--primary-color);
}
.page-index__light-bg {
  color: var(--text-color-dark); /* Light background, dark text */
  background: var(--secondary-color);
}
/* Ensure links in dark backgrounds are visible */
.page-index__dark-bg a {
  color: var(--button-font-color); /* Yellow for links on dark background */
}

/* 移动端增强可读性 */
@media (max-width: 768px) {
  .page-index {
    font-size: 16px;
    line-height: 1.6;
  }
  .page-index__card {
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  }
}