.card-hidden {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 900ms cubic-bezier(0.22, 1, 0.36, 1), transform 900ms cubic-bezier(0.22, 1, 0.36, 1);
}
.card-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 900ms cubic-bezier(0.22, 1, 0.36, 1), transform 900ms cubic-bezier(0.22, 1, 0.36, 1);
}
/* Smooth hover transitions untuk semua elemen */
.smooth-hover {
  transition: all 0.3s ease;
}
/* Loading screen styles */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}
.spinner {
  width: 60px;
  height: 60px;
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-top: 5px solid #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
/* Spinner kecil untuk tombol */
.btn-spinner {
  width: 18px;
  height: 18px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top: 3px solid #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  vertical-align: middle;
  display: inline-block;
  margin-right: 8px;
}
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
/* Tombol Lihat Lebih Banyak */
#load-more-btn {
  transition: all 0.3s ease;
}
.hidden-card {
  display: none;
}

/* Animasi untuk elemen saat scroll */
.scroll-animate {
  opacity: 0;
  transform: translateY(32px);
  transition: all 920ms cubic-bezier(0.22, 1, 0.36, 1);
}

.scroll-animate-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-animate-right {
  opacity: 0;
  transform: translateX(30px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-animate-zoom {
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-visible {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1);
  transition: opacity 920ms cubic-bezier(0.22, 1, 0.36, 1), transform 920ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Stagger delay untuk animasi bertahap */
.delay-100 {
  transition-delay: 100ms;
}
.delay-200 {
  transition-delay: 200ms;
}
.delay-300 {
  transition-delay: 300ms;
}
.delay-400 {
  transition-delay: 400ms;
}
.delay-500 {
  transition-delay: 500ms;
}

/* Animasi untuk judul halaman */
.title-animate {
  opacity: 0;
  transform: translateY(-20px) scale(0.95);
  transition: all 0.8s ease-out;
}

.title-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Animasi untuk tombol lihat lebih banyak */
.button-animate {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s ease-out;
}

.button-visible {
  opacity: 1;
  transform: translateY(0);
}
/* Collapse animation untuk menghilangkan kartu satu-per-satu */
.collapsed {
  opacity: 0;
  transform: translateY(10px) scale(0.99);
  pointer-events: none;
}

/* Transisi hanya untuk opacity/transform agar layout tidak berubah */
#card-container > .bg-white {
  transition: opacity 400ms ease, transform 400ms ease;
}
/* Image overlay and subtle shadow on reveal */
.img-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0px; /* will be set by JS to match image height */
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0));
  opacity: 0;
  transition: opacity 420ms ease;
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
}

#card-container > .bg-white img {
  transition: transform 900ms cubic-bezier(0.22, 1, 0.36, 1), filter 720ms ease, box-shadow 720ms ease;
  transform-origin: center center;
}

#card-container > .bg-white.scroll-visible img {
  transform: scale(1.02);
  filter: brightness(1.03);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
}

#card-container > .bg-white.scroll-visible .img-overlay {
  opacity: 1;
}
/* Card polish: smooth lift, stronger shadow on hover, rounded image tops preserved */
#card-container > .bg-white {
  will-change: transform, opacity;
  transition: transform 360ms cubic-bezier(0.2, 0.9, 0.3, 1), box-shadow 360ms cubic-bezier(0.2, 0.9, 0.3, 1);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

#card-container > .bg-white:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
}

/* Ensure images respect card rounding */
#card-container > .bg-white > img {
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
  display: block;
}
/* Footer styles */
.site-footer {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(6px);
}
.footer-icon {
  transition: filter 180ms cubic-bezier(0.22, 1, 0.36, 1), transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}
.footer-icon:hover {
  filter: saturate(1.4) brightness(1.1);
  transform: translateY(-3px);
}
/* Theme toggle button */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #ddd;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 300ms cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  z-index: 100;
}
.theme-toggle:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  transform: scale(1.08);
}
.theme-toggle i {
  font-size: 24px;
  color: #333;
  transition: transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Trophy button (to the left of theme toggle) */
.trophy-toggle {
  position: fixed;
  top: 20px;
  right: 100px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid #eee;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 260ms cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
  z-index: 100;
}
.trophy-toggle:hover {
  transform: scale(1.06);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.12);
}
.trophy-toggle i {
  font-size: 20px;
  color: #b8860b; /* golden-ish */
}

/* Trophy animation container */
#trophy-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 60;
}

.trophy {
  position: absolute;
  width: 40px;
  height: 40px;
  display: inline-block;
  transform-origin: center center;
  color: #f6c84c;
  will-change: transform, opacity;
  animation-name: trophy-float;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  animation-fill-mode: forwards;
}

@keyframes trophy-float {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg) scale(0.9) translateX(var(--dx, 0px));
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  100% {
    transform: translate3d(0, -120vh, 0) rotate(720deg) scale(1.05) translateX(var(--dx, 0px));
    opacity: 0;
  }
}
/* Dark mode styles */
body.dark-mode {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: #e0e0e0;
}
body.dark-mode .container {
  color: #e0e0e0;
}
body.dark-mode .bg-white {
  background-color: #2d2d44;
  border-color: #444;
}
body.dark-mode .text-gray-800 {
  color: #e0e0e0;
}
/* Ensure trophy icon is visible in dark mode */
body.dark-mode .trophy-toggle i {
  color: #ffd700;
}
body.dark-mode .text-gray-600 {
  color: #b0b0b0;
}
body.dark-mode .text-gray-500 {
  color: #999;
}
body.dark-mode .text-gray-700 {
  color: #c0c0c0;
}
body.dark-mode .border-gray-200 {
  border-color: #444;
}
body.dark-mode .site-footer {
  background: rgba(45, 45, 68, 0.9);
}
body.dark-mode .theme-toggle {
  background: rgba(45, 45, 68, 0.95);
  border-color: #555;
}
/* Make trophy button background dark in dark mode (was staying white) */
body.dark-mode .trophy-toggle {
  background: rgba(45, 45, 68, 0.95);
  border-color: #555;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}
body.dark-mode .trophy-toggle i {
  color: #ffd700; /* ensure trophy icon stays gold */
}
body.dark-mode .theme-toggle i {
  color: #ffd700;
}
body.dark-mode #loading-screen {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}
/* Icon contrast in dark mode */
body.dark-mode .text-pink-500 {
  color: #ff69b4;
}
body.dark-mode .text-black {
  color: #00f7ef;
}
body.dark-mode .text-red-700 {
  color: #ff4444;
}
body.dark-mode .text-red-600 {
  color: #ff6b6b;
}
body.dark-mode .text-gray-700 {
  color: #e8e8e8;
}
body.dark-mode .text-gray-800 {
  color: #ffffff;
}
/* TikTok icon styling */
.tiktok-icon {
  background: linear-gradient(135deg, #ff0050, #00f7ef);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
body.dark-mode .tiktok-icon {
  background: linear-gradient(135deg, #ff3366, #00f7ef);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Popup Ucapan Selamat (overrides & proper placement) */
#congrats-popup {
  transition: opacity 0.35s ease;
}
.popup-card {
  max-width: 820px;
  width: 90%;
  position: relative;
  overflow: visible;
}
.popup-card .close-x {
  line-height: 1;
}

/* simple bounce-in for popup (small local replacement for animate.css)
         keeps visuals without external dependency */
.popup-enter {
  animation: popupIn 450ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes popupIn {
  0% {
    transform: scale(0.92) translateY(10px);
    opacity: 0;
  }
  60% {
    transform: scale(1.02);
    opacity: 1;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* Fireworks (inside popup) */
#fireworks {
  position: relative;
  overflow: visible;
}
.firework {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: explode 1.1s ease-out forwards;
  will-change: transform, opacity;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}
@keyframes explode {
  0% {
    transform: translateY(0) scale(0.6);
    opacity: 1;
  }
  70% {
    opacity: 1;
  }
  100% {
    transform: translateY(-140px) scale(1.6);
    opacity: 0;
  }
}

/* Confetti falling across page (attached to #trophy-container) */
#trophy-container {
  pointer-events: none;
}
.confetti {
  position: absolute;
  width: 10px;
  height: 14px;
  opacity: 0.95;
  transform-origin: center;
  border-radius: 2px;
  animation: confettiFall var(--dur, 2000ms) linear forwards;
}
@keyframes confettiFall {
  0% {
    transform: translateY(-10vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0.95;
  }
}

/* small student list in popup */
#student-list {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
#student-list .student-badge {
  background: #f1f5f9;
  color: #0f172a;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.86rem;
}
/* In dark mode, make the popup 'blue' text readable (use white) */
body.dark-mode #congrats-popup .text-blue-600 {
  color: #ffffff !important;
}
/* popup badges (motivation labels) */
#popup-badges .badge {
  background: linear-gradient(90deg, #fff7ed, #fffbeb);
  color: #92400e;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.06);
  transform: translateY(0);
  transition: transform 0.35s ease;
}
#popup-badges .badge:hover {
  transform: translateY(-6px) rotate(-3deg);
}

/* Big trophy floating */
.trophy-big i {
  color: #f6c84c;
  animation: trophyFloat 2800ms ease-in-out infinite;
  text-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}
@keyframes trophyFloat {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px) rotate(-4deg);
  }
  100% {
    transform: translateY(0);
  }
}

/* emoji confetti (floating and popping) */
.emoji-confetti {
  position: absolute;
  font-size: 20px;
  pointer-events: none;
  animation: emojiRise 2400ms cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
}
@keyframes emojiRise {
  0% {
    transform: translateY(0) scale(0.9);
    opacity: 1;
  }
  70% {
    opacity: 1;
  }
  100% {
    transform: translateY(-160px) rotate(360deg) scale(1.2);
    opacity: 0;
  }
}

/* sparkler micro-particles in popup */
.spark {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  filter: blur(0.4px);
  opacity: 0.95;
  animation: sparkMove 700ms linear forwards;
}
@keyframes sparkMove {
  0% {
    transform: translateY(0) scale(0.6);
    opacity: 1;
  }
  100% {
    transform: translateY(-80px) translateX(40px) scale(1.1);
    opacity: 0;
  }
}

/* Responsive design for mobile */
@media (max-width: 768px) {
  /* Smaller popup card on mobile */
  .popup-card {
    max-width: 95%;
    width: 95%;
    padding: 20px;
  }

  /* Reduce popup trophy size on mobile */
  #popup-badges {
    height: 140px;
    margin-top: 8px;
  }
  #popup-badges .popup-trophy {
    font-size: 80px;
  }

  /* Smaller theme and trophy toggle buttons */
  .theme-toggle {
    width: 48px;
    height: 48px;
    top: 12px;
    right: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  }
  .theme-toggle i {
    font-size: 18px;
  }

  .trophy-toggle {
    width: 48px;
    height: 48px;
    top: 12px;
    right: 70px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  }
  .trophy-toggle i {
    font-size: 16px;
  }

  /* Adjust popup text sizes for mobile */
  #congrats-popup h2 {
    font-size: 26px;
    margin-bottom: 10px;
  }
  #congrats-popup .text-lg {
    font-size: 14px;
    margin-bottom: 8px;
  }
  #congrats-popup .text-md {
    font-size: 12px;
    margin-bottom: 10px;
  }

  /* Adjust fireworks area on mobile */
  #fireworks {
    height: 100px;
  }

  /* Reduce confetti size slightly on mobile */
  .confetti {
    width: 6px;
    height: 8px;
  }
}

@media (max-width: 480px) {
  /* Extra small devices */
  .popup-card {
    padding: 16px;
  }

  #popup-badges {
    height: 120px;
    margin-top: 6px;
  }
  #popup-badges .popup-trophy {
    font-size: 64px;
  }

  .theme-toggle {
    width: 44px;
    height: 44px;
    top: 10px;
    right: 10px;
  }
  .theme-toggle i {
    font-size: 16px;
  }

  .trophy-toggle {
    width: 44px;
    height: 44px;
    top: 10px;
    right: 62px;
  }
  .trophy-toggle i {
    font-size: 14px;
  }

  #congrats-popup h2 {
    font-size: 22px;
    margin-bottom: 8px;
  }
  #congrats-popup .text-lg {
    font-size: 13px;
    margin-bottom: 6px;
  }
  #congrats-popup .text-md {
    font-size: 11px;
    margin-bottom: 8px;
  }

  #fireworks {
    height: 80px;
  }

  /* Footer: show only icons on very small screens */
  .site-footer .container a span {
    display: none !important;
  }

  /* Reduce spacing between footer icons when labels hidden */
  .site-footer .container .flex.items-center.space-x-4 {
    gap: 8px;
  }
}
