/* Imaging Studio — microscopy/histology image analysis workspace. */

.imaging-studio-root .studio {
  --im-panel: color-mix(in srgb, var(--surface, #ffffff) 94%, #0f9d76 6%);
}

.im-drop {
  min-height: 210px;
  border: 1px dashed color-mix(in srgb, var(--border, #cbd5e1), #0f9d76 35%);
  border-radius: 8px;
  display: grid;
  place-items: center;
  gap: 8px;
  text-align: center;
  background: color-mix(in srgb, var(--surface, #ffffff) 92%, #0f9d76 8%);
  cursor: pointer;
  padding: 28px;
}

.im-drop.drop {
  border-color: #0f9d76;
  background: color-mix(in srgb, var(--surface, #ffffff) 84%, #0f9d76 16%);
}

.im-drop-title {
  font-weight: 750;
  font-size: 18px;
}

.im-drop-sub,
.im-status,
.im-disclaimer {
  color: var(--ink-soft, #64748b);
  font-size: 13px;
}

.im-disclaimer {
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--border, #cbd5e1), #f59e0b 35%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface, #ffffff) 90%, #f59e0b 10%);
}

.im-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.im-thumb {
  border: 1px solid var(--border, #d8dee9);
  border-radius: 8px;
  background: var(--surface, #ffffff);
  padding: 8px;
  text-align: left;
  display: grid;
  gap: 6px;
  cursor: pointer;
  min-width: 0;
}

.im-thumb.active {
  border-color: #0f9d76;
  box-shadow: 0 0 0 2px color-mix(in srgb, #0f9d76 24%, transparent);
}

.im-thumb img,
.im-thumb-missing {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  background: #101820;
  color: #dbeafe;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.im-thumb-title {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.im-thumb-meta {
  color: var(--ink-soft, #64748b);
  font-size: 12px;
}

.im-viewbar,
.im-actionbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.im-spacer {
  flex: 1;
}

.im-zoom {
  min-width: 56px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft, #64748b);
}

.im-slider {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-soft, #64748b);
}

.im-slider input {
  width: 110px;
}

.im-stage {
  position: relative;
  height: min(62vh, 620px);
  min-height: 360px;
  overflow: hidden;
  border: 1px solid var(--border, #d8dee9);
  border-radius: 8px;
  background:
    linear-gradient(45deg, rgba(148, 163, 184, 0.14) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148, 163, 184, 0.14) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.14) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.14) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

.im-stage-inner {
  position: absolute;
  left: 20px;
  top: 20px;
  transform-origin: top left;
  background: #05070a;
}

.im-view-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  pointer-events: none;
}

.im-preview-missing {
  width: 100%;
  height: 100%;
  min-height: 240px;
  display: grid;
  place-items: center;
  color: #e2e8f0;
  padding: 24px;
  text-align: center;
}

.im-roi,
.im-ann {
  position: absolute;
  background: rgba(15, 23, 42, 0.08);
  border: 3px solid currentColor;
  font-size: 18px;
  font-weight: 750;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

.im-roi {
  cursor: pointer;
  color: #4fb3ff;
}

.im-roi.active {
  background: rgba(79, 179, 255, 0.16);
  outline: 2px solid #fff;
}

.im-roi span,
.im-ann {
  padding: 4px 6px;
}

.im-ann {
  pointer-events: none;
  color: #f5c542;
}

.im-scalebar {
  position: absolute;
  right: 32px;
  bottom: 28px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  padding-top: 12px;
  width: 190px;
  border-bottom: 8px solid #fff;
  text-shadow: 0 1px 2px #000;
  pointer-events: none;
}

.im-ai-output,
.im-ai-mini,
.im-report {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink, #172033);
}

.im-ai-mini {
  max-height: 220px;
  overflow: auto;
}

@media (max-width: 900px) {
  .im-gallery {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .im-stage {
    min-height: 300px;
  }
}
