/* Mission Control v6.0.0 — Enterprise Security Dashboard */
/* Firm D (Spatial Studios) — Corporate Clean Design */

:root {
  /* Core Colors */
  --bg-primary: #0d0f12;
  --bg-secondary: #13151a;
  --bg-tertiary: #1a1d24;
  --bg-elevated: #21242c;
  
  /* Borders */
  --border-primary: #2a2e38;
  --border-secondary: #1f232b;
  --border-accent: #3a3f4d;
  
  /* Text */
  --text-primary: #e6e8eb;
  --text-secondary: #a8adb8;
  --text-tertiary: #6c7281;
  --text-muted: #4a4f5c;
  
  /* Status Colors */
  --status-green: #10b981;
  --status-green-bg: rgba(16, 185, 129, 0.1);
  --status-yellow: #f59e0b;
  --status-yellow-bg: rgba(245, 158, 11, 0.1);
  --status-red: #ef4444;
  --status-red-bg: rgba(239, 68, 68, 0.1);
  --status-blue: #3b82f6;
  --status-blue-bg: rgba(59, 130, 246, 0.1);
  
  /* Accent */
  --accent-primary: #2563eb;
  --accent-secondary: #1e40af;
  
  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Topbar */
.topbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-primary);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--accent-primary);
}

.logo svg {
  color: var(--accent-primary);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--status-green);
}

.status-dot {
  width: 6px;
  height: 6px;
  background: var(--status-green);
  border-radius: 50%;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

.clock {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

#time {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

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

.refresh-indicator {
  width: 6px;
  height: 6px;
  background: var(--status-blue);
  border-radius: 50%;
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

.refresh-indicator.active {
  opacity: 1;
  animation: pulse 0.6s ease-in-out;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border-accent);
  color: var(--text-secondary);
  padding: 6px 8px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.icon-btn:active {
  transform: scale(0.95);
}

/* KPI Bar */
.kpi-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: var(--border-secondary);
  border-bottom: 1px solid var(--border-primary);
}

.kpi {
  background: var(--bg-secondary);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.kpi-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-tertiary);
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  transition: transform 0.3s ease;
}

.kpi-value.value-updated {
  animation: valueUpdate 0.6s ease;
}

@keyframes valueUpdate {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
    color: var(--accent-primary);
  }
  100% {
    transform: scale(1);
  }
}

.kpi-change {
  font-size: 11px;
  color: var(--text-muted);
}

/* Container */
.container {
  max-width: 1800px;
  margin: 0 auto;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* Grid */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

.grid-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* Section */
.section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.section:hover {
  border-color: var(--border-accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.section-header {
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-primary);
}

.section-header h2 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.section-meta {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* Table */
.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead {
  background: var(--bg-tertiary);
}

.data-table th {
  padding: 10px var(--space-md);
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-primary);
  white-space: nowrap;
}

.data-table th.text-right {
  text-align: right;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-secondary);
  transition: background 0.15s ease;
}

.data-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.01);
}

.data-table tbody tr:last-child {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: var(--bg-elevated);
}

.data-table td {
  padding: 12px var(--space-md);
  color: var(--text-secondary);
}

.data-table td:first-child {
  color: var(--text-primary);
  font-weight: 500;
}

.data-table td.text-right {
  text-align: right;
}

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: -0.01em;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-radius: 3px;
  white-space: nowrap;
}

.badge-green {
  background: var(--status-green-bg);
  color: var(--status-green);
}

.badge-yellow {
  background: var(--status-yellow-bg);
  color: var(--status-yellow);
}

.badge-red {
  background: var(--status-red-bg);
  color: var(--status-red);
}

.badge-blue {
  background: var(--status-blue-bg);
  color: var(--status-blue);
}

.badge-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

/* Health Indicator */
.health {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
}

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.health-green .health-dot {
  background: var(--status-green);
}

.health-yellow .health-dot {
  background: var(--status-yellow);
}

.health-red .health-dot {
  background: var(--status-red);
}

.health-blue .health-dot {
  background: var(--status-blue);
}

.health-green {
  color: var(--status-green);
}

.health-yellow {
  color: var(--status-yellow);
}

.health-red {
  color: var(--status-red);
}

.health-blue {
  color: var(--status-blue);
}

/* Footer */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-primary);
  padding: var(--space-lg);
  margin-top: var(--space-xl);
}

.footer-content {
  max-width: 1800px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-tertiary);
}

.footer-left,
.footer-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.footer-sep {
  color: var(--text-muted);
}

.footer a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer a:hover {
  color: var(--text-primary);
}

/* Responsive */
@media (max-width: 1400px) {
  .grid-2col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  .kpi-bar {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  html {
    font-size: 13px;
  }
  
  .topbar {
    height: 52px;
    padding: 0 var(--space-md);
  }
  
  .topbar-left,
  .topbar-right {
    gap: var(--space-md);
  }
  
  .date-text {
    display: none;
  }
  
  .kpi-bar {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .kpi {
    padding: var(--space-sm) var(--space-md);
  }
  
  .container {
    padding: var(--space-md);
  }
  
  .footer-content {
    flex-direction: column;
    gap: var(--space-sm);
    text-align: center;
  }
}

@media (max-width: 480px) {
  .kpi-bar {
    grid-template-columns: 1fr;
  }
  
  .logo span {
    display: none;
  }
  
  .status-indicator span {
    font-size: 9px;
  }
}

/* Error Toast */
.error-toast {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  background: var(--status-red);
  color: white;
  padding: var(--space-md) var(--space-lg);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10000;
  max-width: 400px;
}

.error-toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Success Toast */
.success-toast {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  background: var(--status-green);
  color: white;
  padding: var(--space-md) var(--space-lg);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10000;
  max-width: 400px;
}

.success-toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Trend Icons */
.trend-icon {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
  opacity: 0.7;
}

.trend-up {
  color: var(--status-green);
}

.trend-down {
  color: var(--status-red);
}

.trend-stable {
  color: var(--text-muted);
  opacity: 0.4;
}

/* Sparklines */
.sparkline {
  display: inline-block;
  vertical-align: middle;
  color: var(--accent-primary);
}

/* Print Styles */
@media print {
  .topbar,
  .footer {
    display: none;
  }
  
  body {
    background: white;
    color: black;
  }
  
  .section {
    page-break-inside: avoid;
  }
}
