/* ------------------------------------------------------------------------------
    Стили для страниц историй Кру
    Файл: /css/kru-stories.css
    Обновленная версия с улучшенной каруселью
------------------------------------------------------------------------------ */

/* ------------------------------------------------------------------------------
    Фикс шапки для страниц историй (всегда с фоном как в чате)
------------------------------------------------------------------------------ */
.site-header {
  background: var(--gradient-primary) !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
}

/* ------------------------------------------------------------------------------
    Стили для видео контейнера (уникальный для историй)
------------------------------------------------------------------------------ */
.video-section {
  margin: 40px 0;
}

.video-container {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9; /* Современный способ задать соотношение сторон */
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 
              0 4px 16px rgba(0, 0, 0, 0.1);
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: var(--border-radius);
}

/* ------------------------------------------------------------------------------
    ОБНОВЛЕННАЯ карусель историй с поддержкой свайпов
------------------------------------------------------------------------------ */
.stories-carousel {
  margin: 40px 0;
}

.carousel-container {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  overflow: hidden;
  /* Убираем возможность выделения текста при свайпах */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.carousel-track {
  display: flex;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  gap: 30px;
  /* Курсор для указания возможности перетаскивания */
  cursor: grab;
}

.carousel-track:active {
  cursor: grabbing;
}

.story-card {
  flex: 0 0 350px; /* Фиксированный размер для десктопа */
  height: 250px;
  border-radius: var(--border-radius);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--box-shadow);
  /* Предотвращаем перетаскивание изображений */
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
}

.story-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.story-card-image {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  position: relative;
  /* Предотвращаем выделение */
  pointer-events: none;
}

.story-card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 25px;
  color: white;
  transition: var(--transition);
  /* Восстанавливаем pointer-events для текста */
  pointer-events: auto;
}

.story-card:hover .story-card-overlay {
  background: linear-gradient(to top, var(--color-primary), rgba(185, 29, 188, 0.7));
}

.story-episode {
  font-size: 14px;
  font-weight: bold;
  opacity: 0.9;
  margin-bottom: 5px;
}

.story-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.3;
}

.story-description {
  font-size: 14px;
  opacity: 0.9;
  line-height: 1.4;
}

/* Карточка "Coming Soon" */
.story-card.coming-soon {
  cursor: default;
}

.story-card.coming-soon:hover {
  transform: none;
}

.story-card.coming-soon .story-card-overlay {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.3));
  justify-content: center;
  align-items: center;
  text-align: center;
}

.story-card.coming-soon:hover .story-card-overlay {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.3));
}

.coming-soon-text {
  font-size: 20px;
  font-weight: bold;
  opacity: 0.8;
}

/* Индикаторы карусели */
.carousel-indicators {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 30px;
}

.indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(185, 29, 188, 0.3);
  cursor: pointer;
  transition: var(--transition);
  /* Улучшенная область клика */
  position: relative;
  padding: 4px;
}

.indicator::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  transition: inherit;
}

.indicator.active {
  background: var(--color-primary);
  transform: scale(1.2);
}

.indicator:hover {
  background: var(--color-secondary);
  transform: scale(1.1);
}

/* ------------------------------------------------------------------------------
    Адаптивный дизайн для карусели
------------------------------------------------------------------------------ */
@media (max-width: 768px) {
  .stories-carousel {
    padding: 40px 0;
  }
  
  .carousel-container {
    overflow: hidden;
    padding: 0 20px;
  }
  
  .carousel-track {
    gap: 20px;
  }
  
  .story-card {
    flex: 0 0 calc(100vw - 60px); /* Полная ширина минус отступы */
    max-width: 320px; /* Максимальная ширина */
    height: 220px;
    margin: 0 auto; /* Центрирование */
  }
  
  .story-card-overlay {
    padding: 20px;
  }
  
  .story-title {
    font-size: 16px;
  }
  
  .story-description {
    font-size: 13px;
  }
  
  .coming-soon-text {
    font-size: 18px;
  }
  
  /* Индикаторы на мобильных */
  .carousel-indicators {
    margin-top: 25px;
  }
  
  .indicator {
    width: 10px;
    height: 10px;
    padding: 3px;
  }
  
  .indicator::before {
    width: 6px;
    height: 6px;
  }
}

@media (max-width: 480px) {
  .carousel-container {
    padding: 0 15px;
  }
  
  .story-card {
    flex: 0 0 calc(100vw - 50px);
    max-width: 300px;
    height: 200px;
  }
  
  .story-card-overlay {
    padding: 15px;
  }
  
  .story-title {
    font-size: 15px;
    margin-bottom: 6px;
  }
  
  .story-description {
    font-size: 12px;
  }
  
  .story-episode {
    font-size: 12px;
  }
  
  .coming-soon-text {
    font-size: 16px;
  }
}

/* ------------------------------------------------------------------------------
    Стили для отдельных страниц историй (уникальные элементы)
------------------------------------------------------------------------------ */

/* Герой-секция истории (расширение базового .hero) */
.story-hero {
  background: var(--gradient-primary);
  padding: 90px 0 60px;
  text-align: center;
  color: white;
  position: relative;
  overflow: hidden;
}

.story-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(circle at 30% 20%, rgba(255, 209, 0, 0.1) 0%, transparent 50%),
                    radial-gradient(circle at 70% 80%, rgba(60, 101, 232, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

.story-hero .story-episode {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 20px;
  backdrop-filter: blur(10px);
}

.story-hero h1 {
  font-size: 42px;
  margin-bottom: 20px;
  line-height: 1.2;
  color: white;
}

.story-meta {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-top: 30px;
  font-size: 14px;
  opacity: 0.9;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Основной контент истории */
.story-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 60px 20px;
  line-height: 1.8;
  font-size: 18px;
}

.story-content h2 {
  color: var(--color-primary);
  font-size: 28px;
  margin: 40px 0 20px 0;
  text-align: center;
}

.story-content h3 {
  color: var(--color-secondary);
  font-size: 22px;
  margin: 30px 0 15px 0;
}

.story-content p {
  margin-bottom: 20px;
  text-align: justify;
}

.story-content p:first-of-type::first-letter {
  font-size: 64px;
  line-height: 1;
  float: left;
  margin: 0 8px 0 0;
  color: var(--color-primary);
  font-weight: bold;
}

.quote {
  background: var(--color-light-gray);
  border-left: 4px solid var(--color-primary);
  padding: 20px 30px;
  margin: 30px 0;
  font-style: italic;
  position: relative;
}

.quote::before {
  content: '"';
  font-size: 60px;
  color: var(--color-primary);
  position: absolute;
  top: -10px;
  left: 15px;
  opacity: 0.3;
}

.scene-divider {
  text-align: center;
  margin: 50px 0;
  font-size: 24px;
  color: var(--color-primary);
}

/* Блок от первого лица */
.first-person {
  background: linear-gradient(135deg, #f8f9ff 0%, #e8f0ff 100%);
  border-radius: var(--border-radius);
  padding: 30px;
  margin: 40px 0;
  border: 2px dashed var(--color-secondary);
  position: relative;
}

.first-person::before {
  content: '💭';
  position: absolute;
  top: -15px;
  left: 30px;
  background: white;
  padding: 0 10px;
  font-size: 20px;
}

.first-person h4 {
  color: var(--color-secondary);
  margin-bottom: 15px;
  text-align: center;
}

.first-person p {
  font-style: italic;
  color: var(--color-secondary);
}

/* Навигация между историями */
.story-navigation {
  background: var(--color-light-gray);
  padding: 40px 0;
  margin-top: 60px;
}

.nav-container {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}

.story-navigation .nav-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 25px;
  background: white;
  border-radius: var(--border-radius);
  text-decoration: none;
  color: var(--color-text);
  transition: var(--transition);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  min-width: 200px;
}

.story-navigation .nav-item:hover {
  background: var(--color-primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(185, 29, 188, 0.2);
}

.story-navigation .nav-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.story-navigation .nav-item.next {
  flex-direction: row-reverse;
  text-align: right;
}

.nav-arrow {
  font-size: 24px;
  font-weight: bold;
}

.nav-text {
  display: flex;
  flex-direction: column;
}

.nav-label {
  font-size: 12px;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nav-title {
  font-size: 14px;
  font-weight: 600;
}

/* Блок с автором истории */
.story-author {
  text-align: center;
  margin: 50px 0;
  padding: 30px;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.author-avatar {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(185, 29, 188, 0.2);
}

.author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--gradient-primary);
  padding: 10px;
}

.author-signature {
  font-style: italic;
  color: var(--color-primary);
  font-size: 16px;
  margin-bottom: 10px;
}

.author-note {
  font-size: 14px;
  color: var(--color-text-light);
}

/* Кнопки действий */
.story-actions {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 40px 0;
  flex-wrap: wrap;
}

.action-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: white;
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
  border-radius: var(--border-radius);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.action-button:hover {
  background: var(--color-primary);
  color: white;
  transform: translateY(-2px);
}

.action-button.chat {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-text);
}

.action-button.chat:hover {
  background: var(--color-secondary);
  border-color: var(--color-secondary);
  color: white;
}

/* ------------------------------------------------------------------------------
    Дополнительные адаптивные стили
------------------------------------------------------------------------------ */

@media (max-width: 768px) {
  /* Страница отдельной истории */
  .story-hero h1 {
    font-size: 32px;
  }
  
  .story-meta {
    flex-direction: column;
    gap: 15px;
  }
  
  .story-content {
    padding: 40px 15px;
    font-size: 16px;
  }
  
  .story-content p:first-of-type::first-letter {
    font-size: 48px;
  }
  
  .nav-container {
    flex-direction: column;
    gap: 20px;
  }
  
  .story-navigation .nav-item {
    min-width: auto;
    width: 100%;
    max-width: 300px;
  }
  
  .story-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .action-button {
    width: 100%;
    max-width: 200px;
    justify-content: center;
  }
}