/* Reset */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
}

body.splash-active {
  overflow: hidden;
}

/* Splash Screen Container */
.splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: 'IRANSans';
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.splash-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Background Effects */
.splash-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
}

.bg-gradient-1 {
  position: absolute;
  top: -50%;
  right: -20%;
  width: 80%;
  height: 150%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
  animation: float 8s ease-in-out infinite;
  border-radius: 50%;
}

.bg-gradient-2 {
  position: absolute;
  bottom: -50%;
  left: -20%;
  width: 80%;
  height: 150%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  animation: float 10s ease-in-out infinite reverse;
  border-radius: 50%;
}

.bg-particles {
  position: absolute;
  width: 100%;
  height: 100%;
}

.particle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  animation: particleFloat 15s infinite ease-in-out;
}

.particle:nth-child(1) {
  top: 20%;
  left: 20%;
  animation-delay: 0s;
  animation-duration: 12s;
}

.particle:nth-child(2) {
  top: 40%;
  left: 80%;
  animation-delay: 2s;
  animation-duration: 15s;
}

.particle:nth-child(3) {
  top: 60%;
  left: 40%;
  animation-delay: 4s;
  animation-duration: 18s;
}

.particle:nth-child(4) {
  top: 80%;
  left: 60%;
  animation-delay: 6s;
  animation-duration: 14s;
}

.particle:nth-child(5) {
  top: 30%;
  left: 70%;
  animation-delay: 8s;
  animation-duration: 16s;
}

.particle:nth-child(6) {
  top: 70%;
  left: 10%;
  animation-delay: 10s;
  animation-duration: 13s;
}

/* Main Content Container */
.splash-container {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  max-width: 90%;
  animation: fadeInUp 0.8s ease-out;
}

/* Logo Section */
.splash-logo-wrapper {
  position: relative;
  margin-bottom: 3rem;
  animation: logoPulse 2s ease-in-out infinite;
}

.splash-logo {
  width: 120px;
  height: 120px;
  object-fit: contain;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
  transition: transform 0.3s ease;
  position: relative;
  z-index: 2;
}

.logo-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 0%, transparent 70%);
  border-radius: 50%;
  animation: glowPulse 2s ease-in-out infinite;
  z-index: 1;
}

/* Title */
.splash-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 1rem 0;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  letter-spacing: -0.5px;
  line-height: 1.3;
  animation: fadeIn 1s ease-out 0.3s both;
}

/* Message */
.splash-message {
  font-size: 1.125rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.9);
  margin: 0 0 3rem 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  line-height: 1.6;
  animation: fadeIn 1s ease-out 0.6s both;
}

/* Loader Spinner */
.splash-loader {
  margin-bottom: 2rem;
  animation: fadeIn 1s ease-out 0.9s both;
}

.loader-spinner {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 4px solid transparent;
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-ring:nth-child(1) {
  width: 80px;
  height: 80px;
  animation-delay: 0s;
  opacity: 1;
}

.spinner-ring:nth-child(2) {
  width: 60px;
  height: 60px;
  animation-delay: -0.15s;
  opacity: 0.8;
  border-top-color: rgba(255, 255, 255, 0.8);
}

.spinner-ring:nth-child(3) {
  width: 40px;
  height: 40px;
  animation-delay: -0.3s;
  opacity: 0.6;
  border-top-color: rgba(255, 255, 255, 0.6);
}

.spinner-ring:nth-child(4) {
  width: 20px;
  height: 20px;
  animation-delay: -0.45s;
  opacity: 0.4;
  border-top-color: rgba(255, 255, 255, 0.4);
}

/* Progress Bar */
.splash-progress {
  width: 300px;
  max-width: 90%;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  overflow: hidden;
  animation: fadeIn 1s ease-out 1.2s both;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffffff 0%, rgba(255, 255, 255, 0.8) 100%);
  border-radius: 10px;
  animation: progressLoad 2s ease-in-out infinite;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes logoPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes glowPulse {
  0%, 100% {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1.1);
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes progressLoad {
  0% {
    width: 0%;
    opacity: 0.5;
  }
  50% {
    width: 70%;
    opacity: 1;
  }
  100% {
    width: 100%;
    opacity: 0.5;
  }
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  33% {
    transform: translate(30px, -30px) rotate(120deg);
  }
  66% {
    transform: translate(-20px, 20px) rotate(240deg);
  }
}

@keyframes particleFloat {
  0%, 100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.4;
  }
  50% {
    transform: translate(100px, -100px) scale(1.5);
    opacity: 0.8;
  }
}

/* Dark Mode Support */
[data-bs-theme="dark"] .splash-screen {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
}

[data-bs-theme="dark"] .splash-title {
  color: #ffffff;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

[data-bs-theme="dark"] .splash-message {
  color: rgba(255, 255, 255, 0.85);
}

[data-bs-theme="dark"] .bg-gradient-1,
[data-bs-theme="dark"] .bg-gradient-2 {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, transparent 70%);
}

[data-bs-theme="dark"] .particle {
  background: rgba(255, 255, 255, 0.3);
}

[data-bs-theme="dark"] .progress-bar {
  background: linear-gradient(90deg, #818cf8 0%, #6366f1 100%);
  box-shadow: 0 0 10px rgba(129, 140, 248, 0.5);
}

/* Responsive Design */
@media (max-width: 768px) {
  .splash-title {
    font-size: 1.75rem;
  }

  .splash-message {
    font-size: 1rem;
    margin-bottom: 2rem;
  }

  .splash-logo {
    width: 90px;
    height: 90px;
  }

  .logo-glow {
    width: 120px;
    height: 120px;
  }

  .loader-spinner {
    width: 60px;
    height: 60px;
  }

  .spinner-ring:nth-child(1) {
    width: 60px;
    height: 60px;
  }

  .spinner-ring:nth-child(2) {
    width: 45px;
    height: 45px;
  }

  .spinner-ring:nth-child(3) {
    width: 30px;
    height: 30px;
  }

  .spinner-ring:nth-child(4) {
    width: 15px;
    height: 15px;
  }

  .splash-progress {
    width: 250px;
  }
}

@media (max-width: 480px) {
  .splash-title {
    font-size: 1.5rem;
  }

  .splash-message {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
  }

  .splash-logo {
    width: 70px;
    height: 70px;
  }

  .logo-glow {
    width: 100px;
    height: 100px;
  }

  .splash-logo-wrapper {
    margin-bottom: 2rem;
  }
}

/* Smooth Transitions */
#root {
  opacity: 1;
  transition: opacity 1s ease-in-out;
}

/* Prevent scroll during splash */
body.splash-active {
  overflow: hidden;
  height: 100vh;
}
