/**
 * Presentation Viewer Styles
 * Стили для просмотра презентаций на публичном сайте
 * v2.0 - Улучшенный UX с автопроигрыванием и полноэкранным режимом
 */

/* ============================================
   КОНТЕЙНЕР ПРЕЗЕНТАЦИИ
   ============================================ */

.presentation-viewer {
  position: relative;
  overflow: hidden;
}

.presentation-viewer .card-header {
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.presentation-viewer .card-header:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.presentation-viewer .card-title a {
  color: inherit;
  text-decoration: none;
}

/* ============================================
   CANVAS КОНТЕЙНЕР
   ============================================ */

.pdf-canvas-container {
  position: relative;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-radius: 8px;
  overflow: hidden;
  min-height: 200px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pdf-canvas {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.3s ease;
}

.pdf-canvas:hover {
  transform: scale(1.005);
}

/* ============================================
   ПАНЕЛЬ УПРАВЛЕНИЯ (ОБЫЧНЫЙ РЕЖИМ)
   ============================================ */

.pdf-controls {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 12px 20px;
  border-radius: 50px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-top: 15px;
}

.pdf-controls .btn {
  border-radius: 50%;
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.pdf-controls .btn:hover:not(:disabled) {
  transform: scale(1.1);
}

.pdf-controls .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Кнопка Play/Pause */
.pdf-controls .play-pause-btn {
  width: 40px;
  height: 40px;
  font-size: 1rem;
}

.pdf-controls .play-pause-btn.btn-success {
  animation: pulse-play 2s ease-in-out infinite;
}

@keyframes pulse-play {
  0%, 100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(40, 167, 69, 0); }
}

/* Кнопка полноэкранного режима */
.pdf-controls .fullscreen-btn {
  margin-left: 8px;
}

/* Счетчик слайдов */
.slide-counter {
  font-weight: 600;
  color: #495057;
  font-size: 0.95rem;
  min-width: 60px;
  text-align: center;
}

.slide-counter .current {
  color: #007bff;
  font-weight: 700;
}

/* ============================================
   ПОЛНОЭКРАННЫЙ РЕЖИМ
   ============================================ */

.pdf-canvas-container.fullscreen-mode {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.pdf-canvas-container.fullscreen-mode .pdf-canvas {
  max-height: calc(100vh - 100px);
  max-width: 100vw;
  border-radius: 0;
}

/* ============================================
   ОВЕРЛЕЙ С КОНТРОЛАМИ (ПОЛНОЭКРАННЫЙ)
   ============================================ */

.fullscreen-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 100;
}

.fullscreen-overlay.visible {
  opacity: 1;
  visibility: visible;
}

/* Контролы полноэкранного режима */
.fullscreen-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  max-width: 600px;
  margin: 0 auto;
}

.fs-control-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.fs-control-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.1);
}

.fs-control-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Кнопка Play/Pause в полноэкранном режиме */
.fs-play-pause {
  width: 60px;
  height: 60px;
  font-size: 1.4rem;
  background: rgba(40, 167, 69, 0.3);
  border-color: rgba(40, 167, 69, 0.5);
}

.fs-play-pause:hover {
  background: rgba(40, 167, 69, 0.5) !important;
  border-color: rgba(40, 167, 69, 0.7) !important;
}

.fs-play-pause.playing {
  background: rgba(220, 53, 69, 0.3);
  border-color: rgba(220, 53, 69, 0.5);
  animation: pulse-fs-playing 1.5s ease-in-out infinite;
}

.fs-play-pause.playing:hover {
  background: rgba(220, 53, 69, 0.5) !important;
  border-color: rgba(220, 53, 69, 0.7) !important;
}

@keyframes pulse-fs-playing {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); }
  50% { box-shadow: 0 0 0 12px rgba(220, 53, 69, 0); }
}

/* Счетчик слайдов в полноэкранном режиме */
.fs-slide-counter {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  min-width: 80px;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.fs-slide-counter .fs-current {
  color: #4dabf7;
  font-weight: 700;
}

/* Прогресс-бар слайдов */
.fs-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.fs-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4dabf7 0%, #228be6 100%);
  width: 0%;
  transition: width 0.3s ease;
  transform-origin: left;
}

/* Кнопка выхода из полноэкранного режима */
.fs-exit-fullscreen {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

/* ============================================
   ИНДИКАТОР ЗАГРУЗКИ
   ============================================ */

.presentation-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.95);
  padding: 20px 30px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  color: #495057;
  z-index: 10;
}

.presentation-loading i {
  color: #007bff;
  font-size: 1.5rem;
}

/* ============================================
   ИНДИКАТОР ОШИБКИ
   ============================================ */

.presentation-error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 80%;
  text-align: center;
  z-index: 10;
}

/* ============================================
   ИНДИКАТОР АВТОПРОИГРЫВАНИЯ (КОЛЬЦО)
   ============================================ */

.autoplay-progress-ring {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  z-index: 10;
}

.autoplay-progress-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.autoplay-progress-ring .progress-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 3;
}

.autoplay-progress-ring .progress-fill {
  fill: none;
  stroke: #4dabf7;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset linear;
}

/* ============================================
   НАВИГАЦИОННЫЕ ЗОНЫ (ВИЗУАЛЬНЫЕ ПОДСКАЗКИ)
   ============================================ */

.pdf-canvas-container::before,
.pdf-canvas-container::after {
  content: '';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 5;
}

.pdf-canvas-container::before {
  left: 20px;
}

.pdf-canvas-container::after {
  right: 20px;
}

.pdf-canvas-container:hover::before,
.pdf-canvas-container:hover::after {
  opacity: 0.5;
}

/* Иконки стрелок для навигационных зон */
.pdf-canvas-container::before {
  background: rgba(255, 255, 255, 0.1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z'/%3E%3C/svg%3E") center/24px no-repeat;
}

.pdf-canvas-container::after {
  background: rgba(255, 255, 255, 0.1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z'/%3E%3C/svg%3E") center/24px no-repeat;
}

/* В полноэкранном режиме зоны больше */
.fullscreen-mode::before,
.fullscreen-mode::after {
  width: 80px;
  height: 80px;
}

.fullscreen-mode::before {
  left: 40px;
}

.fullscreen-mode::after {
  right: 40px;
}

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

@media (max-width: 768px) {
  .pdf-controls {
    padding: 10px 15px;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .pdf-controls .btn {
    width: 32px;
    height: 32px;
  }

  .pdf-controls .play-pause-btn {
    width: 36px;
    height: 36px;
  }

  .slide-counter {
    font-size: 0.85rem;
    min-width: 50px;
  }

  .fullscreen-controls {
    gap: 10px;
  }

  .fs-control-btn {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }

  .fs-play-pause {
    width: 52px;
    height: 52px;
    font-size: 1.2rem;
  }

  .fs-slide-counter {
    font-size: 1rem;
    min-width: 60px;
  }

  .fs-exit-fullscreen {
    position: static;
    transform: none;
  }

  .pdf-canvas-container::before,
  .pdf-canvas-container::after {
    width: 40px;
    height: 40px;
  }

  .pdf-canvas-container::before {
    left: 10px;
  }

  .pdf-canvas-container::after {
    right: 10px;
  }
}

@media (max-width: 480px) {
  .pdf-controls {
    border-radius: 12px;
    padding: 8px 12px;
  }

  .pdf-controls .fullscreen-btn {
    margin-left: 4px;
  }

  .fullscreen-controls {
    flex-wrap: wrap;
    gap: 8px;
  }

  .fs-control-btn {
    width: 40px;
    height: 40px;
  }

  .fs-play-pause {
    width: 48px;
    height: 48px;
  }

  .fullscreen-overlay {
    padding: 15px;
  }
}

/* ============================================
   ТЕМНАЯ ТЕМА (если поддерживается)
   ============================================ */

@media (prefers-color-scheme: dark) {
  .pdf-controls {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
  }

  .slide-counter {
    color: #e2e8f0;
  }

  .presentation-loading {
    background: rgba(45, 55, 72, 0.95);
    color: #e2e8f0;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Фокус для клавиатурной навигации */
.fs-control-btn:focus,
.pdf-controls .btn:focus {
  outline: 3px solid #4dabf7;
  outline-offset: 2px;
}

/* ============================================
   АНИМАЦИЯ ПЕРЕХОДА СЛАЙДОВ
   ============================================ */

.pdf-canvas {
  animation: fadeIn 0.3s ease;
}

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