/* =====================================================
   LEGEND OF THE CODE - SHARED ANIMATIONS & UI POLISH
   Shared CSS for all LotC ecosystem sites
   ===================================================== */

/* ============ LOADING ANIMATIONS ============ */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keytml>
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ============ UTILITY CLASSES ============ */
.animate-spin { animation: spin 1s linear infinite; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-bounce { animation: bounce 1s ease-in-out infinite; }
.animate-fade-in { animation: fadeIn 0.3s ease-out; }
.animate-fade-in-up { animation: fadeInUp 0.4s ease-out; }
.animate-fade-in-down { animation: fadeInDown 0.4s ease-out; }
.animate-slide-in-left { animation: slideInLeft 0.4s ease-out; }
.animate-slide-in-right { animation: slideInRight 0.4s ease-out; }
.animate-scale-in { animation: scaleIn 0.3s ease-out; }
.animate-shimmer { 
  background: linear-gradient(90deg, transparent 25%, rgba(255,255,255,0.1) 50%, transparent 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-shake { animation: shake 0.5s ease-in-out; }
.animate-heartbeat { animation: heartbeat 1s ease-in-out infinite; }

/* Staggered animations for lists */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }

/* ============ LOADING SPINNERS ============ */
.loader {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loader-sm { width: 20px; height: 20px; border-width: 2px; }
.loader-lg { width: 60px; height: 60px; border-width: 4px; }

.loader-dots {
  display: flex;
  gap: 8px;
}

.loader-dots span {
  width: 10px;
  height: 10px;
  background: currentColor;
  border-radius: 50%;
  animation: bounce 0.6s ease-in-out infinite;
}

.loader-dots span:nth-child(2) { animation-delay: 0.1s; }
.loader-dots span:nth-child(3) { animation-delay: 0.2s; }

/* ============ SKELETON LOADING ============ */
.skeleton {
  background: linear-gradient(90deg, 
    rgba(255,255,255,0.05) 25%, 
    rgba(255,255,255,0.1) 50%, 
    rgba(255,255,255,0.05) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

.skeleton-text { height: 1em; margin-bottom: 0.5em; }
.skeleton-title { height: 1.5em; width: 60%; margin-bottom: 1em; }
.skeleton-avatar { width: 48px; height: 48px; border-radius: 50%; }
.skeleton-card { height: 200px; border-radius: 12px; }
.skeleton-btn { height: 44px; width: 120px; border-radius: 8px; }

/* Light mode skeletons */
.skeleton-light {
  background: linear-gradient(90deg, 
    rgba(0,0,0,0.05) 25%, 
    rgba(0,0,0,0.1) 50%, 
    rgba(0,0,0,0.05) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ============ BUTTON STATES ============ */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ============ MICRO-INTERACTIONS ============ */
.hover-lift {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.hover-scale {
  transition: transform 0.2s ease;
}

.hover-scale:hover {
  transform: scale(1.05);
}

.hover-glow {
  transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 30px rgba(255,255,255,0.1);
}

.click-shrink:active {
  transform: scale(0.95);
}

/* Card hover effects */
.card-interactive {
  transition: all 0.3s ease;
}

.card-interactive:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

/* Link underline animation */
.link-underline {
  position: relative;
}

.link-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: currentColor;
  transition: width 0.3s ease;
}

.link-underline:hover::after {
  width: 100%;
}

/* ============ TOAST NOTIFICATIONS ============ */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  animation: slideInRight 0.3s ease-out;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
}

.toast-success { background: #10b981; color: white; }
.toast-error { background: #ef4444; color: white; }
.toast-warning { background: #f59e0b; color: white; }
.toast-info { background: #3b82f6; color: white; }

.toast-exit {
  animation: slideInRight 0.3s ease-out reverse forwards;
}

/* ============ MODAL ANIMATIONS ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease-out;
  z-index: 9998;
}

.modal-content {
  animation: scaleIn 0.3s ease-out;
}

/* ============ PROGRESS BARS ============ */
.progress-bar {
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease-out;
}

.progress-bar-animated .progress-bar-fill {
  background: linear-gradient(90deg, 
    currentColor 0%, 
    rgba(255,255,255,0.5) 50%, 
    currentColor 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

/* ============ COUNTER ANIMATIONS ============ */
.counter {
  display: inline-block;
  transition: transform 0.2s ease;
}

.counter-bump {
  animation: heartbeat 0.3s ease-out;
}

/* ============ SCROLL ANIMATIONS ============ */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease-out;
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ============ RESPONSIVE UTILITIES ============ */
@media (max-width: 768px) {
  .mobile-full { width: 100% !important; }
  .mobile-stack { flex-direction: column !important; }
  .mobile-center { text-align: center !important; }
  .mobile-hide { display: none !important; }
}

@media (min-width: 769px) {
  .desktop-hide { display: none !important; }
}

/* ============ ACCESSIBILITY ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus visible for keyboard navigation */
.focus-ring:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* ============ SCROLL BEHAVIOR ============ */
html {
  scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.1);
}

::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.3);
}

/* Light mode scrollbar */
.light-scrollbar::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.05);
}

.light-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.2);
}
