:root {
  --primary-color: #017439;
  --secondary-color: #C30808; /* For register/login buttons */
  --text-color-light: #ffffff;
  --text-color-dark: #333333;
  --bg-color-light: #ffffff;
  --bg-color-dark: #017439;
  --register-button-bg: #C30808;
  --login-button-bg: #C30808;
  --register-login-font-color: #FFFF00;
}

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

/* Hero Section */
.page-news__hero-section {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
  padding-top: var(--header-offset, 120px); /* Ensure space for fixed header */
  background: linear-gradient(135deg, var(--primary-color), var(--bg-color-light));
  color: var(--text-color-dark);
  overflow: hidden; /* Prevent content overflow */
}

.page-news__hero-container {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.page-news__hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  width: 100%;
  padding-bottom: 30px;
}

.page-news__main-title {
  font-size: 3.2em;
  margin-bottom: 15px;
  color: var(--text-color-dark);
  font-weight: bold;
}

.page-news__intro-text {
  font-size: 1.2em;
  max-width: 800px;
  margin: 0 auto 30px;
  color: var(--text-color-dark);
}

.page-news__hero-image {
  width: 100%;
  max-width: 900px; /* Adjust based on design */
  margin-top: 30px;
  z-index: 1;
}

.page-news__hero-image img {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.page-news__cta-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
  width: 100%;
  max-width: 400px; /* Limit width for button group */
  margin-left: auto;
  margin-right: auto;
}

.page-news__btn-primary,
.page-news__btn-secondary {
  display: inline-block;
  padding: 15px 30px;
  text-decoration: none;
  border-radius: 8px;
  font-size: 1.1em;
  font-weight: bold;
  transition: all 0.3s ease;
  box-sizing: border-box;
  max-width: 100%; /* Ensure buttons don't overflow */
  white-space: normal;
  word-wrap: break-word;
  text-align: center;
}

.page-news__btn-primary {
  background: var(--register-button-bg); /* Custom color for register */
  color: var(--register-login-font-color); /* Custom font color */
  border: 2px solid var(--register-button-bg);
}

.page-news__btn-primary:hover {
  background: #A80707; /* Darker shade of #C30808 */
  border-color: #A80707;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.page-news__btn-secondary {
  background: var(--login-button-bg); /* Custom color for login */
  color: var(--register-login-font-color); /* Custom font color */
  border: 2px solid var(--login-button-bg);
}

.page-news__btn-secondary:hover {
  background: #A80707; /* Darker shade of #C30808 */
  border-color: #A80707;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* General Section Styles */
.page-news__section {
  padding: 80px 20px;
  text-align: center;
  overflow: hidden; /* Prevent content overflow */
}

.page-news__container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
  width: 100%; /* Ensure container fills width */
  box-sizing: border-box;
}

.page-news__section-title {
  font-size: 2.5em;
  margin-bottom: 20px;
  color: var(--text-color-dark);
  font-weight: bold;
}

.page-news__section-description {
  font-size: 1.1em;
  max-width: 800px;
  margin: 0 auto 50px;
  color: #555;
}

.page-news__section-title--light {
  color: var(--text-color-light);
}

.page-news__section-description--light {
  color: rgba(255, 255, 255, 0.8);
}

/* Latest Articles Section */
.page-news__latest-articles {
  background-color: var(--bg-color-light);
}

.page-news__articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  margin-top: 40px;
}

.page-news__article-card {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  text-align: left;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}

.page-news__article-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.page-news__article-image {
  width: 100%;
  height: 220px; /* Fixed height for consistency */
  overflow: hidden;
}

.page-news__article-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.page-news__article-card:hover .page-news__article-image img {
  transform: scale(1.05);
}

.page-news__article-content {
  padding: 25px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.page-news__article-title {
  font-size: 1.4em;
  margin-top: 0;
  margin-bottom: 10px;
  min-height: 60px; /* Ensure consistent title height */
}

.page-news__article-title a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: bold;
  transition: color 0.3s ease;
}

.page-news__article-title a:hover {
  color: darken(var(--primary-color), 10%);
}

.page-news__article-meta {
  font-size: 0.9em;
  color: #777;
  margin-bottom: 15px;
}

.page-news__article-summary {
  font-size: 1em;
  color: #555;
  margin-bottom: 20px;
  flex-grow: 1;
}

.page-news__read-more {
  display: inline-flex;
  align-items: center;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: bold;
  transition: color 0.3s ease;
}

.page-news__read-more:hover {
  color: darken(var(--primary-color), 10%);
}

.page-news__arrow {
  margin-left: 8px;
  transition: transform 0.3s ease;
}

.page-news__read-more:hover .page-news__arrow {
  transform: translateX(5px);
}

.page-news__pagination {
  margin-top: 60px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.page-news__pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #ddd;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: bold;
  transition: all 0.3s ease;
}

.page-news__pagination-link:hover {
  background-color: var(--primary-color);
  color: var(--text-color-light);
  border-color: var(--primary-color);
}

.page-news__pagination-link--active {
  background-color: var(--primary-color);
  color: var(--text-color-light);
  border-color: var(--primary-color);
  cursor: default;
}

.page-news__pagination-link--active:hover {
  background-color: var(--primary-color);
  color: var(--text-color-light);
}

/* Categories Section */
.page-news__categories {
  background-color: var(--bg-color-dark); /* Dark background */
  color: var(--text-color-light);
}

.page-news__categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  margin-top: 40px;
}

.page-news__category-card {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  color: var(--text-color-light);
  text-decoration: none;
  transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 180px;
}

.page-news__category-card:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.page-news__category-title {
  font-size: 1.5em;
  margin-top: 0;
  margin-bottom: 10px;
  color: var(--text-color-light);
}

.page-news__category-description {
  font-size: 1em;
  color: rgba(255, 255, 255, 0.7);
}


/* FAQ Section */
.page-news__faq-section {
  background-color: var(--bg-color-light);
}

.page-news__faq-list {
  max-width: 900px;
  margin: 40px auto 0;
  text-align: left;
}

/* FAQ容器样式 */
.page-news__faq-item {
  margin-bottom: 15px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* FAQ默认状态 - 答案隐藏 */
.page-news__faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s ease, opacity 0.4s ease;
  padding: 0 20px;
  opacity: 0;
}

/* FAQ展开状态 - 🚨 使用!important和足够大的max-height确保一定能展开 */
.page-news__faq-item.active .page-news__faq-answer {
  max-height: 2000px !important; /* 🚨 Sử dụng !important để đảm bảo độ ưu tiên, giá trị đủ lớn để chứa mọi nội dung */
  padding: 20px 20px !important;
  opacity: 1;
  background: #f9f9f9;
  border-radius: 0 0 8px 8px;
}

/* 问题样式 */
.page-news__faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.3s ease, border-color 0.3s ease;
  position: relative;
}

.page-news__faq-item.active .page-news__faq-question {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-color: #d0d0d0;
  background-color: #f5f5f5;
}

.page-news__faq-question:hover {
  background: #f5f5f5;
  border-color: #d0d0d0;
}

.page-news__faq-question:active {
  background: #eeeeee;
}

/* 问题标题样式 */
.page-news__faq-question h3 {
  margin: 0;
  padding: 0;
  flex: 1;
  font-size: 1.15em;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-color-dark);
  pointer-events: none; /* 防止h3标签阻止点击事件 */
}

/* 切换图标 */
.page-news__faq-toggle {
  font-size: 24px;
  font-weight: bold;
  line-height: 1;
  color: var(--primary-color);
  transition: transform 0.3s ease, color 0.3s ease;
  flex-shrink: 0;
  margin-left: 15px;
  pointer-events: none; /* 防止图标阻止点击事件 */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.page-news__faq-item.active .page-news__faq-toggle {
  color: var(--text-color-dark);
  transform: rotate(45deg); /* Rotate for 'x' effect */
}


/* Responsive Design */
@media (max-width: 1024px) {
  .page-news__main-title {
    font-size: 2.8em;
  }

  .page-news__intro-text {
    font-size: 1.1em;
  }

  .page-news__section-title {
    font-size: 2.2em;
  }

  .page-news__article-card {
    height: auto; /* Allow card height to adjust */
  }
}

@media (max-width: 768px) {
  .page-news__hero-section {
    padding-top: var(--header-offset, 120px) !important; /* Mobile specific offset */
    padding-bottom: 40px;
    padding-left: 15px;
    padding-right: 15px;
  }

  .page-news__main-title {
    font-size: 2.2em;
  }

  .page-news__intro-text {
    font-size: 1em;
    margin-bottom: 20px;
  }

  .page-news__cta-buttons {
    flex-direction: column; /* Stack buttons vertically */
    gap: 15px;
    padding: 0 15px;
  }

  .page-news__btn-primary,
  .page-news__btn-secondary {
    max-width: 100% !important;
    width: 100% !important;
    font-size: 1em;
    padding: 12px 20px;
    white-space: normal !important;
    word-wrap: break-word !important;
  }

  .page-news__hero-image img {
    border-radius: 8px;
  }

  .page-news__section {
    padding: 50px 0;
  }

  .page-news__container {
    padding: 0 15px;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .page-news__section-title {
    font-size: 1.8em;
  }

  .page-news__section-description {
    font-size: 0.95em;
    margin-bottom: 30px;
  }

  .page-news__articles-grid {
    grid-template-columns: 1fr; /* Single column layout */
    gap: 20px;
  }
  
  .page-news__article-image {
    height: 180px; /* Adjust height for mobile */
  }

  .page-news__article-content {
    padding: 20px;
  }

  .page-news__article-title {
    font-size: 1.2em;
    min-height: auto;
  }

  .page-news__article-summary {
    font-size: 0.9em;
  }

  .page-news__categories-grid {
    grid-template-columns: 1fr; /* Single column layout */
    gap: 20px;
  }

  .page-news__category-card {
    padding: 25px;
    min-height: 150px;
  }

  .page-news__category-title {
    font-size: 1.3em;
  }

  .page-news__faq-question {
    padding: 15px;
    flex-wrap: wrap;
  }
  
  .page-news__faq-question h3 {
    font-size: 1em;
    margin-bottom: 0;
    width: calc(100% - 40px);
  }
  
  .page-news__faq-toggle {
    margin-left: 10px;
    width: 24px;
    height: 24px;
    font-size: 20px;
  }
  
  .page-news__faq-answer {
    padding: 0 15px;
  }
  
  .page-news__faq-item.active .page-news__faq-answer {
    padding: 15px !important;
  }

  /* Ensure all images are responsive */
  .page-news img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }
}

@media (max-width: 480px) {
  .page-news__main-title {
    font-size: 1.8em;
  }
  .page-news__section-title {
    font-size: 1.5em;
  }
}