/* Link Tracker — Dark Precision */

:root {
  --bg:           #09090b;
  --surface:      #111114;
  --surface-2:    #18181b;
  --surface-3:    #222226;
  --border:       rgba(255,255,255,0.06);
  --border-strong:rgba(255,255,255,0.12);
  --accent:       #a78bfa;
  --accent-dim:   rgba(167,139,250,0.12);
  --accent-border:rgba(167,139,250,0.35);
  --text:         #fafafa;
  --text-muted:   #a1a1aa;
  --text-subtle:  #52525b;
  --danger:       #f87171;
  --danger-dim:   rgba(248,113,113,0.1);
  --danger-border:rgba(248,113,113,0.3);
  --success:      #4ade80;
  --success-dim:  rgba(74,222,128,0.1);
  --success-border:rgba(74,222,128,0.3);
  --warning:      #fbbf24;
  --cyan:         #22d3ee;
  --purple:       #c084fc;
  --blue:         #60a5fa;
  --radius:       10px;
  --radius-sm:    6px;
  --radius-lg:    14px;
  --shadow:       0 1px 3px rgba(0,0,0,0.5), 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.7);
  --font:         'Plus Jakarta Sans', -apple-system, sans-serif;
  --mono:         'Fira Code', 'SF Mono', monospace;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: opacity 0.15s; }
a:hover { opacity: 0.8; text-decoration: none; }

/* ─── Nav ─────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(9,9,11,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-brand::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
}
.nav-right > span {
  color: var(--text-muted);
  padding: 4px 10px;
}
.nav-right > a {
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}
.nav-right > a:hover {
  background: var(--surface-2);
  color: var(--text);
  opacity: 1;
}

/* ─── Layout ──────────────────────────────────────────── */
.main    { max-width: 1200px; margin: 0 auto; padding: 36px 28px; }
.main-sm { max-width: 520px;  margin: 0 auto; padding: 48px 28px; }
.main-md { max-width: 900px;  margin: 0 auto; padding: 36px 28px; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.page-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

/* ─── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.btn:hover { opacity: 0.88; text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--accent);
  color: #09090b;
  box-shadow: 0 2px 8px rgba(167,139,250,0.35);
}
.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger-border);
  padding: 5px 12px;
  font-size: 12px;
}
.btn-danger:hover { background: var(--danger-dim); }
.btn-ghost {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover { color: var(--text); background: var(--surface-3); }

/* ─── Form ────────────────────────────────────────────── */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 7px;
}
.form-input, .form-select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}
.form-input:focus, .form-select:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-input::placeholder { color: var(--text-subtle); }
.form-hint { font-size: 12px; color: var(--text-subtle); margin-top: 5px; }

/* ─── Table ───────────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; }
thead { background: var(--surface-2); }
th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
td {
  padding: 13px 16px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
  font-size: 13px;
}
tr:first-child td { border-top: none; }
tbody tr { transition: background 0.1s; }
tbody tr:hover td { background: var(--surface-2); }

/* ─── Badges ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.badge-purple { background: rgba(192,132,252,0.12); color: var(--purple); border: 1px solid rgba(192,132,252,0.2); }
.badge-blue   { background: rgba(96,165,250,0.12);  color: var(--blue);   border: 1px solid rgba(96,165,250,0.2); }
.badge-red    { background: var(--danger-dim);       color: var(--danger); border: 1px solid var(--danger-border); }
.badge-yellow { background: rgba(251,191,36,0.1);    color: var(--warning);border: 1px solid rgba(251,191,36,0.2); }
.badge-green  { background: var(--success-dim);      color: var(--success);border: 1px solid var(--success-border); }

/* ─── Alerts ──────────────────────────────────────────── */
.alert        { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }
.alert-error  { background: var(--danger-dim);  color: var(--danger);  border: 1px solid var(--danger-border);  padding: 11px 14px; border-radius: var(--radius-sm); }
.alert-success{ background: var(--success-dim); color: var(--success); border: 1px solid var(--success-border); padding: 11px 14px; border-radius: var(--radius-sm); }

/* ─── Card ────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ─── Short URL box ───────────────────────────────────── */
.short-url-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 24px;
  box-shadow: 0 0 20px rgba(167,139,250,0.06);
}
.short-url-link {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--accent);
  text-decoration: none;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.short-url-link:hover { opacity: 1; text-decoration: underline; }
.btn-copy {
  padding: 6px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-copy:hover { background: var(--surface-3); color: var(--text); }
.btn-copy-ok {
  background: var(--success-dim);
  border-color: var(--success-border);
  color: var(--success);
}

/* ─── Stats grid ──────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.4;
}
.stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.04em;
  line-height: 1.1;
}
.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 6px;
}

/* ─── Chart card ──────────────────────────────────────── */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.chart-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* ─── Detail info ─────────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px 20px;
  align-items: start;
}
.info-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-top: 1px;
}
.info-value { font-size: 13px; color: var(--text-muted); }

/* ─── Login ───────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 0%, rgba(167,139,250,0.06) 0%, transparent 60%);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
}
.login-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.04em;
  text-align: center;
  margin-bottom: 4px;
}
.login-sub {
  font-size: 13px;
  color: var(--text-subtle);
  text-align: center;
  margin-bottom: 32px;
}

/* ─── Mono ────────────────────────────────────────────── */
.mono { font-family: var(--mono); font-size: 12.5px; }

/* ─── Logout ──────────────────────────────────────────── */
.logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}
.logout-btn:hover { background: var(--danger-dim); color: var(--danger); }

/* Empty chart state */
.chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  color: var(--text-subtle);
  font-size: 13px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
}

/* ─── Modal ───────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 50;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-lg);
}
.modal-title { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 22px; }

/* ─── Utilities ───────────────────────────────────────── */
.text-muted   { color: var(--text-muted); }
.text-subtle  { color: var(--text-subtle); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-sm      { font-size: 13px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.items-center { align-items: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.w-full { width: 100%; }
.pt-2 { padding-top: 8px; }
