/* Smooth Animations for DPS Calendar */
/* Respects prefers-reduced-motion for accessibility */

/* Fade in animation for page load */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Slide in from bottom */
@keyframes slideInUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Slide in from top */
@keyframes slideInDown {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Scale up */
@keyframes scaleIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Bounce */
@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

/* Pulse */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Shimmer loading effect */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* Apply animations to elements */
body {
  animation: fadeIn 0.3s ease-in;
}

main {
  animation: slideInUp 0.4s ease-out;
}

/* Modals */
.modal.show {
  animation: fadeIn 0.2s ease-in;
}

.modal .dialog {
  animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Buttons */
button {
  transition: all 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

button:active {
  transform: translateY(0);
}

/* Calendar transitions */
#calendar {
  transition: opacity 0.3s ease;
}

#calendar.loading {
  opacity: 0.6;
  pointer-events: none;
}

.fc-event {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fc-event:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
  z-index: 10;
}

/* List view animations */
.list-event {
  animation: slideInUp 0.3s ease-out backwards;
  transition: all 0.2s ease;
}

.list-event:nth-child(1) { animation-delay: 0.05s; }
.list-event:nth-child(2) { animation-delay: 0.1s; }
.list-event:nth-child(3) { animation-delay: 0.15s; }
.list-event:nth-child(4) { animation-delay: 0.2s; }
.list-event:nth-child(5) { animation-delay: 0.25s; }

.list-event:hover {
  transform: translateX(5px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Form inputs */
input,
textarea,
select {
  transition: all 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
  transform: scale(1.01);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Alerts */
[role="alert"],
.alert {
  animation: slideInDown 0.4s ease-out;
}

/* Loading spinner */
.loading-spinner {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Skeleton loading for attachments */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 0%,
    var(--bg-tertiary) 50%,
    var(--bg-secondary) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

/* Smooth scroll */
html {
  scroll-behavior: smooth;
}

/* View transitions */
.view-transition-fade {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.view-transition-fade.active {
  opacity: 1;
}

/* Notification badge pulse */
.notification-badge {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Theme toggle rotation */
#theme-toggle {
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

#theme-toggle:active {
  transform: rotate(180deg) scale(0.95);
}

/* Attachment card animations */
.attachment-card {
  animation: slideInUp 0.3s ease-out;
  transition: all 0.2s ease;
}

.attachment-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Dropdown animations */
.dropdown-menu {
  animation: slideInDown 0.2s ease-out;
  transform-origin: top;
}

/* Toast notifications */
.toast {
  animation: slideInUp 0.4s ease-out;
}

.toast.removing {
  animation: slideInUp 0.3s ease-in reverse;
}

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  transition: outline-offset 0.1s ease;
}

/* Stagger children animations */
.stagger-children > * {
  animation: slideInUp 0.4s ease-out backwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }

/* 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;
    scroll-behavior: auto !important;
  }
  
  .fc-event:hover,
  .list-event:hover,
  button:hover {
    transform: none !important;
  }
}

/* Print - no animations */
@media print {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
