/* style/news.css */

:root {
  --primary-color: #26A9E0;
  --secondary-color: #FFFFFF;
  --text-color-dark: #333333;
  --text-color-light: #ffffff;
  --bg-light: #f9f9f9;
  --bg-dark: #2095c9; /* Slightly darker shade of primary for contrast */
  --border-color: #e0e0e0;
  --button-login-color: #EA7C07;
}

.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(--secondary-color); /* Default body background is light */
}

/* 🚨 固定页头与主体间距 - desktop */
.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); /* Sử dụng var(--header-offset) */
  background: linear-gradient(135deg, var(--primary-color), #5ac2f2); /* Sử dụng màu chính và một sắc thái nhẹ hơn */
  color: var(--text-color-light);
  overflow: hidden; /* Ensure image overflow is handled if any */
}

.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-image {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
  border-radius: 8px;
  object-fit: cover;
  margin-bottom: 30px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  min-width: 200px; /* Ensure minimum image size */
  min-height: 200px; /* Ensure minimum image size */
}

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

.page-news__main-title {
  font-size: 3.2em;
  margin-bottom: 15px;
  line-height: 1.2;
  color: var(--text-color-light);
  text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

.page-news__description {
  font-size: 1.2em;
  margin-bottom: 30px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  color: var(--text-color-light);
  opacity: 0.9;
}

.page-news__cta-button {
  display: inline-block;
  padding: 15px 40px;
  background: var(--button-login-color); /* Sử dụng màu đăng nhập cho CTA */
  color: var(--text-color-light);
  text-decoration: none;
  border-radius: 5px;
  font-size: 1.1em;
  font-weight: bold;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.page-news__cta-button:hover {
  background: #d46b00; /* Slightly darker orange */
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

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

.page-news__section-title {
  font-size: 2.5em;
  color: var(--primary-color);
  text-align: center;
  margin-bottom: 20px;
  font-weight: 700;
}

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

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

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

.page-news__news-card {
  background: var(--secondary-color);
  border-radius: 10px;
  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__news-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.page-news__card-image {
  width: 100%;
  height: 220px; /* Fixed height for consistency on desktop */
  object-fit: cover;
  display: block;
  min-width: 200px; /* Ensure minimum image size */
  min-height: 200px; /* Ensure minimum image size */
}

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

.page-news__card-title {
  font-size: 1.4em;
  margin-top: 0;
  margin-bottom: 10px;
  line-height: 1.3;
}

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

.page-news__card-title a:hover {
  color: #1a7bb0; /* Slightly darker primary */
}

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

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

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

.page-news__read-more-button:hover {
  background: #1a7bb0;
}

.page-news__view-all-button-container {
  text-align: center;
  margin-top: 50px;
}

.page-news__view-all-button {
  display: inline-block;
  padding: 15px 35px;
  background: var(--primary-color);
  color: var(--text-color-light);
  text-decoration: none;
  border-radius: 5px;
  font-size: 1.1em;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.page-news__view-all-button:hover {
  background: #1a7bb0;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

/* Categories Section */
.page-news__categories-section {
  padding: 60px 0;
  background-color: var(--primary-color); /* Sử dụng màu chính làm nền */
  color: var(--text-color-light);
}

.page-news__categories-section .page-news__section-title,
.page-news__categories-section .page-news__section-description {
  color: var(--text-color-light);
}

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

.page-news__category-item {
  display: block;
  background: rgba(255, 255, 255, 0.15); /* Nền trong suốt trên màu chính */
  color: var(--text-color-light);
  text-decoration: none;
  padding: 15px 20px;
  border-radius: 8px;
  text-align: center;
  font-weight: bold;
  font-size: 1.1em;
  transition: background-color 0.3s ease, transform 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.page-news__category-item:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Featured Articles Section */
.page-news__featured-articles-section {
  padding: 60px 0;
  background-color: var(--bg-light);
}

.page-news__news-card--featured {
  border: 2px solid var(--primary-color);
}

/* CTA Section */
.page-news__cta-section {
  padding: 80px 0;
  background: linear-gradient(90deg, var(--primary-color), #40bbf7);
  color: var(--text-color-light);
  text-align: center;
}

.page-news__cta-section .page-news__section-title,
.page-news__cta-section .page-news__section-description {
  color: var(--text-color-light);
}

.page-news__cta-button--large {
  padding: 18px 50px;
  font-size: 1.2em;
  margin-top: 30px;
}

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

/* FAQ容器样式 */
.page-news__faq-list {
  max-width: 900px;
  margin: 0 auto;
}

.page-news__faq-item {
  margin-bottom: 15px;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

/* 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 15px;
  opacity: 0;
}

/* FAQ展开状态 - 🚨 使用!important和足够大的max-height确保一定能展开 */
.page-news__faq-item.active .page-news__faq-answer {
  max-height: 2000px !important; /* 🚨 使用!important确保优先级，值足够大以容纳任何内容 */
  padding: 20px 15px !important;
  opacity: 1;
  background: var(--bg-light);
  border-radius: 0 0 5px 5px;
  color: var(--text-color-dark);
}

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

.page-news__faq-question:hover {
  background: var(--bg-light);
  border-color: #d0d0d0;
}

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

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

/* 切换图标 */
.page-news__faq-toggle {
  font-size: 24px;
  font-weight: bold;
  line-height: 1;
  color: #666;
  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(--primary-color);
  transform: rotate(45deg); /* Optional: rotate for 'x' effect */
}


/* 🚨 移动端响应式设计（必须严格遵守） */
@media (max-width: 768px) {
  /* 🚨 移动端必须重新设置padding-top，覆盖桌面端样式 */
  .page-news__hero-section {
    padding-top: var(--header-offset, 120px) !important;
    padding-bottom: 40px;
    padding-left: 15px;
    padding-right: 15px;
  }
  
  .page-news__main-title {
    font-size: 2em;
  }

  .page-news__description {
    font-size: 1em;
  }

  .page-news__cta-button {
    padding: 12px 30px;
    font-size: 1em;
  }

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

  .page-news__section-description {
    font-size: 0.95em;
  }

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

  /* 🚨 移动端图片响应式适配 */
  .page-news img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }
  
  .page-news__hero-image {
    border-radius: 4px;
  }

  .page-news__card-image {
    height: 180px; /* Adjust card image height for mobile */
  }

  .page-news__news-card {
    flex-direction: column;
  }

  .page-news__card-title {
    font-size: 1.2em;
  }
  
  .page-news__card-content {
    padding: 15px;
  }

  .page-news__read-more-button {
    align-self: stretch;
    text-align: center;
    padding: 10px 15px;
  }

  /* 🚨 移动端按钮响应式适配 */
  .page-news__cta-button,
  .page-news__view-all-button,
  .page-news__category-item {
    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;
  }

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

  .page-news__cta-button--large {
    padding: 15px 30px;
    font-size: 1.1em;
  }

  /* FAQ 移动端适配 */
  .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 content area images meet minimum size requirement */
.page-news__latest-news-section img,
.page-news__featured-articles-section img,
.page-news__hero-section img {
    min-width: 200px;
    min-height: 200px;
}

/* Specific adjustment for card images if their defined height is less than 200px in some contexts, to ensure min-height is met */
.page-news__card-image {
    min-width: 200px;
    min-height: 200px; /* Explicitly set to 200px to strictly meet the requirement */
}

/* Desktop specific height for card images to override min-height for display if needed */
@media (min-width: 769px) {
    .page-news__card-image {
        height: 220px; /* Maintain desktop height, which is > 200px */
    }
}
/* Mobile specific height for card images to override min-height for display if needed */
@media (max-width: 768px) {
    .page-news__card-image {
        height: 180px; /* This height is less than 200px, but it will be visually stretched by width:100% and min-height:200px. If actual display height is needed to be strictly 200px+, this needs adjustment. For now, it will respect min-height. */
    }
}