/* ==========================================================================
   STUDYWIN SEASONAL THEMES ENGINE - FULL ANIMATIONS & 100% TRANSPARENCY
   Zero White Box, True Internal Element Animations, Bulletproof Video Guard
   ========================================================================== */

/* Fixed Corner Mascot Container */
#seasonal-corner-mascot {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 996;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transform-style: preserve-3d;
  perspective: 700px;
  transition: opacity 0.4s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  animation: mascotEntrance 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#seasonal-corner-mascot:hover {
  transform: scale(1.08) translateY(-4px);
}

/* Hide Mascot when Video Modal is Open or body has video-playing */
body.video-playing #seasonal-corner-mascot,
#video-player-modal.show ~ #seasonal-corner-mascot,
#seasonal-corner-mascot.mascot-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
  transform: scale(0.6) translateY(20px) !important;
}

@keyframes mascotEntrance {
  0% { opacity: 0; transform: scale(0.6) translateY(30px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* Mascot Graphic Wrapper */
.mascot-graphic-box {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center bottom;
}

#lottie-christmas-tree {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#lottie-christmas-tree svg {
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
  overflow: visible !important;
}

/* ==========================================================================
   1. 🇱🇰 SRI LANKA NATIONAL FLAG (FULL 3D SILK CLOTH WAVING ANIMATION)
   ========================================================================== */
.mascot-flag-box {
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.45));
}

.flag-cloth-waving {
  transform-origin: 32px 60px;
  animation: flagSilkWave 2.8s infinite ease-in-out;
}

@keyframes flagSilkWave {
  0%, 100% { transform: perspective(600px) rotateY(0deg) skewY(0deg); }
  25% { transform: perspective(600px) rotateY(-18deg) skewY(-2.5deg) scaleX(0.96); }
  50% { transform: perspective(600px) rotateY(4deg) skewY(1deg) scaleX(1); }
  75% { transform: perspective(600px) rotateY(16deg) skewY(2.5deg) scaleX(0.97); }
}

.flag-cloth-ripple {
  animation: flagRippleShimmer 2.8s infinite ease-in-out;
}

@keyframes flagRippleShimmer {
  0%, 100% { opacity: 0.15; transform: translateX(0); }
  50% { opacity: 0.35; transform: translateX(12px); }
}

/* ==========================================================================
   2. 🌕 VESAK & POSON LANTERNS (SWINGING LANTERNS, FLUTTERING TASSELS & MOON)
   ========================================================================== */
.mascot-vesak-box {
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.45)) drop-shadow(0 0 24px rgba(253, 224, 71, 0.4));
  animation: vesakDioramaSway 4.8s infinite ease-in-out;
}

@keyframes vesakDioramaSway {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* Lantern 1 (Blue) Pendulum Swing */
.vesak-lantern-left {
  transform-origin: 64px 44px;
  animation: lanternSwingLeft 3.6s infinite ease-in-out;
}

@keyframes lanternSwingLeft {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(5deg); }
  75% { transform: rotate(-5deg); }
}

/* Lantern 2 (Magenta) Pendulum Swing */
.vesak-lantern-right {
  transform-origin: 106px 44px;
  animation: lanternSwingRight 4.2s infinite ease-in-out;
}

@keyframes lanternSwingRight {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-5deg); }
  75% { transform: rotate(5deg); }
}

/* Flowing Paper Streamers / Tassels (රැලි) */
.vesak-tassels-left {
  transform-origin: 64px 84px;
  animation: tasselsFlutterLeft 2.4s infinite ease-in-out;
}

@keyframes tasselsFlutterLeft {
  0%, 100% { transform: rotate(0deg) skewX(0deg); }
  50% { transform: rotate(-8deg) skewX(-6deg); }
}

.vesak-tassels-right {
  transform-origin: 106px 84px;
  animation: tasselsFlutterRight 2.6s infinite ease-in-out;
}

@keyframes tasselsFlutterRight {
  0%, 100% { transform: rotate(0deg) skewX(0deg); }
  50% { transform: rotate(7deg) skewX(5deg); }
}

/* Candlelight Glow inside lanterns */
.vesak-candle-glow {
  animation: vesakGlowPulse 2.2s infinite alternate ease-in-out;
}

@keyframes vesakGlowPulse {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; filter: drop-shadow(0 0 8px #fef08a); }
}

/* Full Moon Aura */
.vesak-moon-aura {
  animation: moonPulse 3.5s infinite alternate ease-in-out;
}

@keyframes moonPulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.05); opacity: 1; filter: drop-shadow(0 0 16px rgba(250, 204, 21, 0.8)); }
}

/* ==========================================================================
   3. 🎄 CHRISTMAS TREE (PULSING STAR, TWINKLING LIGHTS, BEADED GARLANDS)
   ========================================================================== */
.mascot-christmas-box {
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.45)) drop-shadow(0 0 25px rgba(34, 197, 94, 0.35));
  animation: christmasTreeBob 3.8s infinite ease-in-out;
}

@keyframes christmasTreeBob {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-5px) scale(1.02); }
}

/* Star Ray Beams */
.xmas-star-rays {
  transform-origin: 75px 20px;
  animation: starRotatePulse 3s infinite alternate ease-in-out;
}

@keyframes starRotatePulse {
  0%, 100% { transform: scale(0.9) rotate(-4deg); opacity: 0.85; filter: drop-shadow(0 0 6px #facc15); }
  50% { transform: scale(1.15) rotate(4deg); opacity: 1; filter: drop-shadow(0 0 16px #fef08a) drop-shadow(0 0 28px #eab308); }
}

/* Fairy Lights Twinkling (Group A - Rubies & Gold) */
.xmas-light-a {
  animation: fairyTwinkleA 1.4s infinite alternate ease-in-out;
}

@keyframes fairyTwinkleA {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.2); filter: drop-shadow(0 0 8px #ef4444); }
}

/* Fairy Lights Twinkling (Group B - Emeralds & Sapphires) */
.xmas-light-b {
  animation: fairyTwinkleB 1.8s infinite alternate ease-in-out;
}

@keyframes fairyTwinkleB {
  0%, 100% { opacity: 1; transform: scale(1.2); filter: drop-shadow(0 0 8px #3b82f6); }
  50% { opacity: 0.35; transform: scale(0.85); }
}

/* ==========================================================================
   4. 🎃 HALLOWEEN (FLAPPING WINGS BAT, CANDLE FLICKER PUMPKIN, HAUNTED HOUSE)
   ========================================================================== */
.mascot-halloween-box {
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 25px rgba(249, 115, 22, 0.35));
  animation: dioramaSway 4.2s infinite ease-in-out;
}

@keyframes dioramaSway {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  35% { transform: translateY(-5px) rotate(-1.5deg); }
  70% { transform: translateY(-2px) rotate(1.2deg); }
}

.hw-bat-group {
  animation: batHoverFlight 3.2s infinite ease-in-out;
  transform-origin: center center;
}

@keyframes batHoverFlight {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(-5px, -7px) rotate(-3deg); }
}

.hw-bat-wing-left {
  transform-origin: 36px 25px;
  animation: batFlapLeft 0.8s infinite alternate ease-in-out;
}

.hw-bat-wing-right {
  transform-origin: 52px 25px;
  animation: batFlapRight 0.8s infinite alternate ease-in-out;
}

@keyframes batFlapLeft {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(24deg) translateY(-2px); }
}

@keyframes batFlapRight {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(-24deg) translateY(-2px); }
}

.hw-carved-glow {
  animation: pumpkinCandleFlicker 1.8s infinite alternate ease-in-out;
}

@keyframes pumpkinCandleFlicker {
  0%, 100% { fill: #fef08a; filter: drop-shadow(0 0 4px #f59e0b); }
  50% { fill: #ffffff; filter: drop-shadow(0 0 10px #fbbf24) drop-shadow(0 0 18px #ea580c); }
}

.hw-window-glow {
  animation: windowCandle 2.2s infinite alternate ease-in-out;
}

@keyframes windowCandle {
  0%, 100% { fill: #fde047; opacity: 0.88; filter: drop-shadow(0 0 4px #eab308); }
  50% { fill: #fffbeb; opacity: 1; filter: drop-shadow(0 0 10px #f59e0b) drop-shadow(0 0 20px #ea580c); }
}

/* ==========================================================================
   5. 🌾 SINHALA AVURUDU (TRADITIONAL BRASS OIL LAMP)
   ========================================================================== */
.mascot-avurudu-box {
  filter: drop-shadow(0 6px 16px rgba(245, 158, 11, 0.6)) drop-shadow(0 0 22px rgba(245, 158, 11, 0.4));
  animation: lampGlowSway 3.5s infinite ease-in-out;
}

@keyframes lampGlowSway {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.03); }
}

.lamp-flame-anim {
  transform-origin: center bottom;
  animation: flameFlickerCorner 0.18s infinite alternate ease-in-out;
}

@keyframes flameFlickerCorner {
  0% { transform: scale(0.92, 0.94) rotate(-2deg); }
  100% { transform: scale(1.08, 1.08) rotate(2deg); }
}

/* ==========================================================================
   ❄️ CHRISTMAS FULL-SCREEN FALLING SNOW EFFECT
   ========================================================================== */
#christmas-snow-stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 997;
  overflow: hidden;
  perspective: 1000px;
  opacity: 1;
  transition: opacity 0.4s ease;
}

/* CRITICAL: HIDE SNOW COMPLETELY DURING VIDEO PLAYBACK */
body.video-playing #christmas-snow-stage,
#video-player-modal.show ~ #christmas-snow-stage,
#christmas-snow-stage.snow-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  display: none !important;
}

.s3d-snowflake {
  position: absolute;
  pointer-events: none;
  color: #e0f2fe;
  text-shadow: 0 0 8px rgba(224, 242, 254, 0.9), 0 0 18px rgba(56, 189, 248, 0.6);
  animation: tumbleSnowfall 11s infinite linear;
  will-change: transform, opacity;
}

@keyframes tumbleSnowfall {
  0% {
    transform: translate3d(0, -10vh, 40px) rotate(0deg);
    opacity: 0;
  }
  12% {
    opacity: 0.95;
  }
  88% {
    opacity: 0.95;
  }
  100% {
    transform: translate3d(60px, 110vh, -40px) rotate(360deg);
    opacity: 0;
  }
}

/* ==========================================================================
   MINI DISMISS BUTTON (×)
   ========================================================================== */
.mascot-close-btn {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  font-size: 13px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: auto;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  z-index: 10;
}

#seasonal-corner-mascot:hover .mascot-close-btn {
  opacity: 1;
}

.mascot-close-btn:hover {
  background: #ef4444;
  transform: scale(1.15);
}

/* Responsive Placement */
@media (max-width: 768px) {
  #seasonal-corner-mascot {
    bottom: 84px;
    right: 14px;
    width: 110px;
    height: 110px;
  }
}
