/* ===== RESYNZ ERROR PAGES — System Diagnostic ===== */

/* --- Error Page Section --- */
.rs-error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--rs-nav-height));
  padding: calc(var(--rs-nav-height) + var(--rs-space-3xl)) var(--rs-space-lg) var(--rs-space-4xl);
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* --- Background Glow --- */
.rs-error-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(500px, 80vw);
  height: min(500px, 80vw);
  border-radius: 50%;
  pointer-events: none;
  animation: rs-error-glow-pulse 3s ease-in-out infinite;
}

.rs-error-glow--400 {
  background: radial-gradient(circle, rgba(245, 158, 11, 0.12), transparent 70%);
}
.rs-error-glow--404 {
  background: radial-gradient(circle, rgba(77, 124, 255, 0.10), transparent 70%);
}
.rs-error-glow--500 {
  background: radial-gradient(circle, rgba(239, 68, 68, 0.14), transparent 70%);
}
.rs-error-glow--502 {
  background: radial-gradient(circle, rgba(245, 158, 11, 0.10), transparent 70%);
}

@keyframes rs-error-glow-pulse {
  0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
  50%      { opacity: 1;   transform: translate(-50%, -50%) scale(1.08); }
}

/* --- Error Code (large gradient number) --- */
.rs-error-code {
  font-family: var(--rs-font-display);
  font-size: clamp(6rem, 14vw, 10rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.06em;
  position: relative;
  z-index: 1;
}

.rs-error-code--400 {
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.rs-error-code--404 {
  background: linear-gradient(135deg, var(--rs-blue) 0%, var(--rs-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.rs-error-code--500 {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.rs-error-code--502 {
  background: linear-gradient(135deg, #f59e0b 0%, var(--rs-blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Error Code Digit Animation --- */
.rs-error-code-digit {
  display: inline-block;
  opacity: 0;
  animation: rs-error-digit-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.rs-error-code-digit:nth-child(1) { animation-delay: 0s; }
.rs-error-code-digit:nth-child(2) { animation-delay: 0.12s; }
.rs-error-code-digit:nth-child(3) { animation-delay: 0.24s; }

@keyframes rs-error-digit-in {
  from { opacity: 0; transform: translateY(14px); filter: blur(4px); }
  to   { opacity: 1; transform: translateY(0);   filter: blur(0); }
}

/* --- Diagnostic Label --- */
.rs-error-label {
  font-family: var(--rs-font-mono);
  font-size: clamp(0.7rem, 1.2vw, 0.85rem);
  letter-spacing: 0.18em;
  color: var(--rs-text-tertiary);
  margin-top: var(--rs-space-md);
  margin-bottom: var(--rs-space-lg);
  position: relative;
  z-index: 1;
}

/* --- Error Title --- */
.rs-error-title {
  font-family: var(--rs-font-display);
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  letter-spacing: 0.08em;
  font-weight: 400;
  color: var(--rs-text-primary);
  margin-bottom: var(--rs-space-lg);
  position: relative;
  z-index: 1;
}

/* --- Diagnostics Box --- */
.rs-error-diagnostics {
  background: rgba(6, 10, 20, 0.85);
  border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius-sm);
  padding: var(--rs-space-md) var(--rs-space-lg);
  font-family: var(--rs-font-mono);
  font-size: clamp(0.7rem, 1vw, 0.78rem);
  line-height: 2.2;
  color: var(--rs-text-tertiary);
  text-align: left;
  max-width: 500px;
  width: 100%;
  margin-bottom: var(--rs-space-lg);
  position: relative;
  z-index: 1;
  opacity: 0;
  animation: rs-fade-in-up 0.5s ease 0.6s forwards;
}

.rs-error-diagnostics-line {
  display: block;
}

.rs-error-diagnostics-line--ok   { color: #10b981; }
.rs-error-diagnostics-line--warn { color: #f59e0b; }
.rs-error-diagnostics-line--fail { color: #ef4444; }
.rs-error-diagnostics-line--info { color: var(--rs-blue); }

/* --- Message --- */
.rs-error-message {
  font-family: var(--rs-font-mono);
  font-size: clamp(0.8rem, 1.1vw, 0.9rem);
  color: var(--rs-text-secondary);
  max-width: 460px;
  margin: 0 auto var(--rs-space-2xl);
  line-height: 1.8;
  position: relative;
  z-index: 1;
}

/* --- Actions --- */
.rs-error-actions {
  display: flex;
  gap: var(--rs-space-md);
  flex-wrap: wrap;
  justify-content: center;
  position: relative;
  z-index: 1;
  opacity: 0;
  animation: rs-fade-in 0.5s ease 0.9s forwards;
}

/* --- Scan line (404 only) --- */
.rs-error-scanner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(77, 124, 255, 0.3), transparent);
  opacity: 0;
  animation: rs-error-scan-down 4s ease-in-out 0.5s infinite;
  pointer-events: none;
}

@keyframes rs-error-scan-down {
  0%   { top: 0;   opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* --- H5 / Mobile --- */
@media (max-width: 768px) {
  .rs-error-page {
    min-height: 85vh;
    padding: calc(var(--rs-nav-height) + var(--rs-space-2xl)) var(--rs-space-md) var(--rs-space-2xl);
  }

  .rs-error-code {
    font-size: clamp(4rem, 20vw, 6rem);
  }

  .rs-error-title {
    font-size: 1.1rem;
  }

  .rs-error-label {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
  }

  .rs-error-diagnostics {
    font-size: 0.68rem;
    padding: var(--rs-space-sm) var(--rs-space-md);
    line-height: 2;
  }

  .rs-error-message {
    font-size: 0.8rem;
  }

  .rs-error-glow {
    width: min(320px, 90vw);
    height: min(320px, 90vw);
  }

  .rs-error-actions {
    flex-direction: column;
    align-items: center;
    gap: var(--rs-space-sm);
  }

  .rs-error-actions .rs-btn {
    width: 100%;
    max-width: 260px;
  }

  .rs-error-code-digit {
    animation-duration: 0.25s;
  }
  .rs-error-code-digit:nth-child(2) { animation-delay: 0.08s; }
  .rs-error-code-digit:nth-child(3) { animation-delay: 0.16s; }

  .rs-error-scanner { animation: none; display: none; }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  .rs-error-code-digit {
    opacity: 1;
    transform: none;
    filter: none;
    animation: none;
  }

  .rs-error-glow {
    animation: none;
    opacity: 0.6;
  }

  .rs-error-diagnostics,
  .rs-error-actions {
    opacity: 1;
    animation: none;
  }

  .rs-error-scanner { display: none; }
}
