/* =============================================================
   Exercise Muscle Diagrams
   Clean, responsive anatomical muscle map shown per exercise.
   Uses the app design-system tokens with safe fallbacks.
   ============================================================= */

.exercise-diagram-wrap {
  margin: 16px 0;
}

.exercise-diagram {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: var(--radius-lg, 16px);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.06));
}

/* ---- Header ---- */
.exercise-diagram .ed-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.exercise-diagram .ed-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main, #1e293b);
  letter-spacing: 0.01em;
}

.exercise-diagram .ed-title i {
  color: var(--primary-purple, #e76f51);
}

.exercise-diagram .ed-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.exercise-diagram .ed-chip {
  display: inline-block;
  padding: 4px 11px;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--primary-dark, #c75a3f);
  background: rgba(231, 111, 81, 0.12);
  border: 1px solid rgba(231, 111, 81, 0.28);
  border-radius: 999px;
  white-space: nowrap;
}

/* ---- Figures ---- */
.exercise-diagram .ed-figures {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 28px;
}

.exercise-diagram .ed-figure {
  margin: 0;
  flex: 0 1 150px;
  max-width: 160px;
  text-align: center;
}

.exercise-diagram .ed-svg {
  width: 100%;
  height: auto;
  display: block;
}

.exercise-diagram .ed-figure-label {
  display: block;
  margin-top: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted, #94a3b8);
}

/* ---- Body parts ---- */
.exercise-diagram .ed-part {
  fill: var(--gray-100, #eef1f5);
  stroke: var(--gray-300, #cbd5e1);
  stroke-width: 1;
}

.exercise-diagram .ed-muscle {
  fill: var(--gray-200, #dde3ea);
  stroke: var(--gray-300, #c3ccd6);
  transition: fill 0.25s ease, stroke 0.25s ease;
}

/* Targeted muscles */
.exercise-diagram .ed-muscle.is-active {
  fill: var(--primary-purple, #e76f51);
  stroke: var(--primary-dark, #c75a3f);
  stroke-width: 1.25;
}

/* ---- Dark mode ---- */
[data-theme="dark"] .exercise-diagram {
  background: var(--bg-card, #1a1f2e);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .exercise-diagram .ed-title {
  color: var(--text-main, #f1f5f9);
}

[data-theme="dark"] .exercise-diagram .ed-chip {
  color: #ffd2c4;
  background: rgba(231, 111, 81, 0.18);
  border-color: rgba(231, 111, 81, 0.4);
}

[data-theme="dark"] .exercise-diagram .ed-part {
  fill: #2a3142;
  stroke: #3a4255;
}

[data-theme="dark"] .exercise-diagram .ed-muscle {
  fill: #333c50;
  stroke: #3a4255;
}

[data-theme="dark"] .exercise-diagram .ed-muscle.is-active {
  fill: var(--primary-purple, #e76f51);
  stroke: var(--primary-light, #fb8c6e);
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .exercise-diagram {
    padding: 14px;
  }
  .exercise-diagram .ed-figures {
    gap: 16px;
  }
  .exercise-diagram .ed-figure {
    flex-basis: 130px;
  }
  .exercise-diagram .ed-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 360px) {
  .exercise-diagram .ed-figures {
    gap: 8px;
  }
}
