/* DLPGuard Dashboard — Dark Enterprise UI */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

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

:root {
  --bg:       #090d19;
  --surface:  #0f1624;
  --surface2: #141c2e;
  --surface3: #1a2540;
  --accent:   #6366f1;
  --accent2:  #8b5cf6;
  --accent-glow: rgba(99,102,241,.25);
  --success:  #10b981;
  --danger:   #ef4444;
  --warning:  #f59e0b;
  --info:     #3b82f6;
  --text:     #e2e8f0;
  --muted:    #64748b;
  --muted2:   #94a3b8;
  --border:   #1e2d4a;
  --border2:  #253550;
  --sidebar-w: 240px;
  --topbar-h:  60px;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}

.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 1.6rem; }
.logo-name { font-weight: 700; font-size: 1rem; letter-spacing: -.3px; }
.logo-sub  { font-size: 11px; color: var(--muted); }

.ws-switcher { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.ws-label { font-size: 11px; color: var(--muted); text-transform: uppercase;
             letter-spacing: .6px; display: block; margin-bottom: 6px; }
.ws-select {
  width: 100%; background: var(--surface2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; font-size: 13px; cursor: pointer;
  font-family: inherit;
}
.ws-select:focus { outline: none; border-color: var(--accent); }

.nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px; text-decoration: none;
  color: var(--muted2); font-size: 13.5px; font-weight: 500;
  transition: background .15s, color .15s;
  position: relative;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent-glow); color: #a5b4fc;
                   border: 1px solid rgba(99,102,241,.2); }
.nav-icon { font-size: 1rem; min-width: 20px; }
.badge-count {
  margin-left: auto; background: var(--danger);
  color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 999px; min-width: 18px; text-align: center;
}
.badge-count:empty, .badge-count[data-zero] { display: none; }

.sidebar-footer {
  padding: 16px; border-top: 1px solid var(--border);
}
.sidebar-info { display: flex; align-items: center; gap: 8px;
                font-size: 12px; color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; }
.dot-green { background: var(--success); box-shadow: 0 0 6px var(--success); }

/* ── Main Layout ───────────────────────────────────────────────────────── */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.page-title { font-size: 1.1rem; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.btn-icon {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--muted2); cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.btn-icon:hover { background: var(--surface3); color: var(--text); }

.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
}

/* ── Tab Content ───────────────────────────────────────────────────────── */
.tab-content { display: none; padding: 28px; }
.tab-content.active { display: block; }

/* ── Stats Grid ────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  transition: border-color .2s;
}
.stat-card:hover { border-color: var(--border2); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.stat-num { font-size: 1.8rem; font-weight: 700; letter-spacing: -.5px; }
.stat-label { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 1rem; font-weight: 600; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-12 { margin-top: 12px; }

/* ── Tables ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.table th {
  padding: 12px 16px; text-align: left;
  color: var(--muted); font-weight: 500; font-size: 11px;
  text-transform: uppercase; letter-spacing: .5px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface2); }
.empty { text-align: center; color: var(--muted); padding: 32px !important; }

/* ── Severity Badges ───────────────────────────────────────────────────── */
.sev {
  display: inline-block; padding: 3px 9px; border-radius: 6px;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
}
.sev-CRITICAL { background: rgba(239,68,68,.15);  color: #fca5a5; }
.sev-HIGH     { background: rgba(245,158,11,.15); color: #fde68a; }
.sev-MEDIUM   { background: rgba(59,130,246,.15); color: #93c5fd; }
.sev-LOW      { background: rgba(16,185,129,.15); color: #6ee7b7; }

/* ── Status Badges ─────────────────────────────────────────────────────── */
.status { display: inline-block; padding: 3px 9px; border-radius: 6px;
           font-size: 11px; font-weight: 600; }
.status-pending  { background: rgba(245,158,11,.15); color: #fde68a; }
.status-approved { background: rgba(16,185,129,.15); color: #6ee7b7; }
.status-denied   { background: rgba(239,68,68,.15);  color: #fca5a5; }

/* ── Toolbar ───────────────────────────────────────────────────────────── */
.toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.search-wrap { flex: 1; min-width: 200px; }

/* ── Inputs & Buttons ──────────────────────────────────────────────────── */
.input-field {
  width: 100%; padding: 9px 13px;
  background: var(--surface2); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px;
  font-size: 13.5px; font-family: inherit;
  transition: border-color .15s;
}
.input-field:focus { outline: none; border-color: var(--accent);
                      box-shadow: 0 0 0 3px var(--accent-glow); }
.input-field.mono { font-family: 'JetBrains Mono', monospace; }

.select-field {
  padding: 9px 13px;
  background: var(--surface2); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px;
  font-size: 13.5px; font-family: inherit; cursor: pointer;
}
.select-field:focus { outline: none; border-color: var(--accent); }

.btn-primary {
  padding: 9px 20px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-size: 13.5px; font-weight: 600;
  border: none; cursor: pointer; font-family: inherit;
  transition: opacity .15s, transform .15s;
  white-space: nowrap;
}
.btn-primary:hover { opacity: .9; transform: translateY(-1px); }

.btn-outline {
  padding: 8px 16px; border-radius: 9px;
  background: transparent; color: var(--muted2);
  border: 1px solid var(--border); font-size: 13px;
  cursor: pointer; font-family: inherit;
  transition: border-color .15s, color .15s;
  white-space: nowrap;
}
.btn-outline:hover { border-color: var(--accent); color: var(--text); }

.btn-danger {
  padding: 7px 14px; border-radius: 8px;
  background: rgba(239,68,68,.12); color: #f87171;
  border: 1px solid rgba(239,68,68,.25); font-size: 12px;
  cursor: pointer; font-family: inherit;
  transition: background .15s;
}
.btn-danger:hover { background: rgba(239,68,68,.2); }

/* ── Tab Pills ─────────────────────────────────────────────────────────── */
.tab-pills { display: flex; gap: 8px; }
.pill {
  padding: 8px 18px; border-radius: 9px;
  background: var(--surface2); color: var(--muted2);
  border: 1px solid var(--border); font-size: 13px;
  cursor: pointer; font-family: inherit;
  transition: background .15s, color .15s;
}
.pill.active { background: var(--accent-glow); color: #a5b4fc;
               border-color: rgba(99,102,241,.3); }

/* ── Pagination ────────────────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; padding: 16px;
  border-top: 1px solid var(--border);
}
.page-info { font-size: 13px; color: var(--muted); }

/* ── Pattern Form ──────────────────────────────────────────────────────── */
.form-title { font-size: 1rem; font-weight: 600; padding: 20px 20px 0; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 16px 20px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 12px; color: var(--muted2); font-weight: 500; }
.form-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.form-actions {
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px 20px; flex-wrap: wrap;
}
.regex-test-label { font-size: 12px; color: var(--muted); margin-left: 8px; }
.regex-result { font-size: 12px; font-family: 'JetBrains Mono', monospace; }
.regex-match  { color: var(--success); }
.regex-no-match { color: var(--danger); }

/* ── Settings ──────────────────────────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}
.settings-grid .card { padding: 24px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; }

/* Toggle Switch */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--surface3); border-radius: 999px;
  border: 1px solid var(--border);
  transition: background .2s;
}
.slider::before {
  content: ''; position: absolute;
  height: 16px; width: 16px; left: 4px; bottom: 3px;
  background: var(--muted); border-radius: 50%;
  transition: transform .2s, background .2s;
}
.switch input:checked + .slider { background: rgba(99,102,241,.3); border-color: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(18px); background: var(--accent); }

/* ── Misc ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

.mono-text { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted2);
              white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }

/* ── Toast ─────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 28px; right: 28px; z-index: 9999;
  padding: 12px 20px; border-radius: 12px;
  font-size: 13.5px; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  animation: slideUp .25s ease;
  max-width: 320px;
}
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error   { border-color: var(--danger);  color: var(--danger); }
.toast.info    { border-color: var(--accent);  color: #a5b4fc; }

@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }
