/* ==========================================================================
   Buxoro SSB Portal — Purposeful Animations & Micro-interactions
   ========================================================================== */

/* 1. Page Transition (Fade-In) */
@keyframes pageFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body {
  animation: pageFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 2. Scroll Reveal Animations */
.scroll-reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger Delays for Grid Items */
.stagger-1 { transition-delay: 80ms; }
.stagger-2 { transition-delay: 160ms; }
.stagger-3 { transition-delay: 240ms; }
.stagger-4 { transition-delay: 320ms; }
.stagger-5 { transition-delay: 400ms; }
.stagger-6 { transition-delay: 480ms; }

/* 3. Micro-interactions: Buttons */
button:not(:disabled),
a.inline-flex,
.btn-interactive {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.2s ease,
              color 0.2s ease,
              border-color 0.2s ease;
}

button:not(:disabled):hover,
a.inline-flex:hover,
.btn-interactive:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -4px rgba(0, 92, 109, 0.18), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

button:not(:disabled):active,
a.inline-flex:active,
.btn-interactive:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 4. Micro-interactions: Interactive Cards */
.interactive-card {
  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.25s ease;
}

.interactive-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px -6px rgba(0, 92, 109, 0.12), 0 8px 12px -4px rgba(0, 0, 0, 0.06);
}

.interactive-card .material-symbols-outlined {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease;
}

.interactive-card:hover .material-symbols-outlined {
  transform: scale(1.12);
}

/* 5. Micro-interactions: Table Rows */
table tbody tr {
  transition: background-color 0.18s ease;
}

table tbody tr:hover {
  background-color: rgba(0, 92, 109, 0.04) !important;
}

/* 6. Numbers & Counters */
.counter-value {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  transition: color 0.3s ease;
}

/* 7. STRICT ACCESSIBILITY: prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  body {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .scroll-reveal,
  .scroll-reveal.revealed {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  button:hover,
  a:hover,
  .interactive-card:hover,
  table tbody tr:hover {
    transform: none !important;
    box-shadow: none !important;
  }

  .interactive-card:hover .material-symbols-outlined {
    transform: none !important;
  }
}


/* ==========================================================================
   Mobile Responsiveness & Overflow Protection
   ========================================================================== */
html {
  overflow-x: clip;
}
body {
  overflow-x: clip;
  overscroll-behavior: auto !important;
}

@media (max-width: 768px) {
  header.fixed {
    position: sticky !important;
  }
  
  main.pt-44 {
    padding-top: 1.5rem !important;
  }

  /* Ensure touch targets meet 44px minimum */
  button, 
  a.inline-flex, 
  input[type="text"], 
  input[type="tel"], 
  input[type="email"], 
  select {
    min-height: 44px;
  }

  /* Table horizontal scrolling smoothness */
  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  /* Ensure table does not collapse columns */
  .overflow-x-auto table {
    min-width: 540px;
  }

  /* Mobile typography and padding safety */
  .max-w-7xl {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
}
