/* ===========================
   EONMEDS Animation Library
   =========================== */

/* Root Variables for Animation Timing */
:root {
  --animation-fast: 150ms;
  --animation-normal: 300ms;
  --animation-slow: 500ms;
  --animation-very-slow: 800ms;
  --easing-default: cubic-bezier(0.4, 0, 0.2, 1);
  --easing-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --easing-smooth: cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* ===========================
   Global Transitions
   =========================== */

/* Smooth transitions for all interactive elements */
* {
  transition-property: none;
}

a, button, input, textarea, select, 
.btn, .nav-link, .dropdown-item, 
.card, .modal, .alert, .badge,
.list-group-item, .table-hover tbody tr {
  transition: all var(--animation-normal) var(--easing-default);
}

/* ===========================
   Page Load Animations
   =========================== */

/* Fade in animation for page content */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slide in from left */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide in from right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scale in animation */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Main content area animation */
.main-content, .content-wrapper, .container-fluid {
  animation: fadeIn var(--animation-slow) var(--easing-smooth) forwards;
}

/* Sidebar animation */
.sidebar {
  animation: slideInLeft var(--animation-normal) var(--easing-smooth) forwards;
}

/* Navbar animation */
.navbar {
  animation: slideInRight var(--animation-normal) var(--easing-smooth) forwards;
}

/* Cards and panels */
.card, .panel {
  animation: scaleIn var(--animation-normal) var(--easing-smooth) forwards;
  animation-delay: calc(var(--animation-fast) * var(--index, 0));
}

/* Stagger animation for list items */
.list-group-item, .table tbody tr, .analytics-card {
  animation: fadeIn var(--animation-normal) var(--easing-smooth) forwards;
  animation-delay: calc(50ms * var(--index, 0));
}

/* ===========================
   Hover Effects
   =========================== */

/* Buttons */
.btn {
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
  transform: translateY(0);
  transition-duration: var(--animation-fast);
}

/* Primary button special effect */
.btn-primary {
  background-image: linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.1) 50%);
  background-size: 250% 100%;
  background-position: 100% 0;
}

.btn-primary:hover {
  background-position: 0 0;
  transition-duration: var(--animation-slow);
}

/* Cards */
.card {
  transform: translateZ(0);
  transition: all var(--animation-normal) var(--easing-default);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* Links */
a:not(.btn) {
  position: relative;
  text-decoration: none;
}

a:not(.btn)::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: currentColor;
  transition: width var(--animation-normal) var(--easing-default);
}

a:not(.btn):hover::after {
  width: 100%;
}

/* Navigation items */
.nav-link {
  position: relative;
  overflow: hidden;
}

.nav-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left var(--animation-slow) var(--easing-default);
}

.nav-link:hover::before {
  left: 100%;
}

/* Sidebar items */
.sidebar-item {
  transition: all var(--animation-normal) var(--easing-default);
  border-left: 3px solid transparent;
}

.sidebar-item:hover {
  background-color: rgba(0, 123, 255, 0.1);
  border-left-color: #007bff;
  padding-left: 20px;
}

.sidebar-item.active {
  background-color: rgba(0, 123, 255, 0.15);
  border-left-color: #007bff;
}

/* ===========================
   Form Animations
   =========================== */

/* Input focus effects */
.form-control, .form-select {
  transition: all var(--animation-normal) var(--easing-default);
  border: 1px solid #ced4da;
}

.form-control:focus, .form-select:focus {
  transform: translateY(-1px);
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25), 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Floating labels */
.form-floating label {
  transition: all var(--animation-normal) var(--easing-default);
}

/* Checkbox and radio animations */
.form-check-input {
  transition: all var(--animation-fast) var(--easing-bounce);
}

.form-check-input:checked {
  transform: scale(1.1);
}

/* ===========================
   Modal Animations
   =========================== */

/* Modal backdrop */
.modal-backdrop {
  animation: fadeIn var(--animation-normal) var(--easing-default) forwards;
}

/* Modal dialog */
.modal.fade .modal-dialog {
  transform: scale(0.9) translateY(-50px);
  opacity: 0;
  transition: all var(--animation-normal) var(--easing-smooth);
}

.modal.show .modal-dialog {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* ===========================
   Dropdown Animations
   =========================== */

.dropdown-menu {
  display: block;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: all var(--animation-fast) var(--easing-default);
}

.dropdown-menu.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ===========================
   Loading Animations
   =========================== */

/* Spinner */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  animation: spin 1s linear infinite;
}

/* Pulse effect */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.pulse {
  animation: pulse 2s var(--easing-smooth) infinite;
}

/* Loading dots */
@keyframes loadingDots {
  0%, 80%, 100% {
    opacity: 0;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

.loading-dots span {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #007bff;
  margin: 0 2px;
  animation: loadingDots 1.4s infinite both;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

/* ===========================
   Table Animations
   =========================== */

/* Table row hover */
.table-hover tbody tr {
  transition: all var(--animation-fast) var(--easing-default);
}

.table-hover tbody tr:hover {
  background-color: rgba(0, 123, 255, 0.05);
  transform: scale(1.01);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ===========================
   Alert Animations
   =========================== */

/* Alert slide in */
.alert {
  animation: slideInRight var(--animation-normal) var(--easing-smooth) forwards;
}

.alert.alert-dismissible {
  transition: all var(--animation-normal) var(--easing-default);
}

.alert.fade-out {
  opacity: 0;
  transform: translateX(100%);
}

/* ===========================
   Badge Animations
   =========================== */

.badge {
  transition: all var(--animation-fast) var(--easing-bounce);
}

.badge:hover {
  transform: scale(1.1);
}

/* ===========================
   Progress Bar Animations
   =========================== */

.progress-bar {
  transition: width var(--animation-slow) var(--easing-smooth);
}

.progress-bar-animated {
  animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
  from {
    background-position: 1rem 0;
  }
  to {
    background-position: 0 0;
  }
}

/* ===========================
   Utility Classes
   =========================== */

/* Fade utilities */
.fade-in { animation: fadeIn var(--animation-normal) var(--easing-default) forwards; }
.fade-in-slow { animation: fadeIn var(--animation-slow) var(--easing-default) forwards; }
.fade-in-fast { animation: fadeIn var(--animation-fast) var(--easing-default) forwards; }

/* Slide utilities */
.slide-in-left { animation: slideInLeft var(--animation-normal) var(--easing-default) forwards; }
.slide-in-right { animation: slideInRight var(--animation-normal) var(--easing-default) forwards; }

/* Scale utilities */
.scale-in { animation: scaleIn var(--animation-normal) var(--easing-default) forwards; }

/* Hover scale */
.hover-scale { transition: transform var(--animation-fast) var(--easing-default); }
.hover-scale:hover { transform: scale(1.05); }

/* Hover lift */
.hover-lift { transition: transform var(--animation-fast) var(--easing-default); }
.hover-lift:hover { transform: translateY(-4px); }

/* No animation class */
.no-animation, .no-animation * {
  animation: none !important;
  transition: none !important;
}

/* ===========================
   Responsive Animations
   =========================== */

/* 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;
  }
}

/* Mobile optimizations */
@media (max-width: 768px) {
  /* Reduce animation complexity on mobile */
  .card:hover,
  .btn:hover,
  .table-hover tbody tr:hover {
    transform: none;
  }
  
  /* Faster animations on mobile */
  * {
    animation-duration: calc(var(--animation-duration, 300ms) * 0.8);
  }
} 