/**
 * GSWS Institutional Portal - Enterprise Global Loading & Progress UI System
 * Visual styles for page loader, button spinners, table skeletons, upload progress bars,
 * and multi-step application submission workflow.
 */

/* ========================================================================= */
/* 1. TOP PAGE LOADING PROGRESS BAR                                          */
/* ========================================================================= */
#gswsPageProgress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 50%, #701a24 100%);
  z-index: 99999;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
  box-shadow: 0 1px 8px rgba(245, 158, 11, 0.6);
  pointer-events: none;
}

/* ========================================================================= */
/* 2. BRANDED GLOBAL LOADER OVERLAY (With GSWS Monogram)                      */
/* ========================================================================= */
.gsws-loader-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(11, 29, 47, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 99990;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.gsws-loader-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.gsws-loader-card {
  background: #ffffff;
  border-radius: 1.25rem;
  padding: 2rem 2.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(245, 158, 11, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 90vw;
  width: 360px;
  animation: gswsCardIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.gsws-loader-emblem {
  width: 56px;
  height: 56px;
  border-radius: 1rem;
  background: linear-gradient(135deg, #0f2942 0%, #701a24 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f59e0b;
  font-size: 1.5rem;
  box-shadow: 0 8px 16px rgba(15, 41, 66, 0.3);
  margin-bottom: 1rem;
  animation: gswsEmblemPulse 2s infinite ease-in-out;
}

@keyframes gswsEmblemPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  50% { transform: scale(1.06); box-shadow: 0 0 20px 6px rgba(245, 158, 11, 0.25); }
}

.gsws-loader-dots {
  display: flex;
  gap: 6px;
  margin-top: 0.75rem;
}

.gsws-loader-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #701a24;
  animation: gswsDotBounce 1.4s infinite ease-in-out both;
}

.gsws-loader-dot:nth-child(1) { animation-delay: -0.32s; }
.gsws-loader-dot:nth-child(2) { animation-delay: -0.16s; }
.gsws-loader-dot:nth-child(3) { animation-delay: 0s; }

@keyframes gswsDotBounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; background-color: #f59e0b; }
}

/* ========================================================================= */
/* 3. BUTTON LOADING STATE & SPINNERS                                        */
/* ========================================================================= */
.gsws-btn-loading {
  position: relative;
  pointer-events: none !important;
  opacity: 0.85 !important;
  cursor: not-allowed !important;
}

.gsws-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: gswsSpin 0.65s linear infinite;
  margin-right: 0.4rem;
}

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

/* ========================================================================= */
/* 4. SKELETON SHIMMER LOADERS                                               */
/* ========================================================================= */
.gsws-skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: gswsShimmer 1.5s infinite;
  border-radius: 0.375rem;
  display: inline-block;
}

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

.gsws-table-loading {
  position: relative;
}

.gsws-table-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(2px);
  z-index: 10;
  border-radius: inherit;
}

/* ========================================================================= */
/* 5. MULTI-STEP APPLICATION SUBMISSION PROGRESS MODAL                       */
/* ========================================================================= */
.gsws-submit-modal {
  position: fixed;
  inset: 0;
  background: rgba(11, 29, 47, 0.85);
  backdrop-filter: blur(8px);
  z-index: 99995;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.gsws-submit-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.gsws-submit-box {
  background: #ffffff;
  border-radius: 1.5rem;
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(245, 158, 11, 0.4);
  animation: gswsCardIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.gsws-step-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.75rem;
  transition: all 0.25s ease;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #64748b;
}

.gsws-step-item.pending {
  color: #94a3b8;
}

.gsws-step-item.active {
  background-color: #eff6ff;
  color: #1e40af;
  border-left: 3px solid #2563eb;
}

.gsws-step-item.completed {
  background-color: #ecfdf5;
  color: #065f46;
  border-left: 3px solid #059669;
}

.gsws-step-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.gsws-step-item.pending .gsws-step-icon {
  background-color: #e2e8f0;
  color: #94a3b8;
}

.gsws-step-item.active .gsws-step-icon {
  background-color: #2563eb;
  color: #ffffff;
  animation: gswsSpin 1s linear infinite;
}

.gsws-step-item.completed .gsws-step-icon {
  background-color: #059669;
  color: #ffffff;
}

/* ========================================================================= */
/* 6. UPLOAD PROGRESS BAR                                                    */
/* ========================================================================= */
.gsws-progress-container {
  width: 100%;
  height: 8px;
  background-color: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.gsws-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #047857 0%, #10b981 50%, #f59e0b 100%);
  background-size: 24px 24px;
  transition: width 0.2s ease;
  border-radius: 9999px;
}

.gsws-progress-bar.striped {
  background-image: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.2) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0.2) 75%,
    transparent 75%,
    transparent
  );
  animation: gswsStripes 1s linear infinite;
}

@keyframes gswsStripes {
  from { background-position: 24px 0; }
  to { background-position: 0 0; }
}

/* ========================================================================= */
/* 7. FILE ATTACHMENT BADGES WITH REAL SIZE & METRICS                        */
/* ========================================================================= */
.gsws-file-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 0.625rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.6875rem;
  font-family: 'JetBrains Mono', monospace;
  margin-top: 0.35rem;
  animation: gswsFadeIn 0.25s ease forwards;
}

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

.gsws-file-badge.badge-valid {
  border-color: #a7f3d0;
  background-color: #ecfdf5;
  color: #065f46;
}

.gsws-file-badge.badge-oversized {
  border-color: #fecdd3;
  background-color: #fff1f2;
  color: #9f1239;
}

/* ========================================================================= */
/* 8. MOBILE OPTIMIZATIONS                                                   */
/* ========================================================================= */
@media (max-width: 640px) {
  .gsws-loader-card {
    padding: 1.5rem 1.25rem;
    width: 92vw;
  }
  .gsws-submit-box {
    padding: 1.25rem;
    width: 95vw;
  }
  .gsws-step-item {
    font-size: 0.75rem;
    padding: 0.5rem 0.65rem;
  }
}
