/* ==========================================================================
   VEGA AI Investor Portal — Global Design System Stylesheet
   ========================================================================== */

:root {
  --bg-gradient: linear-gradient(135deg, #e4f2f7 0%, #d8ebf3 100%);
  --navy: #0b1d3a;
  --navy-light: #162a4a;
  --panel-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border-color: #cbd5e1;
  --border-light: #f1f5f9;
  
  --primary-green: #6dc51c;
  --primary-green-dark: #58a514;
  --accent-blue: #2563eb;
  --success-green: #16a34a;
  --danger-red: #dc2626;
  --warning-amber: #f59e0b;

  /* Alpha Models Color Tokens */
  --teal: #0f8a6b;
  --green: #16a34a;
  --gold: #c9922a;
  --red: #dc2626;
  --purple: #6366f1;
  --text: #0f172a;
  --text3: #64748b;
  --mono: 'JetBrains Mono', monospace;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

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

html, body {
  height: 100%;
  font-family: var(--font-sans);
  background: #eaf4f8;
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
  min-width: 0;
}

.main-layout {
  flex: 1;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-gradient);
  min-height: 100vh;
  width: 100%;
  min-width: 0;
}

@media (max-width: 1440px) {
  .content {
    padding: 1.5rem 1.75rem;
  }
}

.content.risk-page {
  padding: 2.5rem 3rem;
  width: 100%;
}

@media (max-width: 1440px) {
  .content.risk-page {
    padding: 1.75rem 2rem;
  }
}

.view-section {
  width: 100%;
  max-width: 100%;
  margin: 0;
}

/* Sidebar Component */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--navy);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: width 0.3s ease;
  padding: 1.25rem 1rem;
}

.sidebar.collapsed {
  width: 72px !important;
  min-width: 72px !important;
}

.sidebar.collapsed .logo,
.sidebar.collapsed .sidebar-group-title,
.sidebar.collapsed .sidebar-item span,
.sidebar.collapsed .sidebar-badge {
  display: none !important;
}

.sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 0.5rem 0;
  margin-bottom: 1.25rem;
}

.sidebar.collapsed .sidebar-item {
  padding: 0.75rem 0;
  justify-content: center;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  width: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.sidebar-toggle {
  flex-shrink: 0;
  margin-left: 0.4rem;
}

.logo-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: #ffffff;
  letter-spacing: 0.5px;
}

.logo-sub {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 500;
}

.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}

.sidebar-group-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.06em;
  padding: 0.4rem 0.75rem;
  text-transform: uppercase;
  margin-bottom: 0.15rem;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.85rem;
  color: #94a3b8;
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.sidebar-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
}

.sidebar-item.active {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.sidebar-badge {
  margin-left: auto;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-green {
  background: var(--primary-green);
  color: #ffffff;
}

/* Cards & Containers */
.kpi-card, .card {
  background: var(--panel-bg);
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-bottom: 1.5rem;
}

.kpi-card:hover {
  box-shadow: var(--shadow-lg);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.card-action {
  font-size: 0.85rem;
  color: var(--accent-blue);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s;
}

.card-action:hover {
  color: #1d4ed8;
}

.card-body {
  padding: 0;
}

/* Base Data Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  table-layout: fixed;
}

.data-table th {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--text-main);
  padding: 0.70rem 1rem;
  text-align: left;
}

.data-table td {
  font-size: 0.94rem;
  color: #334155;
  padding: 0.70rem 1rem;
  text-align: left;
}

.data-table tr {
  border-bottom: 1px solid var(--border-light);
}

/* Utility Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-weight: 500;
  font-size: 0.82rem;
}

.badge-success {
  background: #dcfce7;
  color: #15803d;
}

.badge-danger {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-warning {
  background: #fef3c7;
  color: #b45309;
}

/* ==========================================================================
   Alpha Models & Signal Analytics UI Components
   ========================================================================== */

.engine-health-header {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 1.5rem;
  letter-spacing: 0.3px;
}

.alpha-top-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Universe Coverage Card */
.alpha-coverage-card {
  margin-bottom: 0;
}

.coverage-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  margin-bottom: 1.5rem;
  background: #f8fafc;
  padding: 1.25rem;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.coverage-stat {
  text-align: center;
}

.coverage-stat-val {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.coverage-stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 0.25rem;
}

.coverage-divider {
  width: 1px;
  height: 40px;
  background: #cbd5e1;
}

/* Progress Bar */
.coverage-bar-wrap {
  margin-bottom: 1.5rem;
}

.coverage-bar-bg {
  width: 100%;
  height: 12px;
  background: #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.coverage-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), #14b8a6);
  border-radius: 6px;
  transition: width 0.4s ease;
}

.coverage-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.80rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Coverage Breakdown items */
.coverage-breakdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.coverage-breakdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--text-main);
  background: #ffffff;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.coverage-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* Per-Factor Alpha Scores Grid */
.factor-scores-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  padding: 0.5rem 0;
}

@media (max-width: 1100px) {
  .factor-scores-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .factor-scores-grid {
    grid-template-columns: 1fr;
  }
}

.factor-score-item {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.factor-score-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.factor-score-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.factor-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.factor-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-main);
}

.factor-weight {
  font-size: 0.80rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.factor-score-val {
  margin-left: auto;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--mono);
}

.factor-bar-bg {
  width: 100%;
  height: 8px;
  background: #f1f5f9;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.factor-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.factor-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Bottom Row & Heatmap */
.alpha-bottom-row {
  margin-bottom: 1.5rem;
}

.heatmap-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
  margin-bottom: 1rem;
}

.heatmap-table th {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  padding: 0.4rem;
}

.hm-label {
  font-size: 0.84rem;
  color: var(--text-main);
  padding: 0.4rem 0.6rem;
  white-space: nowrap;
}

.hm-cell {
  text-align: center;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--mono);
  padding: 0.65rem 0.4rem;
  border-radius: 6px;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: center;
  padding-top: 0.5rem;
}

.heatmap-leg-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--mono);
}

.heatmap-gradient {
  width: 160px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(192,57,43,0.7) 0%, rgba(241,245,249,1) 50%, rgba(15,138,107,0.7) 100%);
}

/* Top Alpha Contributors Table */
.alpha-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
}

.alpha-table th {
  background: #f8fafc;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

.alpha-table td {
  font-size: 0.92rem;
  color: #334155;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-light);
}

.alpha-table tr:hover {
  background: #f8fafc;
}

.ticker {
  display: inline-block;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--navy);
  background: #f1f5f9;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.88rem;
}

.hold-sector {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.text-center {
  text-align: center !important;
}

.font-mono {
  font-family: var(--mono) !important;
}
