/**
 * NAVOMAT ANIMATIONS AND TRANSITIONS
 * ===================================
 *
 * External CSS for animations previously defined inline
 * Following HTMX + DaisyUI architecture standards
 *
 * SECTIONS:
 * - HTMX indicator animations
 * - Toast notification animations
 * - Progress bar styling
 */

/* ========================================
   HTMX INDICATOR ANIMATIONS
   ======================================== */

/**
 * HTMX loading indicators - hidden by default
 * Shown during HTMX requests using .htmx-request class
 */
.htmx-indicator {
  opacity: 0;
}

.htmx-request .htmx-indicator {
  opacity: 1;
  transition: opacity 200ms ease-in;
}

.htmx-request.htmx-indicator {
  opacity: 1;
  transition: opacity 200ms ease-in;
}

/* ========================================
   TOAST NOTIFICATION ANIMATIONS
   ======================================== */

/**
 * Toast enter animation - slides in from right
 */
.toast-enter {
  transform: translateX(100%);
  opacity: 0;
  transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

/**
 * Toast show state - fully visible
 */
.toast-show {
  transform: translateX(0);
  opacity: 1;
}

/**
 * Toast exit animation - slides out to right
 */
.toast-exit {
  transform: translateX(100%);
  opacity: 0;
  transition: transform 0.2s ease-in, opacity 0.2s ease-in;
}

/* ========================================
   TOAST PROGRESS BAR STYLING
   ======================================== */

/**
 * Progress bar for toast auto-dismiss countdown
 * Uses currentColor to match alert type color
 */
.progress-bar {
  background-color: currentColor;
  opacity: 0.3;
}

/* ========================================
   VACANCY DETAIL PANEL ANIMATIONS
   ======================================== */

/**
 * Smooth fade-in transitions for research container
 */
.research-container-enter {
  animation: fadeInDown 0.5s ease-out forwards;
}

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

/**
 * Button state transitions
 */
.btn {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

/**
 * Icon animations for loading states
 */
.icon-scale-out {
  animation: scaleOut 0.3s ease-in forwards;
}

.icon-scale-in {
  animation: scaleIn 0.3s ease-out forwards;
}

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

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

/**
 * Success pulse animation
 */
.success-pulse {
  animation: successPulse 0.6s ease-out forwards;
}

@keyframes successPulse {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/**
 * Smooth collapse animations
 */
.collapse-content {
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 1000px;
  }
}

/**
 * Card entrance animations
 */
.card {
  animation: cardFadeIn 0.3s ease-out;
}

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

/**
 * Progress bar animation
 */
.progress {
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/**
 * Skeleton loading pulse
 */
.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/**
 * Alert shake animation for errors
 */
.alert-shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

/**
 * Badge entrance animations
 */
.badge {
  animation: badgeSlideIn 0.3s ease-out;
}

@keyframes badgeSlideIn {
  from {
    opacity: 0;
    transform: scaleX(0);
  }
  to {
    opacity: 1;
    transform: scaleX(1);
  }
}

/**
 * Smooth HTMX swap transitions
 */
.htmx-swapping {
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

.htmx-settling {
  opacity: 1;
  transition: opacity 0.3s ease-in;
}

/* ========================================
   MOBILE PERFORMANCE OPTIMIZATIONS
   ======================================== */

/**
 * Reduce animation complexity on mobile for better performance
 * Simplify transitions on devices with prefers-reduced-motion
 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/**
 * Mobile-specific animations - simpler transitions
 */
@media (max-width: 768px) {
  /* Reduce shadow complexity on mobile */
  .btn:hover:not(:disabled) {
    box-shadow: none;
  }

  /* Simplify card animations on mobile */
  .card {
    animation: none;
  }

  /* Reduce badge animation duration on mobile */
  .badge {
    animation: badgeFadeIn 0.2s ease-out;
  }

  @keyframes badgeFadeIn {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }

  /* Simplify button animations on mobile */
  .btn {
    transition: opacity 0.2s ease-in-out, background-color 0.2s ease-in-out;
  }

  /* Reduce skeleton animation on mobile */
  .animate-pulse {
    animation: mobilePulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  }

  @keyframes mobilePulse {
    0%, 100% {
      opacity: 1;
    }
    50% {
      opacity: 0.6;
    }
  }
}

/* ========================================
   ACCESSIBILITY & FOCUS STATES
   ======================================== */

/**
 * Enhanced focus indicators for keyboard navigation
 * Improves visibility for users navigating with Tab key
 */
:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

button:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

a:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  border-radius: 2px;
}

.btn:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/**
 * Collapse header accessibility - larger focus targets
 */
.collapse-title {
  padding: 0.75rem 1rem;
  transition: background-color 0.2s ease-in-out;
}

.collapse-title:focus-visible {
  background-color: rgba(59, 130, 246, 0.1);
  outline: 2px solid #3b82f6;
  outline-offset: -2px;
}

/**
 * Skip to main content link (common accessibility pattern)
 */
.skip-to-main {
  position: absolute;
  top: -40px;
  left: 0;
  background: #3b82f6;
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  border-radius: 2px;
  z-index: 100;
}

.skip-to-main:focus {
  top: 0;
}

/**
 * Improve visual feedback for disabled buttons
 */
button:disabled,
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

button:disabled:hover,
.btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

/**
 * Make links more accessible with clear visual states
 */
a {
  transition: color 0.2s ease-in-out, text-decoration 0.2s ease-in-out;
}

a:hover {
  text-decoration: underline;
}

/**
 * Improve contrast on hover for badges
 */
.badge {
  transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

/**
 * ARIA live region announcements
 * Used for screen reader announcements of dynamic content
 */
[role="status"],
[role="alert"],
[aria-live] {
  position: relative;
  width: 100%;
}

/**
 * Announce loading states to screen readers
 */
[aria-busy="true"] {
  position: relative;
}

/**
 * Better form input focus states
 */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/**
 * High contrast mode support (Windows High Contrast)
 */
@media (prefers-contrast: more) {
  button,
  .btn,
  a,
  .badge {
    border: 1px solid currentColor;
  }

  :focus-visible {
    outline-width: 3px;
  }
}
