/* ═══ Anchor HQ — Mission Control Section (The Command Center) ═══ */
/* Stardew Valley satellite station — warm earth tones, pixel status indicators */

/* ── Keyframes ── */
@keyframes mcPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
@keyframes mcGlow {
  0%, 100% { box-shadow: 0 0 4px var(--gold); }
  50% { box-shadow: 0 0 12px var(--gold), 0 0 20px rgba(218,165,32,0.3); }
}
@keyframes mcBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Stale Banner ── */
.mc-stale-banner {
  background: rgba(255,193,7,0.08);
  border: 1px solid rgba(255,193,7,0.3);
  border-radius: var(--radius);
  padding: 8px 14px;
  margin-bottom: 16px;
  font-size: 0.8rem;
  color: var(--yellow);
  display: none;
}
.mc-stale-banner.visible { display: flex; align-items: center; gap: 8px; }

/* ── Fleet KPI Grid ── */
.mc-fleet-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.mc-kpi {
  background: linear-gradient(180deg, rgba(107,68,35,0.04) 0%, transparent 40%), var(--panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.mc-kpi::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--wood-dark, #3a2415) 0%, var(--wood, #6b4423) 30%, var(--wood-light, #8b6340) 50%, var(--wood, #6b4423) 70%, var(--wood-dark, #3a2415) 100%);
  border-radius: var(--radius) var(--radius) 0 0;
}
.mc-kpi-label {
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.mc-kpi-value {
  font-family: var(--font-pixel, 'Press Start 2P', monospace);
  font-size: 0.7rem;
  color: var(--gold);
}
.mc-kpi-value.mc-healthy-val { color: var(--green); }
.mc-kpi-value.mc-warning-val { color: var(--yellow); }
.mc-kpi-value.mc-critical-val { color: var(--red); }

/* ── Spend Progress Bar ── */
.mc-spend-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-soft, #1a1610);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}
.mc-spend-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 2px;
  transition: width 300ms ease;
}
.mc-spend-fill.over-budget { background: var(--red); }

/* ── Agent Cards Grid ── */
.mc-agents-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.mc-agent-card {
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: all 250ms;
  position: relative;
  overflow: hidden;
}
.mc-agent-card:hover {
  border-color: var(--border-accent);
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.mc-agent-card.mc-healthy { border-top: 3px solid var(--green); }
.mc-agent-card.mc-warning { border-top: 3px solid var(--yellow); opacity: 0.85; }
.mc-agent-card.mc-critical {
  border-top: 3px solid var(--red);
  background: linear-gradient(135deg, var(--panel) 0%, rgba(231,76,60,0.05) 100%);
  animation: mcPulse 2s ease-in-out infinite;
}

/* Agent card header */
.mc-agent-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.mc-agent-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.mc-dot {
  width: 10px;
  height: 10px;
  border-radius: 0;
  image-rendering: pixelated;
  flex-shrink: 0;
}
.mc-dot.healthy { background: var(--green); box-shadow: 0 0 4px rgba(108,191,74,0.4); }
.mc-dot.warning { background: var(--yellow); box-shadow: 0 0 4px rgba(240,192,64,0.4); }
.mc-dot.critical { background: var(--red); box-shadow: 0 0 4px rgba(224,64,64,0.4); animation: mcBlink 1s ease-in-out infinite; }

/* Agent card meta */
.mc-agent-meta {
  font-size: 0.7rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}
.mc-agent-output-preview {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Agent expand area */
.mc-agent-expand {
  max-height: 0;
  overflow: hidden;
  transition: max-height 300ms ease;
}
.mc-agent-card.expanded .mc-agent-expand {
  max-height: 250px;
}
.mc-agent-expand-inner {
  padding-top: 10px;
  margin-top: 10px;
  border-top: 1px solid var(--border);
}
.mc-agent-full-output {
  font-size: 0.7rem;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 8px;
}
.mc-agent-failures {
  font-size: 0.65rem;
  color: var(--red);
  font-family: var(--font-pixel, 'Press Start 2P', monospace);
}

/* ── Brief Panel ── */
.mc-brief {
  background: linear-gradient(180deg, rgba(107,68,35,0.04) 0%, transparent 40%), var(--panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
  position: relative;
}
.mc-brief::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--wood-dark, #3a2415) 0%, var(--wood, #6b4423) 30%, var(--wood-light, #8b6340) 50%, var(--wood, #6b4423) 70%, var(--wood-dark, #3a2415) 100%);
  border-radius: var(--radius) var(--radius) 0 0;
}
.mc-brief-title {
  font-family: var(--font-pixel, 'Press Start 2P', monospace);
  font-size: 0.6rem;
  color: var(--gold);
  margin-bottom: 10px;
  text-transform: uppercase;
}
.mc-brief-summary {
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 12px;
}
.mc-brief-actions, .mc-brief-alerts {
  margin: 0;
  padding: 0 0 0 16px;
  font-size: 0.75rem;
  line-height: 1.6;
}
.mc-brief-actions li { color: var(--green); }
.mc-brief-alerts li { color: var(--red); font-weight: 600; }
.mc-brief-section-label {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  margin: 8px 0 4px;
  letter-spacing: 0.5px;
}

/* ── Collapsible Panels ── */
.mc-collapsible-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.mc-panel {
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.mc-panel-header {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  user-select: none;
  transition: background 200ms;
}
.mc-panel-header:hover { background: var(--panel-hover); }
.mc-panel-header-title {
  font-family: var(--font-pixel, 'Press Start 2P', monospace);
  font-size: 0.55rem;
  color: var(--gold);
  text-transform: uppercase;
}
.mc-panel-chevron {
  font-size: 0.6rem;
  color: var(--muted);
  transition: transform 200ms;
}
.mc-panel.mc-collapsed .mc-panel-chevron { transform: rotate(-90deg); }
.mc-panel-body {
  padding: 0 14px 14px;
  transition: all 200ms;
}
.mc-panel.mc-collapsed .mc-panel-body { display: none; }

/* ── Trends Row ── */
.mc-trends-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.mc-trend-item {
  text-align: center;
}
.mc-trend-label {
  font-size: 0.65rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.mc-trend-value {
  font-family: var(--font-pixel, 'Press Start 2P', monospace);
  font-size: 0.6rem;
  color: var(--gold);
  margin-bottom: 6px;
}
.mc-trend-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-soft, #1a1610);
  border-radius: 2px;
  overflow: hidden;
}
.mc-trend-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  transition: width 300ms ease;
}

/* ── Improvements List ── */
.mc-improvements-list {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mc-improvement-item {
  display: flex;
  gap: 10px;
  font-size: 0.75rem;
  line-height: 1.4;
}
.mc-improvement-date {
  color: var(--muted);
  font-size: 0.65rem;
  white-space: nowrap;
  min-width: 70px;
}
.mc-improvement-desc { color: var(--text); }

/* ── Department Grades ── */
.mc-grades-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.mc-grade {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.mc-grade-badge {
  font-family: var(--font-pixel, 'Press Start 2P', monospace);
  font-size: 0.6rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.mc-grade-badge.grade-a { background: rgba(108,191,74,0.2); color: var(--green); }
.mc-grade-badge.grade-b { background: rgba(218,165,32,0.2); color: var(--gold); }
.mc-grade-badge.grade-c { background: rgba(240,192,64,0.2); color: var(--yellow); }
.mc-grade-badge.grade-d { background: rgba(224,128,64,0.2); color: #e08040; }
.mc-grade-badge.grade-f { background: rgba(224,64,64,0.2); color: var(--red); }
.mc-grade-label {
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: capitalize;
}

/* ── Growth Milestones ── */
.mc-milestones {
  display: flex;
  align-items: center;
  padding: 10px 0;
}
.mc-milestone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 1;
}
.mc-milestone-dot {
  width: 14px;
  height: 14px;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  background: var(--border);
  transition: all 300ms;
}
.mc-milestone-dot.reached {
  background: var(--gold);
  animation: mcGlow 2s ease-in-out infinite;
}
.mc-milestone-dot.current {
  background: var(--gold-bright, #f0c040);
  width: 18px;
  height: 18px;
  animation: mcGlow 1.5s ease-in-out infinite;
}
.mc-milestone-label {
  font-family: var(--font-pixel, 'Press Start 2P', monospace);
  font-size: 0.45rem;
  color: var(--muted);
}
.mc-milestone-label.reached { color: var(--gold); }
.mc-milestone-line {
  height: 2px;
  flex: 1;
  background: var(--border);
  min-width: 10px;
}
.mc-milestone-line.filled { background: var(--gold); }
.mc-growth-current {
  text-align: center;
  margin-top: 12px;
  font-family: var(--font-pixel, 'Press Start 2P', monospace);
  font-size: 0.55rem;
  color: var(--gold);
}

/* ── Empty State ── */
.mc-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.mc-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}
.mc-empty-text {
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ── Responsive: Tablet ── */
@media (max-width: 1024px) {
  .mc-fleet-bar { grid-template-columns: repeat(2, 1fr); }
  .mc-agents-grid { grid-template-columns: repeat(2, 1fr); }
  .mc-trends-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── Responsive: Mobile ── */
@media (max-width: 640px) {
  .mc-fleet-bar { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .mc-agents-grid { grid-template-columns: 1fr; }
  .mc-trends-grid { grid-template-columns: 1fr; }
  .mc-collapsible-group .mc-panel .mc-panel-body { display: none; }
  .mc-collapsible-group .mc-panel { /* default collapsed on mobile */ }
  .mc-milestones { flex-wrap: wrap; justify-content: center; gap: 4px; }
  .mc-milestone-line { min-width: 6px; }
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  .mc-dot,
  .mc-agent-card.mc-critical,
  .mc-milestone-dot.reached,
  .mc-milestone-dot.current {
    animation: none;
  }
}
