/* Tổng quan và biến màu */
:root {
  --primary-color: #017439;
  --secondary-color: #FFFFFF;
  --text-dark: #333333;
  --text-light: #ffffff;
  --btn-register: #C30808;
  --btn-login: #C30808;
  --bg-color: #FFFFFF;
  --btn-font-color: #FFFF00;
  --header-offset: 120px; /* Giá trị mặc định, sẽ được ghi đè bởi shared.css nếu có */
}

.page-index {
  font-family: Arial, sans-serif;
  color: var(--text-dark); /* Body background is light, so text is dark */
  line-height: 1.6;
}

/* 🚨 HERO主图区域样式 */
.page-index__hero-section {
  position: relative;
  padding-bottom: 0;
  padding-left: 0;
  padding-right: 0;
  padding-top: 10px; /* Giả định shared.css đã cung cấp padding-top cho body */
  margin-top: 0;
  background-color: var(--bg-color); /* Nền cho khu vực hero */
}

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

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

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

@media (min-width: 850px) {
  .page-index__hero-image img {
    aspect-ratio: 16/5;
    object-fit: cover;
  }
}

/* 🚨 Mobile HERO main image prevention of cropping (must read): Prohibit aspect-ratio + object-fit:cover + max-height limit combination */
@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 for HERO section */
@media (max-width: 768px) {
  .page-index__hero-section {
    padding-bottom: 0;
    padding-left: 0;
    padding-right: 0;
    padding-top: 10px !important; /* Ensure it's not overridden by var(--header-offset) */
    margin-top: 0;
  }
}

/* 🚨 Product display image area styles */
.page-index__products-section {
  width: 100%;
  padding: 60px 20px;
  box-sizing: border-box;
  background-color: var(--bg-color);
}

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

.page-index__product-card {
  width: 100%;
  max-width: 300px; /* Maximum width limit */
  border-radius: 0;
  overflow: hidden;
  background: transparent; /* No background */
  box-shadow: none; /* No shadow */
  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; /* Maximum width limit */
  overflow: hidden;
}

.page-index__product-card-image img {
  max-width: 100%;
  width: 100%;
  height: auto;
  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;
    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 columns x 3 rows */
    gap: 15px;
  }
  .page-index__product-card,
  .page-index__product-card-image {
    max-width: 100%; /* Ensure images do not exceed width */
  }
}

/* 🚨 Module 3: Centered decorative main title (unique H1) */
.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: var(--bg-color);
}
.page-index__section-title {
  margin: 0;
  font-size: clamp(1.1rem, 4.5vw, 1.75rem); /* Use clamp for font-size */
  line-height: 1.35;
  color: var(--primary-color); /* H1 title text color */
  font-weight: bold;
}
.page-index__section-title-line {
  flex: 1;
  max-width: 80px;
  height: 2px;
  background-color: var(--primary-color);
  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); /* Adjust font size for mobile */
    padding: 0 5px; /* Add horizontal padding to prevent text from touching edges */
  }
  .page-index__section-title-wrap {
    padding: 20px 10px;
  }
}

/* 🚨 Module 4: Long SEO body (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; /* Prevent horizontal overflow */
  background-color: var(--bg-color);
  color: var(--text-dark);
}
.page-index__article-body h2 {
  margin: 2rem 0 1rem;
  color: var(--primary-color); /* H2 title color */
  font-size: 1.8rem;
}
.page-index__article-body h3 {
  margin: 1.25rem 0 0.75rem;
  color: var(--primary-color); /* H3 title color */
  font-size: 1.4rem;
}
.page-index__article-body p {
  margin-bottom: 1rem;
  color: var(--text-dark);
}
.page-index__article-body ul {
  list-style: disc;
  margin-left: 20px;
  margin-bottom: 1rem;
  color: var(--text-dark);
}
.page-index__article-body li {
  margin-bottom: 0.5rem;
  color: var(--text-dark);
}
.page-index__article-body a {
  color: var(--primary-color);
  text-decoration: underline;
}
.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 border-radius for images in articles */
}
.page-index__article-figure figcaption {
  font-size: 0.9rem;
  color: #666;
  margin-top: 0.5rem;
}
.page-index__article-quote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--primary-color);
  background-color: #f0f8f0; /* Light background for blockquote */
  color: var(--text-dark);
  font-style: italic;
}

@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);
  }
  .page-index__article-body h3 {
    font-size: clamp(1.1rem, 4.5vw, 1.3rem);
  }
  .page-index__article-figure {
    padding: 0 10px; /* Add horizontal padding for figures on mobile */
    box-sizing: border-box;
  }
}

/* 🚨 General buttons and button container styles */
.page-index__btn-primary {
  display: inline-block;
  padding: 12px 25px;
  background-color: var(--btn-register); /* Custom color for Register/Login buttons */
  color: var(--btn-font-color); /* Custom font color */
  text-decoration: none;
  border-radius: 5px;
  font-weight: bold;
  transition: background-color 0.3s ease;
  border: none;
  cursor: pointer;
  text-align: center;
}

.page-index__btn-primary:hover {
  background-color: #a30606; /* Darker color on hover */
}

/* 🚨 General responsive rules for images and containers */
.page-index img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Mobile forced adaptation for all images and containers */
@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,
  .page-index__products-section,
  .page-index__products-container,
  .page-index__products-grid,
  .page-index__article-body {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding-left: 15px;
    padding-right: 15px;
  }

  /* 🚨 Buttons and button containers on mobile */
  .page-index__btn-primary,
  .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;
    margin-bottom: 10px; /* Spacing between buttons */
  }
  
  .page-index__cta-buttons, /* If there's a button group */
  .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;
    display: flex;
    flex-direction: column; /* Buttons stack vertically on mobile */
    gap: 10px; /* Spacing between buttons */
  }
}

/* Smart color contrast assurance */
/* Default for light background (body background #FFFFFF) is dark text */
.page-index {
  color: var(--text-dark); /* #333333 */
}

.page-index__dark-section {
  background: var(--primary-color); /* #017439 */
  color: var(--text-light); /* #ffffff */
}

/* Elements with their own background */
.page-index__card { /* If there are cards in the future */
  background: var(--secondary-color); /* #FFFFFF */
  color: var(--text-dark); /* #333333 */
  border: 1px solid #e0e0e0;
}

/* Buttons already have custom color definitions */
/* .page-index__btn-primary already uses #C30808 with text #FFFF00 */