/* animations.css - Animation effects for Positive Affirmations App */

/* Fade in animation for affirmation cards */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.affirmation-card {
  animation: fadeIn 0.6s ease-out;
}

/* Gentle pulse animation for the daily affirmation */
@keyframes gentlePulse {
  0% {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  }
  50% {
    box-shadow: 0 6px 15px rgba(74, 144, 226, 0.3);
  }
  100% {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  }
}

.affirmation-card.featured {
  animation: gentlePulse 3s infinite;
}

/* Floating animation for buttons on hover */
@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-5px);
  }
  100% {
    transform: translateY(0px);
  }
}

button:hover {
  animation: float 2s ease-in-out infinite;
}

/* Highlight text animation for sharing */
@keyframes highlightText {
  0% {
    background-position: -100% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.btn-share:hover {
  background-image: linear-gradient(90deg, var(--secondary-color) 0%, #7ed67e 50%, var(--secondary-color) 100%);
  background-size: 200% 100%;
  animation: highlightText 2s infinite;
}

/* Staggered appearance for category cards */
.category-card {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeIn 0.5s ease-out forwards;
}

.category-grid .category-card:nth-child(1) { animation-delay: 0.1s; }
.category-grid .category-card:nth-child(2) { animation-delay: 0.2s; }
.category-grid .category-card:nth-child(3) { animation-delay: 0.3s; }
.category-grid .category-card:nth-child(4) { animation-delay: 0.4s; }
.category-grid .category-card:nth-child(5) { animation-delay: 0.5s; }
.category-grid .category-card:nth-child(6) { animation-delay: 0.6s; }

/* Subtle background animation */
@keyframes gradientMove {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

body {
  background: linear-gradient(120deg, #f9f9f9, #f0f8ff, #f5f5f5);
  background-size: 400% 400%;
  animation: gradientMove 15s ease infinite;
}

/* Heart beat animation for favorite button */
@keyframes heartBeat {
  0% {
    transform: scale(1);
  }
  14% {
    transform: scale(1.1);
  }
  28% {
    transform: scale(1);
  }
  42% {
    transform: scale(1.1);
  }
  70% {
    transform: scale(1);
  }
}

.btn-favorite:active {
  animation: heartBeat 1s;
}

/* Loading state animation */
@keyframes loadingDots {
  0% {
    content: ".";
  }
  33% {
    content: "..";
  }
  66% {
    content: "...";
  }
}

.loading-text::after {
  content: ".";
  animation: loadingDots 1.5s infinite;
}

/* Add shimmer effect to daily affirmation title */
@keyframes shimmer {
  0% {
    background-position: -100% 0;
  }
  100% {
    background-position: 100% 0;
  }
}

.daily-affirmation h2 {
  background: linear-gradient(90deg, var(--primary-color), #8ab4ec, var(--primary-color));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 3s infinite;
}

/* Navigation link indicator animation */
@keyframes navIndicator {
  0% {
    width: 0;
  }
  100% {
    width: 100%;
  }
}

nav a.active::after {
  content: '';
  display: block;
  height: 2px;
  background-color: var(--primary-color);
  margin-top: 3px;
  animation: navIndicator 0.3s forwards;
}

/* Page transition animation */
@keyframes pageTransition {
  0% {
    opacity: 0;
    transform: translateX(20px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

#main-content > div {
  animation: pageTransition 0.4s ease-out;
}

/* Button press effect */
button:active {
  transform: scale(0.95);
}

/* Notification slide-in animation */
@keyframes notificationSlideIn {
  0% {
    transform: translateX(-50%) translateY(100px);
    opacity: 0;
  }
  100% {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

.notification.show {
  animation: notificationSlideIn 0.3s forwards;
}

/* Card hover glow effect */
.affirmation-card:hover {
  box-shadow: 0 6px 20px rgba(74, 144, 226, 0.25);
}

/* Category card grow effect */
.category-card:hover {
  transform: scale(1.03) translateY(-5px);
}

/* Responsive animations */
@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;
  }
  
  body {
    animation: none;
  }
}

/* Bounce animation for the random button */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

.btn-random {
  animation: bounce 3s infinite;
  animation-delay: 3s;
}

/* Subtle rotation for favorite toggle */
@keyframes subtleRotate {
  0% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(5deg);
  }
  75% {
    transform: rotate(-5deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

.btn-favorite:hover {
  animation: subtleRotate 0.5s ease-in-out;
}
/* Reminder card animations */
.reminder-card {
  animation: fadeIn 0.5s ease-out;
}

/* Staggered appearance for reminders */
.reminders-list .reminder-card:nth-child(1) { animation-delay: 0.1s; }
.reminders-list .reminder-card:nth-child(2) { animation-delay: 0.2s; }
.reminders-list .reminder-card:nth-child(3) { animation-delay: 0.3s; }
.reminders-list .reminder-card:nth-child(4) { animation-delay: 0.4s; }
.reminders-list .reminder-card:nth-child(5) { animation-delay: 0.5s; }

/* Toggle switch animation */
@keyframes toggleOn {
  0% { background-color: #ccc; }
  100% { background-color: var(--secondary-color); }
}

@keyframes toggleOff {
  0% { background-color: var(--secondary-color); }
  100% { background-color: #ccc; }
}

input:checked + .toggle-slider {
  animation: toggleOn 0.3s forwards;
}

input:not(:checked) + .toggle-slider {
  animation: toggleOff 0.3s forwards;
}

/* Slide in animation for edit form */
@keyframes slideDown {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.reminder-edit-form {
  animation: slideDown 0.3s ease-out;
}

/* Bell notification animation for reminders button */
@keyframes bellRing {
  0%, 100% {
    transform: rotate(0);
  }
  10%, 30%, 50%, 70% {
    transform: rotate(10deg);
  }
  20%, 40%, 60%, 80% {
    transform: rotate(-10deg);
  }
}

nav a[href="#reminders"]:hover::before {
  content: '🔔';
  display: inline-block;
  margin-right: 5px;
  animation: bellRing 0.8s ease-in-out;
}