:root {
  --be-bg: #ecefe8;
  --green: #7e9e7c;
  --dark-green: #657b63;
  --text-dark: #2f3a31;
  --text-light: #ffffff;
  --popup-bg: rgba(255,255,255,0.95);
}

[data-theme="dark"] {
  --be-bg: #2a2f2a;
  --green: #5a7d58;
  --dark-green: #4a6148;
  --text-dark: #e8efe8;
  --text-light: #ffffff;
  --popup-bg: rgba(42, 47, 42, 0.95);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Quicksand", sans-serif;
  background-color: var(--be-bg);
  color: var(--text-dark);
  transition: all 0.3s ease;
}

/* Loading Screen */
.loading-screen {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: var(--green); z-index: 9999; display: flex;
  flex-direction: column; align-items: center; justify-content: center; 
  color: white; font-size: 24px; transition: opacity 0.5s;
}
.loader {
  width: 50px; height: 50px; border: 5px solid rgba(255,255,255,0.3);
  border-top: 5px solid white; border-radius: 50%; animation: spin 1s linear infinite;
  margin-bottom: 20px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Progress Bar */
.progress-bar {
  position: fixed; top: 0; left: 0; height: 4px;
  background: linear-gradient(90deg, var(--green), var(--dark-green)); 
  z-index: 1000; width: 0%; transition: width 0.3s;
}

/* Header */
header {
  background-color: var(--dark-green);
  color: var(--text-light);
  text-align: center;
  padding: 20px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  position: relative;
  flex-wrap: wrap;
}

.logo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: var(--text-light);
  flex-shrink: 0;
  overflow: hidden;
}

.logo-content {
  width: 100%;
  height: 100%;
  background: #5a7d58;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
}

.header-content h1 {
  font-size: 26px;
  letter-spacing: 2px;
  margin: 0;
  color: var(--text-light);
}

.header-content p {
  font-size: 14px;
  color: var(--text-light);
  margin-top: 4px;
}

/* Theme Toggle */
.theme-toggle {
  position: absolute;
  right: 20px;
  top: 20px;
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.3s;
}
.theme-toggle:hover {
  transform: rotate(30deg);
  background: rgba(255,255,255,0.3);
}

/* Navigation */
nav {
  background-color: var(--be-bg);
  text-align: center;
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
nav button {
  background-color: var(--green);
  color: var(--text-light);
  border: none;
  padding: 12px 24px;
  margin: 0 6px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.3s ease;
  font-weight: 600;
}
nav button:hover {
  background-color: var(--dark-green);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
nav button.active {
  background-color: var(--dark-green);
  transform: translateY(-2px);
}

/* Sections */
section {
  display: none;
  max-width: 1000px;
  margin: 40px auto;
  padding: 30px;
  background: var(--popup-bg);
  border-radius: 20px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.08);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s ease;
}
section.active { 
  display: block; 
  opacity: 1;
  transform: translateY(0);
}

/* Section Titles */
.section-title {
  text-align: center;
  font-family: 'Fahkwang', sans-serif;
  color: var(--dark-green);
  margin-bottom: 40px;
  font-size: 32px;
}

/* Trang chủ */
.home {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 30px;
}
.home-text {
  flex: 1;
  font-size: 17px;
  line-height: 1.8;
}
.home-text h2 {
  font-family: "Fahkwang", sans-serif;
  color: var(--dark-green);
  margin-bottom: 20px;
  font-size: 28px;
}
.home-img {
  flex: 1;
  background: var(--be-bg);
  border: 2px solid var(--green);
  border-radius: 15px;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dark-green);
  font-size: 15px;
  overflow: hidden;
  transition: all 0.3s ease;
}
.home-img:hover {
  transform: scale(1.02);
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.class-message {
  margin-top: 20px;
  padding: 15px;
  background: var(--be-bg);
  border-radius: 10px;
  border-left: 4px solid var(--green);
}

.class-photo-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #7e9e7c, #657b63);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  text-align: center;
  padding: 20px;
}

/* Lời chúc - CHIA ĐỀU 2 BÊN */
.wish-section {
  text-align: center;
}

.gifts-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 40px;
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px;
}

.gifts-side {
  display: flex;
  flex-direction: column;
  gap: 30px;
  flex: 1;
}

.gifts-side.left {
  align-items: flex-end;
}

.gifts-side.right {
  align-items: flex-start;
}

.gift {
  width: 160px;
  height: 160px;
  background: linear-gradient(135deg, var(--green), var(--dark-green));
  border-radius: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 32px;
  cursor: pointer;
  position: relative;
  transition: all 0.4s ease;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}
.gift:hover { 
  transform: scale(1.15) rotate(8deg); 
  box-shadow: 0 15px 30px rgba(0,0,0,0.25);
}

.popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  background: var(--popup-bg);
  color: var(--text-dark);
  padding: 40px 50px;
  border-radius: 25px;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  box-shadow: 0 25px 60px rgba(0,0,0,0.4);
  opacity: 0;
  transition: 0.4s;
  z-index: 1000;
  max-width: 85%;
  line-height: 1.7;
  pointer-events: none;
  border: 3px solid var(--green);
  backdrop-filter: blur(10px);
}
.popup.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Kỷ niệm - ẢNH 16:9 VÀ FULLSCREEN */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 25px;
  margin-top: 30px;
}
.photo-item {
  position: relative;
  border-radius: 15px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.4s ease;
  aspect-ratio: 16/9;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.photo-item:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

/* Gradient placeholders */
.photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  text-align: center;
}

.gradient-1 { background: linear-gradient(135deg, #ff9a9e, #fad0c4); }
.gradient-2 { background: linear-gradient(135deg, #a1c4fd, #c2e9fb); }
.gradient-3 { background: linear-gradient(135deg, #ffecd2, #fcb69f); }
.gradient-4 { background: linear-gradient(135deg, #84fab0, #8fd3f4); }
.gradient-5 { background: linear-gradient(135deg, #d4fc79, #96e6a1); }
.gradient-6 { background: linear-gradient(135deg, #fad0c4, #ffd1ff); }

/* Fullscreen overlay */
.fullscreen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.fullscreen-overlay.active {
  display: flex;
  opacity: 1;
}

.fullscreen-image {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 10px;
  transform: scale(0.8);
  transition: transform 0.4s ease;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.fullscreen-overlay.active .fullscreen-image {
  transform: scale(1);
}

.close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  color: white;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.close-btn:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.1);
}

/* Hành trình - TIMELINE */
.timeline {
  position: relative;
  max-width: 900px;
  margin: 50px auto;
}
.timeline::after {
  content: '';
  position: absolute;
  width: 6px;
  background: linear-gradient(to bottom, var(--green), var(--dark-green));
  top: 0;
  bottom: 0;
  left: 50%;
  margin-left: -3px;
  border-radius: 3px;
}
.timeline-item {
  padding: 20px 40px;
  position: relative;
  width: 50%;
  box-sizing: border-box;
  margin-bottom: 40px;
}
.timeline-item:nth-child(odd) {
  left: 0;
}
.timeline-item:nth-child(even) {
  left: 50%;
}
.timeline-content {
  padding: 25px;
  background: var(--be-bg);
  border-radius: 20px;
  border: 2px solid var(--green);
  box-shadow: 0 5px 20px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}
.timeline-content:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}
.timeline-date {
  font-weight: bold;
  color: var(--dark-green);
  margin-bottom: 12px;
  font-size: 18px;
  font-family: 'Fahkwang', sans-serif;
}
.timeline-image {
  width: 100%;
  height: 180px;
  border-radius: 12px;
  margin-top: 15px;
  overflow: hidden;
  background: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
}

.timeline-photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  text-align: center;
}

/* QR Section */
.qr-section {
  text-align: center;
}
.flower-btn {
  background: linear-gradient(135deg, #ff9a9e, #fad0c4);
  border: none;
  border-radius: 50%;
  width: 80px;
  height: 80px;
  cursor: pointer;
  font-size: 32px;
  transition: all 0.4s ease;
  box-shadow: 0 8px 25px rgba(255,154,158,0.3);
  margin: 30px auto;
  display: block;
}
.flower-btn:hover {
  transform: scale(1.2) rotate(15deg);
  box-shadow: 0 15px 35px rgba(255,154,158,0.5);
}
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  margin-top: 20px;
}
.qr-code {
  width: 260px;
  height: 260px;
  background: #fff;
  border: 3px dashed var(--green);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dark-green);
  overflow: hidden;
  transition: all 0.3s ease;
}
.qr-code:hover {
  transform: scale(1.05);
  border-style: solid;
}

.qr-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, #7e9e7c, #657b63);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  text-align: center;
}

.flower-instruction {
  text-align: center;
  font-size: 16px;
  color: var(--dark-green);
  margin-bottom: 20px;
}

/* FAB */
.fab {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
  z-index: 100;
}
.fab:hover {
  transform: scale(1.1);
  background: var(--dark-green);
}

/* Icon hiệu ứng */
.icon {
  position: absolute;
  font-size: 28px;
  animation: fly 2.5s ease-out forwards;
  pointer-events: none;
  z-index: 5;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}
@keyframes fly {
  0% { transform: translate(0,0) scale(1); opacity: 1; }
  50% { opacity: 0.8; }
  100% { transform: translate(calc(var(--x) * 1px), calc(var(--y) * 1px)) scale(0.3); opacity: 0; }
}

/* Flower animation */
@keyframes floatUp {
  0% { transform: translateY(0) rotate(0deg) scale(0.8); opacity: 1; }
  50% { transform: translateY(-50px) rotate(180deg) scale(1.2); opacity: 0.8; }
  100% { transform: translateY(-150px) rotate(360deg) scale(0.5); opacity: 0; }
}

.big-flower {
  animation: floatUp 3s ease-in forwards;
  font-size: 40px;
  filter: drop-shadow(0 5px 10px rgba(0,0,0,0.2));
}

/* Typewriter effect */
.typewriter {
  border-right: 2px solid var(--green);
  animation: blink 1s infinite;
}
@keyframes blink {
  0%, 100% { border-color: transparent; }
  50% { border-color: var(--green); }
}

/* Responsive */
@media (max-width: 768px) {
  .home { flex-direction: column; }
  header { flex-direction: column; gap: 10px; }
  .theme-toggle { position: relative; right: 0; top: 0; margin-top: 10px; }
  .timeline::after { left: 31px; }
  .timeline-item { width: 100%; padding-left: 70px; padding-right: 25px; }
  .timeline-item:nth-child(even) { left: 0; }
  .gifts-container {
    flex-direction: column;
    gap: 20px;
  }
  .gifts-side {
    align-items: center !important;
    gap: 20px;
  }
  .gift { 
    width: 140px; 
    height: 140px; 
    font-size: 28px; 
  }
  .photo-gallery { grid-template-columns: 1fr; }
  .fullscreen-image { max-width: 95%; max-height: 80%; }
}