/**
 * PWA Styles
 * Стили для кнопки установки, баннеров и standalone режима
 */

/* Кнопка установки PWA */
.pwa-install-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9998;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #1E54FF, #2B1E4F);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(30, 84, 255, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: Inter, system-ui, -apple-system, sans-serif;
}

.pwa-install-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(30, 84, 255, 0.4);
}

.pwa-install-btn:active {
  transform: translateY(0);
}

.pwa-install-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.5;
}

/* Баннер обновления */
.pwa-update-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10001;
  background: linear-gradient(135deg, #1E54FF, #2B1E4F);
  color: white;
  padding: 16px 20px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.pwa-update-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pwa-update-content span {
  font-size: 14px;
  font-weight: 500;
}

#pwa-update-button {
  padding: 8px 16px;
  background: white;
  color: #1E54FF;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

#pwa-update-button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

/* Standalone режим */
.pwa-standalone {
  /* Убираем отступы для полноэкранного режима */
}

.pwa-standalone .pwa-install-btn {
  display: none !important;
}

/* Адаптация для iOS */
@supports (-webkit-touch-callout: none) {
  .pwa-standalone {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* Splash screen стили */
.pwa-splash {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  background: linear-gradient(135deg, #1E54FF, #2B1E4F);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  opacity: 1;
  transition: opacity 0.3s ease-out;
}

.pwa-splash.hide {
  opacity: 0;
  pointer-events: none;
}

.pwa-splash-logo {
  width: 120px;
  height: 120px;
  margin-bottom: 24px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.9;
  }
}

.pwa-splash-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
}

.pwa-splash-subtitle {
  font-size: 16px;
  opacity: 0.9;
}

/* Offline индикатор */
.pwa-offline-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  background: #EF4444;
  color: white;
  padding: 8px 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  transform: translateY(-100%);
  transition: transform 0.3s ease-out;
}

.pwa-offline-indicator.show {
  transform: translateY(0);
}

/* Адаптивность */
@media (max-width: 768px) {
  .pwa-install-btn {
    top: auto;
    bottom: 80px;
    right: 16px;
    font-size: 13px;
    padding: 10px 16px;
  }

  .pwa-install-btn svg {
    width: 18px;
    height: 18px;
  }

  .pwa-update-content {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }

  .pwa-update-content span {
    font-size: 13px;
  }

  #pwa-update-button {
    width: 100%;
  }

  .pwa-splash-title {
    font-size: 24px;
  }

  .pwa-splash-subtitle {
    font-size: 14px;
  }
}

/* Анимация загрузки */
.pwa-loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s linear infinite;
}

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

/* Виджет прогресса (для домашнего экрана) */
.widget-progress {
  background: linear-gradient(135deg, #1E54FF, #2B1E4F);
  border-radius: 16px;
  padding: 16px;
  color: white;
  font-family: Inter, system-ui, -apple-system, sans-serif;
}

.widget-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.widget-progress-title {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.9;
}

.widget-progress-icon {
  font-size: 24px;
}

.widget-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.widget-progress-fill {
  height: 100%;
  background: white;
  border-radius: 4px;
  transition: width 0.3s ease-out;
}

.widget-progress-text {
  font-size: 12px;
  opacity: 0.8;
}

/* Виджет следующего занятия */
.widget-lesson {
  background: white;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  font-family: Inter, system-ui, -apple-system, sans-serif;
}

.widget-lesson-time {
  font-size: 12px;
  color: #6B7280;
  margin-bottom: 4px;
}

.widget-lesson-title {
  font-size: 16px;
  font-weight: 600;
  color: #0E0F1A;
  margin-bottom: 8px;
}

.widget-lesson-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #6B7280;
}

/* Виджет квиза */
.widget-quiz {
  background: linear-gradient(135deg, #10B981, #059669);
  border-radius: 16px;
  padding: 16px;
  color: white;
  font-family: Inter, system-ui, -apple-system, sans-serif;
}

.widget-quiz-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.widget-quiz-question {
  font-size: 13px;
  margin-bottom: 12px;
  opacity: 0.9;
}

.widget-quiz-button {
  width: 100%;
  padding: 10px;
  background: white;
  color: #10B981;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

