/* style/news.css */
:root {
  --primary-color: #017439;
  --secondary-color: #C30808; /* For login/register */
  --text-color-dark: #333333;
  --text-color-light: #ffffff;
  --background-color-light: #ffffff;
  --background-color-dark: #017439;
  --button-font-color-login-register: #FFFF00;
}

.page-news {
  font-family: 'Arial', sans-serif;
  color: var(--text-color-dark);
  line-height: 1.6;
  background-color: var(--background-color-light);
}

.page-news__container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.page-news__main-title {
  font-size: 2.8em;
  color: var(--primary-color);
  text-align: center;
  margin-bottom: 20px;
  font-weight: bold;
  line-height: 1.2;
}

.page-news__intro-text {
  font-size: 1.1em;
  text-align: center;
  margin-bottom: 40px;
  color: var(--text-color-dark);
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.page-news__section-title {
  font-size: 2.2em;
  color: var(--primary-color);
  text-align: center;
  margin-bottom: 40px;
  font-weight: bold;
  position: relative;
  padding-bottom: 15px;
}

.page-news__section-title::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background-color: var(--primary-color);
  border-radius: 2px;
}

/* 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);
  background: linear-gradient(180deg, var(--background-color-light) 0%, #f0f0f0 100%);
  border-bottom: 1px solid #eee;
}

.page-news__hero-image {
  width: 100%;
  margin-top: 30px;
  margin-bottom: 30px;
}

.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.15);
}

.page-news__cta-button {
  display: inline-block;
  padding: 15px 40px;
  background: var(--secondary-color); /* Use #C30808 for Register/Login related CTAs */
  color: var(--button-font-color-login-register); /* Use #FFFF00 for Register/Login font */
  text-decoration: none;
  border-radius: 8px;
  font-size: 1.1em;
  font-weight: bold;
  margin-top: 30px;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.page-news__cta-button:hover {
  background: #a30606;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Featured Articles Grid */
.page-news__featured-articles {
  padding: 60px 20px;
  background-color: var(--background-color-light);
}

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

.page-news__article-card {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid #e0e0e0;
}

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

.page-news__article-image {
  width: 100%;
  height: 220px;
  overflow: hidden;
}

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

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

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

.page-news__article-title {
  font-size: 1.4em;
  margin-bottom: 10px;
  font-weight: 600;
}

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

.page-news__article-title a:hover {
  color: #005a2e;
}

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

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

.page-news__read-more {
  display: inline-block;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: bold;
  transition: color 0.3s ease;
  position: relative;
  padding-bottom: 2px;
}

.page-news__read-more::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background-color: var(--primary-color);
  transform: scaleX(0);
  transform-origin: bottom right;
  transition: transform 0.3s ease-out;
}

.page-news__read-more:hover::after {
  transform: scaleX(1);
  transform-origin: bottom left;
}

/* Recent Articles List */
.page-news__recent-articles {
  padding: 60px 20px;
  background-color: #f9f9f9;
}

.page-news__article-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.page-news__list-item {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  margin-bottom: 20px;
  padding: 25px;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.page-news__list-item:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  transform: translateY(-5px);
}

.page-news__list-title {
  font-size: 1.3em;
  margin-bottom: 8px;
  font-weight: 600;
}

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

.page-news__list-title a:hover {
  color: #005a2e;
}

.page-news__list-meta {
  font-size: 0.85em;
  color: #777;
  margin-bottom: 12px;
}

.page-news__list-summary {
  font-size: 0.95em;
  color: #555;
}

/* Pagination */
.page-news__pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 40px;
  gap: 10px;
}

.page-news__pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  background: #f0f0f0;
  color: var(--primary-color);
  text-decoration: none;
  border-radius: 6px;
  font-weight: bold;
  transition: all 0.3s ease;
}

.page-news__pagination-link:hover:not(.page-news__pagination-link--active) {
  background: #e0e0e0;
  color: #005a2e;
}

.page-news__pagination-link--active {
  background: var(--primary-color);
  color: var(--text-color-light);
  cursor: default;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* FAQ Section */
.page-news__faq-section {
  padding: 60px 20px;
  background-color: var(--background-color-light);
}

.page-news__faq-list {
  max-width: 800px;
  margin: 0 auto;
}

/* FAQ容器样式 */
.page-news__faq-item {
  margin-bottom: 15px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e0e0e0;
  box-shadow: 0 4px 15px 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 25px;
  opacity: 0;
  color: #555;
}

/* 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 25px !important;
  opacity: 1;
  background: #fdfdfd;
  border-top: 1px solid #efefef;
}

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

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

.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(--primary-color);
  pointer-events: none; /* 防止h3标签阻止点击事件 */
}

/* 切换图标 */
.page-news__faq-toggle {
  font-size: 28px;
  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: 32px;
  height: 32px;
}

.page-news__faq-item.active .page-news__faq-toggle {
  color: #005a2e;
  transform: rotate(45deg);
}

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

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

  .page-news__article-grid {
    grid-template-columns: 1fr;
  }

  .page-news__article-image {
    height: 180px;
  }

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

  .page-news__list-title {
    font-size: 1.1em;
  }
}

@media (max-width: 768px) {
  .page-news {
    font-size: 16px;
    line-height: 1.6;
  }

  .page-news__container {
    padding: 15px;
  }

  .page-news__hero-section {
    padding-top: var(--header-offset, 120px) !important;
    padding-bottom: 40px;
  }

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

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

  .page-news__section-title {
    font-size: 1.6em;
    margin-bottom: 30px;
  }

  .page-news__cta-button {
    padding: 12px 30px;
    font-size: 1em;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    word-wrap: break-word !important;
  }

  .page-news__featured-articles, .page-news__recent-articles, .page-news__faq-section {
    padding: 40px 15px;
  }

  .page-news__article-card, .page-news__list-item {
    margin-bottom: 15px;
  }

  .page-news__article-image {
    height: 160px;
  }

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

  .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: 28px;
    height: 28px;
    font-size: 24px;
  }
  
  .page-news__faq-answer {
    padding: 0 15px;
  }
  
  .page-news__faq-item.active .page-news__faq-answer {
    padding: 15px !important;
  }

  /* Image responsiveness */
  .page-news img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }
  
  .page-news__section, .page-news__card, .page-news__container, .page-news__article-grid, .page-news__article-card, .page-news__list-item, .page-news__faq-list, .page-news__faq-item {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding-left: 0;
    padding-right: 0;
  }

  .page-news__hero-section .page-news__container {
    padding-left: 15px;
    padding-right: 15px;
  }
  .page-news__featured-articles .page-news__container,
  .page-news__recent-articles .page-news__container,
  .page-news__faq-section .page-news__container {
    padding-left: 15px;
    padding-right: 15px;
  }

  .page-news__pagination {
    flex-wrap: wrap;
    gap: 8px;
  }

  .page-news__pagination-link {
    min-width: 36px;
    height: 36px;
    font-size: 0.9em;
  }
}

/* Ensure body elements use correct text color on default light background */
.page-news p, .page-news li, .page-news__article-summary, .page-news__list-summary {
  color: var(--text-color-dark);
}

.page-news h1, .page-news h2, .page-news h3, .page-news h4, .page-news h5, .page-news h6 {
  color: var(--primary-color);
}

.page-news a {
  color: var(--primary-color);
}

/* Color contrast for specific elements */
.page-news__btn-primary {
  background: var(--secondary-color); /* #C30808 */
  color: var(--button-font-color-login-register); /* #FFFF00 */
  border: 2px solid var(--secondary-color);
}

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

.page-news__read-more {
  color: var(--primary-color);
}
.page-news__read-more::after {
  background-color: var(--primary-color);
}
.page-news__read-more:hover {
  color: #005a2e;
}

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

.page-news__faq-question h3 {
  color: var(--primary-color);
}
.page-news__faq-toggle {
  color: var(--primary-color);
}
.page-news__faq-item.active .page-news__faq-toggle {
  color: #005a2e;
}