/* ==========================================================================
   SecureScope v2.0 - Premium Dark Glassmorphic Design System
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  /* Dark Glass Theme Tokens */
  --bg-main: #0a0d14;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(28, 36, 56, 0.85);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(99, 102, 241, 0.3);
  
  /* Primary & Accent Colors */
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.4);
  --accent-cyan: #06b6d4;
  --accent-purple: #a855f7;

  /* Severity Risk Colors */
  --risk-p0: #ef4444; /* Critical Red */
  --risk-p0-glow: rgba(239, 68, 68, 0.4);
  --risk-p1: #f97316; /* High Orange */
  --risk-p2: #eab308; /* Medium Yellow */
  --risk-p3: #3b82f6; /* Low Blue */
  --risk-p4: #64748b; /* Info Gray */

  /* Status Colors */
  --status-success: #10b981;
  --status-warning: #f59e0b;
  --status-danger: #ef4444;

  /* Text Colors */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;

  /* Fonts */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
}

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

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(168, 85, 247, 0.10) 0%, transparent 40%);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-main);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Layout Grid */
#app-container {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* Glass Sidebar */
.sidebar {
  background: rgba(13, 17, 26, 0.85);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--border-glass);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-glass);
  margin-bottom: 1.5rem;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent-purple));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px var(--primary-glow);
  font-size: 1.2rem;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 10px;
  font-weight: 500;
  transition: all 0.25s ease;
}

.nav-link:hover, .nav-link.active {
  color: #ffffff;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.2);
}

.nav-link.active i {
  color: var(--primary);
}

/* Main Content Area */
.main-wrapper {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: 100vh;
}

/* Top Navigation Bar */
.topbar {
  background: rgba(13, 17, 26, 0.6);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-glass);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-title {
  font-size: 1.4rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Emergency Kill Switch Button */
.btn-kill-switch {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 700;
  font-family: var(--font-heading);
  cursor: pointer;
  box-shadow: 0 0 15px var(--risk-p0-glow);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.btn-kill-switch:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 25px var(--risk-p0-glow);
}

.btn-kill-switch.active {
  background: #10b981;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

/* Content Container */
.content-body {
  padding: 2rem;
}

/* Glass Card Components */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 1.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
}

/* Stats Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-val {
  font-size: 2.2rem;
  font-weight: 800;
  font-family: var(--font-heading);
  margin-top: 0.25rem;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

/* Severity Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-p0 { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.4); }
.badge-p1 { background: rgba(249, 115, 22, 0.2); color: #fdba74; border: 1px solid rgba(249, 115, 22, 0.4); }
.badge-p2 { background: rgba(234, 179, 8, 0.2); color: #fde047; border: 1px solid rgba(234, 179, 8, 0.4); }
.badge-p3 { background: rgba(59, 130, 246, 0.2); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.4); }
.badge-success { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.4); }

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.5rem;
}

.custom-table th {
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
  border-bottom: 1px solid var(--border-glass);
}

.custom-table td {
  padding: 1rem;
  background: rgba(18, 24, 38, 0.5);
  border-top: 1px solid var(--border-glass);
  border-bottom: 1px solid var(--border-glass);
}

.custom-table tr td:first-child { border-left: 1px solid var(--border-glass); border-top-left-radius: 10px; border-bottom-left-radius: 10px; }
.custom-table tr td:last-child { border-right: 1px solid var(--border-glass); border-top-right-radius: 10px; border-bottom-right-radius: 10px; }

/* Attack Surface Graph Container */
#graph-container {
  width: 100%;
  height: 450px;
  background: rgba(10, 13, 20, 0.8);
  border-radius: 12px;
  border: 1px solid var(--border-glass);
  position: relative;
  overflow: hidden;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  background: #121826;
  border: 1px solid var(--border-accent);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 0 40px var(--primary-glow);
}

/* Form Inputs */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  color: var(--text-main);
  font-family: var(--font-body);
  transition: all 0.25s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  font-family: var(--font-heading);
  cursor: pointer;
  border: none;
  transition: all 0.25s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent-purple));
  color: #ffffff;
  box-shadow: 0 0 15px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 25px var(--primary-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
}

/* Code Evidence Viewer */
.evidence-box {
  background: #090d16;
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  padding: 1rem;
  font-family: monospace;
  font-size: 0.85rem;
  color: #a5b4fc;
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
}

/* Printable PDF View */
@media print {
  .sidebar, .topbar, .btn-kill-switch { display: none !important; }
  #app-container { grid-template-columns: 1fr; }
  body { background: #ffffff !important; color: #000000 !important; }
  .glass-card { background: #ffffff !important; border: 1px solid #ccc !important; color: #000 !important; box-shadow: none !important; }
}
