/* BẢO MẬT & HIỆU NĂNG:
  1. Sử dụng biến CSS giúp dễ dàng quản lý tập trung và tránh sai sót.
*/
:root {
  --navy: #002349;
  --navy-dark: #002855;
  --gold: #c5a059;
  --gold-light: #e2c691;
  --gold-btn-start: #C5A031;
  --gold-btn-mid: #F3E5AB;
}

.text-navy { color: var(--navy); }
.bg-navy { background: var(--navy); }
.text-gold { color: var(--gold); }
.bg-gold { background: var(--gold); }

/* Đã thêm fallback fonts an toàn */
.font-serif {
  font-family: 'Times New Roman', Times, serif;
}

/* HIỆU NĂNG ANIMATION: 
  Chỉ sử dụng 'opacity' và 'transform' cho transition/animation để 
  tận dụng GPU acceleration, tránh gây reflow/repaint nặng (ngăn chặn DoS phía client).
*/
.reveal {
  opacity: 0;
  transform: translateY(30px);
  /* Sửa 'all' thành các thuộc tính cụ thể để tối ưu hiệu năng */
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
  /* Ngăn người dùng tương tác với phần tử khi nó đang ẩn */
  pointer-events: none; 
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* BẢO MẬT TÀI NGUYÊN BÊN NGOÀI:
  Luôn đảm bảo các URL bên ngoài sử dụng giao thức HTTPS (như link unsplash dưới đây) 
  để tránh lỗi Mixed Content và các cuộc tấn công Man-in-the-Middle (MitM).
*/
.hero-bg {
  background: linear-gradient(to right, rgba(0, 40, 85, 0.8), rgba(0, 0, 0, 0.4)), 
              url('https://images.unsplash.com/photo-1583417646187-57cb5a18a992?q=80&w=2000') center/cover no-repeat fixed;
}

.nav-transition {
  transition: background-color 0.4s ease, backdrop-filter 0.4s ease, box-shadow 0.4s ease, padding 0.4s ease;
}

.nav-scrolled {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px); /* Hỗ trợ Safari */
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  padding: 12px 0;
}

.nav-scrolled .nav-text,
.nav-scrolled .logo-text {
  color: var(--navy-dark);
}

.text-gradient {
  background: linear-gradient(135deg, #D4AF37, #f9df8a, #D4AF37);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-btn-start), var(--gold-btn-mid), var(--gold-btn-start));
  background-size: 200% auto;
  /* Hạn chế dùng !important, nhưng nếu cần đè thư viện CSS (như Bootstrap/Tailwind) thì giữ nguyên */
  color: var(--navy-dark) !important;
  transition: background-position 0.5s, transform 0.3s, box-shadow 0.3s;
}

.btn-gold:hover, .btn-gold:focus {
  background-position: right center;
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(212, 175, 55, 0.3);
  outline: none; /* Thêm trạng thái focus để hỗ trợ Accessibility (A11y) */
}

.zoom-overlay {
  background: rgba(0, 35, 73, 0.6);
  opacity: 0;
  transition: opacity 0.4s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Đảm bảo overlay không chặn click khi bị ẩn */
  pointer-events: none; 
}

.group:hover .zoom-overlay,
.group:focus-within .zoom-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* Tùy chỉnh thư viện Swiper */
.swiper-pagination-bullet-active {
  background: var(--gold) !important;
  width: 24px !important;
  border-radius: 4px !important;
}

.amenity-card {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform; /* Báo cho trình duyệt biết thuộc tính này sẽ thay đổi để tối ưu */
}

.amenity-card:hover {
  transform: translateY(-10px);
}

.gradient-overlay {
  background: linear-gradient(to top, rgba(0, 35, 73, 0.95) 0%, rgba(0, 35, 73, 0.4) 50%, transparent 100%);
}

.swiper-button-next,
.swiper-button-prev {
  color: var(--gold) !important;
  background: #fff;
  width: 50px !important;
  height: 50px !important;
  border-radius: 50%;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.swiper-button-next:after,
.swiper-button-prev:after {
  font-size: 20px !important;
  font-weight: 700;
}

/* BẢO MẬT UI (Ngăn Clickjacking / Lỗi tương tác không mong muốn):
  Sử dụng pointer-events và visibility cho Popup thay vì chỉ dùng opacity.
*/
#popupModal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex; /* Thay vì display: none đổi qua display: flex, ta dùng visibility để dễ animate */
  align-items: center;
  justify-content: center;
  
  opacity: 0;
  visibility: hidden; /* Ẩn hoàn toàn khỏi DOM tree xét về mặt tương tác */
  pointer-events: none; /* Chắc chắn không click xuyên được */
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#popupModal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-content {
  background: #fff;
  padding: 2rem;
  border-radius: 1.5rem;
  max-width: 90%;
  width: 500px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transform: scale(0.95);
  transition: transform 0.3s ease;
  /* Tránh nội dung quá dài làm vỡ layout modal */
  max-height: 90vh;
  overflow-y: auto; 
}

#popupModal.active .modal-content {
  transform: scale(1);
}

/* MEDIA QUERIES */
@media (max-width: 640px) {
  .hero-bg { min-height: 80vh; }
  .text-5xl { font-size: 2.5rem; }
  .text-7xl { font-size: 3.5rem; }
  .text-8xl { font-size: 4rem; }
  .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .h-\[500px\] { height: 300px; }
  .h-80 { height: 250px; }
  .p-10 { padding: 1.5rem; }
  .p-8 { padding: 1.25rem; }
  .p-6 { padding: 1rem; }
  .gap-16 { gap: 2rem; }
  .gap-12 { gap: 1.5rem; }
  .gap-8 { gap: 1rem; }
  .max-w-7xl {
    max-width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .h-\[500px\] { height: 400px; }
  .h-80 { height: 300px; }
  .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.priceCarousel .swiper-slide img {
  width: 100%;
  height: auto;
  max-height: 720px;           /* phù hợp kích thước poster gốc */
  object-fit: contain;
  background: #f8f8f8;
}
.priceCarousel {
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}
/* FIX POPUP TẢI BẢNG GIÁ */
#taiTaiLieuPopup.active {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

#taiTaiLieuPopup.active > div {
  transform: scale(1) !important;
}