* {
  box-sizing: border-box;
}
/* ===== FONT ===== */
@font-face {
  font-family: "SVN-ProductSans";
  src: url("../assets/font/SVN-Product Sans Regular.otf") format("opentype");
}

:root {
  --blue1: #0033b2;
  --blue2: #3399ff;

  --green1: #056b24;
  --green2: #8be21b;

  --red: #ff0000;
  --orange1: #d04800;
  --orange2: #ffb000;

  --pink1: #c72c9b;
  --pink2: #ffa4d6;

  --cyan: #43dcff;
  --light-bg: #f8ffd2;
}

body {
  margin: 0;
  font-family: "SVN-ProductSans", sans-serif;
  min-height: 100vh;

  background: linear-gradient(180deg, var(--blue1), var(--blue2));

  background-image: url("../assets/khenthuong/bg.png");
  background-size: cover;
  background-position: center bottom;
  background-attachment: fixed;
}

.container {
  max-width: 1200px;
  margin: auto;
  padding: 20px 20px;
}

h2 {
  text-align: center;
  color: #002189;
  margin-bottom: 28px;
  font-size: 26px;
  letter-spacing: 1px;
  font-weight: 700; /* in đậm */
}
/* ===== SEARCH ===== */
.search-box {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 30px;
  font-family: "SVN-ProductSans";
}

.search-box input {
  padding: 12px 20px;
  border-radius: 50px;
  border: none;
  min-width: 250px;
  font-size: 14px;
}

.search-box button {
  padding: 12px 25px;
  border-radius: 50px;
  border: none;
  background: linear-gradient(45deg, var(--orange1), var(--orange2));
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: 0.3s;
  font-family: "SVN-ProductSans";
}

.search-box button:hover {
  transform: translateY(-2px);
}

/* ===== GRID ===== */
#result {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 25px;
}

/* ===== CARD ===== */
.card {
  background: rgba(255, 255, 255, 0.97);
  padding: 12px;
  border-radius: 22px;
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.18);
  transition: 0.3s;
}

.card:hover {
  transform: translateY(-5px);
}

/* ===== IMAGE ===== */
.image-wrapper {
  background: var(--light-bg);
  border-radius: 15px;
  padding: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.image-wrapper {
  background: var(--light-bg);
  border-radius: 15px;
  overflow: hidden;
  height: 260px; /* chiều cao cố định */
  display: flex;
  justify-content: center;
  align-items: center;
}

.image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* crop */
  object-position: center top; /* ưu tiên phần đầu giấy */
  border-radius: 10px;
  cursor: zoom-in;
  transition: transform 0.3s;
}

.image-wrapper img:hover {
  transform: scale(1.03);
}

/* =========================
   IMAGE POPUP
========================= */

.image-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 999999;

  touch-action: none;
  overscroll-behavior: contain;
}

.image-modal img {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
  border-radius: 10px;
}

.close-modal {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 40px;
  cursor: pointer;
  user-select: none;
}
/* ===== CARD INFO (đã thu gọn khoảng cách dòng) ===== */
.card-info {
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.4; /* giảm khoảng cách dòng */
  color: #222;
  text-align: justify;
  text-align-last: left;
  hyphens: auto;
}

.card-info p {
  margin: 3px 0; /* giảm khoảng cách giữa các dòng */
}

.card-info strong {
  color: var(--blue1);
  font-weight: 600;
}

/* ===== DOWNLOAD BUTTON ===== */
.download-btn {
  margin-top: 10px;
  padding: 8px 20px;
  border-radius: 50px;
  border: none;
  background: linear-gradient(45deg, var(--green1), var(--green2));
  color: white;
  font-size: 13px;
  cursor: pointer;
  transition: 0.3s;
}

.download-btn:hover {
  transform: translateY(-2px);
}

/* ===== FOOTER IMAGE FULL WIDTH - NO CROP ===== */

.footer-bg {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 0; /* dưới nội dung */
  pointer-events: none;
}

.footer-bg img {
  width: 100%;
  height: auto; /* giữ đúng tỉ lệ */
  display: block;
}
.container,
.description,
#loading-overlay,
#toast-container {
  position: relative;
  z-index: 2;
}
/* ===== HERO DESCRIPTION MODERN ===== */

.description {
  margin: 0 auto 35px auto;
  max-width: 1000px;
}

.desc-content {
  padding: 28px 30px;
  border-radius: 24px;
  background: linear-gradient(135deg, #0033b2, #3399ff);
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow: 0 15px 40px rgba(0, 51, 178, 0.25);
}

.desc-content p {
  text-align: justify;
  text-align-last: left;
  hyphens: auto; /* ngắt từ tự nhiên hơn */
}

/* hiệu ứng ánh sáng */
.desc-content::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.25), transparent);
  transform: rotate(25deg);
}

.desc-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.desc-guide {
  font-size: 15px;
  line-height: 1.6;
}

/* CHIP bo tròn */
.chip {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 50px;
  background: white;
  color: #0033b2;
  font-weight: 600;
  font-size: 13px;
  margin: 0 4px;
}

.desc-guide em {
  font-style: italic;
  opacity: 0.9;
}

/* ===== LOADING OVERLAY ===== */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.spinner {
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid #0015ff;
  border-radius: 50%;
  width: 35px;
  height: 35px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== TOAST ===== */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
}

.toast {
  min-width: 250px;
  margin-bottom: 10px;
  padding: 12px 18px;
  border-radius: 12px;
  color: white;
  font-size: 14px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  animation:
    slideIn 0.3s ease,
    fadeOut 0.3s ease 2.7s forwards;
}

.toast-success {
  background: linear-gradient(45deg, var(--green1), var(--green2));
}

.toast-error {
  background: linear-gradient(45deg, var(--red), var(--orange2));
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* ===================================== */
/* ========== MOBILE LAYOUT ============ */
/* ===================================== */

@media (max-width: 768px) {
  body {
    background-attachment: scroll;
  }

  .container {
    padding: 16px;
  }

  h2 {
    font-size: 20px;
    margin-bottom: 16px;
  }

  /* SEARCH thành cột dọc */
  .search-box {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    width: 100%;
  }

  .search-box input {
    width: 100%;
    min-width: unset;
    font-size: 15px;
    padding: 14px 18px;
    border-radius: 50px; /* bo tròn 2 đầu */
    border: 1.5px solid #ddd;
    background: #fff;
  }

  .search-box input:focus {
    outline: none;
    border-color: var(--blue2);
    box-shadow: 0 0 0 3px rgba(51, 153, 255, 0.15);
  }

  .search-box button {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    border-radius: 50px; /* bo tròn 2 đầu */
    border: none;
  }

  /* GRID thành 1 cột full width */
  #result {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  /* CARD full width */
  .card {
    width: 100%;
    padding: 16px;
    border-radius: 20px;
  }

  /* ẢNH rộng tối đa */
  .image-wrapper {
    padding: 6px;
  }

  .image-wrapper img {
    width: 100%;
    height: auto;
  }

  /* Thông tin gọn hơn */
  .card-info {
    font-size: 13px;
    line-height: 1.35;
  }

  .card-info p {
    margin: 4px 0;
  }

  /* Nút tải full width */
  .download-btn {
    width: 100%;
    padding: 12px;
    border-radius: 50px; /* bo tròn 2 đầu */
  }

  /* Toast không bị lệch */
  #toast-container {
    left: 10px;
    right: 10px;
    top: 15px;
  }

  .toast {
    width: 100%;
    min-width: unset;
  }
}

.search-box button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ==== Modern Scrollbar Styling ==== */
/* Scrollbar đẹp, mờ nhẹ, không có mũi tên */
::-webkit-scrollbar {
  width: 3px; /* Chiều rộng của thanh cuộn */
  height: 3px; /* Chiều cao của thanh cuộn ngang */
  background: linear-gradient(
    180deg,
    var(--blue1),
    var(--blue2)
  ); /* Nền trong suốt */
}

::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background-color: #ffffff; /* Màu xám mờ */
  border-radius: 20px;
  transition: background-color 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 0, 0, 0); /* Đậm hơn chút khi hover */
}

::-webkit-scrollbar-button {
  display: none; /* Ẩn mũi tên hai đầu */
}
