/* Animations for GratisDobbelSteen.nl */

/* Dice Roll Animation */
@keyframes diceRoll {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes diceBounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

/* Fade In Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slide In From Bottom */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Pulse Animation */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Shake Animation */
@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

/* Spin Animation */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Glow Animation */
@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(52, 152, 219, 0.8);
  }
}

/* Result Pop Animation */
@keyframes resultPop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Loading Dots */
@keyframes loadingDots {
  0%, 20% {
    content: '.';
  }
  40% {
    content: '..';
  }
  60%, 100% {
    content: '...';
  }
}

/* Progress Bar Fill */
@keyframes progressFill {
  from {
    width: 0%;
  }
  to {
    width: 100%;
  }
}

/* Button Press */
@keyframes buttonPress {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(1);
  }
}

/* Utility Classes */
.animate-fadeIn {
  animation: fadeIn 0.5s ease-out;
}

.animate-slideInUp {
  animation: slideInUp 0.5s ease-out;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-shake {
  animation: shake 0.5s ease-in-out;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.animate-glow {
  animation: glow 2s ease-in-out infinite;
}

.animate-resultPop {
  animation: resultPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Dice Specific Animations */
.dice-rolling {
  animation: diceRoll 0.5s ease-in-out, diceBounce 0.5s ease-in-out;
}

.dice-value {
  animation: resultPop 0.3s ease-out;
  animation-delay: calc(var(--index, 0) * 0.1s);
}

/* Loading State */
.loading::after {
  content: '...';
  animation: loadingDots 1.5s steps(3, end) infinite;
}

/* Button Animations */
.roll-btn:active:not(:disabled) {
  animation: buttonPress 0.2s ease-out;
}

.roll-btn.rolling {
  pointer-events: none;
  opacity: 0.7;
}

/* Modal Animations */
.modal-overlay {
  animation: fadeIn 0.3s ease-out;
}

.modal-content {
  animation: slideInUp 0.3s ease-out;
}

/* Cookie Banner Animation */
.cookie-banner {
  animation: slideInUp 0.5s ease-out;
}

/* Scene Button Hover Effects */
.scene-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--secondary-color);
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: var(--border-radius);
  z-index: -1;
}

.scene-btn:hover::before {
  opacity: 0.1;
}

/* Statistics Chart Animations */
.chart-box {
  animation: fadeIn 0.5s ease-out;
}

/* History Item Animation */
.history-item {
  animation: slideInUp 0.3s ease-out;
  animation-fill-mode: backwards;
}

.history-item:nth-child(n) {
  animation-delay: calc(var(--index, 0) * 0.05s);
}

/* Share Button Ripple Effect */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

.share-btn {
  position: relative;
  overflow: hidden;
}

.share-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
}

.share-btn:active::after {
  animation: ripple 0.6s ease-out;
}

/* QR Code Fade In */
.qr-display {
  animation: fadeIn 0.5s ease-out;
}

/* Stat Card Counter Animation */
@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat-card .big-number {
  animation: countUp 0.5s ease-out;
}

/* Toggle Switch Animation */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
  background: #ccc;
  border-radius: 12px;
  transition: background 0.3s ease;
}

.switch::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  top: 2px;
  left: 2px;
  transition: transform 0.3s ease;
}

input:checked + .switch {
  background: var(--success-color);
}

input:checked + .switch::after {
  transform: translateX(26px);
}

/* Disabled State Animation */
@keyframes disabledPulse {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 0.3;
  }
}

button:disabled,
.btn-disabled {
  animation: disabledPulse 2s ease-in-out infinite;
  cursor: not-allowed;
}

/* Success Flash */
@keyframes successFlash {
  0%, 100% {
    background: var(--success-color);
  }
  50% {
    background: var(--secondary-color);
  }
}

.success-flash {
  animation: successFlash 0.5s ease-in-out;
}

/* Error Shake */
.error-shake {
  animation: shake 0.5s ease-in-out;
}

/* Smooth Transitions */
* {
  transition-property: background-color, color, border-color, transform, opacity;
  transition-duration: 0.2s;
  transition-timing-function: ease;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
