/* Основные стили и переменные */

/* CSS переменные */
:root {
  /* Основные цвета */
  --primary-purple: #AC4BFF;
  --primary-blue: #1e3a8a;
  --accent-purple: #7c3aed;
  --accent-blue: #3b82f6;
  --dark-bg: #0f0f23;
  --text-light: #ffffff;
  --text-muted: #a1a1aa;
  
  /* Градиенты */
  --main-gradient: linear-gradient(135deg, #1e1b4b 0%, #312e81 25%, #1e3a8a 50%, #1e40af 75%, #1d4ed8 100%);
  --dark-gradient: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 30%, #2d1b69 60%, #1e3a8a 100%);
  --purple-gradient: linear-gradient(135deg, #4c1d95 0%, #7c3aed 50%, #a855f7 100%);
  
  /* Фон с картинкой */
  --background-image: url('../images/background.svg');
  --background-color: #AC4BFF;
  
  /* Размеры */
  --border-radius: 12px;
  --border-radius-lg: 20px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  
  /* Тени */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* Базовые стили */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--background-color);
  background-image: 
    var(--background-image),
    linear-gradient(135deg, #AC4BFF 0%, #8B5CF6 50%, #7C3AED 100%);
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  background-attachment: fixed, fixed;
  min-height: 100vh;
  color: var(--text-light);
  line-height: 1.6;
}

/* Кастомный скроллбар на страницах: Текст/Дизайн/Видео/Шаблоны/Тарифы */
html.page-custom-scrollbar,
body.page-custom-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: rgb(107 52 166) rgba(255, 255, 255, 0.08);
}

html.page-custom-scrollbar::-webkit-scrollbar,
body.page-custom-scrollbar::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

html.page-custom-scrollbar::-webkit-scrollbar-track,
body.page-custom-scrollbar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

html.page-custom-scrollbar::-webkit-scrollbar-thumb,
body.page-custom-scrollbar::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(172, 75, 255, 0.92), rgba(124, 58, 237, 0.92));
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.08);
}

html.page-custom-scrollbar::-webkit-scrollbar-thumb:hover,
body.page-custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(186, 95, 255, 0.98), rgba(139, 92, 246, 0.98));
}

/* Контейнер */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--spacing-md);
}

@media (min-width: 1440px) {
  .container {
    padding: 0 80px;
  }
}

/* Шапка */
.header {
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  height: clamp(60px, 9vh, 100px);
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 clamp(16px, 5vw, 80px);
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.2vw, 16px);
  position: relative;
  height: 100%;
  box-sizing: border-box;
}

.header-left-cluster {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.5vw, 20px);
  flex-shrink: 0;
  min-width: 0;
}

.header-right-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

@media (min-height: 960px) {
  .header {
    height: 100px;
  }
}

/* Логотип */
.logo {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.2vw, 16px);
  text-decoration: none;
  color: white;
}

/* Выбор языка - Кастомный селектор */
.language-selector {
  position: static;
  transform: none;
  z-index: 1000;
  flex-shrink: 0;
}

.custom-language-select {
  position: relative;
  cursor: pointer;
}

.language-display {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 2px;
  color: white;
  font-size: clamp(12px, 1.5vw, 16px); /* Адаптивный размер шрифта */
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  width: fit-content;
  min-width: 0;
}

.language-text {
  color: white;
}

.language-arrow {
  color: white;
  transition: transform 0.2s ease;
}

.custom-language-select:hover .language-text {
  color: #b230cc;
}

.custom-language-select:hover .language-arrow {
  color: #b230cc;
}

.custom-language-select.open .language-arrow {
  transform: rotate(180deg);
}

.language-dropdown {
  position: absolute;
  top: 100%;
  left: 50%; /* Центрирование по горизонтали */
  transform: translateX(-50%) translateY(-10px); /* Центрирование и анимация */
  background: #b230cc;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  margin-top: 4px;
  width: 35px; /* Уменьшена ширина */
  min-width: 35px;
}

.custom-language-select.open .language-dropdown {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateX(-50%) translateY(0) !important; /* Центрирование и анимация */
  background: #b230cc !important;
  display: block !important;
}

.language-option {
  padding: 2px 3px; /* Значительно уменьшен padding */
  color: white;
  font-size: clamp(12px, 1.8vh, 16px);
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-radius: 4px; /* Уменьшен border-radius */
  margin: 1px; /* Уменьшен margin между опциями */
  text-align: center; /* Центрирование текста */
}

.language-option:hover {
  background: #b230cc;
}

.language-option.selected {
  background: #b230cc;
  font-weight: 600;
}

.logo-icon {
  width: clamp(40px, 1.5vw, 56px); /* Адаптивный размер по ширине окна */
  height: clamp(40px, 1.5vw, 56px); /* Адаптивный размер по ширине окна */
  background: linear-gradient(135deg, #AC4BFF 0%, #8B5CF6 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: clamp(18px, 1.5vw, 24px); /* Адаптивный размер шрифта */
  color: white;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.logo-text {
  font-size: clamp(16px, 1.8vw, 24px); /* Адаптивный размер шрифта как у навигации */
  font-weight: 600;
  color: white;
  font-family: 'Inter', sans-serif;
}

/* Навигация */
.nav {
  position: static;
  transform: none;
  margin: 0;
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
  gap: clamp(10px, 1vw, 70px);
  align-items: center;
}

.nav-link {
  color: white;
  text-decoration: none;
  font-weight: 400;
  font-family: 'Inter', sans-serif;
  font-size: clamp(14px , 1.3vw, 20px); /* Динамичный размер шрифта: 14px → 24px */
  padding: clamp(6px, 1vh, 12px) clamp(12px, 1.5vw, 20px); /* Динамичный padding */
  border-radius: 12px;
  transition: all 0.3s ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #AC4BFF;
}

.nav-link--active {
  background: rgba(172, 75, 255, 0.22);
  color: #fff;
  font-weight: 600;
}

/* Кнопка входа */
.login-btn {
  background: transparent;
  border: 2px solid #AC4BFF; /* Уменьшенная обводка */
  color: white;
  padding: clamp(2px, 0.3vh, 6px) clamp(6px, 4vw, 60px); /* Уменьшенный padding */
  border-radius: 43px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  font-size: clamp(14px, 1.3vw, 20px); /* Адаптивный размер шрифта как у навигации */
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  min-width: clamp(80px, 5vw, 120px); /* Уменьшенная минимальная ширина */
  text-align: center;
}

.login-btn:hover {
  background: #AC4BFF;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* В Telegram mini app выход — в профиле, не в шапке */
body.is-telegram-miniapp #logout-btn {
  display: none !important;
}

/* Мобильное меню */
.mobile-menu-overlay {
  display: none; /* Убираем затемнение */
}

.mobile-menu-dropdown {
  position: fixed;
  top: clamp(60px, 9vh, 100px); /* Под хедером */
  left: 0;
  right: 0;
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
  height: clamp(50px, 7vh, 80px); /* Адаптивная высота, как у хедера */
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  z-index: 1001; /* Поверх контента */
  transform: translateY(-100%); /* Скрыто сверху */
  transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
  border-bottom: 1px solid rgba(172, 75, 255, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  display: flex; /* Всегда показываем для анимации */
  align-items: center;
  opacity: 0; /* Прозрачное когда закрыто */
  visibility: hidden; /* Скрыто от взаимодействия */
  /* При узком экране и длинных подписях — прокрутка полосы меню */
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.mobile-menu-dropdown::-webkit-scrollbar {
  display: none;
}

.mobile-menu-dropdown.open {
  transform: translateY(0); /* Выезжает вниз */
  opacity: 1; /* Полностью видимое */
  visibility: visible; /* Доступно для взаимодействия */
  z-index: 1001; /* Поверх всего контента когда открыто */
}

.mobile-menu-header {
  display: none; /* Убираем заголовок и крестик */
}

.mobile-menu-close {
  display: none;
}

.mobile-menu-nav {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  /* Равные промежутки между подписями и от краёв; не «ячейки» flex:1 */
  justify-content: space-evenly;
  align-items: center;
  align-self: stretch;
  /* Не уже вьюпорта; если пунктов много — шире, прокрутка у .mobile-menu-dropdown */
  width: max-content;
  min-width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 clamp(4px, 1.5vw, 10px);
  gap: 0;
  box-sizing: border-box;
}

.mobile-nav-link {
  flex: 0 0 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: 'Inter', sans-serif;
  font-size: clamp(10px, 2.5vw, 15px);
  font-weight: 500;
  color: white;
  text-decoration: none;
  padding: clamp(6px, 1vh, 10px) clamp(3px, 1vw, 6px);
  transition: all 0.3s ease;
  border-radius: clamp(6px, 1vh, 10px);
  white-space: nowrap;
  line-height: 1.2;
}

.mobile-nav-link:hover,
.mobile-nav-link:active {
  background: rgba(172, 75, 255, 0.2);
  color: #AC4BFF;
}

/* Основной контент */
.main-content {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Нижнее меню */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  justify-content: center;
  width: 100%;
}

@media (min-height: 960px) {
  .bottom-nav-container {
    height: 100px;
  }
}

.is-telegram-miniapp .bottom-nav {
  bottom: 0 !important; /* при скрытом копирайте меню прижато к низу */
}

.bottom-nav-container {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  border-radius: 16px 16px 0 0;
  padding: clamp(8px, 1.8vh, 12px) clamp(16px, 2.5vw, 20px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: none;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 850px;
  height: clamp(60px, 9vh, 100px);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: var(--bottom-nav-item-width, clamp(100px, 20vw, 120px));
  text-align: center;
  gap: clamp(1px, 0.2vh, 2px);
  text-decoration: none;
  color: white;
  padding: clamp(4px, 1vh, 7px) clamp(8px, 1vw, 10px);
  border-radius: clamp(8px, 1.5vh, 12px);
  transition: all 0.3s ease;
  position: relative;
}

.nav-item:first-child {
  margin-left: 0;
}

.nav-item:last-child {
  margin-right: 0;
}

.nav-item.active {
  background: #B230CC;
  color: white;
  box-shadow: 0 2px 8px rgba(172, 75, 255, 0.3);
  border: 1px solid white;
}

.nav-item:hover:not(.active) {
  transform: translateY(-2px);
}

.nav-icon {
  width: clamp(16px, 2.5vh, 24px);
  height: clamp(16px, 2.5vh, 24px);
  filter: brightness(0) invert(1);
}

.nav-item.active .nav-icon {
  filter: none;
}

.nav-label {
  font-size: clamp(10px, 4.5vw, 16px);
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  margin-bottom: 0;
  line-height: 1.2;
}



/* Планшеты и тд версия */
@media (max-width: 880px) {
  .nav-link {
    padding: clamp(6px, 1vh, 12px) clamp(2px, 0.3vw, 20px);
  }
}


/* Мобильная иконка меню - скрыта по умолчанию */
.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin: 0;
  flex-shrink: 0;
}

.mobile-menu-btn img {
  width: 24px;
  height: 24px;
  filter: none; /* Убираем фильтр - розовая иконка */
}

/* Мобильная версия */
@media (max-width: 750px) {
  .nav {
    display: none;
  }

  .mobile-menu-btn {
    display: block;
  }
}

.tab-btn {
  font-size: 14px;
  padding: 10px 16px;
}

/* Черная полоска с копирайтом */
.copyright-bar {
  background: rgba(0, 0, 0, 0.8);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

.copyright-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 clamp(16px, 5vw, 80px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.copyright-text {
  font-size: clamp(11px, 1.2vw, 14px);
  color: rgba(255, 255, 255, 0.7);
  font-family: 'Inter', sans-serif;
  font-weight: 400;
}

.copyright-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.copyright-link {
  font-size: clamp(11px, 1.2vw, 14px);
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  transition: color 0.3s ease;
}

.copyright-link:hover {
  color: #AC4BFF;
}

.copyright-separator {
  color: rgba(255, 255, 255, 0.3);
  font-size: clamp(11px, 1.2vw, 14px);
}

/* Баннер cookie */
.cookie-consent-banner {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(960px, calc(100% - 24px));
  z-index: 1105;
  border-radius: 14px;
  background: rgba(16, 9, 31, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.cookie-consent-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
}

.cookie-consent-text {
  margin: 0;
  font-size: clamp(12px, 1.2vw, 14px);
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.95);
}

.cookie-consent-link {
  color: #c785ff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cookie-consent-btn {
  border: none;
  border-radius: 10px;
  background: #b230cc;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
}

.cookie-consent-btn:hover {
  background: #c142dd;
}

/* Адаптация для мобильных устройств */
@media (max-width: 640px) {
  /* На узких экранах копирайт располагается под нижним меню */
  .copyright-bar {
    bottom: 0; /* внизу экрана */
    z-index: 1000;
  }
  /* Нижнее меню поднимаем над копирайтом */
  .bottom-nav {
    bottom: 35px;
    z-index: 1002;
  }
  
  .copyright-container {
    flex-direction: column;
    gap: 0px;
    text-align: center;
  }

  .cookie-consent-banner {
    bottom: calc(106px + env(safe-area-inset-bottom, 0px));
    width: calc(100% - 16px);
  }

  .cookie-consent-content {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .cookie-consent-btn {
    width: 100%;
  }
}


/* На десктопах поднимем нижнее меню выше полосы и увеличим z-index меню */
@media (min-width: 641px) {
  .bottom-nav {
    bottom: 22px; /* поднимаем меню над полосой */
    z-index: 1002; /* выше чем у полосы */
  }
  .copyright-bar {
    z-index: 1000;
  }
}

/* Динамическое поведение нижних панелей (не для лендинга) */
body.dynamic-bottom-bars .bottom-nav {
  bottom: 0 !important;
}

body.dynamic-bottom-bars .copyright-bar {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(100%);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

body.dynamic-bottom-bars.show-copyright .copyright-bar {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

body.dynamic-bottom-bars.show-copyright .bottom-nav {
  bottom: 22px !important;
}

@media (max-width: 640px) {
  body.dynamic-bottom-bars.show-copyright .bottom-nav {
    bottom: 35px !important;
  }
}

/* Страница после оплаты ЮKassa: по центру экрана, запас под фикс. нижнее меню + копирайт */
body.payment-yookassa-return-page .payment-yookassa-return-shell {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: calc(100svh - clamp(60px, 9vh, 100px));
  min-height: calc(100dvh - clamp(60px, 9vh, 100px));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vw, 28px);
  /* нижнее меню + полоса копирайта + safe area (на телефоне кнопка «К тарифам» не уезжает под панели) */
  padding-bottom: calc(clamp(150px, 26vh, 220px) + env(safe-area-inset-bottom, 0px));
}

body.payment-yookassa-return-page .payment-yookassa-return-card {
  width: 100%;
  max-width: 420px;
  margin-inline: auto;
  padding: clamp(1.25rem, 4vw, 1.75rem);
  text-align: center;
}

body.payment-yookassa-return-page .payment-yookassa-return-title {
  margin: 0 0 1rem;
}

body.payment-yookassa-return-page .payment-yookassa-return-text {
  margin-left: auto;
  margin-right: auto;
  max-width: 34em;
  text-align: center;
}

body.payment-yookassa-return-page .payment-yookassa-return-actions {
  margin: 1.5rem 0 0;
  display: flex;
  justify-content: center;
  width: 100%;
}

body.payment-yookassa-return-page .payment-yookassa-return-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: min(280px, 100%);
  min-height: 50px;
  padding: 14px 24px;
  margin: 0 auto;
  text-decoration: none;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  color: #fff;
  background: linear-gradient(135deg, #b230cc 0%, #8e58ff 100%);
  border: none;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(178, 48, 204, 0.4);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

body.payment-yookassa-return-page .payment-yookassa-return-btn:hover {
  color: #fff;
  text-decoration: none;
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(142, 88, 255, 0.45);
}

body.payment-yookassa-return-page .payment-yookassa-return-btn:visited {
  color: #fff;
}

body.payment-yookassa-return-page .payment-yookassa-return-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 14px rgba(178, 48, 204, 0.35);
}

body.payment-yookassa-return-page .payment-yookassa-return-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

body.is-telegram-miniapp.payment-yookassa-return-page .payment-yookassa-return-shell {
  padding-bottom: calc(clamp(96px, 18vh, 130px) + env(safe-area-inset-bottom, 0px));
}