/* ============================================
   COACH-MARKS
   ============================================
   Inline coach-mark cards anchored to UI elements.
   Triggered by user interactions, not idle timers.
   Each card shows a mini-diagram + one sentence.
   ============================================ */

:root {
  --coach-bg: #ffffff;
  --coach-border: var(--slate-200, #e2e8f0);
  --coach-shadow: 0 12px 32px rgba(15, 23, 42, 0.14), 0 2px 8px rgba(15, 23, 42, 0.06);
  --coach-text: var(--slate-800, #1e293b);
  --coach-text-muted: var(--slate-500, #64748b);
  --coach-primary: var(--primary-500, #14b8a6);
  --coach-primary-dark: var(--primary-600, #0d9488);
  --coach-z: 9400;
  --coach-width: 320px;
}

body.dark-mode {
  --coach-bg: var(--slate-800, #1e293b);
  --coach-border: var(--slate-700, #334155);
  --coach-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.25);
  --coach-text: var(--slate-100, #f1f5f9);
  --coach-text-muted: var(--slate-400, #94a3b8);
}

.coach-mark {
  position: fixed;
  z-index: var(--coach-z);
  width: var(--coach-width);
  max-width: calc(100vw - 24px);
  background: var(--coach-bg);
  border: 1px solid var(--coach-border);
  border-radius: 14px;
  box-shadow: var(--coach-shadow);
  padding: 14px 14px 12px;
  opacity: 0;
  transform: scale(0.96) translateY(4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  font-family: inherit;
  color: var(--coach-text);
}

.coach-mark.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.coach-mark.hiding {
  opacity: 0;
  transform: scale(0.96) translateY(4px);
}

.coach-mark-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--slate-100, #f1f5f9);
  border: 1px solid var(--coach-border);
  border-radius: 50%;
  color: var(--coach-text-muted);
  cursor: pointer;
  padding: 0;
  font-size: 11px;
  z-index: 2;
  transition: background 0.15s ease, color 0.15s ease;
}

.coach-mark-close:hover {
  background: var(--slate-200, #e2e8f0);
  color: var(--coach-text);
}

body.dark-mode .coach-mark-close {
  background: var(--slate-700, #334155);
}

body.dark-mode .coach-mark-close:hover {
  background: var(--slate-600, #475569);
}

/* Mini-diagram area — borrows the same diagram classes used by feature-tour
   so we don't duplicate styles. Cap the height so they read at a glance. */
.coach-mark-diagram {
  margin: 0 0 12px;
  padding: 10px;
  background: var(--slate-50, #f8fafc);
  border: 1px solid var(--coach-border);
  border-radius: 10px;
  max-height: 130px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.dark-mode .coach-mark-diagram {
  background: rgba(255, 255, 255, 0.03);
}

.coach-mark-diagram > * {
  max-width: 100%;
  transform: scale(0.78);
  transform-origin: center;
}

.coach-mark-body {
  margin-bottom: 10px;
}

.coach-mark-diagram + .coach-mark-body {
  padding-top: 10px;
  border-top: 1px solid var(--coach-border);
}

.coach-mark-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--coach-text);
  line-height: 1.3;
  margin-bottom: 4px;
  padding-right: 28px; /* clear the close button */
}

.coach-mark-content {
  font-size: 13px;
  line-height: 1.5;
  color: var(--coach-text-muted);
}

.coach-mark-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--coach-border);
}

.coach-mark-mute {
  appearance: none;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 12px;
  color: var(--coach-text-muted);
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(100, 116, 139, 0.4);
}

.coach-mark-mute:hover {
  color: var(--coach-text);
  text-decoration-color: currentColor;
}

.coach-mark-got-it {
  appearance: none;
  border: none;
  background: var(--coach-primary);
  color: white;
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.coach-mark-got-it:hover {
  background: var(--coach-primary-dark);
}

/* Mobile: full-width card. Vertical placement (top vs bottom half, clear of the
   fixed bottom team-summary panel) is computed in hint-system.js position() — so
   we DON'T pin top/bottom here, or the card would cover its own anchor and the
   bottom toolbar. We only set the width; left/top come from JS inline styles.
   Cap the height and scroll internally so a tall diagram+body card can't run
   off-screen on a short phone. */
@media (max-width: 600px) {
  .coach-mark {
    width: calc(100vw - 24px);
    max-height: 80vh;
    overflow-y: auto;
  }
}
