/**
 * Loading States - Specialized Styles
 * Purpose: Loading spinners, skeleton screens, progress indicators
 * Created: Phase 5 - May 20, 2026
 * 
 * Usage: Include after studentportaltheme.css for pages with async content
 */

/* ==========================================================================
   Loading Spinners
   ========================================================================== */

/* Spinner container */
.loading-spinner {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  vertical-align: text-bottom;
  border: 0.25em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner-border 0.75s linear infinite;
}

.loading-spinner--sm {
  width: 1rem;
  height: 1rem;
  border-width: 0.2em;
}

.loading-spinner--lg {
  width: 3rem;
  height: 3rem;
  border-width: 0.3em;
}

.loading-spinner--primary {
  color: var(--feduni-blue, #0066B3);
}

.loading-spinner--secondary {
  color: var(--text-muted, #6c757d);
}

@keyframes spinner-border {
  to {
    transform: rotate(360deg);
  }
}

/* Growing spinner */
.loading-spinner--grow {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  vertical-align: text-bottom;
  background-color: currentColor;
  border-radius: 50%;
  opacity: 0;
  animation: spinner-grow 0.75s linear infinite;
}

@keyframes spinner-grow {
  0% {
    transform: scale(0);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ==========================================================================
   Loading Overlay
   ========================================================================== */

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.loading-overlay--dark {
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
}

.loading-overlay__content {
  text-align: center;
}

.loading-overlay__spinner {
  margin-bottom: var(--spacing-md, 16px);
}

.loading-overlay__text {
  font-size: var(--font-size-lg, 1.125rem);
  font-weight: var(--font-weight-medium, 500);
  color: var(--feduni-navy, #041243);
}

.loading-overlay--dark .loading-overlay__text {
  color: white;
}

/* Inline loading overlay (for content areas) */
.loading-overlay--inline {
  position: absolute;
  background-color:rgba(255, 255, 255, 0.95);
}

/* ==========================================================================
   Skeleton Screens
   ========================================================================== */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-light, #f8f9fa) 25%,
    var(--bg-lighter, #e9ecef) 50%,
    var(--bg-light, #f8f9fa) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--border-radius, 0.25rem);
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Skeleton shapes */
.skeleton--text {
  height: 1rem;
  margin-bottom: 0.5rem;
}

.skeleton--text:last-child {
  width: 80%;
}

.skeleton--title {
  height: 2rem;
  width: 60%;
  margin-bottom: 1rem;
}

.skeleton--circle {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
}

.skeleton--avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
}

.skeleton--button {
  height: 2.5rem;
  width: 8rem;
  border-radius: var(--border-radius, 0.25rem);
}

.skeleton--card {
  height: 12rem;
  width: 100%;
}

.skeleton--input {
  height: 2.5rem;
  width: 100%;
}

/* ==========================================================================
   Progress Indicators
   ========================================================================== */

.progress-bar-custom {
  display: flex;
  height: 1rem;
  overflow: hidden;
  font-size: 0.75rem;
  background-color: var(--bg-light, #f8f9fa);
  border-radius: var(--border-radius, 0.25rem);
}

.progress-bar-custom__fill {
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  color: white;
  text-align: center;
  white-space: nowrap;
  background-color: var(--feduni-blue, #0066B3);
  transition: width 0.6s ease;
}

.progress-bar-custom__fill--success {
  background-color: var(--success-color, #28a745);
}

.progress-bar-custom__fill--warning {
  background-color: var(--warning-color, #ffc107);
}

.progress-bar-custom__fill--error {
  background-color: var(--error-color, #dc3545);
}

/* Animated progress bar */
.progress-bar-custom__fill--animated {
  animation: progress-bar-stripes 1s linear infinite;
  background-image: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.15) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.15) 75%,
    transparent 75%,
    transparent
  );
  background-size: 1rem 1rem;
}

@keyframes progress-bar-stripes {
  0% {
    background-position: 1rem 0;
  }
  100% {
    background-position: 0 0;
  }
}

/* Step progress indicator */
.progress-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--spacing-2xl, 40px);
  position: relative;
}

.progress-steps::before {
  content: "";
  position: absolute;
  top: 1.5rem;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--border-color, #dee2e6);
  z-index: 0;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
  z-index: 1;
}

.progress-step__circle {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background-color: var(--bg-light, #f8f9fa);
  border: 2px solid var(--border-color, #dee2e6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-semibold, 600);
  color: var(--text-muted, #6c757d);
  margin-bottom: var(--spacing-sm, 12px);
  transition: all var(--transition-base, 0.2s ease-in-out);
}

.progress-step__label {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--text-muted, #6c757d);
  text-align: center;
}

/* Step states */
.progress-step--completed .progress-step__circle {
  background-color: var(--success-color, #28a745);
  border-color: var(--success-color, #28a745);
  color: white;
}

.progress-step--completed .progress-step__label {
  color: var(--success-color, #28a745);
}

.progress-step--active .progress-step__circle {
  background-color: var(--feduni-blue, #0066B3);
  border-color: var(--feduni-blue, #0066B3);
  color: white;
  box-shadow: 0 0 0 0.25rem rgba(0, 102, 179, 0.25);
}

.progress-step--active .progress-step__label {
  color: var(--feduni-blue, #0066B3);
  font-weight: var(--font-weight-semibold, 600);
}

/* ==========================================================================
   Loading States for Content
   ========================================================================== */

.content-loading {
  position: relative;
  min-height: 200px;
  overflow: hidden;
}

.content-loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.6) 50%,
    transparent 100%
  );
  animation: content-shimmer 2s infinite;
}

@keyframes content-shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Pulse loading animation */
.loading-pulse {
  animation: loading-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes loading-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ==========================================================================
   Loading Text
   ========================================================================== */

.loading-text {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm, 12px);
  font-size: var(--font-size-base, 1rem);
  color: var(--text-muted, #6c757d);
}

.loading-text__dots::after {
  content: "";
  animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
  0%, 20% {
    content: "";
  }
  40% {
    content: ".";
  }
  60% {
    content: "..";
  }
  80%, 100% {
    content: "...";
  }
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 767.98px) {
  .progress-steps {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .progress-steps::before {
    top: 0;
    left: 1.5rem;
    bottom: 0;
    right: auto;
    width: 2px;
    height: auto;
  }
  
  .progress-step {
    flex-direction: row;
    width: 100%;
    text-align: left;
    margin-bottom: var(--spacing-lg, 24px);
  }
  
  .progress-step__circle {
    margin-right: var(--spacing-md, 16px);
    margin-bottom: 0;
  }
  
  .progress-step__label {
    text-align: left;
  }
}

@media (max-width: 575.98px) {
  .loading-overlay__text {
    font-size: var(--font-size-base, 1rem);
  }
  
  .progress-step__circle {
    width: 2.5rem;
    height: 2.5rem;
  }
}
