/**
 * Navigation Animations
 * Анимации переходов между экранами
 */

/* ============================================
   БАЗОВЫЕ СТИЛИ ЭКРАНОВ
   ============================================ */

.screen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  min-height: 100vh;
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.screen.active {
  z-index: 1;
  position: relative;
}

/* ============================================
   FADE АНИМАЦИЯ (по умолчанию)
   ============================================ */

.screen-enter {
  opacity: 0;
  animation: fadeIn 0.3s ease forwards;
}

.screen-exit {
  opacity: 1;
  animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* ============================================
   SLIDE АНИМАЦИЯ
   ============================================ */

.screen-enter.slide {
  transform: translateX(100%);
  animation: slideInRight 0.3s ease forwards;
}

.screen-exit.slide {
  transform: translateX(0);
  animation: slideOutLeft 0.3s ease forwards;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutLeft {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(-100%);
    opacity: 0;
  }
}

/* ============================================
   SCALE АНИМАЦИЯ
   ============================================ */

.screen-enter.scale {
  transform: scale(0.9);
  opacity: 0;
  animation: scaleIn 0.3s ease forwards;
}

.screen-exit.scale {
  transform: scale(1);
  opacity: 1;
  animation: scaleOut 0.3s ease forwards;
}

@keyframes scaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes scaleOut {
  from {
    transform: scale(1);
    opacity: 1;
  }
  to {
    transform: scale(1.1);
    opacity: 0;
  }
}

/* ============================================
   LOADING SPINNER
   ============================================ */

#navigation-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.2s ease;
}

.navigation-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================
   НИЖНЯЯ НАВИГАЦИЯ - АКТИВНЫЕ СОСТОЯНИЯ
   ============================================ */

.bottom-nav {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 10000;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  height: 86px;
  transform: none !important;
  transition: none !important;
  animation: none !important;
  will-change: auto !important;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  background: none;
  border: none;
  cursor: pointer;
  transition: none !important;
  animation: none !important;
  transform: none !important;
  will-change: auto !important;
  position: relative;
  color: #666;
  font-size: 12px;
  font-weight: 500;
  border-radius: 12px;
}

.nav-item:hover {
  background: rgba(102, 126, 234, 0.1);
  transform: none !important;
}

.nav-item:active {
  transform: none !important;
}

.nav-item.active {
  color: #667eea;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 0 0 3px 3px;
  animation: none !important;
}

@keyframes slideDown {
  from {
    transform: translateX(-50%) translateY(-3px);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

.nav-icon {
  font-size: 24px;
  transition: none !important;
}

.nav-item.active .nav-icon {
  transform: none !important;
  animation: none !important;
}

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

.nav-label {
  font-size: 11px;
  font-weight: 500;
  transition: none !important;
}

.nav-item.active .nav-label {
  font-weight: 600;
}

/* ============================================
   КАРТОЧКИ МЕНЮ - HOVER ЭФФЕКТЫ
   ============================================ */

.menu-card {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.menu-card:hover::before {
  left: 100%;
}

.menu-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.2);
}

/* ── Авто-скрытие нижнего меню при скролле вниз ──────────────────────────────
   Этот блок ДОЛЖЕН быть в конце файла чтобы переопределить transition:none выше. */
.bottom-nav {
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
  will-change: transform;
}
.bottom-nav.nav--hidden {
  transform: translateY(110%) !important;
}
body.onboarding-active .bottom-nav {
  display: none !important;
}

.menu-card:active {
  transform: translateY(-2px);
}

.menu-card-primary:hover {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.menu-card-secondary:hover {
  border-color: #667eea;
  background: rgba(102, 126, 234, 0.05);
}

/* ============================================
   RIPPLE ЭФФЕКТ ПРИ КЛИКЕ
   ============================================ */

.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
  width: 300px;
  height: 300px;
}

/* ============================================
   АДАПТИВНОСТЬ
   ============================================ */

@media (min-width: 768px) {
  .bottom-nav {
    left: max(0px, calc(50vw - 300px)) !important;
    right: max(0px, calc(50vw - 300px)) !important;
    width: auto !important;
    max-width: none;
    transform: none !important;
    border-radius: 20px 20px 0 0;
  }

  .nav-item {
    padding: 12px 20px;
  }

  .nav-icon {
    font-size: 28px;
  }

  .nav-label {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .screen,
  .nav-item,
  .menu-card {
    animation: none;
    transition: none;
  }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

@media (prefers-color-scheme: dark) {
  .bottom-nav {
    background: rgba(30, 30, 30, 0.95);
    border-top-color: rgba(255, 255, 255, 0.1);
  }

  .nav-item {
    color: #aaa;
  }

  .nav-item.active {
    color: #667eea;
  }

  .nav-item:hover {
    background: rgba(102, 126, 234, 0.2);
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.nav-item:focus-visible {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

.menu-card:focus-visible {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

/* Скрытие элементов для screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

.screen,
.nav-item,
.menu-card {
  will-change: transform, opacity;
}

/* Отключаем will-change после анимации */
.screen.active {
  will-change: auto;
}
