/* ============================================
   AI Operations Command Center — Design System
   Mayo Clinic Portfolio Project
   ============================================ */

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

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Core palette */
  --bg-primary:    #060b1a;
  --bg-secondary:  #0d1332;
  --bg-card:       rgba(15, 23, 60, 0.55);
  --bg-card-hover: rgba(20, 30, 75, 0.7);
  --bg-glass:      rgba(255, 255, 255, 0.04);

  /* Accent colours */
  --accent-teal:   #00d4aa;
  --accent-blue:   #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-amber:  #f59e0b;
  --accent-rose:   #f43f5e;
  --accent-cyan:   #06b6d4;

  /* Text */
  --text-primary:   #f0f4f8;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;

  /* Status */
  --status-green:  #22c55e;
  --status-yellow: #eab308;
  --status-red:    #ef4444;
  --status-blue:   #3b82f6;

  /* Borders & Surfaces */
  --border-glass:  rgba(255, 255, 255, 0.08);
  --border-hover:  rgba(255, 255, 255, 0.15);
  --shadow-card:   0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-glow:   0 0 30px rgba(0, 212, 170, 0.08);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Radius */
  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Sidebar */
  --sidebar-width: 260px;
}

/* ---------- Reset ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ---------- Animated Background ---------- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(0, 212, 170, 0.06), transparent),
    radial-gradient(ellipse 60% 50% at 85% 70%, rgba(139, 92, 246, 0.05), transparent),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(59, 130, 246, 0.04), transparent);
  pointer-events: none;
  z-index: 0;
}

/* ---------- Layout ---------- */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-glass);
  padding: var(--space-lg) 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  transition: transform var(--transition-base);
}

.sidebar-brand {
  padding: 0 var(--space-lg);
  margin-bottom: var(--space-2xl);
}

.sidebar-brand h1 {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent-teal), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.3;
}

.sidebar-brand .brand-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: var(--space-xs);
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 var(--space-sm);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-md);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  position: relative;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(0, 212, 170, 0.1);
  color: var(--accent-teal);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent-teal);
  border-radius: var(--radius-full);
}

.nav-icon {
  font-size: 1.15rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

/* Sidebar footer */
.sidebar-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--border-glass);
  margin-top: auto;
}

.sidebar-footer .author-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.author-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent-teal), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
  flex-shrink: 0;
}

.author-info .author-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.author-info .author-role {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* ---------- Main Content ---------- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: var(--space-xl) var(--space-2xl);
  max-width: 1400px;
}

/* ---------- Page Header ---------- */
.page-header {
  margin-bottom: var(--space-2xl);
}

.page-header h2 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-xs);
}

.page-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ---------- Section (Panel) ---------- */
.section-panel {
  display: none;
}

.section-panel.active {
  display: block;
  animation: fadeInPanel 0.35s ease;
}

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

/* ---------- KPI Grid ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
  cursor: default;
}

.kpi-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-card);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.kpi-card:nth-child(1)::before { background: linear-gradient(90deg, var(--accent-teal), var(--accent-cyan)); }
.kpi-card:nth-child(2)::before { background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple)); }
.kpi-card:nth-child(3)::before { background: linear-gradient(90deg, var(--accent-amber), #fb923c); }
.kpi-card:nth-child(4)::before { background: linear-gradient(90deg, var(--accent-purple), var(--accent-rose)); }

.kpi-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
  font-weight: 600;
}

.kpi-value {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: var(--space-sm);
}

.kpi-card:nth-child(1) .kpi-value { color: var(--accent-teal); }
.kpi-card:nth-child(2) .kpi-value { color: var(--accent-blue); }
.kpi-card:nth-child(3) .kpi-value { color: var(--accent-amber); }
.kpi-card:nth-child(4) .kpi-value { color: var(--accent-purple); }

.kpi-trend {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.78rem;
  font-weight: 500;
}

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

/* Pulse dot */
.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.pulse-dot.green  { background: var(--status-green); box-shadow: 0 0 8px var(--status-green); }
.pulse-dot.yellow { background: var(--status-yellow); box-shadow: 0 0 8px var(--status-yellow); }
.pulse-dot.red    { background: var(--status-red); box-shadow: 0 0 8px var(--status-red); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(1.3); }
}

/* ---------- Glass Card ---------- */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-lg);
  transition: border-color var(--transition-base);
}

.glass-card:hover {
  border-color: var(--border-hover);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.card-title .icon {
  font-size: 1.1rem;
}

/* ---------- Charts Grid ---------- */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.chart-container {
  position: relative;
  width: 100%;
  height: 280px;
}

/* ---------- Initiative Table ---------- */
.table-controls {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.filter-select, .search-input {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.filter-select:focus, .search-input:focus {
  border-color: var(--accent-teal);
}

.search-input {
  flex: 1;
  min-width: 200px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.data-table thead th {
  text-align: left;
  padding: var(--space-md);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
  border-bottom: 1px solid var(--border-glass);
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.03);
  transition: background var(--transition-fast);
}

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

.data-table td {
  padding: var(--space-md);
  vertical-align: middle;
}

/* Status & Risk Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-active    { background: rgba(34,197,94,0.15); color: var(--status-green); }
.badge-review    { background: rgba(234,179,8,0.15); color: var(--status-yellow); }
.badge-planning  { background: rgba(59,130,246,0.15); color: var(--status-blue); }
.badge-deployed  { background: rgba(139,92,246,0.15); color: var(--accent-purple); }
.badge-paused    { background: rgba(100,116,139,0.15); color: var(--text-muted); }

.badge-high   { background: rgba(239,68,68,0.15); color: var(--status-red); }
.badge-medium { background: rgba(234,179,8,0.15); color: var(--status-yellow); }
.badge-low    { background: rgba(34,197,94,0.15); color: var(--status-green); }

/* Progress Bar */
.progress-bar {
  width: 100%;
  max-width: 120px;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 1s ease;
}

.progress-fill.green  { background: linear-gradient(90deg, var(--accent-teal), var(--status-green)); }
.progress-fill.blue   { background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan)); }
.progress-fill.amber  { background: linear-gradient(90deg, var(--accent-amber), #fb923c); }
.progress-fill.purple { background: linear-gradient(90deg, var(--accent-purple), var(--accent-rose)); }

/* ---------- Governance ---------- */
.governance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  margin-bottom: var(--space-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.85rem;
}

.checklist-item:hover {
  background: rgba(255,255,255,0.06);
}

.checklist-item .check-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.checklist-item.checked .check-icon {
  background: var(--accent-teal);
  border-color: var(--accent-teal);
  color: #fff;
}

.checklist-item.checked {
  color: var(--text-secondary);
}

/* Risk Matrix */
.risk-matrix {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.risk-cell {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  transition: transform var(--transition-fast);
  cursor: default;
}

.risk-cell:hover {
  transform: scale(1.08);
}

.risk-low    { background: rgba(34,197,94,0.2); color: var(--status-green); }
.risk-med    { background: rgba(234,179,8,0.2); color: var(--status-yellow); }
.risk-high   { background: rgba(239,68,68,0.2); color: var(--status-red); }
.risk-crit   { background: rgba(239,68,68,0.35); color: #fca5a5; }

/* Gauge */
.gauge-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) 0;
}

.gauge-svg {
  width: 180px;
  height: 100px;
  overflow: visible;
}

.gauge-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: var(--space-md);
  font-weight: 500;
}

/* ---------- Stakeholder Map ---------- */
.stakeholder-canvas {
  width: 100%;
  height: 420px;
  border-radius: var(--radius-md);
  background: rgba(0,0,0,0.2);
}

/* ---------- Intake Pipeline (Kanban) ---------- */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-md);
  overflow-x: auto;
  padding-bottom: var(--space-md);
}

.kanban-column {
  min-width: 180px;
}

.kanban-header {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-md);
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-count {
  background: rgba(255,255,255,0.08);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.65rem;
}

.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  transition: all var(--transition-base);
  cursor: default;
}

.kanban-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.kanban-card-title {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.kanban-card-dept {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.kanban-card-score {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-teal);
}

/* ---------- Team Grid ---------- */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.team-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all var(--transition-base);
  text-align: center;
}

.team-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-card);
}

.team-avatar {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
  margin: 0 auto var(--space-md);
}

.team-name {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.team-role {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.team-dept {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.team-workload {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.team-workload .progress-bar {
  max-width: 80px;
}

/* ---------- Audit Timeline ---------- */
.audit-timeline {
  position: relative;
  padding-left: 28px;
}

.audit-timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-glass);
}

.audit-entry {
  position: relative;
  margin-bottom: var(--space-lg);
  padding-left: var(--space-md);
}

.audit-entry::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-teal);
  border: 2px solid var(--bg-primary);
}

.audit-date {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
  font-weight: 600;
}

.audit-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* ---------- Mobile Hamburger ---------- */
.mobile-toggle {
  display: none;
  position: fixed;
  top: var(--space-md);
  left: var(--space-md);
  z-index: 200;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  font-size: 1.2rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .kanban-board {
    grid-template-columns: repeat(3, 1fr);
  }
  .governance-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .mobile-toggle {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: var(--space-xl) var(--space-lg);
    padding-top: 60px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .kanban-board {
    grid-template-columns: repeat(2, 1fr);
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }
}

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

  .kanban-board {
    grid-template-columns: 1fr;
  }

  .team-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Counter Animation ---------- */
.count-up {
  display: inline-block;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.2);
}

/* ---------- Tooltip ---------- */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-fast);
  border: 1px solid var(--border-glass);
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Stakeholder Legend ---------- */
.stakeholder-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-top: var(--space-md);
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* ---------- Risk Matrix Labels ---------- */
.risk-matrix-container {
  position: relative;
}

.risk-matrix-labels {
  display: flex;
  justify-content: space-between;
  padding: 0 2px;
  margin-bottom: var(--space-xs);
}

.risk-matrix-labels span {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.risk-axis-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  margin-top: var(--space-xs);
}
