/* =========================================
   1. Custom Animations
   ========================================= */

@keyframes spin { 
  to { transform: rotate(360deg); } 
}
.animate-spin-slow { 
  animation: spin 3s linear infinite; 
}

@keyframes slideInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-slide-in { 
  animation: slideInUp 0.4s ease-out forwards; 
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.animate-fade-in { 
  animation: fadeIn 0.3s ease-out forwards; 
}

/* Toast Entry Animation */
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Pulse Animation for Skeleton Screens */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Skeleton Screens */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(203, 213, 225, 0.2) 0%,
    rgba(203, 213, 225, 0.4) 50%,
    rgba(203, 213, 225, 0.2) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.dark .skeleton {
  background: linear-gradient(
    90deg,
    rgba(51, 65, 85, 0.3) 0%,
    rgba(51, 65, 85, 0.6) 50%,
    rgba(51, 65, 85, 0.3) 100%
  );
  background-size: 200% 100%;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Loading Spinner */
.spinner {
  border: 3px solid rgba(99, 102, 241, 0.1);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* =========================================
   2. Custom Scrollbars (Sleek)
   ========================================= */

/* Base Width */
.custom-scrollbar::-webkit-scrollbar { 
  width: 6px; 
  height: 6px; 
}

/* Track (Transparent) */
.custom-scrollbar::-webkit-scrollbar-track { 
  background: transparent; 
}

/* Thumb (Light Mode) */
.custom-scrollbar::-webkit-scrollbar-thumb { 
  background: #cbd5e1; /* slate-300 */
  border-radius: 3px; 
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover { 
  background: #94a3b8; /* slate-400 */
}

/* Thumb (Dark Mode) */
.dark .custom-scrollbar::-webkit-scrollbar-thumb { 
  background: #334155; /* slate-700 */
}
.dark .custom-scrollbar::-webkit-scrollbar-thumb:hover { 
  background: #475569; /* slate-600 */
}

/* =========================================
   3. Theme Transitions
   ========================================= */

/* Ensures background/border changes are smooth when toggling Light/Dark */
body, div, nav, button, input, select, textarea, span {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 200ms;
}

/* =========================================
   4. Toast Notification System
   ========================================= */

/* Container: Sits on top but lets clicks pass through empty space */
#toast-container {
    pointer-events: none;
}

/* Individual Toast: Captures clicks and slides in */
.toast-item {
    pointer-events: auto;
    animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-left-width: 4px;
}

/* =========================================
   5. Loading Overlay
   ========================================= */

.loading-overlay {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.dark .loading-overlay {
    background: rgba(0, 0, 0, 0.7);
}

/* Error States */
.error-state {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}