/* style/news.css */

/* Variables from shared.css will be used, defining local ones for clarity if needed */
:root {
  --primary-color: #017439;
  --secondary-color: #FFFFFF;
  --text-dark: #333333;
  --text-light: #ffffff;
  --button-register-bg: #C30808;
  --button-login-bg: #C30808;
  --button-font-color: #FFFF00;
  --default-bg: #FFFFFF; /* Body background is default white */
}

/* Base styles for the page content */
.page-news {
  font-family: Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-dark); /* Default text color for light backgrounds */
  background-color: var(--default-bg);
}

/* Fixed header spacing */
.page-news__hero-section {
  padding-top: var(--header-offset, 120px); /* Ensures content is not hidden by fixed header */
}

/* General container for content sections */
.page-news__container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  box-sizing: border-box;
}

/* Section titles and descriptions */
.page-news__section-title {
  font-size: 36px;
  color: var(--primary-color);
  text-align: center;
  margin-bottom: 20px;
  font-weight: bold;
}

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

/* --- Hero Section --- */
.page-news__hero-section {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-bottom: 60px; /* Adjusted to not double padding-top from header-offset */
  background: linear-gradient(135deg, var(--primary-color) 0%, #3a9d6e 100%); /* Gradient background for visual appeal */
  overflow: hidden; /* Ensure image doesn't overflow */
}

.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%;
  margin-bottom: 30px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

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

.page-news__hero-image img:hover {
  transform: scale(1.03);
}

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

.page-news__hero-title {
  font-size: 52px; /* Adjusted for 50-60 character length requirement */
  color: var(--text-light);
  margin-bottom: 20px;
  font-weight: 900;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.page-news__hero-description {
  font-size: 20px; /* Adjusted for 130-160 character length requirement */
  color: var(--secondary-color);
  margin-bottom: 40px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
}

.page-news__cta-button {
  display: inline-block;
  padding: 18px 45px;
  background: var(--button-register-bg); /* Using specific color for register/login */
  color: var(--button-font-color); /* Using specific font color */
  text-decoration: none;
  border-radius: 8px;
  font-size: 22px;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.page-news__cta-button:hover {
  background: #e02a2a; /* Slightly darker red on hover */
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

/* --- Recent Articles Section --- */
.page-news__recent-articles-section {
  padding: 80px 0;
  background-color: var(--default-bg); /* Light background for contrast */
}

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

.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(-8px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.page-news__article-image {
  width: 100%;
  height: 225px; /* Fixed height for consistency */
  overflow: hidden;
}

.page-news__article-image img {
  width: 100%;
  height: 100%;
  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: 24px;
  margin-bottom: 15px;
  line-height: 1.3;
}

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

.page-news__article-title a:hover {
  color: #005f2f; /* Slightly darker green on hover */
  text-decoration: underline;
}

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

.page-news__read-more-link {
  display: inline-block;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: bold;
  transition: color 0.3s ease;
}

.page-news__read-more-link:hover {
  color: #005f2f;
  text-decoration: underline;
}

/* --- Call to Action Section --- */
.page-news__cta-section {
  padding: 80px 0;
  text-align: center;
  background-color: var(--primary-color); /* Dark background */
  color: var(--text-light); /* Light text */
}

.page-news__cta-title {
  font-size: 40px;
  margin-bottom: 20px;
  font-weight: bold;
  color: var(--text-light);
}

.page-news__cta-description {
  font-size: 20px;
  margin-bottom: 40px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  color: var(--secondary-color);
}

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

.page-news__btn-primary,
.page-news__btn-secondary {
  display: inline-block;
  padding: 16px 40px;
  text-decoration: none;
  border-radius: 8px;
  font-size: 18px;
  font-weight: bold;
  transition: all 0.3s ease;
  box-sizing: border-box; /* Ensure padding is included in width */
  white-space: normal; /* Allow text to wrap */
  word-wrap: break-word; /* Break long words */
  max-width: 100%; /* Ensure button doesn't overflow */
}

.page-news__btn-primary {
  background: var(--button-register-bg); /* Red button */
  color: var(--button-font-color); /* Yellow text */
  border: 2px solid var(--button-register-bg);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

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

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

.page-news__btn-secondary:hover {
  background: #e6e6e6;
  color: #005f2f;
  border-color: #005f2f;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}


/* --- FAQ Section --- */
.page-news__faq-section {
  padding: 80px 0;
  background-color: #f9f9f9; /* Slightly off-white background */
}

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

.page-news__faq-item {
  margin-bottom: 15px;
  border-radius: 5px;
  overflow: hidden;
}

/* FAQ default state - answer hidden */
.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;
  color: var(--text-dark);
}

/* FAQ expanded state - 🚨 Use!important and sufficiently large max-height */
.page-news__faq-item.active .page-news__faq-answer {
  max-height: 2000px !important; /* 🚨 Use!important to ensure priority, value large enough for any content */
  padding: 20px 15px !important;
  opacity: 1;
  background: var(--secondary-color); /* White background for answer */
  border-radius: 0 0 5px 5px;
}

/* Question style */
.page-news__faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  background: var(--secondary-color); /* White background for question */
  border: 1px solid #e0e0e0;
  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: #f5f5f5;
  border-color: #d0d0d0;
}

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

/* Question title style */
.page-news__faq-question h3 {
  margin: 0;
  padding: 0;
  flex: 1;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--primary-color); /* Green text for question */
  pointer-events: none; /* Prevent h3 from blocking click event */
}

/* Toggle icon */
.page-news__faq-toggle {
  font-size: 28px; /* Slightly larger for better visibility */
  font-weight: bold;
  line-height: 1;
  color: var(--primary-color); /* Green icon */
  transition: transform 0.3s ease, color 0.3s ease;
  flex-shrink: 0;
  margin-left: 15px;
  pointer-events: none; /* Prevent icon from blocking click event */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; /* Increased size */
  height: 32px; /* Increased size */
}

.page-news__faq-item.active .page-news__faq-toggle {
  transform: rotate(45deg); /* Rotate for 'x' effect, or keep as '-' */
  color: #e02a2a; /* Red when active */
}

/* --- Responsive Design --- */
@media (max-width: 1024px) {
  .page-news__hero-title {
    font-size: 44px;
  }
  .page-news__hero-description {
    font-size: 18px;
  }
  .page-news__cta-button {
    padding: 15px 35px;
    font-size: 20px;
  }
  .page-news__section-title {
    font-size: 32px;
  }
  .page-news__cta-title {
    font-size: 36px;
  }
}

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

  .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__section,
  .page-news__card,
  .page-news__container {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding-left: 15px;
    padding-right: 15px;
  }

  /* Hero Section Mobile */
  .page-news__hero-title {
    font-size: 32px;
    margin-bottom: 15px;
  }
  .page-news__hero-description {
    font-size: 16px;
    margin-bottom: 30px;
  }
  .page-news__cta-button {
    padding: 14px 30px;
    font-size: 18px;
    width: 100%; /* Full width button */
  }
  .page-news__hero-image {
    border-radius: 8px;
  }

  /* Articles Grid Mobile */
  .page-news__articles-grid {
    grid-template-columns: 1fr;
    gap: 25px;
  }
  .page-news__article-card {
    margin-bottom: 20px;
  }
  .page-news__article-title {
    font-size: 20px;
  }
  .page-news__article-summary {
    font-size: 15px;
  }

  /* CTA Section Mobile */
  .page-news__cta-title {
    font-size: 28px;
  }
  .page-news__cta-description {
    font-size: 16px;
  }
  .page-news__cta-buttons {
    flex-direction: column; /* Stack buttons vertically */
    gap: 15px;
  }
  .page-news__btn-primary,
  .page-news__btn-secondary {
    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;
  }

  /* FAQ Section Mobile */
  .page-news__faq-question {
    padding: 15px;
    flex-wrap: wrap;
  }
  .page-news__faq-question h3 {
    font-size: 16px;
    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;
  }
}

/* Color Contrast Safeguards */
.page-news__dark-bg {
  background-color: var(--primary-color);
  color: var(--text-light);
}
.page-news__light-bg {
  background-color: var(--default-bg);
  color: var(--text-dark);
}
/* Ensure all text elements within dark backgrounds are light */
.page-news__dark-bg h1,
.page-news__dark-bg h2,
.page-news__dark-bg h3,
.page-news__dark-bg p,
.page-news__dark-bg a {
  color: var(--text-light);
}
/* Specific button colors */
.page-news__btn-primary {
  background-color: var(--button-register-bg);
  color: var(--button-font-color);
  border-color: var(--button-register-bg);
}
.page-news__btn-primary:hover {
  background-color: #e02a2a; /* Darker red */
  border-color: #e02a2a;
}
.page-news__btn-secondary {
  background-color: var(--secondary-color);
  color: var(--primary-color);
  border-color: var(--primary-color);
}
.page-news__btn-secondary:hover {
  background-color: #e6e6e6; /* Lighter white */
  color: #005f2f; /* Darker green */
  border-color: #005f2f;
}