/* ===== Custom 404 Page Styles ===== */

.type-404 .error-content {
  height: auto !important;
  min-height: 70vh;
  margin: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: 12px;
  overflow: visible !important;
  position: relative;
}

[data-theme="dark"] .type-404 .error-content {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

/* Hide original elements — JS will replace them */
.type-404 .error-content > .error-img,
.type-404 .error-content > .error-info {
  display: none !important;
}

/* ---------- Container ---------- */
.custom-404 {
  text-align: center;
  padding: 40px 24px;
  max-width: 560px;
  width: 100%;
  animation: c404FadeInUp 0.8s ease-out both;
}

/* ---------- Illustration ---------- */
.custom-404-scene {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 0 auto 12px;
}

.custom-404-planet {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: linear-gradient(145deg, #a8d8ea, #6db3d8);
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow:
    inset -18px -12px 0 rgba(0, 0, 0, 0.08),
    0 8px 32px rgba(109, 179, 216, 0.3);
  overflow: hidden;
}

.custom-404-planet::before {
  content: "";
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  top: 25px;
  left: 30px;
}

.custom-404-planet::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  top: 65px;
  left: 75px;
}

[data-theme="dark"] .custom-404-planet {
  background: linear-gradient(145deg, #4a6fa5, #2d4a7a);
  box-shadow:
    inset -18px -12px 0 rgba(0, 0, 0, 0.2),
    0 8px 32px rgba(45, 74, 122, 0.4);
}

.custom-404-ring {
  position: absolute;
  width: 200px;
  height: 50px;
  border: 4px solid rgba(168, 216, 234, 0.5);
  border-radius: 50%;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) rotateX(70deg);
}

[data-theme="dark"] .custom-404-ring {
  border-color: rgba(74, 111, 165, 0.5);
}

.custom-404-astronaut {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  animation: c404Float 4s ease-in-out infinite;
}

.custom-404-astronaut-body {
  width: 44px;
  height: 50px;
  background: #e8e8e8;
  border-radius: 12px 12px 8px 8px;
  position: relative;
  margin: 0 auto;
}

[data-theme="dark"] .custom-404-astronaut-body {
  background: #c0c0c0;
}

.custom-404-astronaut-helmet {
  width: 38px;
  height: 38px;
  background: #f0f0f0;
  border: 3px solid #d0d0d0;
  border-radius: 50%;
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  overflow: hidden;
}

.custom-404-astronaut-helmet::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 16px;
  background: linear-gradient(135deg, #87ceeb, #4682b4);
  border-radius: 4px 4px 8px 8px;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
}

[data-theme="dark"] .custom-404-astronaut-helmet {
  background: #d8d8d8;
  border-color: #aaa;
}

[data-theme="dark"] .custom-404-astronaut-helmet::after {
  background: linear-gradient(135deg, #5a9fd4, #2c5f8a);
}

.custom-404-astronaut-pack {
  width: 24px;
  height: 28px;
  background: #ccc;
  border-radius: 4px;
  position: absolute;
  top: 6px;
  left: -14px;
}

[data-theme="dark"] .custom-404-astronaut-pack {
  background: #999;
}

.custom-404-stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.custom-404-star {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #a0b4c8;
  border-radius: 50%;
  animation: c404Twinkle 2s ease-in-out infinite;
}

[data-theme="dark"] .custom-404-star {
  background: #e0e8f0;
}

.custom-404-star:nth-child(1) { top: 15%; left: 10%; animation-delay: 0s; }
.custom-404-star:nth-child(2) { top: 25%; left: 82%; animation-delay: 0.6s; width: 3px; height: 3px; }
.custom-404-star:nth-child(3) { top: 8%;  left: 55%; animation-delay: 1.2s; width: 5px; height: 5px; }
.custom-404-star:nth-child(4) { top: 45%; left: 20%; animation-delay: 0.3s; }
.custom-404-star:nth-child(5) { top: 35%; left: 75%; animation-delay: 0.9s; width: 3px; height: 3px; }
.custom-404-star:nth-child(6) { top: 55%; left: 90%; animation-delay: 1.5s; }

/* ---------- Title ---------- */
.custom-404-title {
  font-size: 6rem;
  font-weight: 900;
  margin: 0 0 8px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -2px;
  line-height: 1;
}

[data-theme="dark"] .custom-404-title {
  background: linear-gradient(135deg, #a78bfa, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
}

/* ---------- Message ---------- */
.custom-404-message {
  font-size: 1.15rem;
  color: #555;
  margin: 0 0 32px;
  line-height: 1.7;
}

[data-theme="dark"] .custom-404-message {
  color: #b0bec5;
}

/* ---------- Buttons ---------- */
.custom-404-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.custom-404-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 50px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none !important;
  transition: all 0.3s ease;
  cursor: pointer;
}

.custom-404-btn-primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff !important;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.35);
}

.custom-404-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
  color: #fff !important;
}

[data-theme="dark"] .custom-404-btn-primary {
  background: linear-gradient(135deg, #a78bfa, #c084fc);
  box-shadow: 0 4px 15px rgba(167, 139, 250, 0.3);
}

[data-theme="dark"] .custom-404-btn-primary:hover {
  box-shadow: 0 6px 20px rgba(167, 139, 250, 0.5);
}

.custom-404-btn-secondary {
  background: rgba(255, 255, 255, 0.7);
  color: #555 !important;
  border: 2px solid rgba(102, 126, 234, 0.3);
  backdrop-filter: blur(4px);
}

.custom-404-btn-secondary:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(102, 126, 234, 0.6);
  color: #333 !important;
}

[data-theme="dark"] .custom-404-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #b0bec5 !important;
  border-color: rgba(167, 139, 250, 0.3);
}

[data-theme="dark"] .custom-404-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(167, 139, 250, 0.6);
  color: #e0e0e0 !important;
}

/* ---------- Footer ---------- */
.custom-404-footer {
  margin-top: 28px;
  font-size: 0.82rem;
  color: #999;
  line-height: 1.9;
}

[data-theme="dark"] .custom-404-footer {
  color: #78909c;
}

.custom-404-footer a {
  color: inherit;
  text-decoration: none;
  transition: color 0.25s;
}

.custom-404-footer a:hover {
  color: #667eea;
}

[data-theme="dark"] .custom-404-footer a:hover {
  color: #a78bfa;
}

.custom-404-footer-sep {
  margin: 0 0.35em;
}

/* ---------- Animations ---------- */
@keyframes c404FadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes c404Float {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-14px); }
}

@keyframes c404Twinkle {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.3); }
}

/* ---------- Responsive ---------- */
@media screen and (max-width: 768px) {
  .custom-404 {
    padding: 30px 20px;
  }

  .custom-404-scene {
    width: 180px;
    height: 180px;
  }

  .custom-404-planet {
    width: 110px;
    height: 110px;
  }

  .custom-404-ring {
    width: 160px;
    height: 40px;
  }

  .custom-404-title {
    font-size: 4.5rem;
  }

  .custom-404-message {
    font-size: 1rem;
  }

  .custom-404-btn {
    padding: 10px 22px;
    font-size: 0.9rem;
  }
}
