/* ==============================================================================
   DARK CORE DESIGN SYSTEM — Universal Tokens (Universal Standard Specification)
   ============================================================================== */

:root {
  /* ── Базовые поверхности (Тёмная тема по умолчанию) ── */
  --bg:            #080808; /* Основной фон приложения */
  --surface:       #111111; /* Карточки, модалки, сайдбар, топбар */
  --surface-alt:   #181818; /* Вложенные блоки, инпуты, селекторы, ховеры строк */
  --surface-hover: #1e1e1e; /* Ховер интерактивных кнопок и карточек */

  /* ── Границы и разделители ── */
  --border:        #2a2a2a; /* Базовый бордер всех контейнеров */
  --border-hover:  #3d3d3d; /* Бордер при наведении и фокусе */

  /* ── Типографика ── */
  --text:          #e2e8f0; /* Основной читабельный текст (Zinc-200) */
  --text-muted:    #71717a; /* Второстепенный текст, подписи (Zinc-500) */
  --text-dim:      #404047; /* Неактивные лейблы, мелкие подписи */

  /* ── Акценты и Навигация ── */
  --accent:              #6366f1; /* Базовый акцентный индиго */
  --nav-active-text:     #ffffff;
  --nav-active-bg:       linear-gradient(90deg, rgba(96, 165, 250, 0.12) 0%, rgba(96, 165, 250, 0.03) 100%);
  --nav-active-border:   rgba(96, 165, 250, 0.25);
  --nav-active-accent:   #60a5fa;

  /* ── Семантические статусы ── */
  --red:       #ef4444; /* Ошибка, критический алерт, бан, оффлайн */
  --red-soft:  #f87171;
  --green:     #10b981; /* Успех, активный онлайн, подтверждение */
  --yellow:    #f59e0b; /* Предупреждение, донат, ожидание */
  --blue:      #60a5fa; /* Инфо, системные сообщения */

  /* ── Размеры и Анимации ── */
  --radius:    6px;   /* ЕДИНЫЙ ГЛОБАЛЬНЫЙ РАДИУС СКРУГЛЕНИЯ */
  --sidebar-w: 240px;
  --topbar-h:  52px;
  --t:         150ms ease;
  --transition-timing: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Светлая тема (Light Mode: [data-theme="light"]) ── */
[data-theme="light"] {
  --bg:            #f4f4f6;
  --surface:       #ffffff;
  --surface-alt:   #f0f0f3;
  --surface-hover: #e5e5eb;

  --border:        #e2e2e8;
  --border-hover:  #c8c8d2;

  --text:          #111827;
  --text-muted:    #6b7280;
  --text-dim:      #9ca3af;

  --nav-active-text:   #1d4ed8;
  --nav-active-bg:     linear-gradient(90deg, rgba(37, 99, 235, 0.1) 0%, rgba(37, 99, 235, 0.02) 100%);
  --nav-active-border: rgba(37, 99, 235, 0.3);
  --nav-active-accent: #2563eb;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg);
  color: var(--text);
  transition: background-color var(--t), color var(--t);
}

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius); }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* Geometric Grid Background (4.1) */
.bg-grid-pattern {
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}

/* ── Базовая кнопка (4.1) ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  border: 2px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
  transition: background var(--t), border-color var(--t), transform var(--t);
  white-space: nowrap;
  line-height: 1;
  user-select: none;
  text-decoration: none;
}
.btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}
.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 600;
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 85%, white);
  border-color: color-mix(in srgb, var(--accent) 85%, white);
  transform: translateY(-1px);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.25);
  color: var(--red-soft);
  font-weight: 600;
}
.btn-danger:hover {
  background: var(--red);
  border-color: var(--red);
  color: #ffffff;
}

.btn-control {
  height: 34px;
  padding: 0 10px;
  background: var(--surface-alt);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background var(--t), border-color var(--t), transform var(--t);
  user-select: none;
  text-decoration: none;
}
.btn-control:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
}
.btn-control:active {
  transform: scale(0.98);
}

/* ── Статусные точки (Zero-Radius Rule: строго микроквадрат 7x7px, border-radius: 2px) ── */
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  flex-shrink: 0;
  margin-right: 5px;
  vertical-align: middle;
}
.dot-green { background: var(--green); }
.dot-red   { background: var(--red); }
.dot-yellow { background: var(--yellow); }

/* ── Бейджи (4.5) ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  white-space: nowrap;
}

/* ── Аватар (СТРОГИЙ КВАДРАТ, border-radius: 6px, НИКАКИХ КРУГОВ) ── */
.avatar {
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--surface-alt);
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-alt);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  flex-shrink: 0;
}

/* ── Языковое выпадающее меню (4.11) ── */
.lang-dropdown-wrapper {
  position: relative;
}

.lang-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 170px;
  background: var(--surface);
  border: 2px solid var(--border-hover);
  border-radius: var(--radius);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 1000;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65);
}

.lang-dropdown-menu.open {
  display: flex;
  animation: dropdownFadeIn 140ms ease;
}

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

.lang-dropdown-item {
  background: transparent;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  padding: 8px 12px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: var(--t);
}

.lang-dropdown-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.lang-dropdown-item.active {
  color: #f59e0b;
  font-weight: 600;
  background: rgba(245, 158, 11, 0.08);
}

.lang-dropdown-item.active i {
  color: #f59e0b;
}

.lang-label-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-flag {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ── Система уведомлений (4.14) ── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 15px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  min-width: 240px;
  max-width: 380px;
  pointer-events: all;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  animation: toastIn 150ms ease forwards;
}

.toast-error   { border-color: var(--red); }
.toast-success { border-color: var(--green); }
.toast-info    { border-color: var(--blue); }

.toast-icon {
  font-size: 13px;
  flex-shrink: 0;
}
.toast-error   .toast-icon { color: var(--red); }
.toast-success .toast-icon { color: var(--green); }
.toast-info    .toast-icon { color: var(--blue); }

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