/*
Workspace mode

Rules in this file apply to the workspace layout and its related controls.
Load this file after style.css so these rules override base styles cleanly.
*/

.toolPanel {
  min-height: 0;
}

.panelWorkspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.panelWorkspacePrimary {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.toolPanelBody {
  height: 100%;
  min-width: 0;
}

:root[data-workspace-mode="true"] .panelWorkspace {
  grid-template-columns: minmax(0, 1fr);
}

:root[data-workspace-mode="true"] .toolPanelBody {
  display: grid;
  gap: 0;
  align-content: stretch;
  padding: 0;
  overflow: hidden;
}

:root[data-workspace-mode="true"][data-workspace-panel-count="1"] .toolPanelBody,
:root[data-workspace-mode="true"][data-workspace-panel-count="2"] .toolPanelBody {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

:root[data-workspace-mode="true"][data-workspace-panel-count="3"] .toolPanelBody {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

:root[data-workspace-mode="true"][data-workspace-panel-count="4"] .toolPanelBody {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

:root[data-workspace-mode="true"] .toolPanelBody>[role="tabpanel"]:not([hidden]) {
  display: block;
  min-width: 0;
  min-height: 0;
  align-self: stretch;
  position: relative;
  border: 0;
  padding: 14px 14px 8px 14px;
  background: var(--panel);
  box-shadow: none;
  overflow: auto;
}

:root[data-workspace-mode="true"] .workspacePlaceholderPanel:not([hidden]) {
  display: block;
  min-width: 0;
  min-height: 0;
  align-self: stretch;
  position: relative;
  padding: 14px 14px 8px 14px;
  background: var(--panel);
  overflow: auto;
}

:root[data-workspace-mode="true"] .toolPanelBody>[role="tabpanel"][data-workspace-index="2"]::before,
:root[data-workspace-mode="true"] .toolPanelBody>[role="tabpanel"][data-workspace-index="3"]::before,
:root[data-workspace-mode="true"] .toolPanelBody>[role="tabpanel"][data-workspace-index="4"]::before,
:root[data-workspace-mode="true"] .workspacePlaceholderPanel[data-workspace-index="2"]::before {
  content: "";
  position: absolute;
  top: var(--panel-divider-pad);
  bottom: var(--panel-divider-pad);
  left: 0;
  width: 1px;
  background: var(--border);
}

:root[data-workspace-mode="true"] .toolPanelBody>[role="tabpanel"][data-workspace-index="1"] {
  order: 1;
}

:root[data-workspace-mode="true"] .toolPanelBody>[role="tabpanel"][data-workspace-index="2"] {
  order: 2;
}

:root[data-workspace-mode="true"] .toolPanelBody>[role="tabpanel"][data-workspace-index="3"] {
  order: 3;
}

:root[data-workspace-mode="true"] .toolPanelBody>[role="tabpanel"][data-workspace-index="4"] {
  order: 4;
}

:root[data-workspace-mode="true"] .workspacePlaceholderPanel[data-workspace-index="2"] {
  order: 2;
}

:root[data-workspace-mode="true"] .toolPanelBody>[role="tabpanel"][data-workspace-focused="true"] {
  box-shadow:
    inset 0 2px 0 var(--accent),
    inset 0 0 0 1px var(--accent-subtle-border);
  z-index: 1;
}

.workspacePlaceholderPanel[hidden] {
  display: none;
}

.workspacePlaceholderBox {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 16px;
  outline: 2px dashed var(--border);
  border-radius: 12px;
}

.workspacePlaceholderPlus {
  inline-size: 1.25em;
  block-size: 1.25em;
  display: inline-grid;
  place-items: center;
  font-family: Courier, monospace;
  font-size: 2em;
  line-height: 1;
  border-radius: 50%;
  background: transparent;
  border: 1px dashed var(--border2);
  color: var(--text-soft);
}

.workspaceAddList {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.workspaceAddPanelBtn {
  appearance: none;
  width: 100%;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface1);
  color: var(--text);
  padding: 8px 6px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.workspaceAddPanelBtn:hover:not(:disabled) {
  background: var(--surface4);
  border-color: var(--border2);
}

.workspaceAddPanelBtn:disabled {
  background: var(--surface5);
  border-color: var(--border2);
  border-style: dashed;
  color: var(--muted);
  cursor: default;
  opacity: 0.4;
  box-shadow: inset 0 0 0 1px var(--border);
}

/* Workspace bottom tabs */

.bottomTabSlot {
  display: flex;
  align-items: stretch;
  min-width: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  box-shadow: none;
  transition:
    background-color 140ms ease,
    box-shadow 140ms ease;
}

.bottomTabSlot:last-child {
  border-right: 0;
}

:root[data-workspace-mode="true"] .bottomTabs [role="tab"] {
  padding: 12px 10px;
  background: transparent;
  box-shadow: none;
  color: var(--text);
  border-right: 0;
}

.workspaceTabLabel {
  flex: 1 1 auto;
  min-width: 0;
  display: block;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspaceTabBadge,
.workspaceTabClose {
  flex: 0 0 auto;
  align-self: center;
}

.workspaceTabBadge {
  display: none;
  place-items: center;
  min-width: 16px;
  height: 16px;
  margin-left: 4px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--surface4);
  border: 1px solid var(--border2);
  color: var(--text);
  font-size: 11px;
  line-height: 1;
}

.workspaceTabClose {
  appearance: none;
  display: none;
  align-items: center;
  justify-content: center;
  width: 1.5em;
  height: 100%;
  margin-left: 0;
  margin-right: 1px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  border: 0;
  cursor: pointer;
}

.tabClose {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 14px;
  line-height: 1;
}

.workspaceTabClose:hover .tabClose,
.workspaceTabClose:focus-visible .tabClose {
  background: var(--surface4);
  border-color: var(--border2);
  color: var(--text);
}

:root[data-workspace-mode="true"] .bottomTabSlot[data-workspace-open="true"] .workspaceTabBadge {
  display: inline-grid;
}

:root[data-workspace-mode="true"][data-workspace-has-placeholder="false"] .bottomTabSlot[data-workspace-open="true"] .workspaceTabClose {
  display: inline-grid;
}

:root[data-workspace-mode="true"][data-workspace-has-placeholder="false"] .bottomTabSlot[data-workspace-open="true"]>[role="tab"] {
  padding-right: 1px;
}

:root[data-workspace-mode="true"] .bottomTabSlot[data-workspace-selected="true"] {
  background: var(--workspace-tab-selected-bg);
  box-shadow: inset 0 2px 0 var(--border2);
}

:root[data-workspace-mode="true"] .bottomTabSlot[data-workspace-focused="true"] {
  background: var(--accent-subtle-bg);
  box-shadow:
    inset 0 2px 0 var(--accent),
    inset 0 0 0 1px var(--accent-soft-ring);
}

:root[data-workspace-mode="true"] .bottomTabSlot[data-workspace-open="true"] {
  gap: 0;
}

.toolPanelBody>[role="tabpanel"]>[data-role="workspace-panel-close"] {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 5;
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border2);
  background: var(--surface5);
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  visibility: hidden;
}

:root[data-workspace-mode="true"][data-workspace-has-placeholder="false"] .toolPanelBody>[role="tabpanel"][data-workspace-index]>[data-role="workspace-panel-close"] {
  visibility: visible;
}

.toolPanelBody>[role="tabpanel"]>[data-role="workspace-panel-close"]:hover {
  color: var(--text);
  background: var(--surface4);
}

/* WORKSPACE MENU */

.workspaceControlGroup {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  flex: 0 0 auto;
  anchor-name: --pc-workspace-anchor;
}

.workspaceModeBtn {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  color: var(--text-soft);
}

.workspaceMenuBtn {
  width: 24px;
  min-width: 24px;
  padding: 0;
  margin-left: -1px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  color: var(--text-soft);
}

.workspaceMenuCaret {
  display: inline-grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 11px;
  line-height: 1;
}

.workspaceModeBtn .svgIcon {
  width: 20px;
  height: 20px;
  stroke-width: 1.8px;
}

.workspaceModeBtn:hover,
.workspaceMenuBtn:hover {
  color: var(--text);
}

#pc_btnWorkspaceMode[aria-pressed="true"] {
  background: var(--workspace-toggle-active-bg);
  color: var(--text);
  border-color: var(--workspace-toggle-active-border);
}

#pc_btnWorkspaceMode[aria-pressed="true"]:hover {
  background: var(--workspace-toggle-active-bg);
  color: var(--text);
  border-color: var(--workspace-toggle-active-border);
}


.workspaceHeaderMenu {
  position-anchor: --pc-workspace-anchor;
  top: anchor(bottom);
  right: anchor(right);
  left: auto;
  bottom: auto;
  min-width: 260px;
  max-width: min(320px, calc(100vw - 16px));
}

.workspaceMenuSavedList {
  display: grid;
}

.workspaceMenuSavedItemInner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.workspaceMenuSavedItemIcon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--text-soft);
}

.workspaceMenuSavedItem .headerMenuItemTitle {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* DIALOG */

.workspaceDialogMaxPanelsField {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.workspaceDialogMaxPanelsField select,
.workspaceDialogAddPanelSelect {
  min-width: 0;
  width: 100%;
}

.workspacePanelsSection {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 12rem;
  align-items: start;
  gap: 16px;
  margin-top: 6px;
}

.workspacePanelList {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.workspacePanelRow {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 10px;
  width: min(100%, 42rem);
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface1);
  box-shadow: inset 0 0 0 1px transparent;
}

.workspacePanelDrag {
  cursor: grab;
  background: none;
  border: none;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.7;
  color: var(--text-soft);
}

.workspacePanelDrag:hover {
  opacity: 1;
}

.workspacePanelIndex {
  width: 3.5em;
}

.workspacePanelLabel {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.workspacePanelRemove {
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.7;
  color: var(--text-soft);
  justify-self: end;
}

.workspacePanelRemove:hover {
  opacity: 1;
}

.workspacePanelRow:hover {
  border-color: var(--border2);
  background: var(--surface4);
}

.workspacePanelRow:focus-within {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-soft-ring);
}

.workspacePanelControls {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  height: 100%;
  gap: 12px;
}

.workspacePanelControls>label,
.workspacePanelControls>select {
  width: 100%;
}

.workspacePanelControls .workspaceDialogMaxPanelsField {
  min-width: 0;
}

@media (max-width: 760px) {
  .workspacePanelsSection {
    grid-template-columns: 1fr;
  }

  .workspacePanelRow {
    width: 100%;
  }
}

.workspaceDialogFooterStart,
.workspaceDialogFooterEnd {
  display: flex;
  align-items: center;
  gap: 12px;
}

.workspaceDialogFooterStart {
  margin-right: auto;
}

.workspaceDialogFooterEnd {
  margin-left: auto;
}