/* =========================================================
   GLOBAL RESET
   Purpose:
   - Make width / padding calculations easier
   - Prevent layout issues across browsers
========================================================= */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Poppins", sans-serif;
  background: #f3f3f3;
  color: #222;
  overflow-x: hidden; /* stop horizontal scroll caused by slider */
}

/* =========================================================
   PAGE TITLE
   Purpose:
   - Blue heading section at top of page
========================================================= */
/* section title */
.section-title-page {
  background: #001176;
  color: #fff;
  padding: 18px 14px;
  margin-bottom: 15px;
}

.section-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0px;
  padding: 0px;
}

/* =========================================================
   FILTER BAR
   Purpose:
   - Search, category, month, sort controls
========================================================= */
.filter-bar {
  max-width: 1200px;
  margin: 0 auto 30px;
  padding: 0 20px;
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.filter-form input,
.filter-form select,
.filter-form button,
.reset-btn {
  padding: 5px 14px;
  border-radius: 10px;
  border: 1px solid #ccc;
  font-size: 14px;
}

input[type="month"]:before {
  color: lightgrey;
  content: attr(placeholder) !important;
  margin-right: 0.5em;
  max-height: 50px;
}

.filter-form input {
  min-width: 200px;
}

.filter-form select {
  max-width: 200px;
}

.filter-form button {
  background: #001176;
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

.reset-btn {
  background: #ffe8e8;
  color: #222;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: 0.5s ease;
}

.reset-btn:hover {
  background: #ff8686;
}
.reset-btn:active {
  background: #ff5b5b;
}

/* =========================================================
   SLIDER LAYOUT
   Structure:
   .slider-container
      .slider-btn
      .slider-window
         .news-track
            .news-page
               .news-card
      .slider-btn

   Purpose:
   - slider-window hides overflow
   - news-track moves left / right
   - each news-page is ONE full slide
========================================================= */
.slider-container {
  width: 95%;
  margin: 0 auto 40px;
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.slider-window {
  overflow: hidden;
  width: 100%;
  cursor: grab;
  user-select: none;
  transition: height 0.35s ease;
}

.slider-window.dragging {
  cursor: grabbing;
}

/* This is the sliding strip */
.news-track {
  display: flex;
  transition: transform 0.4s ease;
  width: 100%;
  align-items: flex-start;
}

.news-track:has(#no-news) + .page_number {
  display: none;
}

/* Each page fills the full visible slider width */
.news-page {
  min-width: 100%;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* desktop: 3 columns */
  gap: 20px;
  align-items: stretch;
  box-sizing: border-box;
  flex-shrink: 0; /* very important for correct sliding */
}

/* =========================================================
   CARD DESIGN
========================================================= */
.news-card {
  min-width: 0;
  background: #fff;
  border: 1px solid #ddd;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  height: 100%;
}

.news-card a {
  text-decoration: none;
}

.news-card img {
  width: 100%;
  height: 260px;
  object-fit: contain;
  object-position: center;
  display: block;
  margin: 0 auto 12px;
}

.meta {
  font-size: 11px;
  font-weight: 600;
  color: #1f5fd1;
  margin-bottom: 10px;
  line-height: 1.4;
  word-break: break-word;
  overflow-wrap: break-word;
}

time {
  font-size: 12px;
}

.news-title {
  min-height: 52px;
  display: flex;
  align-items: center;
}

.news-title a {
  color: #111;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  width: 100% !important;

  /* keep title height more consistent */
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-title a:hover {
  color: #011776;
}

.news-title h2 {
  margin-top: 5px !important;
  margin-bottom: 5px !important;
  width: 100%;
}

.news-label {
  position: relative;
  display: inline-block;
  background: #d73925;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  margin-right: 6px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  overflow: hidden;
}

.news-label::after {
  content: "";
  position: absolute;
  top: 0;
  right: -120%;
  width: 60%;
  height: 100%;

  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.7) 50%,
    rgba(255, 255, 255, 0) 100%
  );

  transform: skewX(-20deg);
  animation: newsShine 4s infinite;
}

@keyframes newsShine {
  0% {
    right: 120%;
  }

  100% {
    right: -120%;
  }
}

.desc {
  font-size: 12px;
  line-height: 1.7;
  color: #444;
  margin-bottom: 16px;
  text-align: justify;
  overflow-wrap: normal;
  word-break: normal;
  /* overflow-wrap: anywhere; */

  /* keep card heights closer to same */
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;

  flex-grow: 1; /* push button to bottom */
  margin-top: 0 !important;
}

.btn {
  display: inline-block;
  align-self: flex-start;
  background: #000;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 20px;
  text-decoration: none;
  line-height: 1;
  margin-top: auto;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn:hover {
  background: #011776;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* page numbers */
/* .page_number {
    text-align: center;
    margin: 30px 0;
}

.page_number span {
    display: inline-block;
    margin: 0 6px;
    padding: 8px 12px;
    background: #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.page_number span.active {
    background: #001176;
    color: #fff;
} */

/* Wrapper */
.page_number {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin: 30px 0;
}

#pageNumbers {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}
/* Page numbers */
.page_number {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Buttons */
.page-btn {
  min-width: 40px;
  height: 40px;
  border: 1px solid #dcdcdc;
  background: #fff;
  color: #001176;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.2s ease;
}

.page-btn:hover:not(:disabled) {
  background: #001176;
  color: #fff;
}

.page-btn.active {
  background: #001176;
  color: #fff;
  border-color: #001176;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Dots */
.page-dots {
  display: flex;
  align-items: center;
  padding: 0 6px;
  font-weight: 600;
  color: #666;
}

/* Jump section */
.page-jump {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-jump span {
  font-size: 14px;
  color: #555;
}

/* Input */
.page-jump input {
  width: 60px;
  height: 40px;
  border: 1px solid #dcdcdc;
  border-radius: 8px;
  text-align: center;
  font-size: 14px;
  margin: 0 auto;
}

/* Button */
.page-jump button {
  height: 40px;
  padding: 0 14px;
  border: none;
  background: #001176;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.5s ease;
}

.page-jump button:active {
  background-color: #000;
}

/* =========================================================
   SLIDER BUTTONS
========================================================= */
.slider-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #000;
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  flex-shrink: 0;
  align-self: center;
}

.slider-btn:hover {
  background: #011776;
}

/* =========================================================
   MOBILE FILTER TOGGLE BUTTON
========================================================= */
.filter-toggle {
  display: none;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  background: #001176;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
  transition: 0.5s ease;
}

.filter-toggle:active {
  background-color: #000;
}

#no-news {
  height: 50vh;
}

/* Register Section */
.register-section {
  background-color: #001776;
  padding: 40px 20px;
  text-align: center;
  margin: 0;
}

.register-section h2 {
  color: white;
  font-size: 2rem;
  margin-bottom: 20px;
}

.register-section p {
  color: #e0e0e0;
  font-size: 16px;
  margin-bottom: 30px;
  line-height: 1.6;
}

.register-btn {
  background-color: #fff;
  color: #001776;
  padding: 14px 30px;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: 30px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.register-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

#no-news {
  width: 100%;
  min-height: 45vh;
  margin: 0;
  padding: 60px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;

  background: #fff;
  border: 1px solid #ddd;
  color: #555;
  font-size: 18px;
  font-weight: 600;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
/* =========================================================
   TABLET DESIGN
   Purpose:
   - Change 3-column page to 2-column page
   - ensure img align
========================================================= */
@media (max-width: 992px) {
  .section-title {
    font-size: 25px;
  }
  .news-title a {
    font-size: 21px !important;
  }

  .news-page {
    grid-template-columns: repeat(2, 1fr);
  }

  .news-card img {
    width: 295px !important;
    height: 220px !important;
    object-fit: contain;
    object-position: center;
    display: block;
    margin-bottom: 12px;
  }

  .reset-btn {
    height: 43.6px;
  }

  /* Register Section Mobile */
  .register-section {
    padding: 30px 15px;
    margin: 0;
  }

  .register-section h2 {
    font-size: 1.6rem;
    margin-bottom: 15px;
  }

  .register-section p {
    font-size: 14px;
    margin-bottom: 25px;
  }

  .register-btn {
    padding: 12px 25px;
    font-size: 14px;
  }
}

/* =========================================================
   MOBILE DESIGN
   Purpose:
   - 1 column layout
   - stable card height
========================================================= */
@media (max-width: 600px) {
  .slider-container {
    display: flex;
    align-items: stretch;
  }

  /* 1 column layout */
  .news-page {
    grid-template-columns: repeat(1, 1fr);
    gap: 20px;
    /* min-height: calc((500px * 6) + (20px * 5)); */
    align-content: start;
    align-self: flex-start;
  }

  .news-card {
    height: 500px;
    margin-bottom: 20px;
  }

  .desc {
    line-height: 1.7;
    /* max-height: calc(12px * 1.7 * 4); */
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 0;
  }
  @supports (-webkit-touch-callout: none) {
    .desc {
      text-align: left;
      overflow-wrap: normal;
      word-break: normal;
    }

    .filter-form input[type="month"] {
      text-align: left;
      color: #222;
      -webkit-text-fill-color: #222;
      direction: ltr;
    }

    .filter-form input[type="month"]::-webkit-datetime-edit {
      text-align: left;
      justify-content: flex-start;
    }

    .filter-form input[type="month"]::-webkit-date-and-time-value {
      text-align: left;
    }
  }

  .news-card img {
    width: 100% !important;
    height: 220px !important;
    object-fit: contain;
    object-position: center;
    display: block;
    margin-bottom: 12px;
  }

  .section-title-page {
    padding: 16px 12px;
  }

  .section-title {
    font-size: 21px;
    text-align: center;
  }

  .news-title a {
    font-size: 19px !important;
  }

  .filter-toggle {
    display: block;
  }

  .filter-form {
    display: none;
    flex-direction: column;
    width: 100%;
    background: #fff;
    padding: 14px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  }

  .filter-form.show {
    display: flex;
  }

  .filter-form input,
  .filter-form select,
  .filter-form button,
  .reset-btn {
    width: 100%;
    min-width: 0;
    max-width: none;
    box-sizing: border-box;
    min-height: 48px;
    max-height: 50px;
    font-size: 16px;
  }

  .filter-form select {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
  }

  .filter-form input[type="month"] {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
  }

  input[type="month"]:before {
    min-height: 45px;
    max-height: 48px;
  }

  #no-news {
    min-height: 35vh;
    padding: 40px 16px;
    font-size: 15px;
  }
}

@media (max-width: 400px) {
  .section-title {
    font-size: 19px;
    text-align: center;
  }

  .news-title a {
    font-size: 18px !important;
  }
}

@media (max-width: 350px) {
  .section-title {
    font-size: 18px;
    text-align: center;
  }

  .news-title a {
    font-size: 17px !important;
  }
}
