/* Ticker animation for newly added items */
.ticker-enter {
  animation: slideDown 350ms ease-out both;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Sad rain cloud animation - foreground */
.sad-cloud {
  position: relative;
  height: 180px;
  will-change: transform;
  z-index: 10;
  margin-top: 20px;
}

.sad-cloud .container {
  width: 320px;
  height: 180px;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.sad-cloud #cloud {
  width: 220px;
  height: 80px;
  background: linear-gradient(to bottom, #94a3b8 5%, #64748b 100%);
  position: relative;
  margin: 30px auto 20px;
  border-radius: 60px;
  animation: sadFloat 3s ease-in-out infinite;
  will-change: transform;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.sad-cloud #cloud:before {
  content: '';
  position: absolute;
  z-index: 1;
  background: #94a3b8;
  border-radius: 50%;
  width: 100px;
  height: 100px;
  top: -50px;
  right: 28px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.sad-cloud .cloud-left {
  display: block;
  position: absolute;
  z-index: 1;
  background: #94a3b8;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  top: -28px;
  left: 26px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.sad-cloud .shadow {
  width: 220px;
  position: absolute;
  bottom: -75px;
  background: rgba(0, 0, 0, 0.15);
  z-index: 0;
  border-radius: 50%;
  box-shadow: 0 0 25px 8px rgba(0, 0, 0, 0.2);
  opacity: 0.4;
}

.sad-cloud .rain {
  position: absolute;
  height: 100px;
  width: 100%;
  top: 70px;
  z-index: 5;
}

.sad-cloud .drop {
  position: absolute;
  width: 3px;
  height: 16px;
  background: linear-gradient(to bottom, #60a5fa, #3b82f6);
  opacity: 0.7;
  border-radius: 2px;
  will-change: transform, opacity;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.sad-cloud .d1 { left: 25%; animation: sadRainDrop 1.2s linear 0s infinite; }
.sad-cloud .d2 { left: 40%; animation: sadRainDrop 1.3s linear 0.2s infinite; }
.sad-cloud .d3 { left: 55%; animation: sadRainDrop 1.1s linear 0.4s infinite; }
.sad-cloud .d4 { left: 70%; animation: sadRainDrop 1.2s linear 0.6s infinite; }
.sad-cloud .d5 { left: 30%; animation: sadRainDrop 1.25s linear 0.3s infinite; }
.sad-cloud .d6 { left: 60%; animation: sadRainDrop 1.15s linear 0.5s infinite; }
.sad-cloud .d7 { left: 45%; animation: sadRainDrop 1.28s linear 0.1s infinite; }
.sad-cloud .d8 { left: 65%; animation: sadRainDrop 1.22s linear 0.7s infinite; }

@keyframes sadRainDrop {
  0% {
    transform: translateY(0) scaleY(1);
    opacity: 0.7;
  }
  100% {
    transform: translateY(100px) scaleY(1.5);
    opacity: 0;
  }
}

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

/* Modal animation */
#createBeerModal:not(.hidden) {
  animation: fadeIn 200ms ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Donation section animations */
#donationSection:not(.hidden) {
  animation: slideUp 400ms ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stagger animation for celebration emojis */
@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.animate-bounce {
  animation: bounce 1s ease-in-out infinite;
}

/* Pulse animation for money emoji */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* Sad box entrance animation */
#sadBox:not(.hidden) {
  animation: sadBoxAppear 500ms ease-out;
}

@keyframes sadBoxAppear {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Happy box entrance animation */
#happyBox:not(.hidden) {
  animation: happyBoxAppear 500ms ease-out;
}

@keyframes happyBoxAppear {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Fullscreen sad rain overlay */
.rain-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  overflow: hidden;
}

.sad-drop {
  position: absolute;
  top: -30px;
  width: 3px;
  height: 20px;
  background: linear-gradient(to bottom, #94a3b8, #64748b); /* slate-400 -> slate-500 - darker */
  border-radius: 3px;
  opacity: 0.85;
  filter: drop-shadow(0 3px 4px rgba(71,85,105,0.5));
  animation-name: sadFall;
  animation-timing-function: ease-in;
  animation-fill-mode: forwards;
  will-change: transform;
  /* GPU acceleration */
  transform: translateZ(0);
}

/* Brief gray dim of the whole page */
.dim-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.28); /* slate-900 @ ~28% */
  z-index: 55; /* below rain */
  opacity: 0;
  transition: opacity 150ms ease;
  pointer-events: none;
}
.dim-overlay.show {
  opacity: 1;
}

@keyframes sadFall {
  0% {
    transform: translate3d(0, -20px, 0) scaleY(0.8);
    opacity: 0.95;
  }
  10% {
    transform: translate3d(calc(var(--drift, 0px) * 0.1), 10vh, 0) scaleY(1);
    opacity: 0.95;
  }
  80% {
    opacity: 0.7;
  }
  100% {
    transform: translate3d(var(--drift, 0px), 115vh, 0) scaleY(1.6);
    opacity: 0;
  }
}

/* Rain effect from CodePen https://codepen.io/K-T/pen/YVYvdW */
#jsi-rain-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    pointer-events: none;
}