/* Loading Screen Styles */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-color);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

.loading-container {
  text-align: center;
  position: relative;
  z-index: 2;
}

/* Logo Styling */
.loading-logo {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-logo img {
  width: 80px;
  height: 80px;
  transition: opacity 0.3s ease;
  position: absolute;
  animation: logoFloat 3s ease-in-out infinite;
}

/* Theme-based logo visibility */
[data-theme="dark"] .loading-logo .logo-light {
  opacity: 1;
}

[data-theme="dark"] .loading-logo .logo-dark {
  opacity: 0;
}

[data-theme="light"] .loading-logo .logo-light {
  opacity: 0;
}

[data-theme="light"] .loading-logo .logo-dark {
  opacity: 1;
}

/* Logo Animation */
@keyframes logoFloat {
  0%,
  100% {
    transform: translateY(0px) scale(1);
  }
  50% {
    transform: translateY(-10px) scale(1.05);
  }
}

/* Loading Text */
.loading-text {
  margin-bottom: 40px;
}

.loading-text h2 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-color);
  animation: textGlow 2s ease-in-out infinite alternate;
}

.loading-text h2 span {
  color: var(--primary-color);
  animation: spanPulse 1.5s ease-in-out infinite;
}

.loading-text p {
  font-size: 1.1rem;
  color: var(--text-color);
  opacity: 0.8;
  animation: fadeInOut 2s ease-in-out infinite;
}

/* Text Animations */
@keyframes textGlow {
  0% {
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
  }
  100% {
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.6), 0 0 30px var(--primary-color);
  }
}

@keyframes spanPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

@keyframes fadeInOut {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

/* Loading Spinner */
.loading-spinner {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 30px;
}

.spinner-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 3px solid transparent;
  border-radius: 50%;
  animation: spin 2s linear infinite;
}

.spinner-ring:nth-child(1) {
  border-top-color: var(--primary-color);
  animation-duration: 1.5s;
}

.spinner-ring:nth-child(2) {
  border-right-color: var(--primary-color);
  animation-duration: 2s;
  animation-direction: reverse;
  opacity: 0.7;
}

.spinner-ring:nth-child(3) {
  border-bottom-color: var(--primary-color);
  animation-duration: 2.5s;
  opacity: 0.4;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Progress Bar */
.loading-progress {
  width: 300px;
  margin: 0 auto;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
}

[data-theme="light"] .progress-bar {
  background-color: rgba(0, 0, 0, 0.1);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), #ff6666);
  border-radius: 2px;
  width: 0%;
  animation: progressFill 2s ease-out forwards;
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes progressFill {
  0% {
    width: 0%;
  }
  100% {
    width: 100%;
  }
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.progress-text {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-color);
  opacity: 0.8;
  font-weight: 500;
}

/* Floating Particles */
.loading-particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.particle {
  position: absolute;
  width: 10px;
  height: 10px;
  background-color: var(--primary-color);
  border-radius: 50%;
  opacity: 0.6;
  animation: particleFloat 4s infinite ease-in-out;
}

.particle:nth-child(1) {
  top: 20%;
  left: 10%;
  animation-delay: 0s;
  animation-duration: 3s;
}

.particle:nth-child(2) {
  top: 60%;
  left: 20%;
  animation-delay: 0.5s;
  animation-duration: 4s;
}

.particle:nth-child(3) {
  top: 30%;
  right: 15%;
  animation-delay: 1s;
  animation-duration: 3.5s;
}

.particle:nth-child(4) {
  bottom: 25%;
  right: 25%;
  animation-delay: 1.5s;
  animation-duration: 4.5s;
}

.particle:nth-child(5) {
  bottom: 40%;
  left: 30%;
  animation-delay: 2s;
  animation-duration: 3.2s;
}

.particle:nth-child(6) {
  top: 70%;
  right: 40%;
  animation-delay: 2.5s;
  animation-duration: 3.8s;
}

@keyframes particleFloat {
  0%,
  100% {
    transform: translateY(0px) translateX(0px) scale(1);
    opacity: 0.6;
  }
  25% {
    transform: translateY(-20px) translateX(10px) scale(1.2);
    opacity: 1;
  }
  50% {
    transform: translateY(-10px) translateX(-15px) scale(0.8);
    opacity: 0.4;
  }
  75% {
    transform: translateY(-30px) translateX(5px) scale(1.1);
    opacity: 0.8;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .loading-text h2 {
    font-size: 2rem;
  }

  .loading-logo {
    width: 100px;
    height: 100px;
  }

  .loading-logo img {
    width: 60px;
    height: 60px;
  }

  .loading-spinner {
    width: 60px;
    height: 60px;
  }

  .progress-bar {
    width: 250px;
  }
}

@media (max-width: 480px) {
  .loading-text h2 {
    font-size: 1.8rem;
  }

  .progress-bar {
    width: 200px;
  }
}

/* Theme Transition for Loading Screen */
.loading-screen.theme-transition {
  animation: loadingThemeTransition 0.5s ease;
}

@keyframes loadingThemeTransition {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
  100% {
    opacity: 1;
  }
}
