/* Body map widget — overlay zones on PNG silhouettes with severity colors. */

.body-map {
  position: relative;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
}

.bm-side {
  flex: 1 1 280px;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bm-side > svg {
  width: 100%;
  height: auto;
  display: block;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* FRONT / BACK side title above each silhouette (iOS BodyMapField). */
.bm-side-title {
  font-family: var(--font-display, system-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-secondary, #666);
}

.muscle {
  fill: transparent;
  stroke: rgba(160, 160, 160, 0.55);
  stroke-width: 1.5;
  stroke-linejoin: round;
  cursor: pointer;
  transition: fill-opacity 120ms ease-out, stroke 120ms ease-out;
}

.muscle[data-severity="none"]     { fill: transparent; }
.muscle[data-severity="mild"]     { fill: var(--sev-mild, #FFD700); fill-opacity: var(--sev-mild-a, 0.55); }
.muscle[data-severity="moderate"] { fill: var(--sev-mod, #FF8C00); fill-opacity: var(--sev-mod-a, 0.65); }
.muscle[data-severity="severe"]   { fill: var(--sev-severe, #FF4444); fill-opacity: var(--sev-severe-a, 0.75); }

.muscle:hover {
  stroke: rgba(70, 70, 70, 0.85);
  stroke-width: 2;
}

.body-map[data-readonly="true"] .muscle {
  cursor: default;
  pointer-events: none;
}
.body-map[data-readonly="true"] .muscle:hover {
  stroke: rgba(160, 160, 160, 0.55);
  stroke-width: 1.5;
}

@supports (transform-box: fill-box) {
  .muscle.pulsing {
    transform-box: fill-box;
    transform-origin: center;
    animation: bm-pulse 150ms ease-out;
  }
}
@supports not (transform-box: fill-box) {
  .muscle.pulsing { animation: bm-flash 150ms ease-out; }
}

@keyframes bm-pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}
@keyframes bm-flash {
  0%, 100% { fill-opacity: 0.55; }
  50%      { fill-opacity: 0.95; }
}

/* Tooltip */
.body-map-tooltip {
  position: fixed;
  z-index: 9999;
  background: rgba(20, 20, 20, 0.92);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-family: system-ui, -apple-system, sans-serif;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.body-map-error {
  padding: 24px;
  color: #FF4444;
  font-family: system-ui, sans-serif;
  text-align: center;
}

/* Debug mode: stroke color set inline by JS (cyan front / magenta back) */

.body-map-debug-overlay {
  position: absolute;
  top: 0;
  right: 0;
  background: rgba(20, 20, 20, 0.85);
  color: #fff;
  padding: 12px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 12px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
}
.body-map-debug-overlay button {
  background: #fff;
  color: #000;
  border: none;
  padding: 6px 10px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}
.body-map-debug-overlay button:hover { background: #ddd; }
