/* Ariy Admin Panel — dark theme matching the popup brand.
 * Brand vars match src/popup.html in the extension repo.            */

:root {
  --bg-0: #05060d;
  --bg-1: #0c0e1c;
  --bg-2: #131628;
  --bg-3: #1c2040;

  --line:        rgba(255, 255, 255, .06);
  --line-strong: rgba(255, 255, 255, .12);
  --line-active: rgba(120, 160, 255, .50);

  --brand:       #5c8dff;
  --brand-2:     #9f6bff;
  --brand-pink:  #ff7ad9;
  --brand-glow:  rgba(92, 141, 255, .35);

  --ok:    #4ade80;
  --warn:  #fbbf24;
  --err:   #fb7185;
  --err-glow: rgba(251, 113, 133, .30);

  --t-0: #fafbff;
  --t-1: rgba(250, 251, 255, .82);
  --t-2: rgba(250, 251, 255, .55);
  --t-3: rgba(250, 251, 255, .32);

  --r-1: 8px;
  --r-2: 12px;
  --r-3: 16px;

  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg-0);
  color: var(--t-0);
  font-family: 'Inter', -apple-system, 'Segoe UI', 'Helvetica Neue', sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}
body {
  min-height: 100vh;
  background:
    radial-gradient(circle 800px at 90% -200px, rgba(120, 160, 255, .12), transparent 70%),
    radial-gradient(circle 700px at -10% 110%, rgba(159, 107, 255, .08), transparent 70%),
    var(--bg-0);
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
input, select {
  background: var(--bg-1);
  border: 1px solid var(--line);
  color: var(--t-0);
  border-radius: var(--r-1);
  padding: 8px 10px;
  outline: none;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
input:focus, select:focus { border-color: var(--line-active); background: var(--bg-2); }
input::placeholder { color: var(--t-3); }

.muted { color: var(--t-2); }
.small { font-size: 12px; }
.hidden { display: none !important; }
.grow { flex: 1; }

/* ── Topbar ────────────────────────────────────────────────────────────── */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 6, 13, .75);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 10;
}
.brand-logo {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 700; font-size: 18px; letter-spacing: -.02em;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 70%, var(--brand-pink) 110%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-logo span { font-weight: 400; opacity: .65; margin-left: 6px; }
.topbar-actions { display: flex; gap: 12px; align-items: center; }

/* ── Page layout ───────────────────────────────────────────────────────── */

.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 24px 60px;
  display: flex; flex-direction: column; gap: 16px;
}
.page-centered {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
}
.card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: 18px;
}

/* ── Login ─────────────────────────────────────────────────────────────── */

.login-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: 36px 40px;
  text-align: center;
  min-width: 320px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.login-card .brand-logo { font-size: 26px; }
.login-card p { margin: 14px 0 18px; }
.tg-widget { min-height: 50px; display: flex; justify-content: center; align-items: center; }

/* ── Filters ───────────────────────────────────────────────────────────── */

.filters .row {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.filters .row:last-child { margin-bottom: 0; }
.filters .row.actions { align-items: center; }

.field {
  display: flex; flex-direction: column; gap: 4px;
  min-width: 140px;
}
.field.grow { flex: 1; }
.field-label { color: var(--t-2); font-size: 12px; }
.field-label-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

.chip-toggles { display: flex; gap: 4px; }

/* Node chips */
.chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  min-height: 44px;
}
.chip {
  display: inline-flex; align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--t-1);
  cursor: pointer;
  transition: all .12s var(--ease);
  user-select: none;
}
.chip:hover { border-color: var(--line-strong); color: var(--t-0); }
.chip.active {
  background: linear-gradient(135deg, rgba(92, 141, 255, .25), rgba(159, 107, 255, .22));
  border-color: var(--line-active);
  color: var(--t-0);
}

/* Buttons */
.btn-primary, .btn-ghost {
  padding: 8px 16px;
  border-radius: var(--r-1);
  font-weight: 500;
  font-size: 13px;
  transition: all .12s var(--ease);
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: white;
  box-shadow: 0 4px 14px var(--brand-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px var(--brand-glow); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--t-1);
}
.btn-ghost:hover { background: var(--bg-3); border-color: var(--line-strong); color: var(--t-0); }
.btn-ghost:disabled { opacity: .4; cursor: not-allowed; }
.btn-ghost.small { padding: 3px 8px; font-size: 11px; }

/* ── Results ───────────────────────────────────────────────────────────── */

.results-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.table-wrap { overflow-x: auto; }

#logs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
#logs-table th, #logs-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
#logs-table th {
  color: var(--t-2); font-weight: 500; font-size: 11px;
  text-transform: uppercase; letter-spacing: .04em;
  background: var(--bg-1);
  position: sticky; top: 0;
}
#logs-table tbody tr:hover { background: rgba(120, 160, 255, .04); }
#logs-table .placeholder td { color: var(--t-3); text-align: center; padding: 28px 0; font-style: italic; }

.col-ts   { white-space: nowrap; width: 1%; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; color: var(--t-1); }
.col-node { white-space: nowrap; width: 1%; }
.col-type { white-space: nowrap; width: 1%; }
.col-user { white-space: nowrap; width: 1%; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; }
.col-ip   { white-space: nowrap; width: 1%; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; color: var(--t-1); }

/* IP-kind colouring — applied on top of .col-ip after /api/ip-info comes back */
.col-ip.ip-residential { color: var(--brand); }                  /* normal user IP — calm blue */
.col-ip.ip-datacenter  { color: var(--err); font-weight: 500; }  /* hosted / VPN — alarming red */
.col-ip.ip-vless       { color: var(--ok); }                     /* xray hairpin — green, real IP hidden */
.col-ip.ip-unknown     { color: var(--t-2); }
.col-ip[title]         { cursor: help; }
.col-ip .badge-vless {
  display: inline-block; padding: 1px 6px; margin-left: 6px;
  border-radius: 4px; font-size: 10px; font-weight: 500;
  background: rgba(74, 222, 128, .15);
  color: var(--ok);
  border: 1px solid rgba(74, 222, 128, .35);
  vertical-align: middle;
}
.col-host { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; }
.col-msg  { color: var(--t-2); font-size: 12px; max-width: 320px; word-break: break-word; }

.badge {
  display: inline-block; padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px; font-weight: 500;
  background: var(--bg-2); color: var(--t-1);
  border: 1px solid var(--line);
}
.badge.type-audit { background: rgba(74, 222, 128, .12); border-color: rgba(74, 222, 128, .30); color: var(--ok); }
.badge.type-abuse { background: var(--err-glow); border-color: rgba(251, 113, 133, .45); color: var(--err); }

.pagination {
  display: flex; justify-content: center; align-items: center; gap: 12px;
  padding-top: 14px; border-top: 1px solid var(--line);
  margin-top: 8px;
}
