<template>
  <div>
    <!-- Экран для неавторизованных пользователей с анимированным REFLEX -->
    <div v-if="!isAuthenticated" class="landing-page">
      <div class="landing-content">
        <!-- Анимированный логотип -->
        <h1 class="app-name">
          <span class="letter">R</span>
          <span class="letter">E</span>
          <span class="letter">F</span>
          <span class="letter">L</span>
          <span class="letter">E</span>
          <span class="letter">X</span>
        </h1>
        <p class="tagline">Найди свою настоящую связь</p>
        
        <div class="landing-features">
          <div class="feature">
            <div class="feature-icon">
              <i class="bi-heart-fill"></i>
            </div>
            <h3>Встречайте людей</h3>
            <p>Найдите подходящие пары на основе общих интересов</p>
          </div>
          
          <div class="feature">
            <div class="feature-icon">
              <i class="bi-chat-dots-fill"></i>
            </div>
            <h3>Общайтесь</h3>
            <p>Знакомьтесь и начинайте увлекательные беседы с новыми людьми</p>
          </div>
          
          <div class="feature">
            <div class="feature-icon">
              <i class="bi-shield-check"></i>
            </div>
            <h3>Безопасность</h3>
            <p>Ваша конфиденциальность — наши главные приоритеты</p>
          </div>
        </div>
        
        <div class="cta-buttons">
          <router-link to="/login" class="action-btn secondary">
            <i class="bi-person"></i>
            Войти
          </router-link>
          <router-link to="/register" class="action-btn primary">
            <i class="bi-person-plus"></i>
            Зарегистрироваться
          </router-link>
        </div>
      </div>
      
      <div class="mobile-showcase">
        <div class="phone-mockup">
          <div class="phone-screen">
            <div class="app-preview">
              <div class="preview-header">
                <div class="preview-logo">REFLEX</div>
              </div>
              <div class="preview-content">
                <div class="preview-card"></div>
                <div class="preview-card"></div>
              </div>
            </div>
          </div>
        </div>
      </div>
      
      <div class="wave-container">
        <div class="wave"></div>
        <div class="wave"></div>
        <div class="wave"></div>
      </div>
    </div>

    <!-- Экран для авторизованных пользователей -->
    <div v-else class="auth-home-view">
      <div class="auth-bg-gradient">
        <div class="auth-header">
          <div class="auth-logo">
            <span class="logo-letter">R</span>
            <span class="logo-letter">E</span>
            <span class="logo-letter">F</span>
            <span class="logo-letter">L</span>
            <span class="logo-letter">E</span>
            <span class="logo-letter">X</span>
          </div>
        </div>
        
        <div class="auth-container">
          <div class="welcome-banner">
            <div class="welcome-avatar">
              <i class="bi-person-circle"></i>
            </div>
            <h1 class="welcome-heading">С возвращением, <span class="user-name">{{ user?.name || 'Пользователь' }}</span>!</h1>
            <p class="welcome-message">Рады видеть вас снова в REFLEX. Найдите свою идеальную пару сегодня.</p>
          </div>
          
          <div class="stats-cards">
            <div class="stat-card">
              <div class="stat-icon">
                <i class="bi-eye"></i>
              </div>
              <div class="stat-info">
                <h3>{{ stats.profileViews }}</h3>
                <p>Просмотров профиля</p>
              </div>
            </div>
            
            <div class="stat-card">
              <div class="stat-icon">
                <i class="bi-heart"></i>
              </div>
              <div class="stat-info">
                <h3>{{ stats.likes }}</h3>
                <p>Лайков</p>
              </div>
            </div>
            
            <div class="stat-card">
              <div class="stat-icon">
                <i class="bi-chat-dots"></i>
              </div>
              <div class="stat-info">
                <h3>{{ stats.unreadMessages }}</h3>
                <p>Новых сообщения</p>
              </div>
            </div>
          </div>
          
          <div class="action-section">
            <h2 class="section-title">Что вы хотите сделать сегодня?</h2>
            
            <div class="action-cards">
              <router-link to="/swipe" class="action-card">
                <div class="action-card-content">
                  <div class="action-icon">
                    <i class="bi-suit-heart-fill"></i>
                  </div>
                  <h3>Искать пару</h3>
                  <p>Находите совпадения с интересными людьми вокруг вас</p>
                </div>
                <div class="card-glare"></div>
              </router-link>
              
              <router-link to="/profile" class="action-card">
                <div class="action-card-content">
                  <div class="action-icon">
                    <i class="bi-person-fill"></i>
                  </div>
                  <h3>Мой профиль</h3>
                  <p>Обновите информацию и фотографии в своем профиле</p>
                </div>
                <div class="card-glare"></div>
              </router-link>
              
              <router-link to="/chats" class="action-card">
                <div class="action-card-content">
                  <div class="action-icon">
                    <i class="bi-chat-text-fill"></i>
                  </div>
                  <h3>Сообщения</h3>
                  <p>Проверьте новые сообщения и продолжите беседы</p>
                </div>
                <div class="card-glare"></div>
              </router-link>
            </div>
          </div>
        </div>
        
        <div class="wave-container-auth">
          <div class="wave-auth"></div>
          <div class="wave-auth"></div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { useAuth } from '@/auth'; // Импортируем наш auth composable
import { onMounted, ref } from 'vue'; // Добавляем ref для реактивных данных
import api from '@/services/api'; // Импортируем API сервис

const { user, isAuthenticated, fetchUser } = useAuth(); // Добавляем fetchUser

// Реактивные данные для статистики
const stats = ref({
  profileViews: 0,
  likes: 0,
  unreadMessages: 0
});
const statsLoading = ref(false);
const statsError = ref('');

// Функция для загрузки статистики пользователя
const fetchUserStats = async () => {
  if (!isAuthenticated.value) return;
  
  statsLoading.value = true;
  statsError.value = '';
  
  try {
    console.log('[HomeView] Загрузка статистики пользователя...');
    const response = await api.getUserStats();
    stats.value = response.data;
    console.log('[HomeView] Статистика загружена:', stats.value);
  } catch (err) {
    console.error('[HomeView] Ошибка при загрузке статистики:', err);
    statsError.value = 'Не удалось загрузить статистику';
  } finally {
    statsLoading.value = false;
  }
};

// Обновляем данные пользователя при монтировании компонента
onMounted(async () => {
  if (localStorage.getItem('userToken')) {
    // Если в localStorage есть токен, пробуем загрузить данные пользователя
    await fetchUser();
    console.log('HomeView: Состояние аутентификации:', isAuthenticated.value);
    console.log('HomeView: Пользователь:', user.value);
    
    // Загружаем статистику после загрузки данных пользователя
    if (isAuthenticated.value) {
      await fetchUserStats();
    }
  }
});
</script>

<style scoped>
/* Глобальные стили */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
  box-sizing: border-box;
}

/* Стили для анимированного REFLEX */
.landing-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  flex-direction: row;
  position: relative;
  overflow: hidden;
  padding: 0;
}

.landing-content {
  width: 55%;
  padding: 5% 2rem;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.app-name {
  font-size: 5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  letter-spacing: 2px;
  display: flex;
  flex-wrap: wrap;
}

.letter {
  display: inline-block;
  animation: gradientShift 8s infinite;
  background: linear-gradient(45deg, #ffffff, #00bfff, #9932cc, #ff4500);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 
    -1px -1px 0 rgba(255, 255, 255, 0.3),
    1px -1px 0 rgba(255, 255, 255, 0.3),
    -1px 1px 0 rgba(255, 255, 255, 0.3),
    1px 1px 0 rgba(255, 255, 255, 0.3),
    0 0 8px rgba(255, 255, 255, 0.5);
}

.letter:nth-child(1) { animation-delay: 0s; }
.letter:nth-child(2) { animation-delay: 0.25s; }
.letter:nth-child(3) { animation-delay: 0.5s; }
.letter:nth-child(4) { animation-delay: 0.75s; }
.letter:nth-child(5) { animation-delay: 1s; }
.letter:nth-child(6) { animation-delay: 1.25s; }

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

.tagline {
  font-size: 1.5rem;
  opacity: 0.9;
  margin-bottom: 3rem;
  font-weight: 300;
  animation: fadeIn 1s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 0.9; transform: translateY(0); }
}

.landing-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.feature {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 1.5rem;
  text-align: center;
  backdrop-filter: blur(5px);
  transition: all 0.3s ease;
}

.feature:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.15);
}

.feature-icon {
  background: rgba(255, 255, 255, 0.2);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}

.feature-icon i {
  font-size: 1.75rem;
}

.feature h3 {
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.feature p {
  opacity: 0.8;
  line-height: 1.4;
  font-size: 0.95rem;
}

.cta-buttons {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  border: none;
  border-radius: 50px;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.action-btn.primary {
  background: linear-gradient(45deg, #667eea, #764ba2);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.6);
}

.action-btn.primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.8);
}

.action-btn.secondary {
  background: rgba(255, 255, 255, 0.9);
  color: #764ba2;
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

.action-btn.secondary:hover {
  transform: translateY(-3px);
  background: white;
  box-shadow: 0 8px 25px rgba(255, 255, 255, 0.5);
}

.action-btn i {
  font-size: 1.2rem;
}

/* Волны анимация */
.wave-container {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 150px;
  overflow: hidden;
  z-index: 1;
}

.wave {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 300%; /* Увеличиваем ширину для сглаживания краёв */
  height: 150px;
  background: url('data:image/svg+xml;utf8,<svg viewBox="0 0 1200 120" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 0v46.29c47.79 22.2 103.59 32.17 158 28 70.36-5.37 136.33-33.31 206.8-37.5 73.84-4.36 147.54 16.88 218.2 35.26 69.27 18 138.3 24.88 209.4 13.08 36.15-6 69.85-17.84 104.45-29.34C989.49 25 1113-14.29 1200 52.47V0z" opacity=".25" fill="white"/><path d="M0 0v15.81c13 21.11 27.64 41.05 47.69 56.24C99.41 111.27 165 111 224.58 91.58c31.15-10.15 60.09-26.07 89.67-39.8 40.92-19 84.73-46 130.83-49.67 36.26-2.85 70.9 9.42 98.6 31.56 31.77 25.39 62.32 62 103.63 73 40.44 10.79 81.35-6.69 119.13-24.28s75.16-39 116.92-43.05c59.73-5.85 113.28 22.88 168.9 38.84 30.2 8.66 59 6.17 87.09-7.5 22.43-10.89 48-26.93 60.65-49.24V0z" opacity=".5" fill="white"/><path d="M0 0v5.63C149.93 59 314.09 71.32 475.83 42.57c43-7.64 84.23-20.12 127.61-26.46 59-8.63 112.48 12.24 165.56 35.4C827.93 77.22 886 95.24 951.2 90c86.53-7 172.46-45.71 248.8-84.81V0z" fill="white"/></svg>') repeat-x;
  background-size: 1200px 150px;
  transform: translateX(0) rotate(180deg); /* Начинаем с нулевого положения */
  animation: wave-slide 30s cubic-bezier(0.36, 0.45, 0.63, 0.53) infinite; /* Плавная бесконечная анимация */
  opacity: 0.6;
}

.wave:nth-child(2) {
  bottom: 10px;
  animation: wave-slide 36s cubic-bezier(0.36, 0.45, 0.63, 0.53) reverse infinite; /* Другая длительность */
  opacity: 0.8;
}

.wave:nth-child(3) {
  bottom: 20px;
  animation: wave-slide 42s cubic-bezier(0.36, 0.45, 0.63, 0.53) infinite; /* Ещё одна длительность */
  opacity: 0.6;
}

@keyframes wave-slide {
  0% { transform: translateX(0) rotate(180deg); }
  100% { transform: translateX(-66.66%) rotate(180deg); } /* Анимируем точно на 2/3 ширины для плавного цикла */
}

/* Мобильный телефон/макет */
.mobile-showcase {
  width: 45%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 2;
}

.phone-mockup {
  width: 280px;
  height: 550px;
  background: #222;
  border-radius: 40px;
  position: relative;
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.4);
  border: 6px solid #333;
  overflow: hidden;
  transform: rotate(-5deg);
}

.phone-screen {
  width: 100%;
  height: 100%;
  background: #fff;
  overflow: hidden;
}

.app-preview {
  width: 100%;
  height: 100%;
}

.preview-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 15px;
  text-align: center;
}

.preview-logo {
  font-weight: 800;
  letter-spacing: 1px;
}

.preview-content {
  height: calc(100% - 50px);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  overflow: hidden;
}

.preview-card {
  height: 250px;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  animation: cardStack 4s infinite alternate;
}

.preview-card:nth-child(1) {
  animation-delay: 0s;
}

.preview-card:nth-child(2) {
  animation-delay: 2s;
}

@keyframes cardStack {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-30px) scale(0.95) rotate(3deg); }
}

/* Адаптивность для лендинга */
@media (max-width: 1200px) {
  .app-name {
    font-size: 4.5rem;
  }
  
  .phone-mockup {
    width: 250px;
    height: 500px;
  }
  
  .tagline {
    font-size: 1.4rem;
    margin-bottom: 2.5rem;
  }
  
  .landing-features {
    gap: 1.2rem;
  }
  
  .feature h3 {
    font-size: 1.1rem;
  }
  
  .feature p {
    font-size: 0.9rem;
  }
}

@media (max-width: 1024px) {
  .app-name {
    font-size: 4rem;
  }
  
  .tagline {
    font-size: 1.3rem;
    margin-bottom: 2rem;
  }
  
  .feature {
    padding: 1.2rem;
  }
  
  .feature-icon {
    width: 50px;
    height: 50px;
    margin-bottom: 1.2rem;
  }
  
  .feature-icon i {
    font-size: 1.5rem;
  }
  
  .action-btn {
    padding: 0.9rem 1.8rem;
  }
  
  .phone-mockup {
    width: 220px;
    height: 450px;
  }
}

@media (max-width: 900px) {
  .landing-page {
    flex-direction: column;
  }
  
  .landing-content {
    width: 100%;
    padding: 4rem 2rem 2rem;
    text-align: center;
  }
  
  .app-name {
    justify-content: center;
  }
  
  .mobile-showcase {
    width: 100%;
    height: auto;
    margin: 0 0 4rem;
  }
  
  .phone-mockup {
    transform: rotate(0);
    width: 220px;
    height: 440px;
    margin-top: -30px;
  }
  
  .landing-features {
    margin-bottom: 2rem;
  }
  
  .cta-buttons {
    justify-content: center;
  }
  
  .feature-icon {
    margin: 0 auto 1.2rem;
  }
}

@media (max-width: 768px) {
  .app-name {
    font-size: 3.5rem;
  }
  
  .tagline {
    font-size: 1.2rem;
    margin-bottom: 2rem;
  }
  
  .landing-content {
    padding: 3.5rem 1.5rem 1.5rem;
  }
  
  .landing-features {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  
  .cta-buttons {
    gap: 1rem;
  }
  
  .action-btn {
    padding: 0.8rem 1.6rem;
    font-size: 0.95rem;
  }
  
  .phone-mockup {
    width: 200px;
    height: 400px;
  }
  
  .wave {
    height: 120px;
    background-size: 1200px 120px;
  }
}

@media (max-width: 576px) {
  .app-name {
    font-size: 3rem;
  }
  
  .landing-content {
    padding: 3rem 1.2rem 2rem;
  }
  
  .landing-features {
    grid-template-columns: 1fr;
    margin-bottom: 1.5rem;
  }
  
  .feature {
    padding: 1.2rem;
  }
  
  .cta-buttons {
    flex-direction: column;
    gap: 0.8rem;
    width: 100%;
  }
  
  .action-btn {
    width: 100%;
    justify-content: center;
  }
  
  .mobile-showcase {
    margin: 0 0 3rem;
  }
  
  .phone-mockup {
    width: 180px;
    height: 360px;
  }
  
  .wave-container {
    height: 100px;
  }
  
  .wave {
    height: 100px;
    background-size: 1200px 100px;
  }
  
  .tagline {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
  }
}

@media (max-width: 480px) {
  .app-name {
    font-size: 2.5rem;
    margin-bottom: 1rem;
  }
  
  .landing-content {
    padding: 2.5rem 1rem 1.5rem;
  }
  
  .feature {
    padding: 1rem;
  }
  
  .feature-icon {
    width: 45px;
    height: 45px;
    margin-bottom: 1rem;
  }
  
  .feature-icon i {
    font-size: 1.3rem;
  }
  
  .feature h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }
  
  .feature p {
    font-size: 0.85rem;
  }
  
  .tagline {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }
  
  .mobile-showcase {
    margin: 0 0 2.5rem;
  }
  
  .phone-mockup {
    width: 160px;
    height: 320px;
    border-radius: 30px;
    border-width: 4px;
  }
  
  .preview-header {
    padding: 10px;
  }
  
  .preview-logo {
    font-size: 0.9rem;
  }
  
  .preview-content {
    padding: 15px;
    gap: 10px;
  }
  
  .preview-card {
    height: 150px;
  }
  
  .action-btn {
    padding: 0.8rem 1.2rem;
    font-size: 0.9rem;
  }
  
  .wave-container {
    height: 80px;
  }
  
  .wave {
    height: 80px;
    background-size: 1200px 80px;
  }
}

@media (max-width: 370px) {
  .app-name {
    font-size: 2.2rem;
  }
  
  .landing-content {
    padding: 2rem 0.8rem 1.5rem;
  }
  
  .tagline {
    font-size: 0.9rem;
    margin-bottom: 1.2rem;
  }
  
  .feature {
    padding: 0.9rem;
  }
  
  .feature-icon {
    width: 40px;
    height: 40px;
  }
  
  .feature-icon i {
    font-size: 1.2rem;
  }
  
  .action-btn {
    padding: 0.7rem 1rem;
    font-size: 0.85rem;
  }
  
  .phone-mockup {
    width: 140px;
    height: 280px;
  }
}

/* Адаптивность для высоты экрана */
@media (max-height: 800px) and (min-width: 901px) {
  .app-name {
    font-size: 3.5rem;
    margin-bottom: 1rem;
  }
  
  .tagline {
    margin-bottom: 1.5rem;
  }
  
  .landing-features {
    gap: 1rem;
    margin-bottom: 1.5rem;
  }
  
  .feature {
    padding: 1rem;
  }
  
  .feature-icon {
    width: 50px;
    height: 50px;
    margin-bottom: 1rem;
  }
  
  .phone-mockup {
    width: 220px;
    height: 440px;
  }
}

@media (max-height: 650px) and (min-width: 901px) {
  .app-name {
    font-size: 3rem;
  }
  
  .tagline {
    font-size: 1.1rem;
    margin-bottom: 1rem;
  }
  
  .landing-features {
    gap: 0.8rem;
    margin-bottom: 1.2rem;
  }
  
  .feature {
    padding: 0.8rem;
  }
  
  .feature-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 0.8rem;
  }
  
  .feature h3 {
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
  }
  
  .feature p {
    font-size: 0.8rem;
  }
  
  .phone-mockup {
    width: 180px;
    height: 360px;
  }
  
  .cta-buttons {
    margin-bottom: 1rem;
  }
  
  .action-btn {
    padding: 0.7rem 1.5rem;
    font-size: 0.9rem;
  }
}

/* Исправления Safari */
@supports (-webkit-touch-callout: none) {
  .letter, .logo-letter, .user-name, .stat-info h3 {
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  
  .welcome-card h1 {
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}

/* Стили для авторизованных пользователей */
.home-view {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 3rem 1rem;
  box-sizing: border-box;
}

.welcome-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 3rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  text-align: center;
  margin-top: 2rem;
  max-width: 100%;
  box-sizing: border-box;
}

.welcome-card h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(45deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.welcome-card .subtitle {
  color: #6c757d;
  font-size: 1.2rem;
  margin-bottom: 3rem;
}

.action-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.action-tile {
  background: white;
  border-radius: 20px;
  padding: 2rem 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  text-align: center;
  transition: all 0.3s ease;
  text-decoration: none;
  color: #333;
}

.action-tile:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 40px rgba(102, 126, 234, 0.2);
}

.tile-icon {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  color: white;
}

.tile-icon i {
  font-size: 2rem;
}

.action-tile h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: #333;
}

.action-tile p {
  color: #6c757d;
  font-size: 0.9rem;
}

/* Новые стили для авторизованного интерфейса */
.auth-home-view {
  min-height: 100vh;
  color: #333;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.auth-bg-gradient {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
  overflow: hidden;
}

.auth-header {
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 2;
}

.auth-logo {
  display: flex;
  align-items: center;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 1px;
}

.logo-letter {
  display: inline-block;
  animation: gradientShift 8s infinite;
  background: linear-gradient(45deg, #ffffff, #00bfff, #9932cc, #ff4500);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 
    -1px -1px 0 rgba(255, 255, 255, 0.3),
    1px -1px 0 rgba(255, 255, 255, 0.3),
    -1px 1px 0 rgba(255, 255, 255, 0.3),
    1px 1px 0 rgba(255, 255, 255, 0.3),
    0 0 8px rgba(255, 255, 255, 0.5);
}

.logo-letter:nth-child(1) { animation-delay: 0s; }
.logo-letter:nth-child(2) { animation-delay: 0.25s; }
.logo-letter:nth-child(3) { animation-delay: 0.5s; }
.logo-letter:nth-child(4) { animation-delay: 0.75s; }
.logo-letter:nth-child(5) { animation-delay: 1s; }
.logo-letter:nth-child(6) { animation-delay: 1.25s; }

.auth-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem 6rem;
  position: relative;
  z-index: 2;
}

.welcome-banner {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 2.5rem;
  margin-bottom: 2rem;
  text-align: center;
  color: white;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  animation: fadeIn 0.8s ease;
}

.welcome-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  border: 3px solid rgba(255, 255, 255, 0.3);
}

.welcome-avatar i {
  font-size: 3rem;
  color: white;
}

.welcome-heading {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: white;
}

.user-name {
  background: linear-gradient(45deg, #00BFFF, #20B2AA);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

.welcome-message {
  font-size: 1.2rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto;
}

.stats-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.stat-card {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 1.5rem;
  color: white;
  flex-shrink: 0;
}

.stat-icon i {
  font-size: 1.8rem;
}

.stat-info {
  flex-grow: 1;
}

.stat-info h3 {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
  background: linear-gradient(45deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-info p {
  font-size: 0.9rem;
  color: #6c757d;
  margin: 0;
  line-height: 1.4;
}

.section-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: white;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -10px;
  height: 4px;
  width: 60px;
  background: linear-gradient(90deg, #00BFFF, #20B2AA);
  border-radius: 2px;
}

.action-section {
  margin-bottom: 3rem;
}

.action-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.action-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  text-decoration: none;
  color: #333;
  height: 100%;
}

.action-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.action-card:hover .card-glare {
  transform: translateX(150%) translateY(-50%) skew(-20deg, 0);
}

.action-card-content {
  padding: 2rem;
  height: 100%;
  position: relative;
  z-index: 1;
}

.action-icon {
  width: 70px;
  height: 70px;
  border-radius: 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  color: white;
}

.action-icon i {
  font-size: 2rem;
}

.action-card h3 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #333;
}

.action-card p {
  font-size: 0.95rem;
  color: #6c757d;
  line-height: 1.6;
}

.card-glare {
  position: absolute;
  width: 40%;
  height: 200%;
  top: 50%;
  left: -120%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: translateY(-50%) skew(-20deg, 0);
  transition: transform 0.7s ease;
  z-index: 1;
}

/* Волны анимация для авторизованных пользователей */
.wave-container-auth {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 150px;
  overflow: hidden;
  z-index: 1;
}

.wave-auth {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 300%; /* Увеличиваем ширину для сглаживания краёв */
  height: 150px;
  background: url('data:image/svg+xml;utf8,<svg viewBox="0 0 1200 120" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 0v46.29c47.79 22.2 103.59 32.17 158 28 70.36-5.37 136.33-33.31 206.8-37.5 73.84-4.36 147.54 16.88 218.2 35.26 69.27 18 138.3 24.88 209.4 13.08 36.15-6 69.85-17.84 104.45-29.34C989.49 25 1113-14.29 1200 52.47V0z" opacity=".25" fill="white"/><path d="M0 0v15.81c13 21.11 27.64 41.05 47.69 56.24C99.41 111.27 165 111 224.58 91.58c31.15-10.15 60.09-26.07 89.67-39.8 40.92-19 84.73-46 130.83-49.67 36.26-2.85 70.9 9.42 98.6 31.56 31.77 25.39 62.32 62 103.63 73 40.44 10.79 81.35-6.69 119.13-24.28s75.16-39 116.92-43.05c59.73-5.85 113.28 22.88 168.9 38.84 30.2 8.66 59 6.17 87.09-7.5 22.43-10.89 48-26.93 60.65-49.24V0z" opacity=".5" fill="white"/><path d="M0 0v5.63C149.93 59 314.09 71.32 475.83 42.57c43-7.64 84.23-20.12 127.61-26.46 59-8.63 112.48 12.24 165.56 35.4C827.93 77.22 886 95.24 951.2 90c86.53-7 172.46-45.71 248.8-84.81V0z" fill="white"/></svg>') repeat-x;
  background-size: 1200px 150px;
  transform: translateX(0) rotate(180deg); /* Начинаем с нулевого положения */
  animation: wave-slide-auth 30s cubic-bezier(0.36, 0.45, 0.63, 0.53) infinite; /* Плавная бесконечная анимация */
  opacity: 0.6;
}

.wave-auth:nth-child(2) {
  bottom: 10px;
  animation: wave-slide-auth 36s cubic-bezier(0.36, 0.45, 0.63, 0.53) reverse infinite;
  opacity: 0.3;
}

@keyframes wave-slide-auth {
  0% { transform: translateX(0) rotate(180deg); }
  100% { transform: translateX(-66.66%) rotate(180deg); } /* Анимируем точно на 2/3 ширины для плавного цикла */
}

/* Медиа-запросы для авторизованного интерфейса */
@media (max-width: 1100px) {
  .stats-cards,
  .action-cards {
    gap: 1rem;
  }
  
  .welcome-heading {
    font-size: 2.2rem;
  }
  
  .action-icon,
  .stat-icon {
    width: 60px;
    height: 60px;
  }
  
  .action-card-content {
    padding: 1.5rem;
  }
}

@media (max-width: 992px) {
  .stats-cards,
  .action-cards {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .welcome-banner {
    padding: 2rem;
  }
  
  .welcome-heading {
    font-size: 2rem;
  }
  
  .section-title {
    font-size: 1.6rem;
  }
  
  .welcome-message {
    font-size: 1.1rem;
  }
  
  .auth-container {
    padding-bottom: 4rem;
  }
}

@media (max-width: 768px) {
  .stats-cards,
  .action-cards {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .welcome-heading {
    font-size: 1.8rem;
  }
  
  .welcome-message {
    font-size: 1rem;
  }
  
  .welcome-avatar {
    width: 70px;
    height: 70px;
  }
  
  .welcome-avatar i {
    font-size: 2.2rem;
  }
  
  .section-title {
    font-size: 1.4rem;
  }
  
  .welcome-banner,
  .stat-card,
  .action-card-content {
    padding: 1.5rem;
  }
  
  .auth-container {
    padding: 0 1rem 4rem;
  }
  
  .auth-header {
    padding: 1rem;
  }
  
  .auth-logo {
    font-size: 1.7rem;
  }
  
  .action-section {
    margin-bottom: 2rem;
  }
}

@media (max-width: 480px) {
  .welcome-heading {
    font-size: 1.6rem;
  }
  
  .welcome-avatar {
    width: 60px;
    height: 60px;
    margin-bottom: 1rem;
  }
  
  .welcome-avatar i {
    font-size: 1.8rem;
  }
  
  .section-title {
    font-size: 1.3rem;
  }
  
  .welcome-banner,
  .stat-card,
  .action-card-content {
    padding: 1.2rem;
  }
  
  .stat-info h3 {
    font-size: 1.6rem;
  }
  
  .action-icon,
  .stat-icon {
    width: 50px;
    height: 50px;
    margin-right: 1rem;
  }
  
  .action-icon i,
  .stat-icon i {
    font-size: 1.5rem;
  }
  
  .auth-container {
    padding: 0 0.75rem 3rem;
  }
  
  .action-card h3 {
    font-size: 1.2rem;
  }
  
  .action-card p {
    font-size: 0.85rem;
  }
}
</style>