/* Dashboard CSS - Updated for new design system */

/* Use CSS variables from main style.css */
:root {
  --primary: #2563EB;
  --text: #1A1D21;
  --text-muted: #667085;
  --background: #F8FAFC;
  --surface: #FFFFFF;
  --border: #E5E7EB;
  --success: #16A34A;
  --warning: #FACC15;
  --error: #DC2626;
  --shadow-sm: 0 1px 2px rgba(16,24,40,0.06), 0 1px 3px rgba(16,24,40,0.1);
  --radius-card: 8px;
  --radius-input: 6px;
  --font-family: Inter, "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Container styles */
.container,
#global-stats-container,
#spotlight-container {
  margin: 32px 0;
  padding: 40px 48px;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

/* Facts Bar - Simplified to 4 cards */
#facts-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 24px 0 32px 0;
}

.fact-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.fact-card.active, 
.fact-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: var(--primary);
  background: #eff6ff;
}

.fact-title {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.fact-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

/* Chart Container - Enhanced */
#chart-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 24px;
  margin: 24px 0 0;
  background: var(--surface);
  min-height: 420px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

#chart-title {
  font-size: 16px;
  color: var(--text);
  font-weight: 600;
  margin: 0 0 20px;
  height: auto;
  text-align: center;
}

#chart-canvas {
  width: 100% !important;
  height: 350px !important;
  max-height: 350px !important;
  display: block;
  position: relative;
}

/* Chart.js size monitor cleanup */
.chartjs-size-monitor,
.chartjs-size-monitor-expand,
.chartjs-size-monitor-shrink {
  position: absolute;
  direction: ltr;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  pointer-events: none;
  visibility: hidden;
  z-index: -1;
}

/* Projects Section (kept but hidden) */
#project-list-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 32px;
  margin: 32px 0;
  max-height: 400px;
  overflow-y: auto;
  display: none; /* Hidden per design */
}

#project-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.project-item {
  background: #eff6ff;
  border: 2px solid var(--border);
  padding: 12px 20px;
  border-radius: 24px;
  cursor: pointer;
  font-size: 14px;
  color: var(--primary);
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-block;
}

.project-item:hover {
  background: #dbeafe;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.project-item.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Q&A Section (kept but styled) */
.qa-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 32px;
  margin: 32px 0;
  max-height: 500px;
  overflow-y: auto;
}

.qa-item {
  padding: 16px;
  margin: 12px 0;
  border-left: 3px solid var(--primary);
  background: #eff6ff;
  border-radius: 0 var(--radius-input) var(--radius-input) 0;
  font-size: 14px;
}

.qa-question {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.qa-answer {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

/* Status and Progress */
#status {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 12px;
  font-weight: 500;
}

#progress-wrapper {
  margin-top: 16px;
}

/* Warning Banner */
#warning-banner {
  background: #fef3c7;
  color: #92400e;
  padding: 16px;
  margin: 16px 0;
  border-radius: var(--radius-card);
  border: 1px solid #fcd34d;
  font-size: 14px;
}

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

::-webkit-scrollbar-track {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Responsive Design */
@media (max-width: 768px) {
  .container,
  #global-stats-container,
  #spotlight-container {
    padding: 24px 20px;
    margin: 16px 0;
  }

  #facts-bar {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin: 16px 0 24px 0;
  }

  .fact-card {
    padding: 16px 12px;
    min-width: 120px;
  }

  .fact-value {
    font-size: 20px;
  }

  .fact-title {
    font-size: 12px;
  }

  #chart-wrap {
    height: 320px;
    padding: 16px;
  }

  #chart-canvas {
    height: 260px !important;
  }

  #project-list-container,
  .qa-section {
    max-height: 300px;
    padding: 20px;
  }
}

@media (max-width: 480px) {
  #facts-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .fact-card {
    padding: 12px 8px;
  }

  .fact-title {
    font-size: 11px;
  }

  .fact-value {
    font-size: 18px;
  }

  #chart-wrap {
    padding: 12px;
  }
}

/* Enhanced focus states for accessibility */
.fact-card:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Loading states */
.skeleton-card {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-card);
  height: 80px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}