/* Pentest Platform — Dark Professional Theme */

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

:root {
  --sidebar-bg: #1a1a2e;
  --sidebar-w: 240px;
  --content-bg: #f5f5f5;
  --card-bg: #fff;
  --text: #212529;
  --text-muted: #6c757d;
  --border: #dee2e6;
  --primary: #4a6cf7;
  --primary-hover: #3a5ce5;
  --danger: #dc3545;
  --danger-hover: #c82333;
  --success: #28a745;
  --warning: #ffc107;
  --orange: #fd7e14;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.1);
}

html { font-size: 15px; }
body { font-family: var(--font); color: var(--text); background: var(--content-bg); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; font-weight: 600; }
h2 { font-size: 1.3rem; font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 600; }

/* Layout */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); background: var(--sidebar-bg); color: #e0e0e0;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
}

.sidebar-brand {
  padding: 1.2rem 1rem; font-size: 1.1rem; font-weight: 700; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: .5rem;
}

.sidebar-nav { flex: 1; padding: .5rem 0; }

.sidebar-nav a {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem 1rem; color: #b0b0c8; font-size: .9rem;
  transition: background .15s, color .15s; text-decoration: none;
}

.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-nav a.active { border-left: 3px solid var(--primary); padding-left: calc(1rem - 3px); }
.sidebar-nav .nav-section { padding: .8rem 1rem .3rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #666; }
.sidebar-nav .disabled { opacity: .4; pointer-events: none; }

.sidebar-footer { padding: .8rem 1rem; border-top: 1px solid rgba(255,255,255,.08); font-size: .85rem; }
.sidebar-footer .user { color: #ccc; margin-bottom: .3rem; }
.sidebar-footer a { color: #999; font-size: .8rem; }
.sidebar-footer a:hover { color: #fff; }

.content { margin-left: var(--sidebar-w); flex: 1; padding: 1.5rem 2rem; max-width: calc(1200px + var(--sidebar-w)); }
.content-inner { max-width: 1200px; }

/* Cards */
.card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem; margin-bottom: 1rem; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .8rem; padding-bottom: .6rem; border-bottom: 1px solid var(--border); }
.card-header h2, .card-header h3 { margin: 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }

.stat-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; text-align: center; }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; line-height: 1.2; }
.stat-card .stat-label { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-card.critical .stat-value { color: var(--danger); }
.stat-card.warning .stat-value { color: var(--orange); }
.stat-card.success .stat-value { color: var(--success); }

/* Badges */
.badge { display: inline-block; padding: .15em .5em; font-size: .75rem; font-weight: 600; border-radius: 3px; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.badge-critical { background: var(--danger); color: #fff; }
.badge-high, .badge-vuln { background: var(--orange); color: #fff; }
.badge-medium, .badge-finding { background: var(--warning); color: #212529; }
.badge-low, .badge-info { background: var(--success); color: #fff; }
.badge-open { background: var(--danger); color: #fff; }
.badge-retesting { background: var(--warning); color: #212529; }
.badge-fixed { background: var(--success); color: #fff; }
.badge-accepted, .badge-accepted_risk { background: var(--text-muted); color: #fff; }
.badge-active { background: var(--primary); color: #fff; }
.badge-completed, .badge-complete { background: var(--success); color: #fff; }
.badge-archived { background: var(--text-muted); color: #fff; }
.badge-queued { background: #6c757d; color: #fff; }
.badge-running { background: var(--primary); color: #fff; animation: pulse 1.5s infinite; }
.badge-cancelled { background: var(--text-muted); color: #fff; }
.badge-failed { background: var(--danger); color: #fff; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }

.scan-progress-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary); margin-left: .3rem; vertical-align: middle;
  animation: pulse 1.5s infinite;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .9rem; font-size: .9rem; font-weight: 500;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card-bg); color: var(--text); cursor: pointer;
  transition: background .15s, border-color .15s; text-decoration: none; line-height: 1.4;
}
.btn:hover { background: #e9ecef; text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn-sm { padding: .25rem .6rem; font-size: .8rem; }

/* Forms */
.form-group { margin-bottom: .8rem; }
.form-group label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: .25rem; }
.form-control {
  width: 100%; padding: .45rem .7rem; font-size: .9rem; font-family: var(--font);
  border: 1px solid var(--border); border-radius: var(--radius); background: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(74,108,247,.15); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { appearance: auto; }
.form-inline { display: flex; gap: .5rem; align-items: flex-end; }
.form-inline .form-group { margin-bottom: 0; flex: 1; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
thead th {
  background: #f8f9fa; padding: .6rem .8rem; text-align: left; font-weight: 600;
  font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted);
  border-bottom: 2px solid var(--border); position: sticky; top: 0; z-index: 1;
}
tbody td { padding: .55rem .8rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:nth-child(even) { background: #fafafa; }
tbody tr:hover { background: #f0f4ff; }
.table-actions { display: flex; gap: .3rem; }

/* Alerts */
.alert { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .9rem; border: 1px solid transparent; }
.alert-success { background: #d4edda; color: #155724; border-color: #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border-color: #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border-color: #ffeeba; }

/* Page Header */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.2rem; }

/* Tabs */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 1rem; }
.tab {
  padding: .5rem 1rem; font-size: .9rem; font-weight: 500; color: var(--text-muted);
  border: none; border-bottom: 2px solid transparent; margin-bottom: -2px;
  cursor: pointer; background: none; text-decoration: none;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Section */
.section { margin-bottom: 1.5rem; }
.section-title { font-size: 1rem; font-weight: 600; margin-bottom: .6rem; }

/* Project items */
.project-item { display: flex; justify-content: space-between; align-items: center; padding: .7rem 0; border-bottom: 1px solid var(--border); }
.project-item:last-child { border-bottom: none; }
.project-item .project-name { font-weight: 500; }
.project-meta { display: flex; gap: .8rem; align-items: center; font-size: .85rem; color: var(--text-muted); }
.severity-counts { display: flex; gap: .3rem; }

/* Attention items */
.attention-item { display: flex; align-items: center; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.attention-item:last-child { border-bottom: none; }

/* Quick Scan */
.quick-scan { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
.quick-scan .form-group { margin-bottom: 0; }
.quick-scan .form-group:first-child { flex: 2; min-width: 200px; }
.quick-scan .form-group:nth-child(2) { flex: 1; min-width: 140px; }

/* Login Page */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--sidebar-bg); }
.login-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 2rem; width: 100%; max-width: 380px; }
.login-card h1 { text-align: center; margin-bottom: .3rem; font-size: 1.4rem; }
.login-card .subtitle { text-align: center; color: var(--text-muted); font-size: .85rem; margin-bottom: 1.5rem; }
.login-card .btn-primary { width: 100%; justify-content: center; margin-top: .5rem; }

/* Empty State */
.empty-state { text-align: center; padding: 2rem; color: var(--text-muted); }
.empty-state .icon { font-size: 2rem; margin-bottom: .5rem; }

/* Keyboard hint */
.kbd-hint {
  position: fixed; bottom: 1rem; right: 1rem; width: 2rem; height: 2rem;
  border-radius: 50%; background: var(--sidebar-bg); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; font-weight: 700; cursor: pointer; opacity: .5;
  transition: opacity .2s; z-index: 200;
}
.kbd-hint:hover { opacity: 1; }

/* Utilities */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .85rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .content { margin-left: 0; padding: 1rem; }
  .card-grid { grid-template-columns: 1fr; }
  .quick-scan { flex-direction: column; }
  .page-header { flex-direction: column; align-items: flex-start; gap: .5rem; }
}

/* Print */
@media print {
  .sidebar, .kbd-hint, .btn, .quick-scan { display: none !important; }
  .content { margin-left: 0; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  body { background: #fff; }
}
