/* style/news.css */

/* Variables and Base Styles */
:root {
  --primary-color: #26A9E0;
  --secondary-color: #FFFFFF;
  --text-dark: #333333;
  --text-light: #ffffff;
  --border-color: #e0e0e0;
  --background-light: #f9f9f9;
  --background-dark: #26A9E0; /* Using primary color for dark sections */
  --button-login: #EA7C07; /* Specific color for login if needed */
  --header-offset: 120px; /* Default value, overridden by shared.css */
}

/* Main page content area */
.page-news {
  font-family: 'Arial', sans-serif;
  line-height: 1.6;
  color: var(--text-dark); /* Default text color for light backgrounds */
  background: var(--secondary-color); /* Default body background is white from shared */
}

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

/* 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 content is below fixed header */
  background: linear-gradient(135deg, var(--primary-color) 0%, #4cbcf0 100%); /* Lighter gradient for hero */
  color: var(--text-light);
  overflow: hidden; /* To contain the image if it overflows slightly */
}

.page-news__hero-container {
  position: relative;
  z-index: 2;
  max-width: 900px;
  margin-bottom: 30px;
}

.page-news__main-title {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 20px;
  line-height: 1.2;
  color: var(--text-light);
}

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

.page-news__cta-button {
  display: inline-block;
  padding: 15px 40px;
  background: var(--button-login); /* Using login color for a standout CTA */
  color: var(--text-light);
  text-decoration: none;
  border-radius: 5px;
  font-size: 18px;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

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

.page-news__hero-image-wrapper {
  width: 100%;
  max-width: 100%;
  margin-top: 30px;
  text-align: center;
}

.page-news__hero-image {
  width: 100%;
  height: auto;
  max-width: 1000px; /* Limit hero image width within the section */
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  display: block;
  margin: 0 auto;
  object-fit: cover;
}

/* General Section Styles */
.page-news__content-area,
.page-news__faq-section,
.page-news__cta-section {
  padding: 80px 0;
}

.page-news__light-bg {
  background-color: var(--secondary-color);
  color: var(--text-dark);
}

.page-news__dark-bg {
  background-color: var(--background-dark);
  color: var(--text-light);
}

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

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

.page-news__intro-text {
  font-size: 18px;
  text-align: center;
  max-width: 800px;
  margin: 0 auto 50px auto;
  line-height: 1.8;
}

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

.page-news__article-card {
  background: var(--secondary-color);
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}

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

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

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

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

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

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

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

.page-news__article-title a:hover {
  color: #1a7bb0; /* Darker shade of primary on hover */
}

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

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

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

.page-news__read-more-btn:hover {
  background: #1a7bb0; /* Darker shade of primary on hover */
}

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

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

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

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

.page-news__pagination-link:last-child {
  width: auto;
  padding: 0 15px;
}

/* FAQ Section */
.page-news__faq-list {
  max-width: 900px;
  margin: 0 auto;
  margin-top: 40px;
}

/* FAQ容器样式 */
.page-news__faq-item {
  margin-bottom: 15px;
  border-radius: 8px; /* Slightly larger border-radius for modern look */
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08); /* Subtle shadow for depth */
}

/* 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; /* Adjust padding for consistency */
  opacity: 0;
  color: var(--text-dark); /* Ensure text color is appropriate for answer background */
}

/* FAQ展开状态 - 🚨 使用!important và đủ lớn max-height để đảm bảo mở rộng */
.page-news__faq-item.active .page-news__faq-answer {
  max-height: 2000px !important; /* 🚨 Use !important for priority, value large enough for any content */
  padding: 20px 25px !important; /* Adjust padding for consistency */
  opacity: 1;
  background: var(--secondary-color); /* Use secondary color for answer background */
  border-radius: 0 0 8px 8px;
}

/* Vấn đề phong cách */
.page-news__faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 25px; /* Adjust padding for consistency */
  background: var(--secondary-color);
  border: 1px solid var(--border-color);
  border-radius: 8px; /* Consistent border-radius */
  cursor: pointer;
  user-select: none;
  transition: background-color 0.3s ease, border-color 0.3s ease;
  position: relative;
  color: var(--text-dark); /* Ensure question text color is appropriate */
}

.page-news__faq-question:hover {
  background: var(--background-light); /* Lighter background on hover */
  border-color: #c0c0c0;
}

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

/* Phong cách tiêu đề câu hỏi */
.page-news__faq-question h3 {
  margin: 0;
  padding: 0;
  flex: 1;
  font-size: 18px; /* Slightly larger font size */
  font-weight: 600;
  line-height: 1.5;
  pointer-events: none; /* Prevent h3 from blocking click events */
  color: var(--primary-color); /* Using primary color for question title */
}

/* Chuyển đổi biểu tượng */
.page-news__faq-toggle {
  font-size: 28px; /* Larger icon */
  font-weight: bold;
  line-height: 1;
  color: var(--primary-color); /* Using primary color for toggle icon */
  transition: transform 0.3s ease, color 0.3s ease;
  flex-shrink: 0;
  margin-left: 15px;
  pointer-events: none; /* Prevent icon from blocking click events */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; /* Larger hit area for icon */
  height: 32px;
}

.page-news__faq-item.active .page-news__faq-toggle {
  color: #1a7bb0; /* Darker primary on active */
  transform: rotate(45deg); /* Rotate for 'x' effect */
}

/* CTA Section */
.page-news__cta-content {
  text-align: center;
}

.page-news__cta-buttons {
  display: flex;
  flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
  justify-content: center;
  gap: 20px;
  margin-top: 40px;
}

.page-news__btn-primary,
.page-news__btn-secondary {
  display: inline-block;
  padding: 15px 35px;
  text-decoration: none;
  border-radius: 5px;
  font-size: 18px;
  font-weight: bold;
  transition: all 0.3s ease;
  box-sizing: border-box; /* Crucial for responsive buttons */
  max-width: 100%; /* Ensure buttons don't overflow */
  white-space: normal; /* Allow text to wrap */
  word-wrap: break-word;
}

.page-news__btn-primary {
  background: var(--button-login);
  color: var(--text-light);
  border: 2px solid transparent;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.page-news__btn-primary:hover {
  background: #d46c00;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.page-news__btn-secondary {
  background: var(--secondary-color);
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.page-news__btn-secondary:hover {
  background: var(--primary-color);
  color: var(--text-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .page-news__main-title {
    font-size: 42px;
  }
  .page-news__hero-description {
    font-size: 17px;
  }
  .page-news__section-title {
    font-size: 32px;
  }
  .page-news__intro-text {
    font-size: 17px;
  }
  .page-news__article-title {
    font-size: 20px;
  }
}

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

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

  .page-news__hero-description {
    font-size: 16px;
    margin-bottom: 25px;
  }

  .page-news__cta-button {
    padding: 12px 30px;
    font-size: 16px;
    width: 100% !important; /* Force full width on mobile */
    max-width: 300px !important; /* Max width for button */
    margin-left: auto;
    margin-right: auto;
  }

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

  .page-news__content-area,
  .page-news__faq-section,
  .page-news__cta-section {
    padding: 50px 0;
  }

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

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

  .page-news__intro-text {
    font-size: 16px;
    margin-bottom: 40px;
  }

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

  .page-news__article-thumbnail {
    height: 180px; /* Adjust thumbnail height for mobile */
  }

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

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

  .page-news__article-excerpt {
    font-size: 15px;
  }

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

  .page-news__pagination {
    margin-top: 40px;
    gap: 8px;
  }

  .page-news__pagination-link {
    width: 36px;
    height: 36px;
    font-size: 15px;
  }

  /* FAQ Mobile Adjustments */
  .page-news__faq-question {
    padding: 15px 20px;
    flex-wrap: wrap;
  }
  
  .page-news__faq-question h3 {
    font-size: 16px;
    margin-bottom: 0;
    width: calc(100% - 40px); /* Adjust width to make space for toggle */
  }
  
  .page-news__faq-toggle {
    margin-left: 10px;
    width: 28px;
    height: 28px;
    font-size: 24px;
  }
  
  .page-news__faq-answer {
    padding: 0 20px;
  }
  
  .page-news__faq-item.active .page-news__faq-answer {
    padding: 15px 20px !important;
  }

  /* CTA Buttons Mobile Adjustments */
  .page-news__cta-buttons {
    flex-direction: column;
    gap: 15px;
  }

  .page-news__btn-primary,
  .page-news__btn-secondary {
    width: 100% !important;
    max-width: 300px !important; /* Limit max width for a better stacked look */
    margin-left: auto;
    margin-right: auto;
    padding: 12px 20px;
    font-size: 16px;
  }

  /* Image responsiveness for all images within .page-news */
  .page-news img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    box-sizing: border-box !important;
  }
}

/* Ensure all content sections and cards respect max-width and padding */
.page-news__content-area > .page-news__container,
.page-news__faq-section > .page-news__container,
.page-news__cta-section > .page-news__container {
  max-width: 1200px; /* Default for desktop */
}
@media (max-width: 768px) {
  .page-news__content-area > .page-news__container,
  .page-news__faq-section > .page-news__container,
  .page-news__cta-section > .page-news__container {
    padding-left: 15px;
    padding-right: 15px;
  }
}