/* ================================================================
   CS2 Scout Platform — main.css
   Design: strict industrial minimalism, zero neon, zero gradients
   ================================================================ */

/* ── Custom Properties ── */
:root {
  --bg:          #121212;
  --surface:     #1e1e1e;
  --surface-2:   #252525;
  --border:      #2e2e2e;
  --border-2:    #3a3a3a;

  --text:        #f0f0f0;
  --text-muted:  #8a8a8a;
  --text-faint:  #555;

  --accent:      #2563eb;
  --accent-hover:#1d4ed8;
  --accent-dim:  rgba(37,99,235,.12);

  --danger:      #c0392b;
  --danger-hover:#a93226;

  /* Status colours — muted, intentional */
  --s-looking:   #4a7c59;   /* deep muted green  */
  --s-testing:   #7a6a2a;   /* amber-brown       */
  --s-signed:    #2563eb;   /* accent blue       */
  --s-inactive:  #555;      /* neutral grey      */

  --radius:      6px;
  --radius-lg:   10px;
  --font:        'DM Mono', 'Courier New', monospace;
  --font-ui:     'DM Sans', system-ui, sans-serif;
  --shadow:      0 2px 12px rgba(0,0,0,.5);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  line-height: 1.55;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Google Fonts import (fallback to system if unavailable) ── */
@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@400;500;600&display=swap');

/* ================================================================
   LAYOUT
   ================================================================ */

.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.page__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.page__title {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.2;
}

.page__sub {
  font-size: .85rem;
  color: var(--text-muted);
  margin-top: .25rem;
}

/* Dashboard two-column grid */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .dash-grid { grid-template-columns: 1fr; }
}

/* ================================================================
   HEADER / NAV
   ================================================================ */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header__inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-mark {
  color: var(--accent);
  font-size: 1.25rem;
  font-family: var(--font);
}

.logo-text {
  font-family: var(--font);
  font-weight: 500;
  font-size: .9rem;
  letter-spacing: .12em;
  color: var(--text);
}

.site-nav {
  display: flex;
  gap: .25rem;
  flex: 1;
}

.site-nav__link {
  padding: .35rem .75rem;
  border-radius: var(--radius);
  font-size: .875rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color .15s, background .15s;
}

.site-nav__link:hover,
.site-nav__link.is-active {
  color: var(--text);
  background: var(--surface-2);
  text-decoration: none;
}

.site-nav__link.is-active {
  color: var(--accent);
}

.site-header__user {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-left: auto;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  color: var(--text-muted);
}

.user-chip__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--s-looking);
}

/* ================================================================
   CARD
   ================================================================ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.card__title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  color: var(--text);
  letter-spacing: -.01em;
}

/* ================================================================
   BUTTONS
   ================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .5rem 1rem;
  font-family: var(--font-ui);
  font-size: .875rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
  line-height: 1;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  text-decoration: none;
  color: #fff;
}

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-2);
}
.btn--ghost:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.btn--danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.btn--danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn--sm  { padding: .3rem .65rem; font-size: .8rem; }
.btn--full { width: 100%; justify-content: center; }

/* ================================================================
   FORM FIELDS
   ================================================================ */

.field { display: flex; flex-direction: column; gap: .35rem; }

.field__label {
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.field__input {
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: .9rem;
  padding: .55rem .75rem;
  transition: border-color .15s;
  width: 100%;
}

.field__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.field__input::placeholder { color: var(--text-faint); }

select.field__input { cursor: pointer; }

.field__textarea {
  resize: vertical;
  min-height: 80px;
  font-family: var(--font-ui);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.field--full { grid-column: 1 / -1; }

/* ================================================================
   DATA TABLE
   ================================================================ */

.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.data-table th {
  text-align: left;
  padding: .6rem .85rem;
  font-size: .73rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: .75rem .85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr {
  transition: background .1s;
}
.data-table tbody tr:hover {
  background: var(--surface-2);
}

.td--nick { font-weight: 500; }
.td--muted { color: var(--text-muted); font-size: .83rem; }
.td--empty {
  text-align: center;
  padding: 2.5rem !important;
  color: var(--text-muted);
  font-size: .875rem;
}
.td--actions {
  display: flex;
  gap: .4rem;
  white-space: nowrap;
}

.table-card { padding: 0; overflow: hidden; }
.table-card .table-wrap { margin: 0; }

/* ================================================================
   STATUS
   ================================================================ */

.status-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status--looking_for_team { background: var(--s-looking); }
.status--testing          { background: var(--s-testing); }
.status--signed           { background: var(--s-signed);  }
.status--inactive         { background: var(--s-inactive); }

/* Quick-status dropdown */
.status-select { position: relative; display: inline-block; }

.status-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .6rem;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: .8rem;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s;
}
.status-btn:hover { border-color: var(--accent); }

.status-arrow { font-size: .65rem; color: var(--text-muted); margin-left: .1rem; }

.status-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  list-style: none;
  min-width: 160px;
  z-index: 200;
  display: none;
  overflow: hidden;
}

.status-menu.is-open { display: block; }

.status-menu__item {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .55rem .85rem;
  background: none;
  border: none;
  font-family: var(--font-ui);
  font-size: .83rem;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background .1s;
}
.status-menu__item:hover    { background: var(--surface-2); }
.status-menu__item.is-current { color: var(--accent); }

/* ================================================================
   FILTER BAR
   ================================================================ */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: 1rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .7rem;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  font-size: .8rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: all .15s;
}
.filter-chip:hover  { border-color: var(--accent); color: var(--text); text-decoration: none; }
.filter-chip.is-active {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--text);
  text-decoration: none;
}

/* ================================================================
   TALENT FORM (collapsible)
   ================================================================ */

.talent-form {
  margin-bottom: 1.5rem;
  transition: opacity .2s;
}
.talent-form.is-hidden { display: none; }

/* ================================================================
   CHAT
   ================================================================ */

.chat-card {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 160px);
  min-height: 400px;
  padding: 1.25rem;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding-right: .25rem;
  margin-bottom: 1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}

.chat-msg { }

.chat-msg__meta {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  margin-bottom: .15rem;
}

.chat-msg__author {
  font-size: .78rem;
  font-weight: 600;
  color: var(--accent);
  font-family: var(--font);
}

.chat-msg__time {
  font-size: .72rem;
  color: var(--text-faint);
  font-family: var(--font);
}

.chat-msg__text {
  font-size: .875rem;
  color: var(--text);
  line-height: 1.45;
  word-break: break-word;
}

.chat-input-wrap {
  display: flex;
  gap: .5rem;
  flex-shrink: 0;
}

.chat-input { flex: 1; margin: 0; }

/* ================================================================
   ORGANIZATIONS
   ================================================================ */

.org-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.org-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  transition: border-color .15s;
}
.org-card:hover { border-color: var(--border-2); }

.org-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .75rem;
}

.org-card__name {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -.01em;
}

.org-card__contact {
  font-size: .82rem;
  color: var(--text-muted);
  margin-bottom: .5rem;
  font-family: var(--font);
}

.org-card__notes {
  font-size: .875rem;
  color: var(--text-muted);
  line-height: 1.5;
  border-left: 2px solid var(--border-2);
  padding-left: .75rem;
  margin-top: .5rem;
}

/* ================================================================
   BADGES
   ================================================================ */

.badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: var(--radius);
  font-size: .73rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.badge--admin   { background: rgba(37,99,235,.15); color: #6ba0ff; border: 1px solid rgba(37,99,235,.3); }
.badge--scouter { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border-2); }

/* ================================================================
   ALERTS
   ================================================================ */

.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  margin-bottom: 1.25rem;
  border: 1px solid;
}

.alert--success { background: rgba(74,124,89,.12); color: #82c99a; border-color: rgba(74,124,89,.3); }
.alert--error   { background: rgba(192,57,43,.12); color: #e07b72;  border-color: rgba(192,57,43,.3); }

/* ================================================================
   AUTH PAGE
   ================================================================ */

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.auth-wrap { width: 100%; max-width: 380px; }

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-bottom: 2.5rem;
}

.auth-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-title {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -.01em;
  margin-bottom: .25rem;
}

/* ================================================================
   LINK
   ================================================================ */

.link { color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ================================================================
   SCROLLBAR (Webkit)
   ================================================================ */

::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ================================================================
   ДОПОЛНЕНИЯ v2
   ================================================================ */

/* Кликабельные строки таблицы */
.tr--clickable { cursor: pointer; }
.tr--clickable:hover td { background: var(--surface-2); }

/* Бейдж внешней БД */
.ext-badge {
  font-size: .65rem;
  color: var(--accent);
  margin-left: .3rem;
  opacity: .7;
}

/* Статусный пилл (без dropdown) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .25rem .6rem;
  border: 1px solid var(--border-2);
  border-radius: 4px;
  font-size: .8rem;
  background: var(--surface-2);
  color: var(--text-muted);
  white-space: nowrap;
}

.status-pill-lg {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .9rem;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  font-size: .875rem;
  background: var(--surface-2);
  font-weight: 500;
}

/* Счётчик на фильтр-чипе */
.filter-chip__count {
  font-size: .7rem;
  color: var(--text-faint);
  margin-left: .1rem;
}

/* Сетка детальной страницы таланта */
.talent-detail-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 900px) {
  .talent-detail-grid { grid-template-columns: 1fr; }
}

/* Статистические боксы */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
}

.stat-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  text-align: center;
}

.stat-box__val {
  font-size: 1.4rem;
  font-weight: 600;
  font-family: var(--font);
  letter-spacing: -.02em;
  margin-bottom: .2rem;
}

.stat-box__label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}

/* Контактная строка */
.contact-row {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .65rem 0;
  border-bottom: 1px solid var(--border);
}
.contact-row:last-child { border-bottom: none; }
.contact-row__icon { font-size: 1.1rem; margin-top: .1rem; }
.contact-row__label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: .2rem; }

/* Навигация: admin badge */
.nav-admin-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  background: rgba(37,99,235,.2);
  color: #6ba0ff;
  border-radius: 3px;
  font-size: .65rem;
  font-weight: 700;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding: 1.5rem 0;
}

.site-footer__inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: .4rem;
}

.footer-copy {
  font-size: .8rem;
  color: var(--text-faint);
}

.footer-meta {
  font-size: .8rem;
  color: var(--text-faint);
  margin-left: auto;
}

/* Sync button animation */
.btn--syncing {
  opacity: .7;
  pointer-events: none;
}
.btn--syncing::before {
  content: '';
  display: inline-block;
  width: 10px; height: 10px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin-right: .4rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast уведомление */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: .75rem 1.25rem;
  font-size: .875rem;
  box-shadow: var(--shadow);
  z-index: 999;
  animation: toastIn .2s ease;
}
.toast--ok  { border-left: 3px solid var(--s-looking); }
.toast--err { border-left: 3px solid var(--danger); }
@keyframes toastIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
