/* ========== WORKBENCH BAR ========== */
/* Horizontal toolbar at the top of the workbench area. */

.workbench-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: flex-start;
  min-height: 40px;
  padding: 0 8px;
  background-color: var(--bg-toolbar);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  z-index: 50;
}

/* ---- View switcher (left) ---- */
.workbench-bar-views {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  order: 1;
  height: 40px;
  z-index: 0;
}

.workbench-bar-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
  white-space: nowrap;
}

.workbench-bar-view-btn:hover {
  background-color: var(--hover-bg);
  color: var(--text-primary);
}

.workbench-bar-view-btn.active {
  background-color: var(--mantine-color-blue-light, rgba(59, 130, 246, 0.12));
  color: var(--mantine-color-blue-6, #3b82f6);
}

.workbench-bar-view-btn.workbench-bar-back-btn {
  color: var(--text-primary);
  font-weight: 600;
}

.workbench-bar-view-btn.workbench-bar-back-btn:hover {
  background-color: color-mix(
    in srgb,
    var(--accent-interactive, #4a90e2) 12%,
    transparent
  );
  color: var(--accent-interactive, #4a90e2);
}

.workbench-bar-view-btn svg {
  font-size: 16px !important;
  width: 16px;
  height: 16px;
}

.workbench-bar-view-label {
  line-height: 1;
}

/* ---- Center: tool buttons ---- */

/* Single-row: center sits between views and globals */
.workbench-bar-center {
  order: 2;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 40px;
  overflow: hidden;
}

/* Two-row: center drops below views+globals */
.workbench-bar[data-wrapped="true"] .workbench-bar-center {
  order: 3;
  flex: 0 0 100%;
  height: auto;
  padding: 4px 0;
  border-top: 1px solid var(--border-subtle);
  justify-content: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.workbench-bar[data-wrapped="true"] .workbench-bar-center > * {
  flex-shrink: 0;
}

/* ---- Right: global buttons (theme / language / download) ---- */
.workbench-bar-globals {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  order: 3;
  height: 40px;
  margin-left: auto;
}

/* In two-row mode globals moves to row 1 right side */
.workbench-bar[data-wrapped="true"] .workbench-bar-globals {
  order: 2;
  margin-left: auto;
}

/* Shared action icon style - applies to both center and global buttons */
.workbench-bar-action-icon {
  color: var(--text-secondary) !important;
  width: 28px !important;
  height: 28px !important;
  background: transparent !important;
}

.workbench-bar-action-icon svg,
.workbench-bar-action-icon img {
  color: inherit !important;
  fill: currentColor;
}

.workbench-bar-action-icon:hover {
  color: var(--text-primary) !important;
  background-color: var(--hover-bg) !important;
}

.workbench-bar-action-icon[data-variant="filled"] {
  background: var(--mantine-color-blue-6, #3b82f6) !important;
  color: #fff !important;
}

.workbench-bar-action-icon[data-variant="filled"]:hover {
  background: var(--mantine-color-blue-7, #2563eb) !important;
  color: #fff !important;
}

.workbench-bar-action-wrapper {
  display: flex;
  align-items: center;
}

.workbench-bar-tooltip-wrapper {
  display: inline-flex;
  align-items: center;
}

.workbench-bar-divider {
  width: 1px;
  height: 16px;
  background-color: var(--border-subtle);
  margin: 0 4px;
}

/* Extra breathing room around the export/close separator */
.workbench-bar-globals-sep {
  margin: 0 8px;
}

/* ---- Inline viewer controls (page nav + zoom) ---- */
.viewer-inline-controls {
  display: flex;
  align-items: center;
  gap: 2px;
}

.viewer-inline-controls__page {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 3rem;
  text-align: center;
  white-space: nowrap;
}

.viewer-inline-controls__slider-wrap {
  display: flex;
  align-items: center;
  padding: 0 4px;
}

.viewer-inline-controls__zoom-pct {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 2.5rem;
  text-align: right;
  white-space: nowrap;
}
