/* =====================================================
   SHADCN SIDEBAR CSS VARIABLES
   ===================================================== */

:root {
  --sidebar-background: #ffffff;
  --sidebar-foreground: #1f2937;
  --sidebar-primary: #111827;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: #f3f4f6;
  --sidebar-accent-foreground: #111827;
  --sidebar-border: #e5e7eb;
  --sidebar-ring: #3b82f6;
}

.dark {
  --sidebar-background: #111827;
  --sidebar-foreground: #f9fafb;
  --sidebar-primary: #f9fafb;
  --sidebar-primary-foreground: #111827;
  --sidebar-accent: #1f2937;
  --sidebar-accent-foreground: #f9fafb;
  --sidebar-border: rgba(255, 255, 255, 0.1);
  --sidebar-ring: #6b7280;
}

/* =====================================================
   SIDEBAR ANIMATIONS
   ===================================================== */

@keyframes slideInFromLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideInFromTop {
  from {
    transform: translateY(-8px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* =====================================================
   SMOOTH SCROLLING & PERFORMANCE OPTIMIZATIONS
   Ultra-smooth scrolling for all devices
   ===================================================== */

/* Native smooth scrolling - works on all modern browsers */
html {
  scroll-behavior: smooth;
  /* Improve text rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Smooth scroll momentum on iOS */
html,
body {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: none;
}

/* GPU acceleration - but NOT for elements that need animation */
/* Removed the universal transform rule that was breaking animations */

/* Reset for smoother animations */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Performance optimizations for images */
img,
video {
  max-width: 100%;
  height: auto;
  /* Prevent layout shift */
  content-visibility: auto;
}

/* Optimize font loading - prevent FOUT/FOIT */
@font-face {
  font-display: swap;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =====================================================
   SPINNER ANIMATION
   ===================================================== */

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Custom spinner styles */
.spinner {
  animation: spin 0.8s linear infinite;
}

/* =====================================================
   SCROLLBAR STYLING
   ===================================================== */

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 22, 102, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 22, 102, 0.5);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 22, 102, 0.3) transparent;
}

/* =====================================================
   ANIMATION PERFORMANCE
   ===================================================== */

/* Use will-change sparingly for animated elements */
.animate-smooth {
  will-change: transform, opacity;
}

/* Ensure smooth transitions */
.smooth-transition {
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* =====================================================
   LOADING OPTIMIZATIONS
   ===================================================== */

/* Skeleton loading for images */
img:not([src]) {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

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

  100% {
    background-position: 200% 0;
  }
}

/* =====================================================
   TOUCH OPTIMIZATIONS
   ===================================================== */

/* Faster tap response on mobile */
a,
button,
[role="button"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Prevent text selection during gestures */
.no-select {
  -webkit-user-select: none;
  user-select: none;
}

/* =====================================================
   LAYOUT STABILITY
   ===================================================== */

/* Reserve space for common element heights */
section {
  contain: layout style;
}

/* Prevent CLS for fonts */
body {
  font-synthesis: none;
}