/* style/resources.css */

/* Base Styles & Color Contrast */
.page-resources {
  color: #ffffff; /* Body background is #000 (dark), so text should be light */
  background-color: #000; /* Ensure main content background matches body */
}

.page-resources__dark-bg {
  background-color: #000; /* Explicitly dark background for sections */
  color: #ffffff;
}

.page-resources__light-bg {
  background-color: #f8f9fa; /* Light background for sections */
  color: #333333;
}

/* General Container */
.page-resources__container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  box-sizing: border-box;
}

/* Section Titles */
.page-resources__section-title {
  font-size: 32px;
  font-weight: bold;
  text-align: center;
  margin-bottom: 40px;
  color: inherit; /* Inherit from section for contrast */
}

/* Buttons */
.page-resources__btn-primary,
.page-resources__btn-secondary {
  display: inline-block;
  padding: 12px 25px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  font-size: 16px;
  transition: all 0.3s ease;
  text-align: center;
  cursor: pointer;
  box-sizing: border-box; /* Ensure padding is included in width */
  white-space: normal;
  word-wrap: break-word;
}

.page-resources__btn-primary {
  background-color: #007bff;
  color: #ffffff;
  border: 2px solid #007bff;
}

.page-resources__btn-primary:hover {
  background-color: #0056b3;
  border-color: #0056b3;
  transform: translateY(-2px);
}

.page-resources__btn-secondary {
  background-color: transparent;
  color: #ffc107;
  border: 2px solid #ffc107;
}

.page-resources__btn-secondary:hover {
  background-color: #ffc107;
  color: #000000;
  transform: translateY(-2px);
}

/* Images */
.page-resources img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Hero Section */
.page-resources__hero-section {
  position: relative;
  padding-top: var(--header-offset, 120px); /* If shared does not give body padding, this will. Otherwise, 0. */
  padding-bottom: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 500px;
  overflow: hidden;
}

.page-resources__hero-content {
  z-index: 1;
  max-width: 800px;
  padding: 0 20px;
}

.page-resources__hero-title {
  font-size: 48px;
  font-weight: bold;
  margin-bottom: 20px;
  color: #ffffff;
  line-height: 1.2;
}

.page-resources__hero-description {
  font-size: 18px;
  margin-bottom: 30px;
  color: #f0f0f0;
  line-height: 1.6;
}

.page-resources__hero-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
}

.page-resources__hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.4); /* Darken image for text readability */
}

/* Categories Section */
.page-resources__categories-section {
  padding: 80px 0;
}

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

.page-resources__category-card {
  background-color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  padding: 30px;
  text-align: center;
  text-decoration: none;
  color: #333333;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}

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

.page-resources__category-icon {
  width: 100px;
  height: 100px;
  margin-bottom: 20px;
  border-radius: 50%;
  background-color: #e9ecef;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.page-resources__category-icon img {
  width: 80%;
  height: 80%;
  object-fit: contain;
}

.page-resources__category-title {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 10px;
  color: #007bff;
}

.page-resources__category-description {
  font-size: 15px;
  line-height: 1.5;
  color: #555555;
}

/* FAQ Section */
.page-resources__faq-section {
  padding: 80px 0;
}

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

/* FAQ容器样式 */
.page-resources__faq-item {
  margin-bottom: 15px;
  border-radius: 5px;
  overflow: hidden;
}

/* FAQ默认状态 - 答案隐藏 */
.page-resources__faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s ease;
  padding: 0 15px;
  opacity: 0;
  background-color: #1a1a1a; /* Darker background for dark section */
  color: #ffffff; /* Light text for dark section */
}

/* FAQ展开状态 - 🚨 使用!important和足够大的max-height确保一定能展开 */
.page-resources__faq-item.active .page-resources__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 15px !important;
  opacity: 1;
  border-radius: 0 0 5px 5px;
}

/* 问题样式 */
.page-resources__faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  background: #007bff; /* Primary color for question background */
  border: 1px solid #0056b3;
  border-radius: 5px;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.3s ease, border-color 0.3s ease;
  position: relative;
  color: #ffffff;
}

.page-resources__faq-question:hover {
  background: #0056b3;
  border-color: #004085;
}

.page-resources__faq-question:active {
  background: #004085;
}

/* 问题标题样式 */
.page-resources__faq-question h3 {
  margin: 0;
  padding: 0;
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  pointer-events: none; /* 防止h3标签阻止点击事件 */
  color: inherit;
}

/* 切换图标 */
.page-resources__faq-toggle {
  font-size: 24px;
  font-weight: bold;
  line-height: 1;
  color: #ffffff; /* White color for toggle */
  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-resources__faq-item.active .page-resources__faq-toggle {
  transform: rotate(45deg); /* Use rotation for '+' to 'x' effect */
  color: #ffc107; /* Highlight toggle in active state */
}

/* News Section */
.page-resources__news-section {
  padding: 80px 0;
}

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

.page-resources__news-card {
  background-color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  color: #333333;
}

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

.page-resources__news-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.page-resources__news-card img {
  width: 100%;
  height: 250px;
  object-fit: cover;
}

.page-resources__news-title {
  font-size: 20px;
  font-weight: bold;
  margin: 20px 20px 10px;
  color: #007bff;
}

.page-resources__news-date {
  font-size: 14px;
  color: #777777;
  margin: 0 20px 20px;
}

.page-resources__button-group {
  text-align: center;
  margin-top: 50px;
}

/* CTA Section */
.page-resources__cta-section {
  padding: 80px 0;
  text-align: center;
}

.page-resources__cta-title {
  font-size: 36px;
  font-weight: bold;
  margin-bottom: 20px;
  color: #ffffff;
}

.page-resources__cta-description {
  font-size: 18px;
  margin-bottom: 40px;
  color: #f0f0f0;
}

.page-resources__cta-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
}

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

/* Tablet (max-width: 1024px) */
@media (max-width: 1024px) {
  .page-resources__hero-title {
    font-size: 40px;
  }

  .page-resources__hero-description {
    font-size: 16px;
  }

  .page-resources__section-title {
    font-size: 28px;
  }

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

  .page-resources__category-icon {
    width: 80px;
    height: 80px;
  }

  .page-resources__category-title {
    font-size: 18px;
  }

  .page-resources__news-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
  }

  .page-resources__news-card img {
    height: 200px;
  }

  .page-resources__news-title {
    font-size: 18px;
  }

  .page-resources__cta-title {
    font-size: 30px;
  }
}

/* Mobile (max-width: 768px) */
@media (max-width: 768px) {
  .page-resources__container {
    padding: 20px 15px;
  }

  .page-resources__hero-section {
    padding-top: var(--header-offset, 120px) !important; /* Ensure mobile padding-top */
    min-height: 400px;
  }

  .page-resources__hero-content {
    padding: 0 15px;
  }

  .page-resources__hero-title {
    font-size: 32px;
    margin-bottom: 15px;
  }

  .page-resources__hero-description {
    font-size: 15px;
    margin-bottom: 25px;
  }

  .page-resources__btn-primary,
  .page-resources__btn-secondary {
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px 20px;
    font-size: 15px;
  }

  .page-resources__cta-buttons {
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 300px; /* Constrain buttons for better stacking */
    margin: 0 auto;
  }

  .page-resources__section-title {
    font-size: 24px;
    margin-bottom: 30px;
  }

  .page-resources__categories-section,
  .page-resources__faq-section,
  .page-resources__news-section,
  .page-resources__cta-section {
    padding: 50px 0;
  }

  .page-resources__category-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .page-resources__category-card {
    padding: 20px;
  }

  .page-resources__category-icon {
    width: 70px;
    height: 70px;
  }

  .page-resources__category-title {
    font-size: 17px;
  }

  .page-resources__category-description {
    font-size: 14px;
  }

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

  .page-resources__news-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .page-resources__news-card img {
    
  }

  .page-resources__news-title {
    font-size: 17px;
    margin: 15px 15px 8px;
  }

  .page-resources__news-date {
    margin: 0 15px 15px;
  }

  .page-resources__cta-title {
    font-size: 26px;
  }

  .page-resources__cta-description {
    font-size: 16px;
  }

  /* Ensure all images are responsive and do not overflow */
  .page-resources img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }
  
  /* All image containers must ensure no overflow */
  .page-resources__hero-image,
  .page-resources__category-icon,
  .page-resources__news-card {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
}