/* Google Fonts moved to <link> in index.html for non-blocking loading */

/* ============================================================
   Aurora Fin — theme-v2.css
   Глобальная тёмная тема: премиум, Notion/Arc/Linear-вайб
   ============================================================ */

/* --- Сброс и базовые правила --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  color-scheme: dark;

  /* Основные цвета */
  --bg-primary:       #0a1628;
  --bg-surface:       rgba(255, 255, 255, 0.03);
  --bg-surface-hover: rgba(16, 185, 129, 0.06);
  --bg-card:          rgba(255, 255, 255, 0.03);

  /* Акценты */
  --accent-primary:   #10b981;
  --accent-secondary: #06b6d4;
  --accent-warning:   #f59e0b;
  --accent-danger:    #ef4444;

  /* Текст */
  --text-primary:   #f0f4f8;
  --text-secondary: #a0b4c8;
  --text-muted:     #6b7c93;

  /* Рамки */
  --border-default: rgba(16, 185, 129, 0.1);
  --border-hover:   rgba(16, 185, 129, 0.4);
  --border-focus:   rgba(16, 185, 129, 0.6);

  /* Тени */
  --shadow-card:  0 4px 30px rgba(0, 0, 0, 0.15);
  --shadow-hover: 0 8px 40px rgba(16, 185, 129, 0.12);
  --shadow-glow:  0 0 20px rgba(16, 185, 129, 0.2);

  /* Скругления */
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  /* Анимации */
  --spring:       cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --spring-out:   cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition:   400ms var(--spring);
}

html {
  scroll-behavior: smooth;
}

/* ============================================================
   Тело и анимированный фон Aurora
   ============================================================ */
body {
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(16, 185, 129, 0.15), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(6, 182, 212, 0.12), transparent 50%),
    radial-gradient(circle at 50% 100%, rgba(5, 150, 105, 0.10), transparent 50%);
  animation: aurora-drift 30s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

@keyframes aurora-drift {
  0%   { transform: translate(0, 0) scale(1);       opacity: 0.8; }
  50%  { transform: translate(5%, -3%) scale(1.1);  opacity: 1;   }
  100% { transform: translate(-3%, 4%) scale(0.95); opacity: 0.7; }
}

body > * {
  position: relative;
  z-index: 1;
}

/* ============================================================
   Типографика
   ============================================================ */
.mono, code, pre, .num,
[class*="price"], [class*="value"], [class*="count"],
[class*="percent"], [class*="rate"] {
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.75rem;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
}

h3 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin-bottom: 0.5rem;
}

h4, h5, h6 {
  font-weight: 600;
  color: var(--text-secondary);
}

p {
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

a {
  color: var(--accent-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-primary);
}

small, .muted, .hint {
  color: var(--text-muted);
  font-size: 0.8rem;
}

strong, b {
  font-weight: 600;
  color: var(--text-primary);
}

/* ============================================================
   Карточки, контейнеры, панели
   ============================================================ */
.card, .container, .panel, .section,
.widget, .block, .modal-content,
.box, .surface {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: transform var(--transition),
              border-color var(--transition),
              box-shadow var(--transition);
}

.card:hover, .panel:hover, .widget:hover, .box:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
}

/* Дополнительный padding для карточек с контентом */
.card { padding: 20px; }
.panel { padding: 24px; }

/* ============================================================
   Сетка и расположение
   ============================================================ */
.wrap, .wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }

.flex { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

/* ============================================================
   Кнопки
   ============================================================ */
.btn, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition),
              box-shadow var(--transition),
              background var(--transition),
              opacity var(--transition);
  white-space: nowrap;
  user-select: none;
}

.btn, button[type="submit"], .btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #fff;
  box-shadow: 0 2px 16px rgba(16, 185, 129, 0.3);
}

.btn:hover, button[type="submit"]:hover, .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.45);
}

.btn:active, button:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  backdrop-filter: blur(8px);
}

.btn-secondary:hover {
  border-color: var(--border-hover);
  background: rgba(16, 185, 129, 0.08);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.2);
  transform: translateY(-1px);
}

button:disabled, .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ============================================================
   Поля ввода
   ============================================================ */
input, select, textarea {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 10px 14px;
  width: 100%;
  outline: none;
  backdrop-filter: blur(8px);
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}

select option {
  background: #0a1628;
  color: var(--text-primary);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 6px;
}

.form-group {
  margin-bottom: 16px;
}

/* ============================================================
   Таблицы
   ============================================================ */
table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
  color: var(--text-primary);
}

thead tr {
  background: rgba(16, 185, 129, 0.06);
}

thead th {
  padding: 12px 14px;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-default);
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

tbody tr {
  transition: background var(--transition);
}

tbody tr:hover {
  background: rgba(16, 185, 129, 0.04);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ============================================================
   Бейджи и теги
   ============================================================ */
.badge, .tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.badge-success, .dir-long {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-primary);
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.15);
}

.badge-danger, .dir-short {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.15);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-info, .dir-neutral {
  background: rgba(107, 124, 147, 0.15);
  color: var(--text-muted);
  border: 1px solid rgba(107, 124, 147, 0.2);
}

.badge-cyan {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-secondary);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.new-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #fff;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-left: 6px;
  vertical-align: middle;
}

/* ============================================================
   Статус-индикаторы
   ============================================================ */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.live {
  background: var(--accent-primary);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  animation: pulse-ring 2s infinite;
}

.status-dot.warn {
  background: var(--accent-warning);
}

.status-dot.err {
  background: var(--accent-danger);
}

/* ============================================================
   Скроллбар
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(16, 185, 129, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(16, 185, 129, 0.5);
}

/* ============================================================
   Код и pre
   ============================================================ */
code {
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.85em;
  color: var(--accent-secondary);
}

pre {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 16px;
  overflow-x: auto;
  font-size: 0.85rem;
  color: var(--text-primary);
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* ============================================================
   Разделители и вспомогательные элементы
   ============================================================ */
hr {
  border: none;
  border-top: 1px solid var(--border-default);
  margin: 24px 0;
}

/* ============================================================
   Анимации — fade-in / scroll-reveal
   ============================================================ */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity   600ms var(--spring),
    transform 600ms var(--spring);
}

.fade-in.revealed {
  opacity: 1;
  transform: translateY(0);
}

.stagger-in > * {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity   500ms var(--spring),
    transform 500ms var(--spring);
}

.stagger-in.revealed > *:nth-child(1)  { transition-delay: 0ms;   opacity: 1; transform: none; }
.stagger-in.revealed > *:nth-child(2)  { transition-delay: 60ms;  opacity: 1; transform: none; }
.stagger-in.revealed > *:nth-child(3)  { transition-delay: 120ms; opacity: 1; transform: none; }
.stagger-in.revealed > *:nth-child(4)  { transition-delay: 180ms; opacity: 1; transform: none; }
.stagger-in.revealed > *:nth-child(5)  { transition-delay: 240ms; opacity: 1; transform: none; }
.stagger-in.revealed > *:nth-child(6)  { transition-delay: 300ms; opacity: 1; transform: none; }
.stagger-in.revealed > *:nth-child(7)  { transition-delay: 360ms; opacity: 1; transform: none; }
.stagger-in.revealed > *:nth-child(8)  { transition-delay: 420ms; opacity: 1; transform: none; }
.stagger-in.revealed > *:nth-child(n+9){ transition-delay: 480ms; opacity: 1; transform: none; }

/* ============================================================
   Skeleton загрузка
   ============================================================ */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.02) 0%,
    rgba(16, 185, 129, 0.06) 50%,
    rgba(255, 255, 255, 0.02) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
  border-radius: var(--radius-md);
  height: 80px;
  margin-bottom: 12px;
}

.skeleton-card  { height: 120px; }
.skeleton-line  { height: 16px; width: 100%; margin-bottom: 8px; }
.skeleton-short { height: 16px; width: 60%; }
.skeleton-title { height: 24px; width: 80%; margin-bottom: 12px; }

/* ============================================================
   Pulse — живой индикатор
   ============================================================ */
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  100% { box-shadow: 0 0 0 14px rgba(16, 185, 129, 0); }
}

.pulse {
  position: relative;
}

.pulse::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  animation: pulse-ring 2s infinite;
}

/* ============================================================
   Glow — свечение важных элементов
   ============================================================ */
.glow {
  box-shadow: 0 0 0 1px var(--accent-primary),
              0 0 16px rgba(16, 185, 129, 0.3);
  border-color: var(--accent-primary) !important;
}

/* ============================================================
   Float — плавающий элемент
   ============================================================ */
@keyframes float-up-down {
  0%, 100% { transform: translateY(0);    }
  50%       { transform: translateY(-8px); }
}

.float {
  animation: float-up-down 4s ease-in-out infinite;
}

/* ============================================================
   Page enter
   ============================================================ */
.page-enter {
  opacity: 0;
}

.page-entered {
  opacity: 1;
  transition: opacity 400ms ease;
}

/* ============================================================
   Спиннер кнопки при загрузке
   ============================================================ */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn.loading::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  margin-left: 8px;
  animation: spin 600ms linear infinite;
}

/* ============================================================
   Модальное окно
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
}

.modal-content {
  max-width: 600px;
  width: 100%;
  padding: 28px;
  max-height: 80vh;
  overflow-y: auto;
}

/* ============================================================
   Alert / уведомления
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--accent-primary);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: var(--accent-warning);
}

.alert-danger, .alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--accent-danger);
}

.alert-info {
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.25);
  color: var(--accent-secondary);
}

/* ============================================================
   Утилитарные классы
   ============================================================ */
.text-primary   { color: var(--text-primary)   !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted     { color: var(--text-muted)     !important; }
.text-success   { color: var(--accent-primary)   !important; }
.text-danger    { color: var(--accent-danger)    !important; }
.text-warning   { color: var(--accent-warning)   !important; }
.text-cyan      { color: var(--accent-secondary) !important; }

.text-right  { text-align: right;  }
.text-center { text-align: center; }
.text-left   { text-align: left;   }

.font-mono { font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }
.font-bold { font-weight: 700; }
.font-600  { font-weight: 600; }

.mt-8  { margin-top:    8px;  }
.mt-16 { margin-top:   16px;  }
.mt-24 { margin-top:   24px;  }
.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; }
.visible { visibility: visible; }

.rounded    { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }

/* ============================================================
   Медиазапросы
   ============================================================ */
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .grid-auto {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }

  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.2rem; }

  .card, .panel {
    padding: 16px;
  }

  .wrap, .wrapper {
    padding: 0 16px;
  }
}

@media (max-width: 480px) {
  body { font-size: 14px; }

  .grid-auto {
    grid-template-columns: 1fr;
  }
}
