/* =========================================================
   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; */
  background-color: white;
  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;
}

/* =========================================================
   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: 12px 14px;
  border-radius: 10px;
  border: 1px solid #ccc;
  font-size: 14px;
}

.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
         .products-track
            .products-page
               .products-card
      .slider-btn

   Purpose:
   - slider-window hides overflow
   - products-track moves left / right
   - each products-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 */
.products-track {
  display: flex;
  transition: transform 0.4s ease;
  width: 100%;
  align-items: flex-start;
}

/* Each page fills the full visible slider width */
.products-page {
  min-width: 100%;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* desktop: 3 columns */
  /* gap: 20px; */
  gap: 0;
  align-items: stretch;
  box-sizing: border-box;
  flex-shrink: 0; /* very important for correct sliding */
}

/* =========================================================
   CARD DESIGN
========================================================= */
.products-card {
  min-width: 0;
  background: #fff;
  /* border: 1px solid #ddd; */
  /* border: 1px solid #e0e0e0; */
  border: none;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  height: 100%;
}

.products-card {
  border: none;
  border-top: 1px solid #e0e0e0; /* only top line */
  border-right: 1px solid #e0e0e0; /* only right line */
  border-bottom: 1px solid #e0e0e0; /* only bottom line */
}

/* desktop: 3 columns */
.products-card:nth-child(3n) {
  border-right: none;
}

/* remove bottom border from last row only */
/* .products-card:nth-last-child(-n + 3) {
  border-bottom: none;
} */

.products-card a {
  text-decoration: none;
}

.products-card img {
  width: 100%;
  height: 260px;
  object-fit: contain;
  object-position: center;
  display: block;
  margin: 0 auto 12px;
}

.meta h3 {
  font-size: 14px;
  font-weight: 600;
  color: #777;
  margin-bottom: 10px;
  line-height: 1.4;
  word-break: break-word;
  overflow-wrap: break-word;
  text-align: center;

  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.products-title {
  min-height: 40px;
}

.products-title h2 {
  color: #111;
  font-size: 23px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  text-align: center;
  margin: 0;
  padding-bottom: 10px;

  /* keep title height more consistent */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.products-title a:hover {
  color: #011776;
}

.desc {
  font-size: 13px;
  line-height: 1.7;
  color: #444;
  margin-bottom: 16px;
  text-align: justify;
  word-break: break-word;
  overflow-wrap: break-word;

  /* keep card heights closer to same */
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;

  flex-grow: 1; /* push button to bottom */
}

.btn {
  display: inline-block;
  margin: 0 auto;
  background: #ff2b2b;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 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: #d90000;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.disable-btn {
  background: #ff2b2b;
  color: #fff;
  cursor: not-allowed;
  pointer-events: none;
}

.disable-btn::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%;
  }
}

/* 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: 15px;
  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: bold;
  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);
}

/* =========================================================
   TABLET DESIGN
   Purpose:
   - Change 3-column page to 2-column page
   - ensure img align
========================================================= */
@media (max-width: 992px) {
  .section-title {
    font-size: 24px;
  }

  .products-page {
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
  }

  .products-title h2 {
    font-size: 20px;
  }

  .products-card {
    border: none;
    border-top: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
  }

  /* cancel desktop rules first */
  .products-card:nth-child(3n) {
    border-right: 1px solid #e0e0e0;
  }

  .products-card:nth-last-child(-n + 3) {
    border-bottom: 1px solid #e0e0e0;
  }

  /* apply tablet rules */
  .products-card:nth-child(2n) {
    border-right: none;
  }

  /* .products-card:nth-last-child(-n + 2) {
    border-bottom: none;
  } */
}

.products-card img {
  width: 295px !important;
  height: 220px !important;
  object-fit: contain;
  object-position: center;
  display: block;
  margin-bottom: 12px;
}

.products-title a {
  font-size: 22px;
}

.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: 15px;
}

/* =========================================================
   MOBILE DESIGN
   Purpose:
   - 1 column layout
   - stable card height
========================================================= */
@media (max-width: 600px) {
  .slider-container {
    display: flex;
    align-items: stretch;
  }

  /* 1 column layout */
  .products-page {
    grid-template-columns: repeat(1, 1fr);
    gap: 0;
    /* min-height: calc((500px * 6) + (20px * 5)); */
    align-content: start;
    align-self: flex-start;
  }

  .meta h3 {
    font-size: 12px !important;
  }

  .products-card {
    height: 380px;
    margin-bottom: 20px;
    /* reset everything first */
    border: none !important;
    border-top: none !important;
    border-right: none !important;
    border-left: none !important;
    border-bottom: 1px solid #e0e0e0 !important;
  }

  .products-card img {
    width: 100% !important;
    height: 220px !important;
    object-fit: contain;
    object-position: center;
    display: block;
    margin-bottom: 12px;
  }

  /* reset old desktop/tablet nth rules */
  .products-card:nth-child(2n) {
    border-right: none !important;
  }

  .products-card:nth-child(3n) {
    border-right: none !important;
  }

  .products-card:nth-last-child(-n + 2) {
    border-bottom: 1px solid #e0e0e0 !important;
  }

  .products-card:nth-last-child(-n + 3) {
    border-bottom: 1px solid #e0e0e0 !important;
  }

  /* remove only the final card line */
  /* .products-card:last-child {
    border-bottom: none !important;
  } */

  .section-title-page {
    padding: 16px 12px;
  }

  .section-title {
    font-size: 22px;
  }

  .products-title h2 {
    font-size: 20px;
  }

  .meta h3 {
    font-size: 15px;
  }

  .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%;
  }

  .filter-form select {
    max-width: 400px;
  }
}
