/* /imageview - imageview.php / imageview.js */
.iv {
  --iv-bg: #ffffff;
  --iv-text: #1f2937;
  --iv-muted: #6b7280;
  --iv-border: #e5e7eb;
  --iv-chip: #f3f4f6;
  --iv-accent: #f59e0b;
  --iv-net: #7c3aed;
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 16px 24px;
  color: var(--iv-text);
  box-sizing: border-box;
}
@media (prefers-color-scheme: dark) {
  .iv {
    --iv-bg: #1f2937;
    --iv-text: #e5e7eb;
    --iv-muted: #9ca3af;
    --iv-border: #374151;
    --iv-chip: #374151;
  }
}

.iv-header h1 { font-size: 1.5rem; margin: 4px 0 6px; line-height: 1.3; }
.iv-description { color: var(--iv-muted); margin: 0 0 10px; max-width: 70ch; }
.iv-manage { font-size: 0.8rem; font-weight: normal; margin-left: 8px; }
.iv-private { font-size: 0.7rem; font-weight: 600; vertical-align: middle; background: #fee2e2; color: #991b1b; border-radius: 999px; padding: 2px 8px; }

/* Board pages (/boards/map/..., board-map-lib.php) */
.iv-device { font-family: 'IBM Plex Mono', 'Courier New', monospace; font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--copper-text, #A1531F); margin: 8px 0 0; }
.iv-counts { margin: 0 0 8px; }
.iv-visibility { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 10px; }
.iv-visibility button { font-size: 0.85rem; border: 1px solid var(--iv-border); background: var(--iv-chip); color: var(--iv-text); border-radius: 6px; padding: 3px 10px; cursor: pointer; }
.iv-parts { margin-top: 28px; }
.iv-parts h2 { font-size: 1.3rem; margin-bottom: 10px; }
.iv-parts table { color: var(--iv-text); }
.iv-parts-rd { white-space: normal; max-width: 260px; font-family: 'IBM Plex Mono', 'Courier New', monospace; font-size: 0.85em; }

.iv-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 6px; }
.iv-tab {
  flex: 0 0 auto; border: 1px solid var(--iv-border); background: var(--iv-chip); color: var(--iv-text);
  border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 0.9rem; white-space: nowrap;
}
.iv-tab.active { border-color: var(--iv-accent); box-shadow: inset 0 -3px 0 var(--iv-accent); }
.iv-tab-count { background: var(--iv-accent); color: #111; border-radius: 999px; padding: 0 6px; font-size: 0.75rem; font-weight: 700; }

/* Zoom controls stay on screen while the page scrolls - under the site's
   sticky header (--iv-top, set from its height in imageview.js) */
.iv-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px;
  position: sticky; top: var(--iv-top, 62px); z-index: 20; background: var(--iv-bg); padding: 6px 0; }
/* Scrolled to from the nets list: the photo lands just below the toolbar */
#ivStageWrap { scroll-margin-top: calc(var(--iv-top, 62px) + 56px); }
.iv-toolbar button {
  min-width: 38px; height: 34px; border: 1px solid var(--iv-border); background: var(--iv-bg); color: var(--iv-text);
  border-radius: 6px; cursor: pointer; font-size: 1rem; padding: 0 10px;
}
.iv-toolbar #ivFocus { border-color: var(--iv-accent); }
.iv-caption { color: var(--iv-muted); font-size: 0.85rem; margin-left: 4px; }

.iv-stage {
  position: relative;
  overflow: auto;
  max-height: min(80vh, 900px);
  border: 1px solid var(--iv-border);
  border-radius: 6px;
  background: #111;
  -webkit-overflow-scrolling: touch;
}
.iv-stage canvas { display: block; width: 100%; height: auto; cursor: pointer; }
.iv-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #f87171; font-weight: bold; min-height: 200px; }
.iv-loading[hidden] { display: none; }

.iv-popup {
  position: absolute; z-index: 5; display: none; max-width: 280px;
  background: var(--iv-bg); color: var(--iv-text); border: 1px solid var(--iv-border);
  border-radius: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); padding: 10px 28px 10px 12px; font-size: 0.9rem;
}
.iv-popup p { margin: 6px 0 0; color: var(--iv-muted); }
.iv-popup a { display: inline-block; margin-top: 6px; }
.iv-pop-close { position: absolute; top: 2px; right: 4px; border: none; background: none; color: var(--iv-muted); font-size: 1.3rem; cursor: pointer; line-height: 1; }
.iv-pop-title { font-weight: 700; word-break: break-word; }
.iv-pop-rd { color: var(--iv-muted); }
.iv-pop-val { margin-top: 2px; }
.iv-pop-badge { display: inline-block; font-size: 0.7rem; font-weight: 700; background: #fef3c7; color: #92400e; border-radius: 999px; padding: 1px 8px; margin-bottom: 4px; }
.iv-net-btn {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; border: 1px solid var(--iv-net); color: var(--iv-net);
  background: none; border-radius: 999px; padding: 2px 10px; cursor: pointer; font-size: 0.85rem;
}
.iv-net-btn.active { background: #facc15; border-color: #ca8a04; color: #111; }

.iv-members, .nets-list { margin-top: 10px; }
.iv-members-title, .nets-list-title { font-size: 0.85rem; color: var(--iv-muted); margin-bottom: 4px; }
.nets-list-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.iv-members { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.iv-members-title { flex-basis: 100%; }
.iv-member, .net-chip {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 4px 10px; cursor: pointer;
  font-size: 0.85rem; background: var(--iv-chip); color: var(--iv-text); border: 1px solid var(--iv-border);
}
.iv-member { border-color: var(--iv-accent); }
.iv-member.active { background: #cffafe; border-color: #06b6d4; color: #111; }
.iv-rd { color: var(--iv-muted); font-size: 0.8em; }
.net-chip { color: var(--iv-net); }
.net-chip.active { background: #facc15; border-color: #ca8a04; color: #111; }
.net-count { font-size: 0.75em; opacity: 0.7; }
.net-icon { display: inline-flex; }

@media (max-width: 600px) {
  .iv { padding: 8px 12px 16px; }
  .iv-header h1 { font-size: 1.2rem; }
  .iv-stage { max-height: 70vh; }
}

/* Holds the stage and the minimap (minimap.js) on top of it */
.iv-stage-wrap { position: relative; }
/* Designators given by Circuit Fixers, not printed on the board (/designators) */
.iv-pop-assigned { font-size: 0.75em; font-style: italic; }
.iv-assigned { color: var(--iv-muted); margin-left: 1px; }
/* Several nets from the link (?net=a,b,c): a legend in their colours */
.nets-legend .net-chip { border-color: var(--net-colour); }
.nets-legend .net-chip.off { opacity: 0.5; }
.net-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--net-colour); margin-right: 5px; vertical-align: -1px; }
