/**
 * Utility Classes
 * Helper classes for common styling patterns and interactive elements
 */

/* Scroll to Top Button */
#scrollToTopBtn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: none;
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  z-index: 1000;
  transition: all var(--transition-normal);
  opacity: 0;
  transform: scale(0.8);
}

#scrollToTopBtn.show {
  display: block !important;
  opacity: 1;
  transform: scale(1);
}

#scrollToTopBtn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

/* Enhanced Interactive Elements */
.interactive-hover {
  transition: all var(--transition-normal);
}

.interactive-hover:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

/* Form Focus Utilities */
.focus-lift:focus {
  transform: translateY(-2px);
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
}

/* Prevent focus effects on Select2 elements */
.select2-hidden-accessible.focus-lift:focus,
.select2-container .focus-lift:focus {
  transform: none !important;
  box-shadow: none !important;
}

/* Scale Animations */
.scale-hover {
  transition: transform var(--transition-fast);
}

.scale-hover:hover {
  transform: scale(1.05);
}

.scale-hover-large:hover {
  transform: scale(1.1);
}

/* Ripple Effect Container */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  pointer-events: none;
  transform: scale(0);
  animation: ripple-animation 0.6s linear;
}

@keyframes ripple-animation {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Modal Animations */
/* Modal styles moved to components/modals.css */

/* Accordion Icon Rotation */
.accordion-icon {
  transition: transform var(--transition-normal);
}

.accordion-icon.rotated {
  transform: rotate(180deg);
}

/* Navigation Active State */
.nav-link.active {
  font-weight: var(--font-weight-semibold) !important;
}

/* Card Mobile Spacing */
@media (max-width: 768px) {
  .card-mobile-spacing {
    margin-bottom: 1rem !important;
  }
}

/* Enhanced Table Row States */
.table-enhanced-hover {
  transition: all var(--transition-fast);
}

.table-enhanced-hover:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.dark-mode .table-enhanced-hover:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Focused Row Accessibility */
tbody tr.focused {
  outline: 2px solid var(--primary-500);
  outline-offset: -2px;
  background-color: rgba(59, 130, 246, 0.1);
}

.dark-mode tbody tr.focused {
  background-color: rgba(59, 130, 246, 0.2);
}

/* Loading States */
.btn-loading {
  position: relative;
}

.btn-loading::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn-loading.loading::before {
  opacity: 1;
}

.btn-loading.loading .btn-text {
  opacity: 0;
}

/* Enhanced Form States */
.form-group-lift {
  transition: transform var(--transition-fast);
}

.form-group-lift.focused {
  transform: translateY(-2px);
}

/* Gradient Text - Now solid color */
.gradient-text {
  color: var(--primary-600);
  font-weight: var(--font-weight-semibold);
}

/* Status Indicators */
.status-pulse {
  animation: pulse 2s infinite;
}

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

/* Completion Animation */
.completing {
  animation: completeItem 0.5s ease-out;
}

@keyframes completeItem {
  0% {
    transform: scale(1);
    background-color: transparent;
  }
  50% {
    transform: scale(1.02);
    background-color: rgba(16, 185, 129, 0.1);
  }
  100% {
    transform: scale(1);
    background-color: transparent;
  }
}

/* Fade Transitions */
.fade-out {
  opacity: 0;
  transform: translateX(-100%);
  transition: all var(--transition-normal);
}

.fade-in {
  opacity: 1;
  transform: translateX(0);
  transition: all var(--transition-normal);
}

/* Professional Shadow Utilities */
.shadow-lift {
  transition: box-shadow var(--transition-normal);
}

.shadow-lift:hover {
  box-shadow: var(--shadow-xl);
}

/* Text Utilities */
.text-gradient-primary {
  color: var(--primary-600);
  font-weight: var(--font-weight-semibold);
}

/* Interactive States */
.cursor-pointer {
  cursor: pointer;
}

.user-select-none {
  user-select: none;
}

/* Accessibility Utilities */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus Visible for Better Accessibility */
.focus-visible:focus {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .btn {
    border-width: 2px;
  }
  
  .card {
    border-width: 2px;
  }
  
  .status-indicator {
    border: 2px solid currentColor;
  }
}

/* Clickable Card Interactions */
.clickable-card {
  transition: all var(--timing-normal) var(--easing-smooth);
  position: relative;
  overflow: hidden;
}

.clickable-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left var(--timing-slow) var(--easing-smooth);
  pointer-events: none;
}

.clickable-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  border-color: rgba(37, 99, 235, 0.3);
}

.clickable-card:hover::before {
  left: 100%;
}

.clickable-card:active {
  transform: translateY(0);
}

/* Tab Navigation Enhancement */
.clickable-card[data-target-tab] {
  cursor: pointer;
  user-select: none;
}

.clickable-card[data-target-tab]:hover {
  background: rgba(37, 99, 235, 0.05) !important;
  border-color: rgba(37, 99, 235, 0.4) !important;
}

/* Quick Action Button Enhancements */
.btn-glass.w-100 {
  text-align: center;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.btn-glass.w-100[style*="flex-direction: column"] {
  flex-direction: column !important;
  gap: var(--space-2) !important;
}

/* Hover Effects for Glass Cards */
.card-glass.hover-lift:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Timeline Enhancements */
.timeline-marker {
  transition: all var(--timing-normal) var(--easing-bounce);
}

.timeline-item:hover .timeline-marker {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Enhanced Timeline Cards */
.timeline-card {
  position: relative;
  overflow: hidden;
}

.timeline-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left var(--timing-slow) var(--easing-smooth);
  pointer-events: none;
}

.timeline-card:hover::before {
  left: 100%;
}

.timeline-progression {
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.timeline-progression::-webkit-scrollbar {
  height: 6px;
}

.timeline-progression::-webkit-scrollbar-track {
  background: transparent;
}

.timeline-progression::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-full);
}

.timeline-progression::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}

/* Current Location Pulse Animation */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

/* Timeline Arrow Hover */
.timeline-arrow i {
  transition: all var(--timing-fast) var(--easing-smooth);
}

.timeline-arrow:hover i {
  transform: translateX(4px);
}

/* Progress Bar Animations */
[style*="width: "][style*="%"] {
  animation: progressFill 1s ease-out;
}

@keyframes progressFill {
  from {
    width: 0% !important;
  }
}

/* Badge Enhancements */
.badge {
  transition: all var(--timing-fast) var(--easing-smooth);
}

.badge:hover {
  transform: scale(1.05);
}

/* Glass Dropdown Styling - Let Bootstrap handle show/hide */
.dropdown-menu-glass {
  z-index: 1050;
}

/* Remove dropdown arrow */
.dropdown-toggle::after {
  display: none;
}

.dropdown-item-glass {
  transition: all var(--timing-fast) var(--easing-smooth);
}

.dropdown-item-glass:hover {
  background: rgba(37, 99, 235, 0.1) !important;
  transform: translateX(4px);
}

.dropdown-item-glass:focus {
  background: rgba(37, 99, 235, 0.15) !important;
  outline: none;
  transform: translateX(4px);
}

.dropdown-item-glass:active {
  background: rgba(37, 99, 235, 0.2) !important;
  transform: translateX(2px);
}

/* Quick Actions Trigger */
.quick-actions-trigger {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 60px;
  padding: 16px 32px;
  color: white;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
  display: flex;
  align-items: center;
  text-decoration: none;
}

.quick-actions-trigger:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 40px rgba(102, 126, 234, 0.4);
  color: white;
}

/* Slide-out Quick Actions Panel */
.quick-actions-panel {
  position: fixed;
  top: 80px;
  right: -400px;
  width: 400px;
  height: calc(100vh - 80px);
  
  backdrop-filter: var(--glass-blur) saturate(180%);
  -webkit-backdrop-filter: var(--glass-blur) saturate(180%);
  border-left: var(--glass-border);
  border-radius: 24px 0 0 24px;
  box-shadow: var(--glass-shadow);
  z-index: 10001 !important;
  transition: right 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow-y: auto;
}

/* Ensure the active panel is always on top */
.quick-actions-panel.active {
  right: 0;
  z-index: 10001 !important;
}

.quick-actions-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%, rgba(255,255,255,0.05) 100%);
  pointer-events: none;
  z-index: 1;
  border-radius: inherit;
}

.quick-actions-panel > * {
  position: relative;
  z-index: 2;
}

.panel-header, .quick-actions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  border-bottom: var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(15px) saturate(180%);
  -webkit-backdrop-filter: blur(15px) saturate(180%);
  position: sticky;
  top: 0;
  z-index: 10;
  border-radius: 24px 0 0 0;
}

.panel-header h4, .quick-actions-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-glass);
  position: relative;
  z-index: 2;
}

.panel-close, .quick-actions-header .btn-close {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: rgba(255, 255, 255, 0.9);
  font-size: 16px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.panel-close:hover, .quick-actions-header .btn-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
  border-color: rgba(255, 255, 255, 0.5);
}

.panel-content, .quick-actions-content {
  padding: 24px;
}

.action-item {
  margin-bottom: 16px;
}

.action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  padding: 20px;
  border: none;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(15px) saturate(150%);
  -webkit-backdrop-filter: blur(15px) saturate(150%);
  border: var(--glass-border);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}

.action-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s ease;
}

.action-btn:hover::before {
  left: 100%;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--glass-shadow-strong);
  border-color: var(--border-glass-strong);
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.action-btn:active {
  transform: translateY(0);
}

.action-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 16px;
  font-size: 22px;
  color: white;
  flex-shrink: 0;
}

.action-primary .action-icon { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.action-success .action-icon { background: linear-gradient(135deg, #10b981, #047857); }
.action-warning .action-icon { background: linear-gradient(135deg, #f59e0b, #d97706); }
.action-info .action-icon { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.action-danger .action-icon { background: linear-gradient(135deg, #ef4444, #dc2626); }
.action-secondary .action-icon { background: linear-gradient(135deg, #6b7280, #4b5563); }

.action-text {
  flex: 1;
  text-align: left;
}

.action-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-glass);
  margin-bottom: 4px;
}

.action-subtitle {
  font-size: 14px;
  color: var(--text-glass-muted);
  line-height: 1.4;
}

.action-arrow {
  color: var(--text-glass-muted);
  font-size: 16px;
  transition: transform 0.3s ease;
  margin-left: 12px;
}

.action-btn:hover .action-arrow {
  transform: translateX(4px);
}

.action-divider {
  border: none;
  height: 1px;
  background: rgba(0, 0, 0, 0.1);
  margin: 24px 0;
}

/* Panel Overlay */
.panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1040;
}

.panel-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Body when panel is open */
body.panel-open {
  overflow: hidden;
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
  .quick-actions-panel {
    width: 350px;
    right: -350px;
  }
  
  .panel-header {
    padding: 20px;
  }
  
  .panel-content {
    padding: 20px;
  }
  
  .action-btn {
    padding: 16px;
  }
  
  .action-icon {
    width: 44px;
    height: 44px;
    font-size: 20px;
    margin-right: 14px;
  }
  
  .action-title {
    font-size: 15px;
  }
  
  .action-subtitle {
    font-size: 13px;
  }
  
  .quick-actions-trigger {
    padding: 14px 28px;
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  .quick-actions-panel {
    width: 100vw;
    right: -100vw;
  }
  
  .panel-header {
    padding: 16px;
  }
  
  .panel-content {
    padding: 16px;
  }
  
  .action-btn {
    padding: 14px;
  }
  
  .action-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
    margin-right: 12px;
  }
  
  .action-title {
    font-size: 14px;
  }
  
  .action-subtitle {
    font-size: 12px;
  }
}

/* Reduced Motion Support */
@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;
  }
  
  .ripple-effect {
    display: none;
  }
  
  .clickable-card::before {
    display: none;
  }
  
  .timeline-marker {
    transition: none;
  }
  
  [style*="width: "][style*="%"] {
    animation: none;
  }
}


/* All modal styles consolidated in components/modals.css for consistency */
