/* style/news.css */

/* Biến màu từ shared.css */
:root {
  --primary-color: #017439;
  --secondary-color: #FFFFFF;
  --register-button-color: #C30808;
  --login-button-color: #C30808;
  --button-text-color: #FFFF00;
  --text-dark: #333333;
  --text-light: #f0f0f0;
  --border-light: #e0e0e0;
  --bg-light: #f9f9f9;
}

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

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

.page-news__section-title {
  font-size: 2.5em;
  color: var(--primary-color);
  text-align: center;
  margin-bottom: 40px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* 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(135deg, var(--primary-color) 0%, #333 100%); /* Adjusted for better contrast */
  color: var(--text-light);
}

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

.page-news__hero-image {
  width: 100%;
  margin-bottom: 30px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.page-news__hero-image img {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
  object-fit: cover;
}

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

.page-news__hero-title {
  font-size: 3.5em;
  margin-bottom: 20px;
  font-weight: 900;
  color: var(--secondary-color);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.page-news__hero-description {
  font-size: 1.3em;
  margin-bottom: 30px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  color: var(--text-light);
}

.page-news__cta-button {
  display: inline-block;
  padding: 18px 45px;
  background: var(--register-button-color);
  color: var(--button-text-color);
  text-decoration: none;
  border-radius: 8px;
  font-size: 1.4em;
  font-weight: bold;
  margin-top: 30px;
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  border: none;
}

.page-news__cta-button:hover {
  background: #E53935; /* Slightly lighter red */
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
}

/* Intro Section */
.page-news__intro-section {
  padding: 60px 20px;
  background-color: var(--secondary-color);
  text-align: center;
}

.page-news__intro-title {
  font-size: 2.2em;
  color: var(--primary-color);
  margin-bottom: 25px;
}

.page-news__intro-text {
  font-size: 1.1em;
  max-width: 900px;
  margin: 0 auto 15px auto;
  color: var(--text-dark);
}

/* Latest News Section */
.page-news__latest-news {
  padding: 60px 20px;
  background-color: var(--bg-light);
}

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

.page-news__article-card {
  background: var(--secondary-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  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 25px rgba(0, 0, 0, 0.15);
}

.page-news__article-image {
  width: 100%;
  height: 220px; /* Fixed height for consistency */
  object-fit: cover;
  display: block;
}

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

.page-news__article-title {
  font-size: 1.4em;
  margin-bottom: 15px;
  line-height: 1.4;
}

.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: #005f2c; /* Darker primary for hover */
}

.page-news__article-excerpt {
  font-size: 1em;
  color: var(--text-dark);
  margin-bottom: 20px;
  flex-grow: 1;
}

.page-news__read-more {
  display: inline-block;
  padding: 10px 20px;
  background: var(--primary-color);
  color: var(--secondary-color);
  text-decoration: none;
  border-radius: 5px;
  font-weight: bold;
  font-size: 0.95em;
  transition: background-color 0.3s ease;
  align-self: flex-start;
}

.page-news__read-more:hover {
  background: #005f2c;
}

/* Categories Section */
.page-news__categories-section {
  padding: 60px 20px;
  background-color: var(--secondary-color);
}

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

.page-news__category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--bg-light);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  text-decoration: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.page-news__category-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.page-news__category-image {
  width: 100%;
  height: 180px; /* Fixed height */
  object-fit: cover;
  display: block;
}

.page-news__category-title {
  font-size: 1.3em;
  color: var(--primary-color);
  margin: 20px 15px;
  font-weight: bold;
}

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

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

/* 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;
  background: var(--secondary-color);
}

/* 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 !important;
  opacity: 1;
  background: var(--secondary-color);
  border-radius: 0 0 8px 8px;
}

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

.page-news__faq-question:hover {
  background: #005f2c; /* Darker primary for hover */
  border-color: #005f2c;
}

.page-news__faq-item.active .page-news__faq-question {
  border-radius: 8px 8px 0 0;
  background: #005f2c;
}

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

/* 切换图标 */
.page-news__faq-toggle {
  font-size: 28px;
  font-weight: bold;
  line-height: 1;
  color: var(--secondary-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;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}

.page-news__faq-item.active .page-news__faq-toggle {
  transform: rotate(45deg);
  background: var(--secondary-color);
  color: var(--primary-color);
}

/* --- Responsive Design --- */

/* 🚨 Mobile specific styles */
@media (max-width: 768px) {
  .page-news {
    font-size: 15px;
    line-height: 1.5;
  }

  .page-news__container {
    padding: 15px;
  }

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

  .page-news__hero-title {
    font-size: 2.2em;
    margin-bottom: 15px;
  }

  .page-news__hero-description {
    font-size: 1em;
    margin-bottom: 20px;
  }

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

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

  .page-news__intro-section,
  .page-news__latest-news,
  .page-news__categories-section,
  .page-news__faq-section {
    padding: 40px 15px;
  }

  .page-news__article-grid,
  .page-news__category-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

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

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

  .page-news__read-more {
    padding: 8px 15px;
    font-size: 0.9em;
  }

  .page-news__category-image {
    height: 150px;
  }

  .page-news__category-title {
    font-size: 1.1em;
    margin: 15px;
  }

  /* FAQ Mobile */
  .page-news__faq-question {
    padding: 15px;
  }

  .page-news__faq-question h3 {
    font-size: 1em;
  }

  .page-news__faq-toggle {
    font-size: 24px;
    width: 28px;
    height: 28px;
  }

  .page-news__faq-item.active .page-news__faq-answer {
    padding: 15px !important;
  }

  /* General 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__hero-section,
  .page-news__intro-section,
  .page-news__latest-news,
  .page-news__categories-section,
  .page-news__faq-section,
  .page-news__article-card,
  .page-news__category-card {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding-left: 15px;
    padding-right: 15px;
  }

  .page-news__hero-section.page-news__container {
    padding-left: 0;
    padding-right: 0;
  }

  .page-news__hero-image {
    padding-left: 0;
    padding-right: 0;
  }
}