/* =========================
   Upload Zone
========================= */
.upload-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 50px;
  max-width: 640px;
  margin: 0 auto;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  animation: fadeInUp 0.6s ease 0.3s backwards;
  transform-origin: center center;
}

.upload-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 24px;
  background: radial-gradient(circle at center, var(--accent-soft) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.upload-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 60px rgba(255, 107, 107, 0.08);
}

.upload-card:hover::before { opacity: 1; }

.drop-zone {
  border: 2px dashed var(--border-bright);
  border-radius: 20px;
  padding: 50px 30px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  background: var(--bg-tertiary);
}

.drop-zone:hover {
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--accent);
}

.drop-zone.dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.02);
}

.drop-zone.processing { border-color: var(--warning); }

.drop-zone.success {
  border-color: var(--success);
  background: var(--success-soft);
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 20px;
  display: block;
}

.upload-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.upload-subtitle {
  color: var(--text-tertiary);
  font-size: 14px;
  line-height: 1.6;
}

.upload-subtitle span {
  color: var(--accent);
  font-weight: 500;
}

.sample-link {
  display: inline-block;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-tertiary);
  text-decoration: none;
  transition: all 0.2s;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.sample-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* =========================
   Modal
========================= */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal.visible { display: flex; }

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  max-width: 500px;
  width: 90%;
  animation: fadeInUp 0.3s ease;
}

.modal-header {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
}

.modal-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 30px;
}

.column-selector { margin-bottom: 20px; }

.column-selector label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.column-selector select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: border-color 0.2s;
}

.column-selector select:focus {
  outline: none;
  border-color: var(--accent);
}

.modal-buttons {
  display: flex;
  gap: 12px;
  margin-top: 30px;
}

/* =========================
   Buttons
========================= */
.btn {
  flex: 1;
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover { border-color: var(--border-bright); }

/* NOTE: You reference .btn-primary in HTML but didn’t define it */
.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.05);
}

/* =========================
   Spinner + Error
========================= */
.spinner {
  display: none;
  width: 40px;
  height: 40px;
  margin: 20px auto;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner.visible { display: block; }

.error-message {
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 20px;
  margin-top: 20px;
  color: var(--accent);
  display: none;
  font-size: 14px;
  line-height: 1.6;
}

.error-message.visible {
  display: block;
  animation: fadeInUp 0.4s ease;
}

/* =========================
   Metrics
========================= */
.metrics-section {
  display: none;
  margin-top: 80px;
  animation: fadeInUp 0.6s ease;
}

.metrics-section.visible { display: block; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
}

.section-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* Missing in your CSS but used in HTML */
.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Used in HTML */
.metrics-block {
  margin-bottom: 60px;
}

/* Used in HTML */
.big-title {
  font-size: 28px;
}

.download-btn {
  padding: 10px 20px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.download-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--border-bright);
  transform: translateY(-2px);
}

.secondary-btn { background: var(--bg-secondary); }
.secondary-btn:hover { background: var(--bg-tertiary); }

.metrics-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
  margin-bottom: 40px;
}

.hero-metric {
  grid-column: span 1;
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.08) 0%, var(--bg-secondary) 100%);
  border-color: rgba(255, 107, 107, 0.3);
  position: relative;
  min-height: 200px;
}

.hero-metric::after {
  content: '★ PRIMARY METRIC';
  position: absolute;
  top: 16px;
  right: 24px;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--accent);
  opacity: 0.6;
  font-weight: 700;
}

.hero-metric .metric-value { font-size: 3rem; }

.forecast-visualization {
  grid-column: 1 / -1;
  margin: 40px 0;
}

.forecast-visualization .section-title {
  font-size: 28px;
  margin-bottom: 20px;
}

/* Ensures the chart is tall like in index.html */
.forecast-visualization canvas {
  min-height: 400px !important;
}

/* Wrapper used in your HTML - previously missing */
.chart-shell {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 30px;
  background: var(--bg-tertiary);
}

.comparison-container {
  grid-column: 1 / -1;
  margin: 60px 0;
}

.comparison-container .section-title {
  font-size: 28px;
  margin-bottom: 30px;
}

/* Winner banner (your JS writes to this) */
.winner-banner {
  padding: 24px 32px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-tertiary);
  margin-bottom: 30px;
  font-size: 20px;
}

/* Keep your ID styles too (won’t hurt) */
#winnerBanner {
  padding: 24px 32px !important;
  font-size: 20px !important;
  margin-bottom: 30px !important;
}

/* Table wrapper used in your HTML - previously missing */
.table-shell {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

/* Charts layout used in your HTML - previously missing */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 30px;
  margin-top: 30px;
}

.chart-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  background: var(--bg-tertiary);
}

.chart-title {
  margin: 0 0 20px 0;
  font-size: 18px;
  color: var(--text-secondary);
}

/* Comparison table tweaks */
.comp-table tbody td {
  padding: 24px !important;
  font-size: 18px !important;
}

.comp-table thead th {
  padding: 20px 24px !important;
  font-size: 13px !important;
}

/* Charts */
#fisChart, #otherChart {
  min-height: 300px !important;
}

.individual-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 40px;
}

.metric-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  text-align: left;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  min-height: 180px;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--success));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.metric-card:hover {
  border-color: var(--border-bright);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.metric-card:hover::before { opacity: 1; }

.metric-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
  font-weight: 600;
}

/* ✅ Keep ONE definition (was duplicated before) */
.metric-value {
  font-family: var(--font-mono);
  font-size: 2.8rem; /* big numbers */
  font-weight: 600;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

.metric-value.primary { color: var(--accent); }
.metric-value.success { color: var(--success); }
.metric-value.warning { color: var(--warning); }

.stat-number {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.metric-description {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.5;
}

.health-indicator {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 8px;
}

.health-excellent {
  background: var(--success-soft);
  color: var(--success);
}

.health-good {
  background: rgba(255, 212, 59, 0.1);
  color: var(--warning);
}

.health-poor {
  background: var(--accent-soft);
  color: var(--accent);
}

/* =========================
   Tables
========================= */
.comp-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 40px;
  text-align: left;
  background: transparent;
}

.comp-table thead th {
  padding: 16px 24px;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  background: transparent;
  border-bottom: 1px solid var(--border);
}

.comp-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.comp-table tbody tr:last-child { border-bottom: none; }

.comp-table tbody td {
  padding: 32px 24px;
  font-size: 15px;
  background: transparent;
}

.comp-table tbody td:first-child {
  font-weight: 600;
  color: var(--text-primary);
}

.comp-table tbody tr:hover { background: rgba(255, 255, 255, 0.01); }

.check {
  color: var(--success);
  font-weight: 500;
  font-size: 14px;
}

.cross {
  color: var(--text-tertiary);
  font-weight: 400;
  font-size: 14px;
}

/* =========================
   Info Section
========================= */
.info-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 30px;
  margin-top: 30px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
}

.info-item h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--accent);
}

.info-item p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}
/* ================================
   Forecast vs Actuals chart sizing
   ================================ */

/* keep your existing metrics-section rules (only once) */
.metrics-section { display: none; }
.metrics-section.visible { display: block; }

/* make the chart area tall (this is what you want visually) */
.chart-shell {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 30px;
  background: var(--bg-tertiary);

  /* IMPORTANT: actual height for Chart.js to target */
  height: 420px;
}

/* do NOT force canvas height:100% here; let Chart.js size the canvas */
.chart-shell canvas {
  width: 100% !important;
  display: block;
}
