/* Planet Dashboard — full-viewport canvas-based ecosystem visualization */

.planet-dashboard {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #08081a;
}

.planet-dashboard canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Header */
.dashboard-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  pointer-events: none;
  z-index: 10;
}

.dashboard-title {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.5px;
  margin: 0;
}

.dashboard-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

.dashboard-updated {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.dashboard-refresh {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 6px 8px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
}

.dashboard-refresh:hover {
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.8);
}

/* Loading */
.dashboard-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 6px;
  z-index: 20;
}

.loading-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  animation: loading-pulse 1.2s infinite ease-in-out;
}

.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes loading-pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.2); }
}

/* Error */
.dashboard-error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 20;
}

.dashboard-error p {
  color: rgba(255, 255, 255, 0.5);
  font-size: 14px;
  margin-bottom: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.dashboard-error button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: all 0.2s;
}

.dashboard-error button:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Legend / Visual Key */
.dashboard-legend {
  position: absolute;
  bottom: 16px;
  left: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  z-index: 10;
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.legend-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.25);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
}

.legend-text {
  font-style: italic;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.legend-healthy { background: hsl(210, 60%, 55%); }
.legend-warning { background: hsl(45, 70%, 55%); }
.legend-unhealthy { background: hsl(0, 65%, 50%); }
.legend-growing { background: hsl(120, 65%, 50%); box-shadow: 0 0 6px hsl(120, 65%, 50%); }
.legend-shrinking { background: hsl(0, 65%, 50%); box-shadow: 0 0 6px hsl(0, 65%, 50%); }

.legend-ring {
  width: 12px;
  height: 6px;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
}

.legend-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: hsl(0, 65%, 50%);
  animation: legend-pulse-anim 1.5s ease-in-out infinite;
}

@keyframes legend-pulse-anim {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}

.legend-refresh-info {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.2);
}

/* Detail Panel */
.detail-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 340px;
  height: 100%;
  background: rgba(12, 12, 36, 0.95);
  backdrop-filter: blur(12px);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 30;
  overflow-y: auto;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.detail-panel.panel-open {
  transform: translateX(0);
}

.panel-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.2s;
}

.panel-close:hover {
  color: rgba(255, 255, 255, 0.8);
}

/* Panel content */
.panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-right: 32px;
}

.panel-planet-name {
  font-size: 20px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  margin: 0;
}

.panel-visit-link {
  font-size: 13px;
  color: rgba(140, 180, 255, 0.8);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s;
}

.panel-visit-link:hover {
  color: rgba(180, 210, 255, 1);
}

/* Health bar */
.panel-health {
  margin-bottom: 20px;
}

.panel-health-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 6px;
}

.panel-health-value {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
}

.panel-health-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.panel-health-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* Metrics grid */
.panel-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.metric-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-value {
  font-size: 16px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.metric-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
}

.metric-warning .metric-value {
  color: hsl(45, 90%, 65%);
}

.metric-warning {
  border-color: rgba(255, 200, 50, 0.15);
}

.metric-traffic .metric-value {
  color: hsl(210, 70%, 70%);
}

.metric-growth .metric-value {
  color: hsl(120, 65%, 60%);
}

.metric-growth {
  border-color: rgba(80, 200, 80, 0.15);
}

.metric-shrink .metric-value {
  color: hsl(0, 65%, 65%);
}

.metric-shrink {
  border-color: rgba(255, 100, 100, 0.15);
}

/* Sections */
.panel-section {
  margin-bottom: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.panel-section h3 {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 8px 0;
}

.panel-work-items {
  display: flex;
  gap: 12px;
}

.work-item {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}

.work-bug {
  color: hsl(0, 70%, 65%);
}

.metric-dim .metric-value {
  color: rgba(255, 255, 255, 0.3);
  font-size: 13px;
}

.metric-dim {
  border-color: rgba(255, 255, 255, 0.03);
  background: rgba(255, 255, 255, 0.02);
}

.panel-traffic-section {
  background: rgba(255, 255, 255, 0.02);
  margin-left: -20px;
  margin-right: -20px;
  padding: 12px 20px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.panel-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.25);
  font-style: italic;
  margin-top: 8px;
}

.panel-footer-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-deploy-info,
.panel-importance-info {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
}

/* Mobile: panel slides up from bottom */
@media (max-width: 640px) {
  .detail-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 60%;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    transform: translateY(100%);
    border-radius: 16px 16px 0 0;
  }

  .detail-panel.panel-open {
    transform: translateY(0);
  }

  .dashboard-legend {
    bottom: 8px;
    left: 12px;
    gap: 4px 12px;
  }

  .legend-item {
    font-size: 9px;
  }

  .legend-label {
    font-size: 9px;
  }

  .legend-refresh-info {
    display: none;
  }

  .dashboard-header {
    padding: 12px 16px;
  }

  .dashboard-title {
    font-size: 15px;
  }
}
