* {
  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;
  --primary-red: #c8102e;
  --red-dark: #8b0000;
  --gold: #ffd700;
  --gold-soft: #f4d182;
  --blue-soft: #2f6fff;
}

body {
  margin: 0;
  font-family: "SVN-ProductSans", sans-serif;
  min-height: 100vh;
  background: linear-gradient(180deg, #b3030d, #8b0000);
  background-size: cover;
  background-position: center bottom;
  background-attachment: fixed;
}

.container {
  max-width: 1200px;
  margin: auto;
  padding: 20px 20px;
}

h2 {
  text-align: center;
  color: #fbff00;
  margin-bottom: 28px;
  font-size: 26px;
  letter-spacing: 1px;
  font-weight: 700; /* in đậm */
}
/* ===== SEARCH ===== */
.search-filter-row {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap; /* để responsive xuống hàng nhỏ */
  margin-bottom: 20px;
}

.filter-buttons {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  background: white; /* Nền trắng bao quanh */
  border-radius: 50px; /* Bo tròn toàn bộ khung */
  padding: 5px 12px; /* Khoảng cách trong khung */
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1); /* Bóng nhẹ nếu muốn */
}

.filter-btn {
  background: transparent; /* Nền trong suốt để lộ nền trắng của filter-buttons */
  color: #d8102e;
  border: none;
  padding: 8px 20px;
  border-radius: 40px; /* Bo tròn riêng từng nút */
  font-weight: 700;
  font-family: "SVN-ProductSans", sans-serif;
  font-size: 14px;
  cursor: pointer;
  transition: 0.3s;
  user-select: none;
  min-width: 80px; /* Giữ kích thước nút đều nhau */
  text-align: center;
}

.filter-btn.active {
  background: linear-gradient(90deg, #ffba43, #f2691e);
  color: white;
  box-shadow: 0 2px 8px rgba(255, 186, 67, 0.6);
}

.filter-btn:hover:not(.active) {
  color: #ff4d4d;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-grow: 1; /* chiếm phần còn lại */
  min-width: 250px; /* tối thiểu rộng */
}

.search-box input {
  font-family: "SVN-ProductSans", sans-serif;
  flex-grow: 1;
  padding: 10px 18px;
  border-radius: 50px;
  border: 1.5px solid #ddd;
  font-size: 14px;
}

.search-box button {
  font-family: "SVN-ProductSans", sans-serif;
  padding: 10px 25px;
  border-radius: 50px;
  border: none;
  background: linear-gradient(45deg, #d04800, #ffb000);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: 0.3s;
}

.search-box button:hover {
  transform: translateY(-2px);
}

/* Responsive mobile: xuống hàng */
@media (max-width: 600px) {
  .search-filter-row {
    flex-direction: column;
    gap: 12px;
  }
  .filter-buttons {
    justify-content: center;
    flex-wrap: wrap;
  }
  .search-box {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .search-filter-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .filter-buttons {
    display: flex;
    justify-content: space-between; /* phân đều khoảng cách */
    width: 100%; /* full chiều ngang */
  }

  .filter-btn {
    flex: 1; /* mỗi nút chiếm đều nhau */
    margin: 0 4px; /* khoảng cách nhỏ giữa các nút */
    font-size: 14px;
    padding: 8px 0;
  }

  /* Giảm margin của nút đầu và cuối cho đẹp */
  .filter-btn:first-child {
    margin-left: 0;
  }

  .filter-btn:last-child {
    margin-right: 0;
  }
}

/* ===== GRID ===== */
#result {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 25px;
}

/* CSS cho thông báo khi không có dữ liệu */
#result.nodata {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-size: 18px;
  color: #ffffff;
  margin: 40px 0;
  font-weight: 600;
  font-family: "SVN-ProductSans", sans-serif;
  user-select: none;
  height: 100px;
}
/* ===== CARD ===== */
.card {
  background: #fffaf3;
  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: linear-gradient(45deg, #f4bc31, #ffd700, #f4bc31);
  border-radius: 10px;
  padding: 2px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden; /* bắt buộc để crop ảnh */
}

.image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* cắt vừa khung, không bẻ méo */
  aspect-ratio: 16 / 9; /* đảm bảo tỉ lệ 16:9 */
  border-radius: 10px;
}

/* ===== 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;
}

.card-info p {
  margin: 3px 0; /* giảm khoảng cách giữa các dòng */
}

.card-info strong {
  font-weight: 600;
}

/* ===== DOWNLOAD BUTTON ===== */
.download-btn {
  font-family: "SVN-ProductSans";
  margin-top: 10px;
  padding: 8px 20px;
  border-radius: 50px;
  border: none;
  background: linear-gradient(45deg, #c8102e, #ff4d4d);
  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 var(--gold);
  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: 22px;
    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;
    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;
    border: none;
    font-family: "SVN-ProductSans", sans-serif; /* thêm font */
  }

  #searchID {
    font-family: "SVN-ProductSans", sans-serif;
    border: 1.5px solid #ccc; /* viền mặc định */
    border-radius: 50px;
    padding: 12px 20px;
    outline: none;
    transition: border-color 0.3s ease;
  }

  /* Viền đen khi input được focus (nhấn vào) */
  #searchID:focus {
    border-color: #ffba43; /* viền đen */
    box-shadow: 0 0 5px #ffba4380; /* hiệu ứng nhẹ */
  }

  /* Đặt font cho placeholder */
  #searchID::placeholder {
    font-family: "SVN-ProductSans", sans-serif;
    color: #999999; /* màu placeholder nếu muốn */
  }
  /* 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: 3px;
  }

  .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;
}

.pt-title {
  font-size: 15px;
  font-weight: 700;
  color: #ff0000;
  margin-bottom: 8px;
  line-height: 1.4;
  text-align: justify;
  /* giới hạn 2 dòng */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pt-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
  color: white;
}

.pt-yes {
  background: linear-gradient(45deg, #d4a017, #ffd700);
  color: #4a3000;
}

.pt-no {
  background: linear-gradient(45deg, #ff0000, #ff6a6a);
}

.countdown-badge {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.75);
  color: white;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: bold;
  backdrop-filter: blur(3px);
}

.header-bar {
  position: relative;
  width: 100%;
  padding: 10px 0;
  text-align: center; /* căn giữa tiêu đề */
  margin-bottom: 20px;
}

/* Logo desktop: góc trái */
.header-logo {
  position: absolute;
  top: 50%;
  left: 20px;
  transform: translateY(-50%);
  height: 70px;
  width: auto;
}

/* Tiêu đề luôn căn giữa */
#titlePT {
  text-align: center;
  font-weight: bold;
}

/* Mobile: logo trên, căn giữa, tiêu đề dưới */
@media (max-width: 768px) {
  .header-logo {
    position: static; /* không còn absolute */
    transform: none;
    display: block;
    margin: 0 auto; /* căn giữa */
    height: 60px;
  }

  #titlePT {
    font-size: 20px;
    margin-top: 10px; /* cách logo một chút */
  }
}

/* ==== 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 */
}

/* ===== QR nhỏ ===== */
.qr-badge {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  background: white;
  border-radius: 2px;
  padding: 1px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  transition: 0.2s;
}

.qr-badge:hover {
  transform: scale(1.1);
}

.qr-badge img {
  border-radius: 2px;
  width: 100%;
  height: 100%;
}

/* ===== POPUP QR ===== */
.qr-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: hsla(0, 0%, 0%, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.qr-content {
  background: white;
  padding: 20px;
  border-radius: 16px;
  text-align: center;
}

.qr-content img {
  width: 220px;
  height: 220px;
}

.qr-actions {
  margin-top: 12px;
}

.qr-actions a,
.qr-actions button {
  margin: 5px;
  padding: 8px 14px;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  background: #ff4d4d;
  color: white;
}

.qr-actions {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  gap: 12px;
}

.qr-loading {
  opacity: 0.4;
  filter: blur(1px);
  transition: 0.3s ease;
}
/* Base button */
.qr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.25s ease;
  min-width: 110px;
}

/* Primary (Tải QR) */
.qr-btn.primary {
  background: linear-gradient(45deg, #c8102e, #ff4d4d);
  color: white;
  border: none;
}

.qr-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(200, 16, 46, 0.4);
}

/* Outline (Đóng) */
.qr-btn.outline {
  font-family: "SVN-ProductSans";
  background: transparent;
  border: 1px solid #c8102e;
  color: #c8102e;
}

.qr-btn.outline:hover {
  background: #c8102e;
  color: white;
}
