:root {
  --bg-dark: #07090e;
  --panel-bg: rgba(15, 23, 42, 0.75);
  --panel-border: rgba(56, 189, 248, 0.15);
  --primary-accent: #00f2fe;
  --secondary-accent: #4facfe;
  --alert-red: #ff2a6d;
  --success-green: #05ffa1;
  --warning-amber: #ffb703;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(0, 242, 254, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(255, 42, 109, 0.05) 0%, transparent 40%);
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  padding: 2rem;
}

.dashboard-container {
  max-width: 1400px;
  margin: 0 auto;
}

/* Header styling */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--panel-border);
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(5, 255, 161, 0.1);
  border: 1px solid rgba(5, 255, 161, 0.3);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--success-green);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--success-green);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--success-green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 15px var(--success-green); }
  100% { transform: scale(0.95); opacity: 0.8; }
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff 0%, var(--primary-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

.vps-info {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 242, 254, 0.4);
}

.metric-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.metric-value {
  font-size: 2.25rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #ffffff;
}

.metric-value.highlight-red {
  color: var(--alert-red);
}

.metric-value.highlight-cyan {
  color: var(--primary-accent);
}

/* Content Split Layout */
.main-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 1024px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 1.5rem;
  min-width: 0;
}

.panel-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Map Styling & Threat Arcs */
.leaflet-container {
  background: #090d16 !important;
}

.animated-threat-line {
  stroke-dasharray: 8, 8;
  animation: dash 20s linear infinite;
}

@keyframes dash {
  to {
    stroke-dashoffset: -1000;
  }
}

/* Attack Stream Table */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
  table-layout: fixed;
}

th {
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
  text-transform: uppercase;
}

td {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.ip-cell {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--primary-accent);
}

.tag {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.tag-scan { background: rgba(56, 189, 248, 0.15); color: var(--secondary-accent); }
.tag-success { background: rgba(5, 255, 161, 0.15); color: var(--success-green); }
.tag-fail { background: rgba(255, 42, 109, 0.15); color: var(--alert-red); }

.code-snippet {
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.4);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  color: #e2e8f0;
  word-wrap: break-word;
  white-space: pre-wrap;
}

/* Scanner List */
.scanner-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.scanner-name {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.scanner-count {
  font-weight: 700;
  color: var(--primary-accent);
}

/* Modal Overlay & Forensics Inspector Card */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(7, 9, 14, 0.85);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-card {
  background: #0f172a;
  border: 1px solid rgba(0, 242, 254, 0.3);
  box-shadow: 0 0 30px rgba(0, 242, 254, 0.15);
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  padding: 1.5rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.inspect-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.inspect-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
  body {
    padding: 1rem;
  }
  
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .logo-section {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  h1 {
    font-size: 1.35rem;
    line-height: 1.2;
  }
  
  .vps-info {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.75rem !important;
  }
  
  .panel {
    padding: 1rem;
  }
  
  /* Force table to scroll horizontally instead of crushing text */
  table {
    min-width: 800px;
  }
  
  .table-container {
    -webkit-overflow-scrolling: touch;
  }
  
  .inspect-grid {
    grid-template-columns: 1fr;
  }
  
  .metric-value {
    font-size: 1.75rem;
  }
}
