/* SEMP Command Center - Stylesheet v4 */
:root {
  --bg-main: #020617;
  --bg-card: rgba(15, 23, 42, 0.7);
  --bg-card-hover: rgba(30, 41, 59, 0.8);
  --border-card: rgba(0, 240, 255, 0.15);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --color-primary: #00f0ff;
  --color-secondary: #0ea5e9;
  --color-success: #39ff14;
  --color-warning: #ffea00;
  --color-danger: #ff003c;
  --color-historic: #0ea5e9;
  --color-current: #39ff14;
  --color-future: #ff6000;
}

body.light-theme {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --border-card: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --color-primary: #0284c7;
  --color-secondary: #0284c7;
  --color-success: #059669;
  --color-warning: #d97706;
  --color-danger: #dc2626;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6, .card-title, .form-label, .dash-subtitle {
  font-family: 'Rajdhani', sans-serif;
  text-transform: uppercase;
}

.cell-value, .cell-delta, .metric-value, .metric-footer, .slider-val, table th, table td {
  font-family: 'JetBrains Mono', monospace;
}

/* Background Blobs */
.bg-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  z-index: 0;
  pointer-events: none;
  opacity: 0.15;
}
.blob-1 {
  width: 500px;
  height: 500px;
  background: var(--color-primary);
  top: -100px;
  left: -100px;
}
.blob-2 {
  width: 600px;
  height: 600px;
  background: var(--color-secondary);
  bottom: -150px;
  right: -150px;
}

/* Dashboard Container */
.dashboard-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px;
  position: relative;
  z-index: 1;
}

/* Header */
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}
.dash-title {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--color-primary);
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
}
.dash-subtitle {
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  display: block;
}
.header-right-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}
.info-tooltip-container:hover .tooltip-content {
  visibility: visible !important;
  opacity: 1 !important;
}

.dash-meta-badge {
  background: rgba(0, 240, 255, 0.05);
  border: 1px solid var(--color-primary);
  padding: 6px 12px;
  border-radius: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: inset 0 0 8px rgba(0,240,255,0.1);
}

.theme-toggle-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.theme-toggle-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--color-primary);
}

/* Card Widget */
.card-widget {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 4px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.3s ease;
  position: relative;
}
.card-widget::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
  opacity: 0.3;
}
.card-widget:hover {
  box-shadow: 0 8px 30px rgba(0,240,255,0.08);
  border-color: rgba(0, 240, 255, 0.4);
}

.card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Copy Widget Button */
.copy-widget-btn {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--color-primary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.copy-widget-btn:hover {
  background: var(--color-primary);
  color: #0f172a;
}

/* Switch Controls */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider-switch {
  position: absolute; cursor: pointer; inset: 0;
  background-color: var(--border-card);
  transition: .3s;
  border-radius: 20px;
}
.slider-switch:before {
  position: absolute; content: ""; height: 14px; width: 14px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
input:checked + .slider-switch { background-color: var(--color-primary); }
input:checked + .slider-switch:before { transform: translateX(16px); }

.norm-control-item {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
}

/* KPI Matrix Table */
.kpi-matrix-wrapper {
  overflow-x: auto;
}
.kpi-matrix-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.kpi-matrix-table th {
  padding: 10px 14px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-card);
  text-align: right;
}
.kpi-matrix-table th:first-child { text-align: left; }
.kpi-matrix-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.85rem;
  text-align: right;
  vertical-align: middle;
}
.kpi-matrix-table td:first-child { text-align: left; }

.row-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
}
.row-badge.historic { background: rgba(56, 189, 248, 0.15); color: var(--color-historic); }
.row-badge.current { background: rgba(16, 185, 129, 0.15); color: var(--color-current); }
.row-badge.future { background: rgba(139, 92, 246, 0.15); color: var(--color-future); }
.row-desc { display: block; font-size: 0.65rem; color: var(--text-muted); margin-top: 2px; }

.cell-value { font-weight: 700; color: var(--text-main); }
.cell-delta { font-size: 0.68rem; color: var(--text-muted); margin-top: 2px; }

/* Scenario Wizard */
.scenario-wizard-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  margin-top: 12px;
}
@media (max-width: 1024px) {
  .scenario-wizard-layout { grid-template-columns: 1fr; }
}

.slider-group {
  margin-bottom: 10px;
}
.slider-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-main);
  margin-bottom: 4px;
}
.scenario-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 2px;
  background: rgba(0, 240, 255, 0.2);
  outline: none;
  border-radius: 2px;
}
.scenario-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 16px;
  background: var(--color-primary);
  cursor: pointer;
  border-radius: 2px;
  box-shadow: 0 0 10px var(--color-primary);
}
.slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.58rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.filter-select {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border-card);
  color: var(--text-main);
  border-radius: 2px;
  padding: 6px 10px;
  font-size: 0.75rem;
  outline: none;
}

.chart-tab-btn {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.chart-tab-btn.active, .chart-tab-btn:hover {
  background: var(--color-primary);
  color: #0f172a;
  border-color: var(--color-primary);
}

.chart-btn-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Detail Drawer Sheet */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: none; z-index: 999;
}
.sheet-backdrop.open { display: block; }
.bottom-sheet {
  position: fixed; bottom: -100%; left: 50%; transform: translateX(-50%);
  width: 90%; max-width: 800px; background: var(--bg-card);
  border: 1px solid var(--border-card); border-radius: 16px 16px 0 0;
  z-index: 1000; transition: bottom 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 20px; box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
}
.bottom-sheet.open { bottom: 0; }
.sheet-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.sheet-close { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; }

/* Gemini Flyover */
.gemini-flyover {
  position: fixed; bottom: 80px; right: 24px; width: 380px; max-height: 520px;
  background: var(--bg-card); border: 1px solid var(--border-card);
  border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,0.4);
  z-index: 900; display: flex; flex-direction: column; opacity: 0;
  transform: translateY(20px) scale(0.95); pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.gemini-flyover.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.flyover-header { padding: 14px; border-bottom: 1px solid var(--border-card); display: flex; justify-content: space-between; align-items: center; }
.flyover-chat { padding: 14px; flex: 1; overflow-y: auto; font-size: 0.78rem; display: flex; flex-direction: column; gap: 10px; max-height: 320px; }
.flyover-controls { padding: 14px; border-top: 1px solid var(--border-card); background: rgba(0,0,0,0.1); }
.flyover-toggle {
  position: fixed; bottom: 24px; right: 24px; width: 48px; height: 48px;
  border-radius: 50%; background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: white; border: none; cursor: pointer; z-index: 901;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.4); transition: transform 0.2s ease;
}
.flyover-toggle:hover { transform: scale(1.08); }

@keyframes spin { 100% { transform: rotate(360deg); } }

@media (max-width: 1024px) {
  .simulation-hub-grid {
    grid-template-columns: 1fr !important;
  }
}


@keyframes highlightFlash {
  0% { color: var(--color-warning); text-shadow: 0 0 15px var(--color-warning); transform: scale(1.05); }
  100% { color: inherit; text-shadow: inherit; transform: scale(1); }
}
.value-flash {
  animation: highlightFlash 10s ease-out;
}

