/* =========================================================================
   Theme Loader & Transition Animations
   Приветственное окно загрузки и плавная смена тем через жидкое стекло
   ========================================================================= */

/* === ПРИВЕТСТВЕННОЕ ОКНО ЗАГРУЗКИ === */
#themeLoader {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg,
    #8b1728 0%,
    #1e3a8a 25%,
    #581c87 50%,
    #9f1239 75%,
    #064e3b 100%);
  background-size: 400% 400%;
  animation: gradientShift 6s ease infinite;
  pointer-events: none;
  opacity: 1;
  transition: opacity 1s cubic-bezier(0.19, 1, 0.22, 1);
}

#themeLoader.hidden {
  opacity: 0;
  pointer-events: none;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.loader-blur {
  position: absolute;
  inset: 0;
  backdrop-filter: blur(60px) saturate(150%);
  -webkit-backdrop-filter: blur(60px) saturate(150%);
}

.loader-content {
  position: relative;
  z-index: 2;
  text-align: center;
  animation: loaderFadeIn 0.4s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

@keyframes loaderFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.loader-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, rgba(20,20,24,0.95), rgba(10,10,14,0.9));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(227, 29, 58, 0.3);
  animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

.loader-logo::before {
  content: "";
  width: 40%;
  height: 40%;
  border: 3px solid rgba(227, 29, 58, 0.95);
  border-radius: 25%;
  transform: rotate(45deg);
  position: absolute;
}

.loader-logo::after {
  content: "";
  width: 14%;
  height: 14%;
  border-radius: 50%;
  background: rgba(227, 29, 58, 0.95);
  position: absolute;
  box-shadow: 0 0 16px rgba(227, 29, 58, 0.8);
}

.loader-title {
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 8px;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  letter-spacing: -0.02em;
}

.loader-subtitle {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.loader-dots {
  display: inline-flex;
  gap: 4px;
  margin-left: 4px;
}

.loader-dots span {
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  display: inline-block;
  animation: dotPulse 2s ease-in-out infinite;
}

.loader-dots span:nth-child(2) { animation-delay: 0.3s; }
.loader-dots span:nth-child(3) { animation-delay: 0.6s; }

@keyframes dotPulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}


/* === АНИМАЦИЯ СМЕНЫ ТЕМЫ ЧЕРЕЗ ЖИДКОЕ СТЕКЛО === */
#themeTransition {
  position: fixed;
  inset: 0;
  z-index: 99999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

#themeTransition.active {
  opacity: 1;
  pointer-events: auto;
}

.transition-glass {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 16, 0.3);
  backdrop-filter: blur(0px) saturate(100%);
  -webkit-backdrop-filter: blur(0px) saturate(100%);
  animation: glassBlurIn 0.6s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

@keyframes glassBlurIn {
  0% {
    backdrop-filter: blur(0px) saturate(100%);
    -webkit-backdrop-filter: blur(0px) saturate(100%);
    background: rgba(10, 10, 16, 0);
  }
  100% {
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    background: rgba(10, 10, 16, 0.5);
  }
}

.transition-glass.fade-out {
  animation: glassBlurOut 0.6s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

@keyframes glassBlurOut {
  0% {
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    background: rgba(10, 10, 16, 0.5);
  }
  100% {
    backdrop-filter: blur(0px) saturate(100%);
    -webkit-backdrop-filter: blur(0px) saturate(100%);
    background: rgba(10, 10, 16, 0);
  }
}

.transition-gradient {
  position: absolute;
  inset: 0;
  opacity: 0;
  animation: gradientFadeIn 1s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

@keyframes gradientFadeIn {
  0% {
    opacity: 0;
    transform: scale(1.1);
  }
  100% {
    opacity: 0.15;
    transform: scale(1);
  }
}

.transition-gradient.fade-out {
  animation: gradientFadeOut 0.8s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

@keyframes gradientFadeOut {
  0% {
    opacity: 0.15;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.95);
  }
}


/* === АДАПТАЦИЯ ДЛЯ МОБИЛЬНЫХ === */
@media (max-width: 768px) {
  .loader-logo {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
  }

  .loader-title {
    font-size: 24px;
  }

  .loader-subtitle {
    font-size: 10px;
  }
}
