/* =========================
   БАЗОВЫЕ СТИЛИ
========================= */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

body {
  background: #fefefe;
  color: #111;
  transition: background 0.3s ease, color 0.3s ease;
}

body.dark {
  background: #1a1a1a;
  color: #fff;
}

main {
  max-width: 80%;
  margin: 0 auto;
  padding: 2rem 1rem;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #0077cc rgba(0, 0, 0, 0.05);
}

body.dark * {
  scrollbar-color: #66ccff rgba(255, 255, 255, 0.05);
}

/* =========================
   СКРОЛЛБАР
========================= */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 5px;
}

body.dark ::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #0077cc, #66ccff);
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #005fa3, #3399cc);
  transform: scale(1.05);
}

::-webkit-scrollbar-thumb:active {
  background: linear-gradient(135deg, #004d80, #0077cc);
}

body.dark ::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #66ccff, #3399cc);
}

body.dark ::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #3399cc, #0077cc);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* =========================
   ШАПКА
========================= */
header {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  max-height: 70px;
}

body.dark header {
  background: #2a2a2a;
  border-color: #444;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  max-width: 1200px;
  margin: 0 auto;
  gap: 1rem;
}

/* =========================
   ЛОГОТИП И НАЗВАНИЕ
========================= */
.logo-box {
  display: flex;
  align-items: center;
  gap: 1rem;
  order: 2; /* Второй элемент после кнопки */
  margin-left: 10%; /* 10% отступ от кнопки меню */
  flex: 1;
}

.logo {
  height: 50px;
  width: auto;
  border-radius: 8px;
  flex-shrink: 0;
}

.title-box {
  text-align: left;
}

.title-box h1 {
  margin: 0;
  color: #0077cc;
  font-size: 1.8rem;
}

body.dark .title-box h1 {
  color: #66ccff;
}

.title-box p {
  margin: 0.2rem 0 0;
  color: #666;
  font-size: 0.9rem;
}

body.dark .title-box p {
  color: #fff;
}

/* Стили для ПК (большие экраны) */
@media (min-width: 769px) {
  .logo {
    margin-left: 10rem;
  }
  
  #nav-btn {
    margin-left: -20.5rem;
  }
}

/* Стили для мобильных устройств (маленькие экраны) */
@media (max-width: 768px) {
  .logo {
    margin-left: 0;
  }
  
  #nav-btn {
    margin-left: 0;
  }
}

/* =========================
   ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ
========================= */
.theme-toggle {
  margin-right: auto;
  background: none;
  border: none;
  cursor: pointer;
  width: 60px;
  height: 30px;
  position: relative;
  flex-shrink: 0;
}

.theme-toggle-track {
  background: #e0e0e0;
  border-radius: 15px;
  width: 60px;
  height: 100%;
  display: block;
  transition: all 0.3s ease;
  position: relative;
}

body.dark .theme-toggle-track {
  background: #666;
}

.theme-toggle-thumb {
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  height: 24px;
  width: 24px;
  position: absolute;
  top: 50%;
  left: 3px;
  transform: translateY(-50%);
  transition: all 0.3s ease;
}

body.dark .theme-toggle-thumb {
  transform: translate(30px, -50%);
  background: #333;
}

.theme-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
}

.theme-icon.sun { left: 8px; }
.theme-icon.moon { right: 8px; }

/* =========================
   НАВИГАЦИОННОЕ МЕНЮ
========================= */
.navbtn {
  position: relative;
  top: auto;
  left: auto;
  width: 30px;
  height: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 200;
  transition: left 0.3s ease;
  flex-shrink: 0;
}

.navbtn span {
  height: 3px;
  width: 100%;
  background: #0077cc;
  border-radius: 3px;
  transition: 0.3s;
}

body.dark .navbtn span {
  background: #66ccff;
}

/* ПК — ширина больше 768px */
@media (min-width: 769px) {

  /* Кнопка меню — фиксируем слева */
  #nav-btn {
    position: fixed;
    left: 30px;
    top: 30px;
    margin-left: 0 !important;
    z-index: 300; /* чтобы была выше всего */
  }

  /* Логотип с названием — отступаем от кнопки */
  .logo-box {
    margin-left: -10%;
  }
}


.nav-menu.active ~ .header-container .navbtn {
  left: 220px;
}

.nav-menu.active ~ .header-container .back-link {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.nav-menu.active ~ .header-container .navbtn span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.nav-menu.active ~ .header-container .navbtn span:nth-child(2) {
  opacity: 0;
}

.nav-menu.active ~ .header-container .navbtn span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

.nav-menu {
  position: fixed;
  top: 0;
  left: -250px;
  width: 200px;
  height: 100%;
  background: #fff;
  box-shadow: 2px 0 5px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  padding: 5.5rem 1rem;
  gap: 1.5rem;
  transition: left 0.3s ease;
  z-index: 150;
}

body.dark .nav-menu {
  background: #2a2a2a;
  box-shadow: 2px 0 5px rgba(0,0,0,0.5);
}

.nav-menu a {
  color: #0077cc;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
  padding: 0.5rem;
  border-radius: 4px;
}

.nav-menu a:hover {
  color: #005694;
}

body.dark .nav-menu a {
  color: #66ccff;
}

body.dark .nav-menu a:hover {
  color: #3399cc;
}

.nav-menu.active {
  left: 0;
}

.nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 140;
}

.nav-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* =========================
   ПОДМЕНЮ НАВИГАЦИИ
========================= */
.nav-submenu {
  display: none;
  flex-direction: column;
  gap: 0.8rem;
  margin-left: 1rem;
  border-left: 2px solid #0077cc;
  padding-left: 0.8rem;
  margin-top: 0.5rem;
  animation: slideIn 0.3s ease;
}

body.dark .nav-submenu {
  border-left-color: #66ccff;
}

.nav-submenu a {
  font-size: 0.9rem;
  color: #0077cc;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
}

.nav-submenu a:hover {
  color: #0077cc;
  background: rgba(0, 119, 204, 0.1);
}

body.dark .nav-submenu a {
  color: #ccc;
}

body.dark .nav-submenu a:hover {
  color: #66ccff;
  background: rgba(102, 204, 255, 0.1);
}

/* Анимация для подменю */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* =========================
   АККОРДЕОН ПОДМЕНЮ
========================= */
.nav-submenu-accordion {
  margin: 0;
}

.nav-submenu-toggle {
  background: none;
  border: none;
  color: #0077cc;
  font-weight: 600;
  cursor: pointer;
  padding: 0.5rem;
  width: 100%;
  text-align: left;
  transition: color 0.2s ease;
  border-radius: 4px;
  font-family: inherit;
  font-size: inherit;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-submenu-toggle:hover {
  color: #005694;
  background: none;
}

body.dark .nav-submenu-toggle {
  color: #66ccff;
}

body.dark .nav-submenu-toggle:hover {
  color: #3399cc;
  background: none;
}

.nav-arrow {
  font-size: 0.8em;
  transition: transform 0.3s ease;
}

.nav-submenu-accordion.active .nav-arrow {
  transform: rotate(180deg);
}

.nav-submenu-accordion.active .nav-submenu {
  display: flex;
}

/* =========================
   ПОЛОСКА ПОДДЕРЖКИ
========================= */
.support-banner {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 0.8rem 1rem;
  position: fixed;
  top: 103px;
  left: 0;
  right: 0;
  z-index: 99;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  transform: translateY(0);
  transition: transform 0.3s ease;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}

/* Опционально: скрывать баннер при скролле вниз */
.support-banner.hidden {
  transform: translateY(-100%);
}

body.dark .support-banner {
  background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.support-banner-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.support-text {
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.support-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.5rem 1.2rem;
  border-radius: 25px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  border: 2px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
}

.support-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.support-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

@media (min-width: 769px) {
  .support-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
  }
}

/* =========================
   СЕКЦИИ
========================= */
.section {
  background: #f8f8f8;
  border-radius: 8px;
  margin: 2rem 0;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

body.dark .section {
  background: #2a2a2a;
}

.section h2 {
  color: #0077cc;
  text-align: center;
  margin-bottom: 2rem;
}

body.dark .section h2 {
  color: #66ccff;
}

/* =========================
   КАРТОЧКИ
========================= */
.cards {
  display: grid;
  gap: 4.0rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.card {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  opacity: 1;
  transform: translateY(0);
  margin-top: 7rem;
}

body.dark .card {
  background: #333;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.card:hover {
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  transform: translateY(-5px);
}

body.dark .card:hover {
  box-shadow: 0 8px 25px rgba(0,0,0,0.5);
}

.card h3 {
  color: #0077cc;
  margin-top: 0;
}

body.dark .card h3 {
  color: #66ccff;
}

.card p {
  flex-grow: 1;
  margin-bottom: 1rem;
}

/* =========================
   КНОПКИ
========================= */
.btn {
  color: #0077cc;
  text-decoration: none;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: all 0.3s ease;
  align-self: flex-start;
}

.btn:hover {
  color: #005694;
}

body.dark .btn {
  color: #66ccff;
}

body.dark .btn:hover {
  color: #3c7b9b;
}

/* =========================
   ИЗОБРАЖЕНИЯ
========================= */
.image-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 2rem;
}

.image-container img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

/* =========================
   КОНТАКТЫ
========================= */
#contacts {
  text-align: center;
  background: #f0f8ff;
  border-radius: 8px;
  scroll-margin-top: 190px;
}

body.dark #contacts {
  background: #1e2a3a;
}

#contacts ul {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
}

#contacts li {
  margin: 1rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.contact-link {
  color: #0077cc;
  text-decoration: none;
  transition: color 0.3s ease;
  font-weight: 600;
}

.contact-link:hover {
  color: #005fa3;
}

body.dark .contact-link {
  color: #66ccff;
}

body.dark .contact-link:hover {
  color: #3399cc;
}

.contact-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.75rem;
  background: #ffd966;
  color: #333;
  font-weight: 600;
  vertical-align: middle;
}

body.dark .contact-badge {
  background: #cfa93d;
  color: #fff;
}

/* Telegram акцент */
.tg-highlight {
  font-weight: 600;
  position: relative;
}

.tg-highlight::after {
  content: "";
  position: absolute;
  height: 2px;
  left: 0;
  right: 0;
  bottom: -2px;
  background: currentColor;
  opacity: 0.8;
  transition: 0.25s ease;
}

.tg-highlight:hover::after {
  opacity: 1;
  bottom: -3px;
}

/* =========================
   ФУТЕР
========================= */
footer {
  background: #f8f8f8;
  border-top: 1px solid #e0e0e0;
  padding: 2rem 1rem;
  margin-top: 2rem;
}

body.dark footer {
  background: #2a2a2a;
  border-color: #444;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-contact {
  color: #0077cc;
  text-decoration: none;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.3s ease;
  display: inline-block;
}

.footer-contact:hover {
  transform: translateY(-1px);
}

body.dark .footer-contact {
  color: #66ccff;
}

/* =========================
   СОЦИАЛЬНЫЕ СЕТИ
========================= */
.footer-socials {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-socials .social-link {
  display: inline-block;
  padding: 0.4rem;
  transition: all 0.3s ease;
}

.footer-socials .social-link:hover {
  transform: translateY(-1px);
}

.footer-socials .social-link img {
  width: 28px;
  height: 28px;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.footer-socials .social-link:hover img {
  opacity: 1;
}

.socials-section {
  justify-content: center;
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* =========================
   ФУТЕР - РАЗРАБОТЧИК
========================= */
.developer-credit {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #666;
}

body.dark .developer-credit {
  color: #ccc;
}

.craftify-link {
  color: #0077cc;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.craftify-link:hover {
  color: #005fa3;
  transform: translateY(-1px);
}

body.dark .craftify-link {
  color: #66ccff;
}

body.dark .craftify-link:hover {
  color: #3399cc;
}

.craftify-link::after {
  content: "↗";
  font-size: 0.8em;
  opacity: 0.7;
}

/* =========================
   ФУТЕР - ССЫЛКИ
========================= */
.footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
}

/* =========================
   УТИЛИТЫ
========================= */
.server-x {
  color: #2ecc71;
  font-weight: 600;
}

.server-y {
  color: #e67e22;
  font-weight: 600;
}

/* =========================
   МОБИЛЬНАЯ ВЕРСИЯ (768px и меньше)
========================= */
@media (max-width: 768px) {
  main {
    max-width: 100%;
    width: 100%;
    padding: 1rem 0.5rem;
    box-sizing: border-box;
    margin-top: 0;
  }

  header {
    position: relative;
    padding: 0.75rem;
    max-height: none;
    min-height: 70px;
  }

  .header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: nowrap;
  }

  /* Логотип и название на мобильных */
  .logo-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0; /* Для правильного обрезания текста */
  }

  .logo {
    height: 40px;
    width: 40px;
    flex-shrink: 0;
  }

  .title-box {
    text-align: left;
    min-width: 0;
    flex: 1;
  }

  .title-box h1 {
    font-size: 1.2rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .title-box p {
    font-size: 0.7rem;
    margin: 0;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block; /* Всегда показываем описание */
  }

  body.dark .title-box p {
    color: #ccc;
  }

  /* Кнопка меню */
  .navbtn {
    position: relative;
    top: auto;
    left: auto;
    margin-right: 0.5rem;
    flex-shrink: 0;
  }

  /* Переключатель темы */
  .theme-toggle {
    margin-left: 0;
    flex-shrink: 0;
    width: 50px;
    height: 25px;
  }

  .theme-toggle-track {
    width: 50px;
  }

  .theme-toggle-thumb {
    height: 20px;
    width: 20px;
  }

  body.dark .theme-toggle-thumb {
    transform: translate(25px, -50%);
  }

  .theme-icon {
    font-size: 12px;
  }

  .theme-icon.sun { left: 6px; }
  .theme-icon.moon { right: 6px; }

  /* Остальные стили для мобильной версии */
  .cards {
    grid-template-columns: 1fr;
  }

  .card {
    width: 100%;
    box-sizing: border-box;
  }

  .card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  }

  body.dark .card:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
  }

  .section {
    margin: 1rem 0;
    padding: 1.5rem;
  }

  .nav-menu.active ~ .header-container .navbtn {
    left: 215px;
  }

  .nav-menu {
    width: 180px;
    padding: 5rem 1rem;
  }

  /* Адаптивность для подменю на мобильных */
  .nav-submenu {
    margin-left: 0.5rem;
    padding-left: 0.5rem;
  }
  
  .nav-submenu a {
    font-size: 0.85rem;
    padding: 0.2rem 0.4rem;
  }

  /* Баннер поддержки */
  .support-banner {
    position: static;
    top: auto;
    order: 3;
    width: 100%;
    margin-top: 0rem;
    border-radius: 0;
    box-shadow: none;
  }

  .support-banner-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding-right: 3rem;
  }

  .support-close {
    top: 0.5rem;
    right: 0.5rem;
    transform: none;
  }

  .support-text {
    font-size: 0.9rem;
  }

  .support-btn {
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
  }

  /* Адаптивность для футера */
  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }
  
  .developer-credit {
    margin-top: 0.8rem;
  }

  .footer-links {
    align-items: center;
    gap: 0.8rem;
    margin-top: 1rem;
  }
}

/* =========================
   ДОПОЛНИТЕЛЬНЫЕ ИСПРАВЛЕНИЯ ДЛЯ ОЧЕНЬ МАЛЕНЬКИХ ЭКРАНОВ
========================= */
@media (max-width: 480px) {
  .title-box h1 {
    font-size: 1.8rem;
  }

  .title-box p {
    font-size: 0.7rem;
  }

  .logo {
    height: 48px;
    width: 48px;
  }

  .logo-box {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1; /* Даёт занять всё пространство между кнопкой и меню */
    gap: 0.7rem;
  }

  #nav-btn {
    margin-right: 0.5rem;
  }

  .support-banner {
    padding: 0.6rem 0.8rem;
  }
  
  .support-text {
    font-size: 0.85rem;
  }
  
  .support-btn {
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
  }

  .footer-links {
    flex-direction: column;
    gap: 0.5rem;
  }
}

@media (max-width: 360px) {
  .logo {
    height: 42px;
    width: 42px;
  }

  .title-box h1 {
    font-size: 1.4rem;
  }

  .title-box p {
    font-size: 0.65rem;
  }
}

/* =========================
   СТИЛИ ДЛЯ КНОПКИ ДОНАТА В МЕНЮ
========================= */
.donation-link {
  color: #ff6b6b !important;
  font-weight: 700 !important;
}

body.dark .donation-link {
  color: #ff8787 !important;
}

.donation-link:hover {
  color: #ff5252 !important;
  background: rgba(255, 107, 107, 0.1) !important;
}

body.dark .donation-link:hover {
  color: #ff6b6b !important;
  background: rgba(255, 135, 135, 0.1) !important;
}

/* =========================
   УБИРАЕМ ЛИШНИЕ ОТСТУПЫ ДЛЯ ГЛАВНОГО КОНТЕНТА
========================= */
main {
  max-width: 80%;
  margin: 0 auto;
  padding: 1rem 1rem;
  margin-top: 70px;
}

@media (max-width: 768px) {
  main {
    max-width: 100%;
    padding: 0.5rem 0.5rem;
    margin-top: 0;
  }
}