/* Sentinel Edge — Dark Theme Stylesheet */

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-card: #1c2128;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #484f58;
  --accent-blue: #58a6ff;
  --accent-green: #3fb950;
  --accent-yellow: #d29922;
  --accent-orange: #db6d28;
  --accent-red: #f85149;
  --border-color: #30363d;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --radius: 8px;
  --font-mono: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', monospace;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

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

/* Sidebar */
.sidebar {
  width: 240px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
}

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

.sidebar-header h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent-blue);
}

.sidebar-header p {
  font-size: 12px;
  color: var(--text-secondary);
}

.nav-links {
  list-style: none;
  padding: 10px 0;
  flex: 1;
}

.nav-links li a {
  display: block;
  padding: 10px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
}

.nav-links li a:hover,
.nav-links li a.active {
  color: var(--text-primary);
  background-color: var(--bg-tertiary);
  border-left: 3px solid var(--accent-blue);
}

.sidebar-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--border-color);
}

.sidebar-footer select {
  width: 100%;
  padding: 6px 10px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 13px;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.page-section { display: none; }
.page-section.active { display: block; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.stat-value {
  font-size: 36px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-blue);
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Camera Grid */
.camera-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.camera-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.camera-card.online { border-left: 3px solid var(--accent-green); }
.camera-card.offline { border-left: 3px solid var(--accent-red); }

.camera-name { font-weight: 600; flex: 1; }
.camera-status.online { color: var(--accent-green); }
.camera-status.offline { color: var(--accent-red); }
.camera-fps { color: var(--text-muted); font-family: var(--font-mono); font-size: 13px; }

/* Stream Viewer */
.stream-container {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}

.stream-container img {
  width: 100%;
  height: auto;
  display: block;
}

.camera-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

.camera-btn {
  padding: 8px 16px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.camera-btn:hover, .camera-btn.active {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}

/* Alerts */
.alert-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 8px;
}

.alert-item.severity-critical { border-left: 3px solid var(--accent-red); }
.alert-item.severity-high { border-left: 3px solid var(--accent-orange); }
.alert-item.severity-medium { border-left: 3px solid var(--accent-yellow); }
.alert-item.severity-low { border-left: 3px solid var(--accent-green); }

.alert-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.alert-type { font-weight: 600; font-size: 14px; }

.alert-severity {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--bg-tertiary);
}

.alert-details {
  display: flex;
  gap: 16px;
  color: var(--text-secondary);
  font-size: 13px;
}

.no-alerts {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}

/* Toast */
.alert-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--accent-red);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transform: translateX(120%);
  transition: transform 0.3s ease;
  z-index: 1000;
  max-width: 400px;
}

.alert-toast.show { transform: translateX(0); }

/* Reports */
.report-filters {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 12px; color: var(--text-secondary); }

.filter-group input,
.filter-group select {
  padding: 8px 12px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 13px;
}

.btn {
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.2s;
}

.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--accent-blue); color: #fff; }
.btn-success { background: var(--accent-green); color: #fff; }

/* Status Badge */
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
}

.status-operational { background: rgba(63, 185, 80, 0.15); color: var(--accent-green); }
.status-degraded { background: rgba(210, 153, 34, 0.15); color: var(--accent-yellow); }
.status-offline { background: rgba(248, 81, 73, 0.15); color: var(--accent-red); }

/* Responsive */
@media (max-width: 768px) {
  .app-container { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; overflow-x: auto; padding: 10px; }
  .sidebar-header { display: none; }
  .nav-links { display: flex; padding: 0; }
  .nav-links li a { padding: 8px 14px; white-space: nowrap; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
