/* ============================================================
   ДОСТИГАТОР — Основные стили (дизайн-система)
   Стиль: dark glassmorphism + neon accent
   ============================================================ */

/* ------------------------------------------------------------
   Google Fonts: Montserrat + Inter + JetBrains Mono
   ------------------------------------------------------------ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&family=Montserrat:wght@600;700;800;900&display=swap');

/* ------------------------------------------------------------
   CSS-переменные (дизайн-система)
   ------------------------------------------------------------ */
:root {
  /* Фоны */
  --bg-primary:     #0a0a0f;
  --bg-secondary:   #12121a;
  --bg-glass:       rgba(255, 255, 255, 0.05);
  --bg-glass-hover: rgba(255, 255, 255, 0.08);

  /* Акценты */
  --accent-purple:  #7c3aed;
  --accent-purple-dim: rgba(124, 58, 237, 0.15);
  --accent-cyan:    #06b6d4;
  --accent-cyan-dim: rgba(6, 182, 212, 0.15);
  --accent-green:   #10b981;
  --accent-green-dim: rgba(16, 185, 129, 0.15);
  --accent-red:     #ef4444;
  --accent-red-dim: rgba(239, 68, 68, 0.15);
  --accent-gold:    #f59e0b;
  --accent-gold-dim: rgba(245, 158, 11, 0.15);

  /* Текст */
  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;

  /* Границы */
  --border-glass:   rgba(255, 255, 255, 0.1);
  --border-glass-hover: rgba(255, 255, 255, 0.2);

  /* Тени */
  --shadow-neon-purple: 0 0 30px rgba(124, 58, 237, 0.3);
  --shadow-neon-cyan:   0 0 30px rgba(6, 182, 212, 0.3);
  --shadow-neon-green:  0 0 30px rgba(16, 185, 129, 0.3);
  --shadow-neon-red:    0 0 30px rgba(239, 68, 68, 0.3);
  --shadow-neon-gold:   0 0 30px rgba(245, 158, 11, 0.3);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);

  /* Скругления */
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Шрифты */
  --font-heading: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

  /* Переходы */
  --transition-fast: 150ms cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-normal: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-slow: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Z-index */
  --z-base: 1;
  --z-dropdown: 100;
  --z-modal-backdrop: 200;
  --z-modal: 300;
  --z-toast: 400;
  --z-tooltip: 500;
}

/* ------------------------------------------------------------
   Сброс и базовые стили
   ------------------------------------------------------------ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Фоновый градиент (эффект глубины) */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(124, 58, 237, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(6, 182, 212, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(16, 185, 129, 0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: -1;
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--accent-purple);
}

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

ul, ol {
  list-style: none;
}

/* ------------------------------------------------------------
   Типографика
   ------------------------------------------------------------ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }

.text-gradient {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

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

.text-mono {
  font-family: var(--font-mono);
}

.text-gold {
  color: var(--accent-gold);
}

.text-red {
  color: var(--accent-red);
}

.text-green {
  color: var(--accent-green);
}

.text-center {
  text-align: center;
}

/* ------------------------------------------------------------
   Layout: Container / Grid
   ------------------------------------------------------------ */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.container--narrow {
  max-width: 800px;
}

.container--wide {
  max-width: 1400px;
}

.page {
  padding: 20px 0;
  min-height: 100vh;
}

/* ------------------------------------------------------------
   Header
   ------------------------------------------------------------ */
.header {
  position: sticky;
  top: 0;
  z-index: var(--z-dropdown);
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
  padding: 12px 0;
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--text-primary);
  text-decoration: none;
}

.header__logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: var(--shadow-neon-purple);
}

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

.header__nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.header__nav-link:hover,
.header__nav-link.active {
  color: var(--text-primary);
  background: var(--bg-glass);
  border-color: var(--border-glass);
}

.header__nav-link.active {
  color: var(--accent-purple);
}

.header__balance {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--accent-gold);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.header__balance:hover {
  background: var(--bg-glass-hover);
  box-shadow: var(--shadow-neon-gold);
}

.header__balance-icon {
  font-size: 1.1rem;
}

.header__user {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 12px 4px 4px;
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
}

.header__user:hover {
  background: var(--bg-glass);
}

.header__avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: white;
}

.header__user-name {
  font-weight: 500;
  font-size: 0.9rem;
}

/* ------------------------------------------------------------
   Кнопки
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-lg);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:active {
  transform: scale(0.96);
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent-purple), #6d28d9);
  color: white;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
}

.btn--primary:hover {
  box-shadow: 0 6px 30px rgba(124, 58, 237, 0.6);
  transform: translateY(-2px);
}

.btn--secondary {
  background: var(--bg-glass);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
}

.btn--secondary:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-glass-hover);
}

.btn--success {
  background: linear-gradient(135deg, var(--accent-green), #059669);
  color: white;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
}

.btn--success:hover {
  box-shadow: 0 6px 30px rgba(16, 185, 129, 0.6);
  transform: translateY(-2px);
}

.btn--danger {
  background: linear-gradient(135deg, var(--accent-red), #dc2626);
  color: white;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
}

.btn--danger:hover {
  box-shadow: 0 6px 30px rgba(239, 68, 68, 0.6);
  transform: translateY(-2px);
}

.btn--gold {
  background: linear-gradient(135deg, var(--accent-gold), #d97706);
  color: white;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
}

.btn--gold:hover {
  box-shadow: 0 6px 30px rgba(245, 158, 11, 0.6);
  transform: translateY(-2px);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 16px;
}

.btn--ghost:hover {
  color: var(--text-primary);
  background: var(--bg-glass);
}

.btn--sm {
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: var(--radius-md);
}

.btn--lg {
  padding: 16px 32px;
  font-size: 1.1rem;
  border-radius: var(--radius-xl);
}

.btn--full {
  width: 100%;
}

.btn--icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* ------------------------------------------------------------
   Карточки (Glassmorphism)
   ------------------------------------------------------------ */
.card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: all var(--transition-normal);
}

.card:hover {
  border-color: var(--border-glass-hover);
  box-shadow: var(--shadow-card), var(--shadow-neon-purple);
}

.card--compact {
  padding: 16px;
  border-radius: var(--radius-lg);
}

.card--glow-purple {
  box-shadow: var(--shadow-card), var(--shadow-neon-purple);
}

.card--glow-cyan {
  box-shadow: var(--shadow-card), var(--shadow-neon-cyan);
}

.card--glow-green {
  box-shadow: var(--shadow-card), var(--shadow-neon-green);
}

.card--glow-gold {
  box-shadow: var(--shadow-card), var(--shadow-neon-gold);
}

/* ------------------------------------------------------------
   Формы
   ------------------------------------------------------------ */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px var(--accent-purple-dim);
  background: rgba(255, 255, 255, 0.08);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ------------------------------------------------------------
   Модальные окна
   ------------------------------------------------------------ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-modal-backdrop);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  z-index: var(--z-modal);
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-2xl);
  padding: 32px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.modal.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal__title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
}

.modal__close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal__close:hover {
  background: var(--accent-red-dim);
  color: var(--accent-red);
  border-color: var(--accent-red);
}

/* ------------------------------------------------------------
   Прогресс-бар
   ------------------------------------------------------------ */
.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-cyan));
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.progress-bar__fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-bar--green .progress-bar__fill {
  background: linear-gradient(90deg, var(--accent-green), #34d399);
}

.progress-bar--red .progress-bar__fill {
  background: linear-gradient(90deg, var(--accent-red), #f87171);
}

/* ------------------------------------------------------------
   Бейджи / Теги
   ------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge--purple {
  background: var(--accent-purple-dim);
  color: var(--accent-purple);
  border: 1px solid rgba(124, 58, 237, 0.3);
}

.badge--cyan {
  background: var(--accent-cyan-dim);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.badge--green {
  background: var(--accent-green-dim);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge--red {
  background: var(--accent-red-dim);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge--gold {
  background: var(--accent-gold-dim);
  color: var(--accent-gold);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* ------------------------------------------------------------
   Утилиты
   ------------------------------------------------------------ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.p-16 { padding: 16px; }
.p-24 { padding: 24px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ------------------------------------------------------------
   Скроллбар
   ------------------------------------------------------------ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ------------------------------------------------------------
   Toast-уведомления
   ------------------------------------------------------------ */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(20px);
}

.toast--success {
  border-left: 3px solid var(--accent-green);
}

.toast--error {
  border-left: 3px solid var(--accent-red);
}

.toast--warning {
  border-left: 3px solid var(--accent-gold);
}

.toast--info {
  border-left: 3px solid var(--accent-cyan);
}

.toast__icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.toast__message {
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.4;
}

.toast__close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  transition: color var(--transition-fast);
}

.toast__close:hover {
  color: var(--text-primary);
}

@keyframes toast-in {
  0% {
    opacity: 0;
    transform: translateX(100px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.toast.removing {
  animation: toast-out 0.3s ease-in forwards;
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(100px) scale(0.9);
  }
}

/* ------------------------------------------------------------
   Адаптивность
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.5rem; }

  .header__inner {
    flex-wrap: wrap;
    gap: 8px;
  }

  .header__nav {
    order: 3;
    width: 100%;
    justify-content: center;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .header__balance {
    font-size: 0.85rem;
    padding: 6px 12px;
  }

  .modal {
    max-width: 95vw;
    padding: 20px;
    border-radius: var(--radius-xl);
  }

  .container {
    padding: 0 16px;
  }

  .btn--lg {
    padding: 14px 24px;
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .header__user-name {
    display: none;
  }

  .header__nav-link span {
    display: none;
  }

  .toast-container {
    left: 16px;
    right: 16px;
    max-width: none;
  }
}
