/* Security Operations Hub - v2.0.0 */
/* Styles preserved from Availability Metrics Hub v1.5.5 */

:root {
  --bg-base: #0a0a0b;
  --bg-elevated: #111113;
  --bg-surface: #18181b;
  --bg-hover: #1f1f23;
  --border: #27272a;
  --border-subtle: #1e1e21;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent-blue: #3b82f6;
  --accent-blue-dim: rgba(59, 130, 246, 0.15);
  --accent-green: #22c55e;
  --accent-green-dim: rgba(34, 197, 94, 0.12);
  --accent-yellow: #eab308;
  --accent-yellow-dim: rgba(234, 179, 8, 0.12);
  --accent-orange: #f97316;
  --accent-orange-dim: rgba(249, 115, 22, 0.12);
  --accent-red: #ef4444;
  --accent-red-dim: rgba(239, 68, 68, 0.12);
  --accent-purple: #a855f7;
  --accent-purple-dim: rgba(168, 85, 247, 0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

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

body {
  font-family: 'IBM Plex Sans', -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

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

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  width: 220px;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  margin-bottom: 28px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.logo-text { font-weight: 700; font-size: 14px; letter-spacing: -0.02em; }
.logo-text span { color: var(--text-muted); font-weight: 400; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-blue-dim); color: var(--accent-blue); }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }

.nav-divider { height: 1px; background: var(--border); margin: 12px 8px; }

.period-selector {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  margin-top: auto;
}

.period-selector label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.period-selector select {
  width: 100%;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}

.period-selector select:focus { outline: none; border-color: var(--accent-blue); }
.period-row { display: flex; gap: 6px; }
.period-row select { flex: 1; min-width: 0; }

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content { flex: 1; margin-left: 220px; padding: 28px 36px; max-width: 1300px; }
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.2s ease; }

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

.page-header { margin-bottom: 28px; }
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 4px; }
.page-subtitle { color: var(--text-secondary); font-size: 14px; }

/* ============================================
   DASHBOARD GRID & METRIC CARDS
   ============================================ */
.dashboard-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 28px; }

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.metric-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.metric-card.blue::before { background: var(--accent-blue); }
.metric-card.green::before { background: var(--accent-green); }
.metric-card.yellow::before { background: var(--accent-yellow); }
.metric-card.orange::before { background: var(--accent-orange); }
.metric-card.purple::before { background: var(--accent-purple); }

.metric-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 8px; }
.metric-value { font-family: 'IBM Plex Mono', monospace; font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.metric-subtext { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

/* ============================================
   CHARTS
   ============================================ */
.charts-section { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 28px; }
.chart-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.chart-title { font-size: 14px; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.chart-container { position: relative; height: 240px; }

/* Health Grid */
.health-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.health-item { background: var(--bg-hover); border-radius: var(--radius-md); padding: 14px; text-align: center; }
.health-count { font-family: 'IBM Plex Mono', monospace; font-size: 22px; font-weight: 600; margin-bottom: 2px; }
.health-count.online { color: var(--accent-green); }
.health-count.error { color: var(--accent-red); }
.health-count.warning { color: var(--accent-yellow); }
.health-count.maintenance { color: var(--accent-orange); }
.health-label { font-size: 11px; color: var(--text-secondary); }

/* Chart Controls */
.chart-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; padding: 12px; background: var(--bg-base); border-radius: var(--radius-md); }

.chart-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.chart-toggle:hover { border-color: var(--text-muted); }
.chart-toggle.active { border-color: var(--accent-blue); color: var(--text-primary); background: var(--accent-blue-dim); }
.chart-toggle .toggle-dot { width: 10px; height: 10px; border-radius: 50%; }
.chart-toggle input { display: none; }

/* ============================================
   ENTRY CARDS
   ============================================ */
.entry-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

.entry-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.entry-card.full-width { grid-column: 1 / -1; }

.entry-header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }

.entry-icon { width: 36px; height: 36px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.entry-icon.blue { background: var(--accent-blue-dim); }
.entry-icon.green { background: var(--accent-green-dim); }
.entry-icon.yellow { background: var(--accent-yellow-dim); }
.entry-icon.orange { background: var(--accent-orange-dim); }
.entry-icon.purple { background: var(--accent-purple-dim); }

.entry-title { font-size: 14px; font-weight: 600; }
.entry-subtitle { font-size: 12px; color: var(--text-secondary); }

/* ============================================
   DROP ZONES
   ============================================ */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-base);
}

.drop-zone:hover { border-color: var(--accent-blue); background: var(--accent-blue-dim); }
.drop-zone.dragover { border-color: var(--accent-blue); background: var(--accent-blue-dim); transform: scale(1.01); }
.drop-zone-icon { font-size: 32px; margin-bottom: 10px; opacity: 0.7; }
.drop-zone-text { font-size: 13px; color: var(--text-secondary); margin-bottom: 2px; }
.drop-zone-hint { font-size: 11px; color: var(--text-muted); }

/* ============================================
   FILE LIST
   ============================================ */
.file-list { margin-top: 12px; max-height: 180px; overflow-y: auto; }

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  font-size: 12px;
}

.file-item-name { font-family: 'IBM Plex Mono', monospace; color: var(--text-secondary); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.file-item-status { font-size: 10px; padding: 2px 6px; border-radius: 4px; margin-left: 10px; white-space: nowrap; font-family: 'IBM Plex Mono', monospace; }
.file-item-status.success { background: var(--accent-green-dim); color: var(--accent-green); }
.file-item-status.pending { background: var(--accent-yellow-dim); color: var(--accent-yellow); }
.file-item-status.error { background: var(--accent-red-dim); color: var(--accent-red); }
.file-item-status.multi-month { background: var(--accent-purple-dim); color: var(--accent-purple); }

/* ============================================
   FORMS
   ============================================ */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }

.form-input {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.15s ease;
}

.form-input:focus { outline: none; border-color: var(--accent-blue); }
.form-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.form-row-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
}

.btn-primary { background: var(--accent-blue); color: white; }
.btn-primary:hover { background: #2563eb; transform: translateY(-1px); }
.btn-secondary { background: var(--bg-hover); border: 1px solid var(--border); color: var(--text-primary); }
.btn-secondary:hover { background: var(--border); }

/* ============================================
   STATS PREVIEW
   ============================================ */
.stats-preview { background: var(--bg-base); border-radius: var(--radius-md); padding: 14px; margin-top: 14px; }
.stats-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border-subtle); font-size: 12px; }
.stats-row:last-child { border-bottom: none; }
.stats-label { color: var(--text-secondary); }
.stats-value { font-family: 'IBM Plex Mono', monospace; font-weight: 500; }

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 6px; }

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
  min-width: 260px;
}

@keyframes slideIn { from { opacity: 0; transform: translateX(100px); } to { opacity: 1; transform: translateX(0); } }
.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error { border-left: 3px solid var(--accent-red); }
.toast.info { border-left: 3px solid var(--accent-blue); }
.toast-icon { font-size: 16px; }
.toast-message { font-size: 13px; flex: 1; }

/* ============================================
   HISTORY TABLE
   ============================================ */
.history-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.history-table th {
  text-align: left;
  padding: 12px 14px;
  background: var(--bg-hover);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.history-table td { padding: 12px 14px; border-bottom: 1px solid var(--border-subtle); font-family: 'IBM Plex Mono', monospace; }
.history-table tr:hover { background: var(--bg-hover); }

/* ============================================
   STATUS BADGES
   ============================================ */
.status-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: 500; }
.status-badge.complete { background: var(--accent-green-dim); color: var(--accent-green); }
.status-badge.partial { background: var(--accent-yellow-dim); color: var(--accent-yellow); }
.status-badge.empty { background: var(--bg-hover); color: var(--text-muted); }
.status-badge.finalized { background: var(--accent-blue-dim); color: var(--accent-blue); }

/* ============================================
   EXPORT REPORT
   ============================================ */
.export-report { 
  background: #BEBEBE; 
  color: #1a1a1a; 
  padding: 40px 48px; 
  border-radius: var(--radius-lg); 
  font-family: 'IBM Plex Sans', sans-serif;
  min-height: 800px;
}

.export-report .report-header { 
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 2px solid #a0a0a0;
}

.export-report .report-header-text { flex: 1; }

.export-report .report-title { 
  font-size: 28px; 
  font-weight: 800; 
  color: #000000; 
  margin-bottom: 6px;
  line-height: 1.2;
}

.export-report .report-period { 
  font-size: 18px; 
  color: #505050; 
  font-weight: 600;
}

.export-report .report-logo {
  height: 50px;
  width: auto;
  margin-left: 24px;
}

/* Hero KPI Cards */
.export-report .report-kpi-grid { 
  display: grid; 
  grid-template-columns: repeat(5, 1fr); 
  gap: 16px; 
  margin-bottom: 28px; 
}

.export-report .report-kpi-card { 
  background: white; 
  padding: 20px; 
  border-radius: 10px; 
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  border-top: 3px solid #dee2e6;
  position: relative;
}

.export-report .report-kpi-card.blue { border-top-color: #3b82f6; }
.export-report .report-kpi-card.purple { border-top-color: #a855f7; }
.export-report .report-kpi-card.orange { border-top-color: #f97316; }
.export-report .report-kpi-card.green { border-top-color: #22c55e; }
.export-report .report-kpi-card.yellow { border-top-color: #eab308; }

.export-report .report-kpi-label { 
  font-size: 10px; 
  color: #6c757d; 
  text-transform: uppercase; 
  letter-spacing: 0.05em; 
  margin-bottom: 10px;
  font-weight: 600;
  min-height: 28px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.export-report .report-kpi-value { 
  font-size: 32px; 
  font-weight: 700; 
  font-family: 'IBM Plex Mono', monospace;
  line-height: 1;
  color: #1a1a1a;
}

.export-report .report-kpi-subtext {
  font-size: 11px;
  color: #868e96;
  margin-top: 6px;
}

/* Detail Section Cards */
.export-report .report-detail-section {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.export-report .report-detail-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.export-report .report-card {
  background: white;
  padding: 24px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.export-report .report-card.full-width { grid-column: 1 / -1; }

.export-report .report-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 2px solid #f1f3f5;
}

.export-report .report-card-icon { font-size: 20px; }

.export-report .report-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
  flex: 1;
}

.export-report .report-card-subtitle {
  font-size: 14px;
  color: #6c757d;
  margin-left: auto;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
}

/* Camera Health Grid in Export */
.export-report .camera-health-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.export-report .camera-stat {
  background: #e9ecef;
  padding: 14px;
  border-radius: 8px;
  text-align: center;
  border: 1px solid #d0d4d8;
}

.export-report .camera-stat-value {
  font-size: 24px;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  margin-bottom: 4px;
}

.export-report .camera-stat-value.online { color: #22c55e; }
.export-report .camera-stat-value.degraded { color: #eab308; }
.export-report .camera-stat-value.error { color: #f97316; }
.export-report .camera-stat-value.offline { color: #ef4444; }

.export-report .camera-stat-label {
  font-size: 11px;
  color: #495057;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 500;
}

/* Site/ServiceNow Stats in Export */
.export-report .stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.export-report .stat-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f1f3f5;
}

.export-report .stat-item:last-child { border-bottom: none; }

.export-report .stat-label {
  font-size: 13px;
  color: #495057;
  font-weight: 500;
}

.export-report .stat-value {
  font-size: 15px;
  font-weight: 600;
  font-family: 'IBM Plex Mono', monospace;
  color: #1a1a1a;
}

.export-buttons { display: flex; gap: 10px; margin-top: 14px; }

/* ============================================
   COMPLETENESS & FINALIZE
   ============================================ */
.completeness-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.completeness-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.completeness-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.completeness-bar { 
  height: 4px; 
  background: var(--bg-hover); 
  border-radius: 2px; 
  overflow: hidden; 
}

.completeness-fill { 
  height: 100%; 
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple)); 
  transition: width 0.3s ease; 
}

.finalize-section {
  background: var(--bg-base);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.finalize-left { display: flex; align-items: center; gap: 12px; }
.finalize-checkbox { width: 20px; height: 20px; cursor: pointer; accent-color: var(--accent-green); }
.finalize-label { font-size: 13px; font-weight: 500; }
.finalize-hint { font-size: 11px; color: var(--text-muted); }
.finalize-status { font-size: 12px; color: var(--text-secondary); }

/* ============================================
   SYNC STATUS INDICATOR
   ============================================ */
.sync-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 10px;
}

.sync-status .sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
}

.sync-status.syncing .sync-dot {
  background: var(--accent-yellow);
  animation: pulse 1s infinite;
}

.sync-status.offline .sync-dot {
  background: var(--accent-orange);
}

.sync-status.error .sync-dot {
  background: var(--accent-red);
}

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

/* ============================================
   UTILITIES
   ============================================ */
input[type="file"] { display: none; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
