/* ════════════════════════════════════════════════════════════
   COMPONENTS — buttons, cards, tables, badges, forms,
                modals, toast, login, toggles, charts
   ════════════════════════════════════════════════════════════ */

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius); border: 1px solid;
  font-family: var(--mono); font-size: 12px; cursor: pointer;
  transition: all .15s; font-weight: 500; white-space: nowrap;
}
.btn-primary { background: var(--accent);  border-color: var(--accent);  color: var(--bg); }
.btn-primary:hover { background: var(--accent2); border-color: var(--accent2); }
.btn-ghost   { background: transparent; border-color: var(--border2); color: var(--text2); }
.btn-ghost:hover { border-color: var(--text2); color: var(--text); background: var(--surface2); }
.btn-danger  { background: rgba(239,68,68,.1);  border-color: rgba(239,68,68,.3);  color: var(--danger); }
.btn-danger:hover { background: rgba(239,68,68,.2); }
.btn-warn    { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.3); color: var(--warn); }
.btn-sm      { padding: 4px 10px; font-size: 11px; }

/* ── STAT CARDS ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  position: relative; overflow: hidden; transition: border-color .2s;
}
.stat-card:hover { border-color: var(--border2); }
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
}
.stat-card.green::before { background: var(--accent); }
.stat-card.blue::before  { background: var(--info); }
.stat-card.warn::before  { background: var(--warn); }
.stat-card.red::before   { background: var(--danger); }
.stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--text3); }
.stat-value { font-family: var(--sans); font-size: 28px; font-weight: 700; color: var(--text); margin: 4px 0; line-height: 1; }
.stat-delta { font-size: 11px; }
.stat-delta.up   { color: var(--accent); }
.stat-delta.down { color: var(--danger); }
.stat-icon  { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 28px; opacity: .08; }

/* ── CARDS ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.card-header {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--text); }
.card-body  { padding: 18px; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; padding: 10px 14px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--text3); border-bottom: 1px solid var(--border);
  font-weight: 600; white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .12s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
tbody td { padding: 10px 14px; font-size: 12px; color: var(--text2); vertical-align: middle; }
tbody td:first-child { color: var(--text); }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 3px; font-size: 10px; font-weight: 500; letter-spacing: .3px;
  text-transform: uppercase; border: 1px solid;
}
.badge-green { background: rgba(0,229,160,.1);  color: var(--accent);  border-color: rgba(0,229,160,.25); }
.badge-blue  { background: rgba(59,130,246,.1);  color: var(--info);    border-color: rgba(59,130,246,.25); }
.badge-warn  { background: rgba(245,158,11,.1);  color: var(--warn);    border-color: rgba(245,158,11,.25); }
.badge-red   { background: rgba(239,68,68,.1);   color: var(--danger);  border-color: rgba(239,68,68,.25); }
.badge-muted { background: rgba(74,85,104,.15);  color: var(--text3);   border-color: rgba(74,85,104,.3); }

/* ── FORMS ── */
.form-row     { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.form-group   { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.form-label   { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--text3); }
.form-input, .form-select, .form-textarea {
  background: var(--bg); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 8px 11px;
  font-family: var(--mono); font-size: 12px; color: var(--text);
  outline: none; transition: border-color .2s; width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0,229,160,.08);
}
.form-select option { background: var(--surface2); }
.form-textarea { resize: vertical; min-height: 80px; }

/* ── SEARCH BAR ── */
.search-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.search-input-wrap { position: relative; flex: 1; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text3); font-size: 12px; }
.search-input {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 8px 11px 8px 30px;
  font-family: var(--mono); font-size: 12px; color: var(--text);
  outline: none; width: 100%; transition: border-color .2s;
}
.search-input:focus { border-color: var(--accent); }

/* ── TOGGLE ── */
.toggle {
  width: 36px; height: 20px; border-radius: 10px;
  background: var(--border2); border: none; cursor: pointer;
  position: relative; transition: background .2s;
}
.toggle.on { background: var(--accent); }
.toggle::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%; background: white;
  transition: left .2s;
}
.toggle.on::after { left: 19px; }

/* ── PROGRESS BAR ── */
.progress-wrap { background: var(--border); border-radius: 3px; height: 5px; overflow: hidden; }
.progress-bar  { height: 100%; border-radius: 3px; background: var(--accent); transition: width .4s; }

/* ── MINI CHART (bars) ── */
.mini-chart { display: flex; align-items: flex-end; gap: 3px; height: 40px; }
.mini-bar   { flex: 1; border-radius: 2px 2px 0 0; min-width: 4px; background: var(--border2); transition: background .2s; }
.mini-bar.accent { background: var(--accent); }
.mini-bar.info   { background: var(--info); }

/* ── ACTIVITY LIST ── */
.activity-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-dot  { width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }
.activity-text { font-size: 12px; color: var(--text2); line-height: 1.5; }
.activity-time { font-size: 10px; color: var(--text3); margin-top: 2px; }

/* ── INLINE ALERT ── */
.alert {
  padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px;
  font-size: 12px; border: 1px solid; display: flex; align-items: flex-start; gap: 10px;
}
.alert-warn    { background: rgba(245,158,11,.08);  border-color: rgba(245,158,11,.25); color: var(--warn); }
.alert-danger  { background: rgba(239,68,68,.08);   border-color: rgba(239,68,68,.25);  color: var(--danger); }
.alert-success { background: rgba(0,229,160,.08);   border-color: rgba(0,229,160,.25);  color: var(--accent); }
.alert-info    { background: rgba(59,130,246,.08);  border-color: rgba(59,130,246,.25); color: var(--info); }

/* ── MODAL ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.7); backdrop-filter: blur(3px);
  z-index: 1000; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 8px; padding: 24px; width: 480px; max-width: 95vw;
  max-height: 90vh; overflow-y: auto; animation: modalIn .2s ease;
}
.modal-header  { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title   { font-family: var(--sans); font-size: 16px; font-weight: 700; }
.modal-close   { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 18px; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-footer  { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ── BAN REASON MODAL ── */
.ban-reason-input {
  width: 100%; background: var(--bg); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 8px 11px;
  font-family: var(--mono); font-size: 12px; color: var(--text);
  outline: none; transition: border-color .2s; margin-top: 12px;
}
.ban-reason-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(0,229,160,.08); }

/* ── TOAST ── */
#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 12px 16px; font-size: 12px;
  max-width: 320px; box-shadow: 0 8px 24px rgba(0,0,0,.4);
  display: none; animation: slideIn .2s ease;
}
#toast.show    { display: block; }
#toast.success { border-color: rgba(0,229,160,.4); color: var(--accent); }
#toast.error   { border-color: rgba(239,68,68,.4);  color: var(--danger); }
#toast.warn    { border-color: rgba(245,158,11,.4);  color: var(--warn); }

/* ── LOGIN PAGE ── */
#login-page {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.login-box {
  width: 380px; background: var(--surface); border: 1px solid var(--border2);
  border-radius: 10px; padding: 36px; position: relative;
}
.login-box::before {
  content: ''; position: absolute; top: 0; left: 20%; right: 20%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  border-radius: 0 0 4px 4px;
}
.login-logo     { font-family: var(--sans); font-size: 22px; font-weight: 800; color: var(--accent); margin-bottom: 4px; }
.login-subtitle { color: var(--text3); font-size: 11px; margin-bottom: 28px; }
.login-step     { animation: fadeIn .2s ease; }
.totp-grid      { display: flex; gap: 8px; margin: 12px 0; }
.totp-digit {
  flex: 1; height: 44px; background: var(--bg); border: 1px solid var(--border2);
  border-radius: var(--radius); text-align: center; font-family: var(--mono);
  font-size: 18px; font-weight: 600; color: var(--accent); outline: none;
  transition: border-color .2s;
}
.totp-digit:focus { border-color: var(--accent); }
.login-error { color: var(--danger); font-size: 11px; margin-top: 8px; min-height: 16px; }

/* ── NOTIFICATION COMPOSER ── */
.notif-preview       { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-top: 12px; }
.notif-preview-title { font-weight: 600; color: var(--text); font-size: 13px; }
.notif-preview-body  { color: var(--text2); font-size: 12px; margin-top: 4px; }

/* ── MAINTENANCE MODE BANNER ── */
.maintenance-active {
  background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.2);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 12px; color: var(--danger); font-size: 12px;
}

/* ── GEO MAP PLACEHOLDER ── */
.geo-map {
  height: 220px; border-radius: var(--radius); background: var(--surface2);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  color: var(--text3); font-size: 12px; position: relative; overflow: hidden;
}
