/* ==============================================================================
   LINKZMINT DESIGN SYSTEM & GLOBAL ANIMATION ENGINE
   Primary Green: #16a34a / #15803d | Accent: #22c55e | Background: #ffffff / #f0fdf4
   ============================================================================== */

:root {
  --color-primary: #16a34a;
  --color-primary-dark: #15803d;
  --color-primary-light: #22c55e;
  --color-primary-bg: #f0fdf4;
  --color-border: #e2e8f0;
  --color-text-main: #0f172a;
  --color-text-muted: #64748b;
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html {
  scroll-behavior: smooth;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--color-text-main);
  background-color: #ffffff;
  overflow-x: hidden;
}

/* ==============================================================================
   1. UNIVERSAL PAGE ENTRANCE & CONTAINER ANIMATIONS
   ============================================================================== */
main,
.page-container,
.animate-page-enter {
  animation: pageFadeInUp 0.38s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes pageFadeInUp {
  0% {
    opacity: 0;
    transform: translateY(12px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Glassmorphism & Sticky Nav */
.glass-nav {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.7);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(22, 163, 74, 0.12);
  box-shadow: 0 10px 30px -5px rgba(22, 163, 74, 0.08);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.2s ease;
}

.glass-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 36px -8px rgba(22, 163, 74, 0.14);
}

/* Hero Parallax Floating Cards & Shapes */
.floating-card {
  transition: transform 0.25s ease-out;
  will-change: transform;
}

.parallax-bg-shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
}

.shape-green {
  background: radial-gradient(circle, #22c55e 0%, rgba(22, 163, 74, 0) 70%);
}

.shape-emerald {
  background: radial-gradient(circle, #10b981 0%, rgba(16, 185, 129, 0) 70%);
}

/* ==============================================================================
   2. KEYFRAME ANIMATION SUITE
   ============================================================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes popIn {
  0% { opacity: 0; transform: scale(0.85); }
  70% { transform: scale(1.03); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes floatSlow {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(1.2deg); }
}

@keyframes floatGentle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(34, 197, 94, 0);
  }
}

@keyframes pulseSubtle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.92; transform: scale(1.02); }
}

@keyframes pulseBadge {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.88; }
}

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

@keyframes gradientFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes toastSlideIn {
  0% { transform: translateX(110%); opacity: 0; }
  70% { transform: translateX(-6px); opacity: 1; }
  100% { transform: translateX(0); opacity: 1; }
}

@keyframes modalPopIn {
  0% { opacity: 0; transform: scale(0.92) translateY(14px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes bounceSoft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Utility Animation Classes */
.animate-fade-in { animation: fadeIn 0.4s ease forwards; }
.animate-fade-in-up { animation: fadeInUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.animate-fade-in-down { animation: fadeInDown 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.animate-fade-in-left { animation: fadeInLeft 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.animate-fade-in-right { animation: fadeInRight 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.animate-scale-in { animation: scaleIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.animate-pop-in { animation: popIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.animate-float { animation: floatSlow 6s ease-in-out infinite; }
.animate-float-gentle { animation: floatGentle 4s ease-in-out infinite; }
.animate-float-delayed { animation: floatSlow 7s ease-in-out 2s infinite; }
.animate-pulse-glow { animation: pulseGlow 2.5s infinite; }
.animate-bounce-soft { animation: bounceSoft 2s ease-in-out infinite; }
.animate-spin-slow { animation: spinSlow 14s linear infinite; }

/* ==============================================================================
   3. UNIVERSAL INTERACTIVE MICRO-INTERACTIONS & CARD ELEVATION
   ============================================================================== */
.card-hover,
.hover-lift {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.2s ease !important;
}

.card-hover:hover,
.hover-lift:hover {
  transform: translateY(-4px) !important;
  box-shadow: 0 16px 32px -8px rgba(15, 23, 42, 0.12),
              0 4px 12px -2px rgba(22, 163, 74, 0.08) !important;
}

/* Interactive subtle lift on dashboard cards, stat cards, articles */
.dashboard-card,
article.group,
.stat-card {
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.2s ease;
}

.dashboard-card:hover,
article.group:hover,
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px -6px rgba(15, 23, 42, 0.09);
}

/* Button Micro-Interactions */
button,
a.btn,
input[type="submit"],
.btn-interactive {
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.18s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.2s ease,
              border-color 0.2s ease;
}

button:active,
input[type="submit"]:active,
a.btn:active {
  transform: scale(0.97) !important;
}

.btn-glow {
  box-shadow: 0 4px 14px 0 rgba(22, 163, 74, 0.35);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-glow:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px 0 rgba(22, 163, 74, 0.45);
}

.btn-pulse {
  animation: pulseGlow 3s infinite;
}

/* Form Inputs Micro-Interactions */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
select,
textarea {
  transition: border-color 0.2s ease,
              box-shadow 0.2s ease,
              transform 0.15s ease,
              background-color 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  transform: translateY(-1px);
}

/* Pulsing Badges and Status Dots */
.pulse-badge,
.badge-pulse {
  animation: pulseBadge 2.2s ease-in-out infinite;
}

.pulse-dot {
  position: relative;
}

.pulse-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 9999px;
  background-color: inherit;
  opacity: 0.5;
  animation: pulseBadge 2s ease-in-out infinite;
  z-index: -1;
}

/* Shimmer Wave Effect */
.animate-shimmer {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.35) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  animation: shimmerSweep 2.4s infinite;
}

/* Table Row Smooth Interaction */
tbody tr {
  transition: background-color 0.18s ease, transform 0.18s ease;
}

tbody tr:hover {
  background-color: rgba(240, 253, 244, 0.5);
}

/* Toast and Modal Animations */
.toast-enter {
  animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-enter {
  animation: modalPopIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Reading Progress Bar */
#reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #16a34a, #22c55e, #10b981);
  z-index: 9999;
  width: 0%;
  transition: width 0.1s ease-out;
}

/* ==============================================================================
   4. UNIVERSAL SCROLL-REVEAL SYSTEM (AOS-COMPATIBLE)
   ============================================================================== */
.scroll-reveal,
[data-aos] {
  opacity: 0;
  transform: translate3d(0, 24px, 0);
  transition: opacity 0.55s ease,
              transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}

[data-aos="fade-down"] {
  transform: translate3d(0, -24px, 0);
}

[data-aos="fade-left"] {
  transform: translate3d(-24px, 0, 0);
}

[data-aos="fade-right"] {
  transform: translate3d(24px, 0, 0);
}

[data-aos="zoom-in"] {
  transform: scale(0.92);
}

.scroll-reveal.is-visible,
[data-aos].is-visible {
  opacity: 1 !important;
  transform: translate3d(0, 0, 0) scale(1) !important;
}

/* Stagger Delays */
.stagger-1 { animation-delay: 50ms !important; transition-delay: 50ms !important; }
.stagger-2 { animation-delay: 100ms !important; transition-delay: 100ms !important; }
.stagger-3 { animation-delay: 150ms !important; transition-delay: 150ms !important; }
.stagger-4 { animation-delay: 200ms !important; transition-delay: 200ms !important; }
.stagger-5 { animation-delay: 250ms !important; transition-delay: 250ms !important; }
.stagger-6 { animation-delay: 300ms !important; transition-delay: 300ms !important; }
.stagger-7 { animation-delay: 350ms !important; transition-delay: 350ms !important; }
.stagger-8 { animation-delay: 400ms !important; transition-delay: 400ms !important; }

/* Grid Auto Stagger */
.stagger-children > *:nth-child(1) { animation-delay: 40ms; transition-delay: 40ms; }
.stagger-children > *:nth-child(2) { animation-delay: 80ms; transition-delay: 80ms; }
.stagger-children > *:nth-child(3) { animation-delay: 120ms; transition-delay: 120ms; }
.stagger-children > *:nth-child(4) { animation-delay: 160ms; transition-delay: 160ms; }
.stagger-children > *:nth-child(5) { animation-delay: 200ms; transition-delay: 200ms; }
.stagger-children > *:nth-child(6) { animation-delay: 240ms; transition-delay: 240ms; }
.stagger-children > *:nth-child(7) { animation-delay: 280ms; transition-delay: 280ms; }
.stagger-children > *:nth-child(8) { animation-delay: 320ms; transition-delay: 320ms; }

/* Click Ripple Wave */
.ripple-target {
  position: relative;
  overflow: hidden;
}

.ripple-wave {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  transform: scale(0);
  animation: rippleAnimation 0.55s ease-out;
  pointer-events: none;
}

@keyframes rippleAnimation {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ==============================================================================
   5. MOBILE SIDEBAR DRAWER GUARANTEE & MULTI-DEVICE RESPONSIVENESS
   ============================================================================== */
@media (max-width: 1023px) {
  #dashboard-sidebar {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 18rem !important;
    max-width: 85vw !important;
    z-index: 50 !important;
    background-color: #ffffff !important;
    transform: translateX(-100%) !important;
    -webkit-transform: translateX(-100%) !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease !important;
    visibility: hidden !important;
    pointer-events: none !important;
    box-shadow: none !important;
  }

  #dashboard-sidebar.sidebar-open,
  #dashboard-sidebar[data-open="true"] {
    transform: translateX(0) !important;
    -webkit-transform: translateX(0) !important;
    visibility: visible !important;
    pointer-events: auto !important;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35) !important;
  }

  #sidebar-overlay {
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }
}

@media (min-width: 1024px) {
  #dashboard-sidebar {
    transform: translateX(0) !important;
    -webkit-transform: translateX(0) !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }
}

/* Touch manipulation & responsiveness */
button, a, input, select, textarea {
  touch-action: manipulation;
}

/* Responsive Table Wrapper with iOS inertial scrolling */
.table-responsive,
.overflow-x-auto {
  -webkit-overflow-scrolling: touch;
}

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

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ==============================================================================
   6. ACCESSIBILITY: RESPECT REDUCED MOTION
   ============================================================================== */
@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;
  }
  .scroll-reveal, [data-aos] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .floating-card, .animate-float, .animate-float-delayed, .btn-pulse, .animate-shimmer {
    transform: none !important;
    animation: none !important;
  }
}
