/* ==========================================================================
   Splash Screen Styles (Non-Critical)
   ========================================================================== */

/* CAD/3D Splash Screen */
.splash-screen-cad {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  opacity: 1;
  visibility: visible;
  transition:
    opacity 0.4s ease,
    transform 0.4s ease;
  overflow: hidden;
}

.splash-background-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(100, 150, 250, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(100, 150, 250, 0.05) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: grid-move 20s linear infinite;
}

@keyframes grid-move {
  0% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(50px, 50px);
  }
}

.splash-content-cad {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 600px;
  width: 90%;
  padding: 20px;
}

/* 3D CAD 큐브 로고 */
.splash-logo-cad {
  position: relative;
  height: 120px;
  margin-bottom: 30px;
  perspective: 1000px;
}

.cad-cube {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotateX(-20deg) rotateY(30deg);
  width: 80px;
  height: 80px;
  transform-style: preserve-3d;
  animation: cube-rotate 8s infinite linear;
  will-change: transform;
  backface-visibility: hidden;
}

@keyframes cube-rotate {
  0% {
    transform: translate(-50%, -50%) rotateX(-20deg) rotateY(30deg);
  }
  100% {
    transform: translate(-50%, -50%) rotateX(340deg) rotateY(390deg);
  }
}

.cube-face {
  position: absolute;
  width: 80px;
  height: 80px;
  background: rgba(66, 153, 225, 0.15);
  border: 2px solid #4299e1;
  box-shadow: 0 0 20px rgba(66, 153, 225, 0.5);
  backface-visibility: hidden;
  transform: translateZ(0);
}

.cube-front {
  transform: translateZ(40px);
}
.cube-back {
  transform: translateZ(-40px) rotateY(180deg);
}
.cube-left {
  transform: rotateY(-90deg) translateZ(40px);
}
.cube-right {
  transform: rotateY(90deg) translateZ(40px);
}
.cube-top {
  transform: rotateX(90deg) translateZ(40px);
}
.cube-bottom {
  transform: rotateX(-90deg) translateZ(40px);
}

.cad-rings {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.ring {
  position: absolute;
  left: 50%;
  top: 50%;
  border: 2px solid rgba(66, 153, 225, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: ring-pulse 3s ease-in-out infinite;
  will-change: transform, opacity;
}

.ring-1 {
  width: 100px;
  height: 100px;
  animation-delay: 0s;
}

.ring-2 {
  width: 130px;
  height: 130px;
  animation-delay: 0.5s;
}

.ring-3 {
  width: 160px;
  height: 160px;
  animation-delay: 1s;
}

@keyframes ring-pulse {
  0%,
  100% {
    opacity: 0.3;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(1.05);
  }
}

/* 타이틀 */
.splash-title-cad {
  margin: 0 0 40px 0;
  font-weight: 300;
  letter-spacing: 2px;
}

.title-text {
  display: block;
  font-size: 32px;
  font-weight: 600;
  color: #e2e8f0;
  text-shadow: 0 0 20px rgba(66, 153, 225, 0.5);
  margin-bottom: 8px;
}

.title-subtitle {
  display: block;
  font-size: 14px;
  color: #4299e1;
  font-weight: 400;
  letter-spacing: 3px;
  text-transform: uppercase;
}

/* 진행률 바 */
.splash-progress-wrapper {
  margin-bottom: 30px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  color: #cbd5e0;
  font-size: 13px;
}

.progress-percentage {
  font-size: 16px;
  font-weight: 600;
  color: #4299e1;
  font-family: 'Courier New', monospace;
}

.progress-status {
  color: #a0aec0;
  font-size: 12px;
}

.splash-progress-container-cad {
  position: relative;
  width: 100%;
  height: 10px;
  background: rgba(66, 153, 225, 0.1);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(66, 153, 225, 0.2);
}

.splash-progress-bar-cad {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4299e1, #667eea);
  border-radius: 5px;
  transition: width 0.3s ease;
  box-shadow: 0 0 15px rgba(66, 153, 225, 0.6);
}

.progress-glow {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  background: rgba(66, 153, 225, 0.3);
  filter: blur(10px);
  transition: width 0.3s ease;
}

/* 로딩 단계 목록 */
.loading-steps-container {
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 20px;
  scrollbar-width: thin;
  scrollbar-color: #4299e1 rgba(66, 153, 225, 0.1);
}

.loading-steps-container::-webkit-scrollbar {
  width: 6px;
}

.loading-steps-container::-webkit-scrollbar-track {
  background: rgba(66, 153, 225, 0.1);
  border-radius: 3px;
}

.loading-steps-container::-webkit-scrollbar-thumb {
  background: #4299e1;
  border-radius: 3px;
}

.loading-steps-list {
  text-align: left;
}

.loading-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  margin-bottom: 6px;
  background: rgba(26, 26, 46, 0.5);
  border: 1px solid rgba(66, 153, 225, 0.1);
  border-radius: 6px;
  transition: all 0.3s ease;
}

.loading-step.step-loading {
  background: rgba(66, 153, 225, 0.1);
  border-color: #4299e1;
  box-shadow: 0 0 10px rgba(66, 153, 225, 0.3);
}

.loading-step.step-completed {
  background: rgba(72, 187, 120, 0.1);
  border-color: rgba(72, 187, 120, 0.3);
  opacity: 0.7;
}

.step-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.step-content {
  flex: 1;
  min-width: 0;
}

.step-label {
  color: #e2e8f0;
  font-size: 13px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.step-status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #a0aec0;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #718096;
}

.step-loading .status-dot {
  background: #4299e1;
  animation: dot-blink 1s infinite;
}

.step-completed .status-dot {
  background: #48bb78;
}

@keyframes dot-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

.step-checkmark {
  font-size: 16px;
  color: #48bb78;
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s ease;
}

.step-completed .step-checkmark {
  opacity: 1;
  transform: scale(1);
}

/* 에러 상태 스타일 */
.step-error {
  background: rgba(245, 101, 101, 0.1);
  border-color: rgba(245, 101, 101, 0.5);
  box-shadow: 0 0 10px rgba(245, 101, 101, 0.3);
}

.step-error .status-dot {
  background: #f56565;
  animation: none;
}

.step-error .step-label {
  color: #fc8181;
}

.step-error .status-text {
  color: #f56565;
}

@keyframes fadeIn {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* 통계 */
.splash-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-top: 20px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #cbd5e0;
}

.stat-icon {
  font-size: 16px;
}

.stat-value {
  font-family: 'Courier New', monospace;
  color: #4299e1;
  font-weight: 600;
}

/* 모바일 최적화 */
/* 성능 향상을 위한 애니메이션 최적화 */
@media (prefers-reduced-motion: reduce) {
  .cad-cube,
  .ring,
  .splash-background-grid {
    animation: none;
  }
  .ring {
    opacity: 0.6;
  }
}

@media (max-width: 640px) {
  .title-text {
    font-size: 24px;
  }

  .title-subtitle {
    font-size: 11px;
  }

  .cad-cube {
    width: 60px;
    height: 60px;
  }

  .cube-face {
    width: 60px;
    height: 60px;
  }

  .loading-steps-container {
    max-height: 150px;
  }

  .splash-stats {
    flex-direction: column;
    gap: 10px;
  }
}

.splash-screen-cad:not(.splash-active) {
  display: none !important;
}
