/* Loading States and Indicators */

/* Global Loading Spinner */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: var(--brand-primary);
  animation: spin 1s ease-in-out infinite;
}

.loading-spinner.large {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

.loading-spinner.small {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Button Loading States */
.btn.loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
  opacity: 0.7;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 1s ease-in-out infinite;
}

.btn.loading:disabled {
  cursor: not-allowed;
}

/* Card Loading Skeleton */
.loading-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, transparent 37%, #f0f0f0 63%);
  background-size: 400% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}

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

.skeleton-line {
  height: 16px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-line.title {
  height: 24px;
  width: 70%;
}

.skeleton-line.subtitle {
  height: 18px;
  width: 90%;
}

.skeleton-line.text {
  height: 14px;
  width: 100%;
}

.skeleton-line.short {
  width: 60%;
}

/* Job Listings Loading */
.job-listings-loading {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
}

.job-skeleton {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.job-title-skeleton {
  height: 20px;
  width: 70%;
  margin-bottom: 0.5rem;
}

.job-meta-skeleton {
  height: 14px;
  width: 50%;
  margin-bottom: 1rem;
}

.job-description-skeleton {
  height: 14px;
  width: 100%;
  margin-bottom: 0.5rem;
}

.job-description-skeleton:last-child {
  width: 80%;
}

/* Solution Cards Loading */
.solution-card.loading {
  position: relative;
  overflow: hidden;
}

.solution-card.loading::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: loading-shimmer 1.5s infinite;
  z-index: 1;
}

@keyframes loading-shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.form-field-loading {
  position: relative;
}

.form-field-loading::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 2px solid #ddd;
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 1s ease-in-out infinite;
}

/* Progress Indicators */
.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin: 1rem 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary));
  border-radius: 2px;
  transition: width 0.3s ease;
  position: relative;
}

.progress-fill.animated::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: progress-shimmer 2s infinite;
}

@keyframes progress-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

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

.loading-content {
  text-align: center;
  color: var(--text);
}

.loading-content .loading-spinner {
  width: 40px;
  height: 40px;
  border-width: 4px;
  margin-bottom: 1rem;
}

/* Pulse Animation for Real-time Updates */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.pulse {
  animation: pulse 2s infinite;
}

/* Status Indicators */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-weight: 500;
}

.status-indicator.loading {
  background: rgba(255, 193, 7, 0.1);
  color: #856404;
}

.status-indicator.success {
  background: rgba(40, 167, 69, 0.1);
  color: #155724;
}

.status-indicator.error {
  background: rgba(220, 53, 69, 0.1);
  color: #721c24;
}

.status-indicator.info {
  background: rgba(23, 162, 184, 0.1);
  color: #0c5460;
}

/* Responsive Loading States */
@media (max-width: 768px) {
  .loading-spinner.large {
    width: 32px;
    height: 32px;
  }
  
  .job-skeleton {
    padding: 1rem;
  }
  
  .loading-overlay .loading-content {
    padding: 1rem;
  }
}

/* Dark Mode Loading States */
@media (prefers-color-scheme: dark) {
  .loading-skeleton {
    background: linear-gradient(90deg, #2d2d2d 25%, transparent 37%, #2d2d2d 63%);
  }
  
  .job-skeleton {
    background: var(--surface);
  }
  
  .loading-overlay {
    background: rgba(18, 18, 18, 0.9);
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .loading-spinner,
  .shimmer,
  .loading-shimmer,
  .progress-shimmer,
  .pulse {
    animation: none;
  }
  
  .loading-skeleton {
    background: #f0f0f0;
  }
  
  @media (prefers-color-scheme: dark) {
    .loading-skeleton {
      background: #2d2d2d;
    }
  }
}