/* AppProxyPro Admin — Dark theme */
:root {
  --bg:        #0f1117;
  --bg2:       #171b26;
  --bg3:       #1e2333;
  --border:    #2a2f45;
  --accent:    #4f8cff;
  --accent2:   #6ee7b7;
  --danger:    #f87171;
  --warning:   #fbbf24;
  --text:      #e2e8f0;
  --text2:     #8892a4;
  --radius:    8px;
  --font:      'Inter', 'Segoe UI', system-ui, sans-serif;
  --mono:      'JetBrains Mono', 'Fira Code', 'Courier New', 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;
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 0 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.logo-icon { font-size: 1.4rem; color: var(--accent); }
.logo-text  { font-size: 1rem; font-weight: 700; letter-spacing: -.3px; }

.sidebar-nav { list-style: none; flex: 1; }
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem 1.25rem;
  color: var(--text2);
  text-decoration: none;
  border-radius: 0;
  transition: background .15s, color .15s;
}
.sidebar-nav li a:hover { background: var(--bg3); color: var(--text); }
.sidebar-nav li a.active {
  background: rgba(79,140,255,.12);
  color: var(--accent);
  border-left: 3px solid var(--accent);
}
.nav-icon { font-size: 1rem; opacity: .7; }

.sidebar-footer {
  padding: 1rem 1.25rem 0;
  border-top: 1px solid var(--border);
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.nav-link-small { color: var(--text2); text-decoration: none; font-size: .8rem; }
.nav-link-small:hover { color: var(--text); }

/* ── Main ── */
.main-content {
  margin-left: 220px;
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: 1200px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}
.page-header h1 { font-size: 1.4rem; font-weight: 700; }

/* ── Cards ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }

/* ── Stats grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.stat-label  { font-size: .75rem; color: var(--text2); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .4rem; }
.stat-value  { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.stat-sub    { font-size: .75rem; color: var(--text2); margin-top: .25rem; }
.status-ok   { color: var(--accent2); }
.status-err  { color: var(--danger); }

/* ── Table ── */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text2);
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: .75rem;
  border-bottom: 1px solid rgba(255,255,255,.04);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(255,255,255,.02); }

.url-cell { display: flex; align-items: center; gap: .5rem; }
.url-text  { font-family: var(--mono); font-size: .75rem; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.empty-state { color: var(--text2); text-align: center; padding: 2rem; }
.mono { font-family: var(--mono); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem 1rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 500;
  text-decoration: none;
  transition: opacity .15s;
  white-space: nowrap;
}
.btn:hover { opacity: .85; }
.btn-primary   { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-danger    { background: rgba(248,113,113,.15); color: var(--danger); border: 1px solid rgba(248,113,113,.3); }
.btn-sm        { padding: .3rem .65rem; font-size: .78rem; }
.btn-full      { width: 100%; justify-content: center; }

.btn-copy {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  padding: .2rem .5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: .7rem;
  white-space: nowrap;
}
.btn-copy:hover { color: var(--text); }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: .4rem; font-size: .85rem; font-weight: 500; }
.form-group label small { color: var(--text2); font-weight: 400; margin-left: .3rem; }
.form-group input[type="text"],
.form-group input[type="password"] {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: .55rem .75rem;
  font-size: .9rem;
  outline: none;
  transition: border .15s;
}
.form-group input:focus { border-color: var(--accent); }
.form-group small { color: var(--text2); font-size: .75rem; margin-top: .25rem; display: block; }
.form-actions { display: flex; gap: .75rem; margin-top: 1.25rem; }

/* ── Alerts ── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .875rem;
}
.alert-error   { background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.3); color: var(--danger); }
.alert-success { background: rgba(110,231,183,.1); border: 1px solid rgba(110,231,183,.3); color: var(--accent2); }
.alert-info    { background: rgba(79,140,255,.08); border: 1px solid rgba(79,140,255,.25); color: #93bbff; }

/* ── Modal ── */
.modal {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal.open { display: flex; }
.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 440px;
}
.modal-box h2 { margin-bottom: 1.25rem; font-size: 1.1rem; }

/* ── Login ── */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 360px;
}
.login-logo { display: flex; align-items: center; gap: .7rem; margin-bottom: .4rem; }
.login-logo .logo-icon { font-size: 1.8rem; }
.login-logo .logo-text { font-size: 1.25rem; font-weight: 700; }
.login-sub  { color: var(--text2); font-size: .85rem; margin-bottom: 1.5rem; }
.login-hint { color: var(--text2); font-size: .75rem; text-align: center; margin-top: 1.25rem; }

/* ── Snippets tabs ── */
.tabs { display: flex; gap: .25rem; margin-bottom: -1px; margin-top: 1.5rem; }
.tab {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  color: var(--text2);
  cursor: pointer;
  padding: .5rem 1rem;
  font-size: .85rem;
}
.tab.active { background: var(--bg2); color: var(--text); border-color: var(--border); }
.tab-content { display: none; background: var(--bg2); border: 1px solid var(--border); border-radius: 0 var(--radius) var(--radius) var(--radius); }
.tab-content.active { display: block; }
.snippet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .8rem;
  color: var(--text2);
}
pre { padding: 1.25rem; overflow-x: auto; }
pre code { font-family: var(--mono); font-size: .82rem; line-height: 1.7; color: #c9d1e0; }

/* ── Sparklines ── */
.sparkline { display: flex; align-items: flex-end; gap: 2px; height: 32px; }
.spark-bar { width: 8px; background: var(--accent); opacity: .6; border-radius: 2px 2px 0 0; min-height: 2px; }

/* ── New credentials banner (shown after user creation) ── */
.new-creds-banner {
  background: rgba(110,231,183,.07);
  border: 1px solid rgba(110,231,183,.35);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}
.new-creds-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1rem;
  font-size: .95rem;
}
.new-creds-icon { color: var(--accent2); font-size: 1.1rem; }
.new-creds-grid { display: flex; flex-direction: column; gap: .75rem; }
.new-creds-item { display: flex; flex-direction: column; gap: .25rem; }
.new-creds-label { font-size: .75rem; color: var(--text2); text-transform: uppercase; letter-spacing: .04em; }
.new-creds-note  { margin-top: .9rem; font-size: .8rem; color: var(--text2); }

/* ── Table helpers ── */
.text-sm   { font-size: .82rem; }
.text-muted { color: var(--text2); }
