/* ===== 1. ПЕРЕМЕННЫЕ (СИСТЕМА ДИЗАЙНА) ===== */
:root {
  /* Цвета: Тёмная тема */
  --bg: #05060a;
  --bg-secondary: #0f1117;
  --bg-tertiary: #14161e;
  --text: #e6edf3;
  --text-muted: #7d8590;
  --text-secondary: #b1bac4;
  --border: rgba(48, 54, 61, 0.6);
  --primary: #3fb950;
  --primary-glow: rgba(63, 185, 80, 0.15);
  --accent: #58a6ff;
  --accent-glow: rgba(88, 166, 255, 0.15);
  --accent-pink: #f778ba;

  /* Эффекты */
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 12px 32px rgba(88, 166, 255, 0.2);
  --gradient-line: linear-gradient(90deg, transparent, var(--primary), var(--accent), transparent);

  /* Размеры */
  --header-h: 52px;
  --sidebar-w: 280px;
  --sidebar-collapsed-w: 80px;
  --sidebar-nav-pad: 0.75rem;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s ease;
  --grid-transition-delay: 0.3s;
}

[data-theme="light"] {
  --bg: #fafbfc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f6f8fa;
  --text: #1f2328;
  --text-muted: #6e7781;
  --text-secondary: #59636e;
  --border: rgba(208, 215, 222, 0.8);
  --primary: #2da44e;
  --primary-glow: rgba(45, 164, 78, 0.12);
  --accent: #0969da;
  --accent-glow: rgba(9, 105, 218, 0.08);
  --accent-pink: #d1246e;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 12px 32px rgba(9, 105, 218, 0.15);
}

/* ===== 2. БАЗОВЫЕ СБРОСЫ ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.3s, color 0.2s;
  position: relative;
}

/* НОВОЕ: добавляем радиальный градиент на body для фоновой глубины */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  opacity: 0.7;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent);
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
  position: relative;
  z-index: 2;
  width: 100%;
}

/* ===== 3. КОМПОНЕНТЫ ===== */
.card,
.terminal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: all var(--transition-base);
  backdrop-filter: blur(10px);
}

.card:hover,
.terminal-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  margin: -1.5rem -1.5rem 1.5rem -1.5rem;
}

.terminal-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.terminal-dot.red {
  background: #f85149;
}

.terminal-dot.yellow {
  background: #d29922;
}

.terminal-dot.green {
  background: var(--primary);
}

.terminal-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: 8px;
  font-family: var(--font-mono);
}

.terminal-body {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  background: var(--terminal-bg, #0a0c12);
  padding: 1.5rem;
}

.terminal-line {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.terminal-prompt {
  color: var(--primary);
  font-weight: 600;
  margin-right: 8px;
}

.terminal-command {
  color: var(--accent);
}

.terminal-output {
  color: var(--text-muted);
}

.terminal-cursor::after {
  content: '▋';
  animation: blink 1s step-end infinite;
  color: var(--primary);
  margin-left: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.5rem;
  font-weight: 600;
  border-radius: 40px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--bg-tertiary);
  font-size: 0.9rem;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  color: white;
}

.btn-outline {
  border-color: var(--border);
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-sm {
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 0.8rem 2rem;
  font-size: 1rem;
}

/* ===== 4. ЛЕЙАУТ ===== */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-h);
  backdrop-filter: blur(12px);
  background: rgba(5, 6, 10, 0.8);
  border-bottom: 1px solid var(--border);
}

[data-theme="light"] .header {
  background: rgba(250, 251, 252, 0.8);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 1.5rem;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.logo-img {
  height: 28px;
  width: auto;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.02em;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-glow);
}

.main-content {
  position: relative;
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  width: calc(100% - var(--sidebar-w));
  min-height: calc(100vh - var(--header-h));
  padding: 0;
  box-sizing: border-box;
  background: var(--bg);
  z-index: 1;
  padding: 0 0 80px 0;
  transition: margin-left 0.2s ease, width 0.2s ease;
}

.content-wrapper {
  width: 100%;
  padding: 0;
  margin: 0;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: 3rem;
  background: var(--bg-secondary);
  margin-left: var(--sidebar-w);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  justify-items: center;
}

.footer-section h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text);
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-link {
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.5rem;
}

.footer-link a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-link a:hover {
  color: var(--primary);
}

.footer-social {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.social-link:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
}

.social-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  padding: 0.25rem 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.7rem;
  color: var(--text);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  pointer-events: none;
}

.social-link:hover .social-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-12px);
}

.footer-bottom {
  text-align: center;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
}

.scroll-to-top {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 45px;
  height: 45px;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--primary-glow);
  transition: all var(--transition-base);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.scroll-to-top:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

img, svg {
  display: block;
  max-width: 100%;
}

.icon-wrapper svg {
  width: 24px;
  height: 24px;
}

/* ===== 5. HERO И СПЕЦЭЛЕМЕНТЫ ===== */
section.hero {
  display: block;
  width: 100%;
  padding: 8rem 0 3rem 0;
  margin: 0;
  box-sizing: border-box;
}

.hero-outer-container {
  position: absolute;
  width: 100%;
  background: radial-gradient(ellipse at 30% 40%, var(--primary, #3fb950) 0%, transparent 60%);
  opacity: 0.05;
  pointer-events: none;
  filter: blur(60px);
"
}

.hero-inner-container {
  position: relative;
  z-index: 2;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  width: 100%;
  box-sizing: border-box;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.45rem 1.3rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  backdrop-filter: blur(4px);
  margin-bottom: 1.8rem;
  width: max-content;
}

.hero-badge p {
  margin: 0;
}

.hero-tag {
  margin: 0;
}

.hero-badge-pulse {
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  display: inline-block;
  animation: pulse 1.5s ease-out infinite;
  box-shadow: 0 0 12px var(--primary);
}

.hero h1 {
  font-size: 3.25rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1.5rem;
  color: var(--text);
}

@media (max-width: 768px) {
  .hero h1 {
    font-size: 3rem;
  }
}

.hero h1 span {
  will-change: background-position;
}

.paint-text {
  background: linear-gradient(135deg, #00de1e, #1779e9, #9f67ff);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: textShine 8s linear infinite;
}

.hero-description {
  font-size: 1.25rem;
  color: var(--text-secondary, #b1bac4);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
  width: 100%;
}

.hero-video-container {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

@media (max-width: 768px) {
  .hero-video-container {
    justify-content: center;
  }
}

@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

/* ===== 6. УВЕДОМЛЕНИЯ ===== */
.messages-container {
  position: fixed;
  top: calc(var(--header-h) + 20px);
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
}

.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: fadeIn 0.3s ease;
  backdrop-filter: blur(10px);
}

.alert-success {
  border-left: 4px solid var(--primary);
}

.alert-error {
  border-left: 4px solid #f85149;
}

.alert-info {
  border-left: 4px solid var(--accent);
}

.alert-content {
  color: var(--text);
}

.alert-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0;
  transition: color var(--transition-fast);
}

.alert-close:hover {
  color: var(--text);
}

/* ===== 7. УТИЛИТЫ ===== */
.gradient-line {
  height: 2px;
  background: var(--gradient-line);
  background-size: 200%;
  animation: shift 8s linear infinite;
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--accent), #a371f7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 200% auto;
  animation: shimmer 6s linear infinite;
}

.text-muted {
  color: var(--text-muted);
}

.footer-text-muted {
  color: var(--text-muted);
}

.text-secondary {
  color: var(--text-secondary);
}

.d-none {
  display: none !important;
}

.d-md-none {
  display: block;
}

.d-md-flex {
  display: none;
}

.d-md-inline {
  display: inline;
}

/* ===== 8. АНИМАЦИИ ===== */
@keyframes shift {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

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

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

@keyframes pulse {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

@keyframes blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

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

:root {
  --terminal-bg: #0a0c12;
  --accent-blue: #58a6ff;
}

[data-theme="light"] {
  --terminal-bg: #ffffff;
  --accent-blue: #0969da;
}

/* ===== 9. АДАПТИВ ===== */

@media (max-width: 768px) {
  :root {
    --header-h: 48px;
  }

  .container {
    padding: 0 1rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
    justify-items: flex-start;
  }

  .d-md-none {
    display: none !important;
  }

  .d-md-flex {
    display: flex !important;
  }

  .d-md-inline {
    display: none !important;
  }

  .logo-text {
    font-size: 1.1rem;
  }

  .messages-container {
    top: calc(var(--header-h) + 10px);
    right: 10px;
    left: 10px;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .header-container {
    padding: 0 1rem;
  }

  .theme-toggle {
    width: 32px;
    height: 32px;
  }
}

@media (max-width: 768px) {
  .hero-description {
    font-size: 1rem;
  }
}

/* ===== ГЛАВНАЯ - ГРАДИЕНТНЫЙ ЗАГОЛОВОК ===== */
.gradient-text-main {
  background: linear-gradient(135deg, var(--primary, #3fb950), var(--accent, #58a6ff), #a371f7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 200% auto;
  animation: shimmer 6s linear infinite;
  font-size: clamp(2.8rem, 10vw, 6rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}


/* ===== МОДАЛЬНОЕ ОКНО - ИСПРАВЛЕННАЯ ВЕРСИЯ ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1055;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  outline: 0;
}

.modal-dialog {
  position: relative;
  width: auto;
  margin: 1.75rem auto;
  pointer-events: none;
}

.modal.fade .modal-dialog {
  transition: transform 0.3s ease-out;
  transform: translate(0, -50px);
}

.modal.show .modal-dialog {
  transform: none;
}

.modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  pointer-events: auto;
  background-color: var(--bg-secondary);
  background-clip: padding-box;
  border: 1px solid var(--border);
  border-radius: 20px;
  outline: 0;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Красивая анимация для модалки */
.modal.fade .modal-content {
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Хедер модального окна с градиентом */
.modal-header {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  background: linear-gradient(135deg, rgba(63, 185, 80, 0.1), rgba(88, 166, 255, 0.05));
}

.modal-header .modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.modal-header .btn-close {
  background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23888'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;
  opacity: 0.7;
  transition: all 0.2s ease;
}

.modal-header .btn-close:hover {
  opacity: 1;
  transform: rotate(90deg);
}

/* Тело модального окна */
.modal-body {
  position: relative;
  flex: 1 1 auto;
  padding: 1.75rem;
}

/* Поля ввода */
.modal-body .form-control {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  color: var(--text);
  transition: all 0.2s ease;
}

.modal-body .form-control::placeholder {
  color: var(--text-muted);
}

.modal-body .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.1);
  background: var(--bg-tertiary);
}

.modal-body .form-control.is-invalid {
  border-color: #f85149;
  box-shadow: 0 0 0 3px rgba(248, 81, 73, 0.1);
}

.modal-body .form-control.is-invalid:focus {
  border-color: #f85149;
  box-shadow: 0 0 0 3px rgba(248, 81, 73, 0.2);
}

/* Чекбокс */
.modal-body .form-check-input {
  width: 1.2em;
  height: 1.2em;
  margin-top: 0.1em;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.modal-body .form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

.modal-body .form-check-label {
  margin-left: 0.5rem;
  color: var(--text-secondary);
}

.modal-body .hint-text {
  color: var(--text-muted);
}

/* Футер */
.modal-footer {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  padding: 1rem 1.5rem 1.5rem;
  border-top: 1px solid var(--border);
  border-bottom-right-radius: 20px;
  border-bottom-left-radius: 20px;
  gap: 0.75rem;
}

/* Кнопки */
.modal-footer .btn {
  padding: 0.6rem 1.5rem;
  border-radius: 40px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.modal-footer .btn-secondary {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text);
}

.modal-footer .btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.modal-footer .btn-primary {
  background: linear-gradient(135deg, var(--primary), #2da44e);
  border: none;
  color: white;
  box-shadow: 0 4px 12px rgba(63, 185, 80, 0.3);
}

.modal-footer .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(63, 185, 80, 0.4);
  filter: brightness(1.05);
}

/* Алерты внутри модалки */
.modal-body .alert {
  margin-top: 1rem;
  border-radius: 12px;
  padding: 1rem;
  border: none;
}

.modal-body .alert-success {
  background: rgba(63, 185, 80, 0.15);
  color: var(--primary);
  border-left: 3px solid var(--primary);
}

.modal-body .alert-danger {
  background: rgba(248, 81, 73, 0.15);
  color: #f85149;
  border-left: 3px solid #f85149;
}

/* Спиннер */
.modal-body .spinner-border {
  color: var(--primary);
}

/* Бекдроп (затемнение фона) */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1050;
  width: 100vw;
  height: 100vh;
  background-color: #000;
}

.modal-backdrop.fade {
  opacity: 0;
}

.modal-backdrop.show {
  opacity: 0.6;
}

/* Адаптивность */
@media (min-width: 576px) {
  .modal-dialog {
    max-width: 500px;
    margin: 1.75rem auto;
  }

  .modal-dialog-centered {
    min-height: calc(100% - 3.5rem);
  }
}

@media (max-width: 576px) {
  .modal-dialog {
    margin: 1rem;
  }

  .modal-header {
    padding: 1rem;
  }

  .modal-body {
    padding: 1.25rem;
  }

  .modal-footer {
    padding: 0.75rem 1.25rem 1.25rem;
  }
}

.modal-lg {
  max-width: 700px;
}