/* ============================================================
   exam-toolbar.css — Exam Card Toolbar
   ─────────────────────────────────────────
   PURPOSE : Current-condition button, eye tracking, quick tour and
             settings buttons above the eyes
             (html-templates/exam/exam-toolbar.html).
   ============================================================ */

.exam-toolbar {
  /* Tools on the exam field share this stacking context; the Krimsky prism
     reaches z-index 200 while dragged (css/krimsky/prism.css). The toolbar
     and its settings popover must stay above it. */
  position: relative;
  z-index: 210;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -14px -6px 14px;
}

/* ── Current condition ────────────────────────────────────────── */
.exam-current {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  padding: 6px 14px 6px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--surface-sunken);
  color: var(--text);
  font-family: inherit;
  text-align: start;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}

.exam-current:hover {
  border-color: var(--accent);
  background: var(--surface);
}

.exam-current:focus-visible,
.exam-toolbar__btn:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Amber while a pathology is loaded, teal for the normal baseline. */
.exam-current__dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mark-catch);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mark-catch) 25%, transparent);
}

.exam-current[data-normal="true"] .exam-current__dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.exam-current__text {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.exam-current__name {
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exam-current__eye {
  flex: none;
  font-size: 12px;
  color: var(--text-soft);
  white-space: nowrap;
}

.exam-current__eye[hidden] {
  display: none;
}

.exam-current__change {
  flex: none;
  padding-inline-start: 10px;
  border-inline-start: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

/* ── Action buttons ───────────────────────────────────────────── */
.exam-toolbar__actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
}

/* The tracking toggle used to float over the card (css/stage.css); here it
   sits in the toolbar's row instead. */
.exam-toolbar .track-toggle-btn {
  position: static;
  z-index: auto;
  height: 32px;
}

.exam-toolbar__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.exam-toolbar__btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.exam-toolbar__btn:hover,
.exam-toolbar__btn[aria-expanded="true"] {
  border-color: var(--accent);
  background: var(--accent-tint);
  color: var(--accent-strong);
}

html[dir="rtl"] .exam-current,
html[dir="rtl"] .exam-toolbar__btn {
  font-family: 'IBM Plex Sans Arabic', 'Tajawal', 'Inter', system-ui, sans-serif;
}

/* ── Narrow cards: condition on its own row, icon-only buttons ─── */
@media (max-width: 720px) {
  .exam-toolbar {
    flex-wrap: wrap;
    margin: -8px -2px 12px;
  }

  .exam-current {
    flex: 1 1 100%;
  }

  .exam-current__change {
    margin-inline-start: auto;
  }

  .exam-toolbar__actions {
    margin-inline-start: auto;
  }

  .exam-toolbar__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .exam-toolbar__btn {
    width: 32px;
    padding: 0;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .exam-current,
  .exam-toolbar__btn {
    transition: none;
  }
}
