/* ==========================================================================
   TẬP LỆNH CSS TÙY BIẾN CHO THIỆP CƯỚI ĐIỆN TỬ (MODERN BEIGE & FLORAL ELEGANCE)
   ========================================================================== */

/* 1. Thiết lập thanh cuộn trang web sang trọng (Custom Scrollbar) */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #FDFBF7;
}

::-webkit-scrollbar-thumb {
  background: #E0D7C6;
  border-radius: 9999px;
  border: 2px solid #FDFBF7;
}

::-webkit-scrollbar-thumb:hover {
  background: #C5A880;
}

/* Thanh cuộn cho Sổ lưu bút */
.custom-scrollbar::-webkit-scrollbar {
  width: 5px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: #F7F3EB;
  border-radius: 9999px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #D4A373;
  border-radius: 9999px;
}

/* 2. Hiệu ứng phóng to cực nhẹ cho ảnh nền Hero (Subtle Zoom Animation) */
@keyframes subtleZoom {
  0% {
    transform: scale(1.02);
  }
  50% {
    transform: scale(1.07);
  }
  100% {
    transform: scale(1.02);
  }
}

.animate-subtle-zoom {
  animation: subtleZoom 25s ease-in-out infinite;
}

/* =========================================================================
   3. FLOATING MUSIC PLAYER – NÚT ĐIỀU KHIỂN NHẠC NỀN
   ========================================================================= */

/* Wrapper cố định góc dưới-trái */
.music-player-wrap {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Nút tròn chính */
.music-toggle-btn {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(197, 168, 128, 0.45);
  box-shadow: 0 4px 20px rgba(0,0,0,0.12), 0 0 0 0 rgba(197,168,128,0);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  outline: none;
}

.music-toggle-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(0,0,0,0.16), 0 0 0 5px rgba(197,168,128,0.12);
}

.music-toggle-btn:active {
  transform: scale(0.95);
}

/* Đĩa nhạc trang trí xoay bên trong nút */
@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.music-disc {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 1.5px dashed rgba(197, 168, 128, 0.55);
  animation: spinSlow 8s linear infinite;
  pointer-events: none;
  opacity: 0.6;
  transition: opacity 0.4s;
}

/* Khi nhạc tạm dừng thì đĩa ngừng xoay */
.music-disc.spin-paused {
  animation-play-state: paused;
  opacity: 0.3;
}

/* Icon nốt nhạc */
.music-note-icon {
  position: relative;
  z-index: 2;
  font-size: 1rem;
  color: #8b7355;
  transition: color 0.3s;
}

/* Khi đang phát: icon đổi màu rose gold */
.music-toggle-btn.is-playing .music-note-icon {
  color: #c9856c;
}

/* Pulse ring khi đang phát */
@keyframes musicPulse {
  0%   { box-shadow: 0 0 0 0   rgba(201,133,108, 0.40); }
  70%  { box-shadow: 0 0 0 10px rgba(201,133,108, 0); }
  100% { box-shadow: 0 0 0 0   rgba(201,133,108, 0); }
}

.music-toggle-btn.is-playing {
  animation: musicPulse 2s ease-out infinite;
}

/* Tooltip trạng thái */
.music-tooltip {
  display: none;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(197,168,128,0.3);
  border-radius: 999px;
  font-size: 0.7rem;
  color: #5c4a3a;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.music-player-wrap:hover .music-tooltip {
  display: flex;
  opacity: 1;
}

/* Chấm nhấp nháy xanh lá khi đang phát */
.music-tooltip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #93af87;
  flex-shrink: 0;
}

/* Animate-spin-slow (giữ lại để tương thích các nơi dùng cũ) */
.animate-spin-slow {
  animation: spinSlow 8s linear infinite;
}

.spin-paused {
  animation-play-state: paused;
}

/* 4. Tùy chỉnh hiệu ứng làm mờ nền kính (Glassmorphism) */
.glass-panel {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

/* 5. Hiệu ứng viền vàng kim tuyến lấp lánh nhẹ khi hover thẻ */
.hover-gold-glow {
  transition: all 0.3s ease;
}

.hover-gold-glow:hover {
  box-shadow: 0 15px 35px -5px rgba(197, 168, 128, 0.25), 0 5px 15px rgba(0, 0, 0, 0.04);
  border-color: rgba(212, 163, 115, 0.6);
}

/* 6. Timeline line căn chỉnh trên mobile và desktop */
@media (max-width: 767px) {
  .timeline-line {
    left: 18px !important;
  }
}

/* 7. Canvas cánh hoa rơi bao phủ toàn màn hình */
#petals-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 30;
}

/* 8. Hiệu ứng gõ chữ và bóng đổ văn bản */
.text-shadow-soft {
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

/* Tinh chỉnh typography cho font chữ uốn lượn */
.font-calligraphy {
  font-family: 'Great Vibes', cursive;
  letter-spacing: 0.02em;
}

/* Tinh chỉnh hiệu ứng mở Modal */
#gift-modal.active,
#lightbox-modal.active {
  display: flex !important;
  opacity: 1 !important;
}

#gift-modal.active > div {
  transform: scale(1) !important;
}


#toast.show {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

/* =========================================================================
   9. BIỂU TƯỢNG THÁNH GIÁ & CHIM BỒ CÂU (BIBLE QUOTE SECTION)
   ========================================================================= */

/* Hiệu ứng phát sáng + nhấp nháy nhẹ Thánh Giá */
@keyframes crossGlow {
  0%, 100% {
    text-shadow: 0 0 6px rgba(197,168,128,0.5), 0 0 16px rgba(197,168,128,0.25);
    opacity: 1;
  }
  50% {
    text-shadow: 0 0 14px rgba(197,168,128,0.85), 0 0 30px rgba(197,168,128,0.45);
    opacity: 0.88;
  }
}

.sacred-cross-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 0.4rem;
}

.sacred-cross {
  font-size: 2.4rem;
  color: #c9a84c;
  animation: crossGlow 3s ease-in-out infinite;
}

/* Hiệu ứng bay nhẹ lên xuống + glow cho Chim Bồ Câu */
@keyframes doveFloat {
  0%, 100% { transform: translateY(0);    opacity: 0.80; }
  50%       { transform: translateY(-6px); opacity: 1;   }
}

/* Keyframe riêng cho chim bên phải: kết hợp scaleX(-1) + translateY */
@keyframes doveFloatRight {
  0%, 100% { transform: scaleX(-1) translateY(0);    opacity: 0.80; }
  50%       { transform: scaleX(-1) translateY(-6px); opacity: 1;   }
}

/* Con chim bên trái (mặt hướng phải, vào chữ) */
.dove-icon {
  display: inline-block;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(197,168,128,0.55));
}

.dove-left {
  animation: doveFloat 4s ease-in-out infinite;
  animation-delay: 0s;
}

/* Con chim bên phải: scaleX(-1) được xử lý trong keyframe riêng */
.dove-right {
  animation: doveFloatRight 4s ease-in-out infinite;
  animation-delay: 0.8s;
  transform: scaleX(-1); /* fallback khi animation chưa chạy */
}

/* 10. NAV RESPONSIVE – chống ngắt chữ, tự co giãn theo màn hình */
#main-nav nav a {
  white-space: nowrap;
  font-size: clamp(0.6rem, 0.8vw, 0.75rem);
  letter-spacing: clamp(0.05em, 0.15vw, 0.2em);
}

#main-nav nav {
  gap: clamp(0.75rem, 1.5vw, 2rem);
}

/* Ở màn hình trung bình (md → lg) thu nhỏ padding header */
@media (min-width: 768px) and (max-width: 1023px) {
  #main-nav {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  #main-nav > div {
    gap: 0.5rem;
  }

  #main-nav nav {
    gap: clamp(0.5rem, 1.2vw, 1.2rem);
  }

  #main-nav nav a {
    font-size: clamp(0.55rem, 0.7vw, 0.7rem);
    letter-spacing: 0.08em;
  }

  #main-nav nav button {
    font-size: clamp(0.55rem, 0.7vw, 0.7rem);
    padding: 0.3rem 0.6rem;
  }
}

/* =========================================================================
   11. MÀN HÌNH BÌA THIỆP CƯỚI (INVITATION COVER ENVELOPE)
   ========================================================================= */

/* --- Overlay toàn màn hình --- */
#wedding-cover {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  /* Nền hồng kem nhạt mộng mơ với gradient dịu dàng */
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 220, 210, 0.55) 0%, transparent 55%),
    radial-gradient(ellipse at 70% 80%, rgba(255, 200, 195, 0.45) 0%, transparent 55%),
    linear-gradient(160deg, #FFF5F0 0%, #FDE8E0 35%, #FAE0DC 65%, #FBE8E4 100%);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  /* Transition biến mất mượt mà */
  transition: opacity 0.85s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.85s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, transform;
}

/* Trạng thái khi đang đóng (fade-out + slide-up) */
#wedding-cover.is-closing {
  opacity: 0;
  transform: translateY(-30px) scale(0.97);
  pointer-events: none;
}

/* --- Hoa văn góc --- */
.cover-corner {
  position: absolute;
  width: 120px;
  height: 120px;
  pointer-events: none;
  opacity: 0.9;
}

.cover-corner-tl { top: 0;    left: 0; }
.cover-corner-tr { top: 0;    right: 0;   transform: scaleX(-1); }
.cover-corner-bl { bottom: 0; left: 0;    transform: scaleY(-1); }
.cover-corner-br { bottom: 0; right: 0;   transform: scale(-1); }

/* --- Nội dung trung tâm --- */
.cover-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 2rem 1.5rem;
  text-align: center;
  pointer-events: none;
}

/* --- Chữ Hỷ (囍) --- */
.cover-xi-char {
  font-size: clamp(2.8rem, 7vw, 4rem);
  color: #C0392B;
  line-height: 1;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 12px rgba(192, 57, 43, 0.3), 0 0 30px rgba(192, 57, 43, 0.15);
  animation: xiGlow 3s ease-in-out infinite;
}

@keyframes xiGlow {
  0%, 100% {
    text-shadow: 0 2px 12px rgba(192, 57, 43, 0.3), 0 0 30px rgba(192, 57, 43, 0.15);
    transform: scale(1);
  }
  50% {
    text-shadow: 0 2px 20px rgba(192, 57, 43, 0.55), 0 0 45px rgba(192, 57, 43, 0.3);
    transform: scale(1.05);
  }
}

/* --- THE WEDDING OF --- */
.cover-wedding-of {
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(0.55rem, 1.5vw, 0.72rem);
  letter-spacing: 0.35em;
  color: #A0766A;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
  font-weight: 600;
}

/* --- Tên cặp đôi --- */
.cover-couple-name {
  font-family: 'Great Vibes', cursive;
  font-size: clamp(2rem, 6.5vw, 3.6rem);
  color: #6B3A2A;
  line-height: 1.2;
  margin-bottom: 0.35rem;
  text-shadow: 0 2px 8px rgba(107, 58, 42, 0.12);
}

.cover-ampersand {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 0.7em;
  color: #C0392B;
}

/* --- Ngày cưới --- */
.cover-date {
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(0.6rem, 1.6vw, 0.75rem);
  letter-spacing: 0.22em;
  color: #A0766A;
  font-weight: 500;
  margin-bottom: 1.5rem;
}

/* --- Khu vực bao thư --- */
.cover-envelope-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  animation: envelopeBounce 3s ease-in-out infinite;
  pointer-events: auto;
}

@keyframes envelopeBounce {
  0%, 100% { transform: translateY(0px); }
  30%       { transform: translateY(-10px); }
  60%       { transform: translateY(-5px); }
}

/* --- Bao thư --- */
.cover-envelope {
  position: relative;
  width: clamp(160px, 40vw, 220px);
  height: clamp(112px, 28vw, 154px);
  filter: drop-shadow(0 10px 30px rgba(180, 100, 80, 0.25)) drop-shadow(0 4px 8px rgba(0,0,0,0.08));
  transition: filter 0.3s ease, transform 0.3s ease;
}

.cover-envelope-wrap:hover .cover-envelope {
  filter: drop-shadow(0 16px 40px rgba(180, 100, 80, 0.35)) drop-shadow(0 6px 12px rgba(0,0,0,0.1));
  transform: translateY(-3px);
}

/* Nắp bao thư hình tam giác phía trên */
.cover-envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 55%;
  background: linear-gradient(170deg, #F5BDB0 0%, #EFA499 50%, #E8918A 100%);
  clip-path: polygon(0% 0%, 100% 0%, 50% 85%);
  border-radius: 4px 4px 0 0;
  z-index: 2;
}

/* Thân bao thư chính */
.cover-envelope-body {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 78%;
  background: linear-gradient(180deg, #F9D0C8 0%, #F2B8AD 40%, #EDA89C 100%);
  border-radius: 2px 2px 8px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  /* Đường gấp bao thư bên trái & phải */
  overflow: hidden;
}

/* Hai đường gấp góc bao thư (giả bằng pseudo-elements) */
.cover-envelope-body::before,
.cover-envelope-body::after {
  content: '';
  position: absolute;
  bottom: 0;
  width: 55%;
  height: 100%;
  background: rgba(255,255,255,0.08);
}

.cover-envelope-body::before {
  left: 0;
  clip-path: polygon(0% 100%, 100% 100%, 0% 0%);
}

.cover-envelope-body::after {
  right: 0;
  clip-path: polygon(0% 100%, 100% 100%, 100% 0%);
}

/* --- Con dấu sáp (Wax Seal) --- */
.cover-wax-seal {
  position: relative;
  z-index: 10;
  width: clamp(54px, 13vw, 72px);
  height: clamp(54px, 13vw, 72px);
  border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #E8523A 0%, #C0392B 45%, #9B2D24 100%);
  box-shadow:
    0 0 0 3px rgba(192, 57, 43, 0.25),
    0 0 0 6px rgba(192, 57, 43, 0.12),
    0 4px 16px rgba(150, 40, 30, 0.45),
    inset 0 -3px 8px rgba(0,0,0,0.2),
    inset 0 2px 5px rgba(255,200,190,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: waxPulse 2.5s ease-in-out infinite;
  /* Nét răng cưa trang trí viền con dấu */
  outline: none;
}

/* Hiệu ứng viền con dấu dạng răng cưa */
.cover-wax-seal::before {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: transparent;
  border: 2.5px dashed rgba(192, 57, 43, 0.4);
  animation: waxRotate 8s linear infinite;
}

@keyframes waxRotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes waxPulse {
  0%, 100% {
    box-shadow:
      0 0 0 3px rgba(192, 57, 43, 0.25),
      0 0 0 6px rgba(192, 57, 43, 0.12),
      0 4px 16px rgba(150, 40, 30, 0.45),
      inset 0 -3px 8px rgba(0,0,0,0.2),
      inset 0 2px 5px rgba(255,200,190,0.3);
  }
  50% {
    box-shadow:
      0 0 0 5px rgba(192, 57, 43, 0.3),
      0 0 0 10px rgba(192, 57, 43, 0.1),
      0 6px 24px rgba(150, 40, 30, 0.55),
      inset 0 -3px 8px rgba(0,0,0,0.2),
      inset 0 2px 5px rgba(255,200,190,0.3);
  }
}

.cover-wax-inner {
  width: 75%;
  height: 75%;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 38%, #C0392B 0%, #9B2D24 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 180, 170, 0.2);
}

.cover-wax-text {
  font-family: 'Great Vibes', cursive;
  color: rgba(255, 240, 235, 0.92);
  font-size: clamp(0.75rem, 2.5vw, 1rem);
  font-weight: 400;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  line-height: 1;
}

/* --- Gợi ý chạm để mở --- */
.cover-tap-hint {
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(0.7rem, 2.2vw, 0.85rem);
  color: #8B4A3A;
  letter-spacing: 0.1em;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: tapBlink 1.8s ease-in-out infinite;
}

@keyframes tapBlink {
  0%, 100% { opacity: 1;    transform: scale(1); }
  50%       { opacity: 0.45; transform: scale(0.96); }
}

/* --- Responsive --- */
@media (max-width: 480px) {
  .cover-corner {
    width: 80px;
    height: 80px;
  }

  .cover-content {
    gap: 0;
    padding: 1.5rem 1rem;
  }
}
