/* Panel access bars, side panels, bottom panel, markups list table. */

/* ---- Access bars ---- */
.bb-accessbar {
  width: var(--bb-accessbar-w); background: var(--bb-accessbar);
  display: flex; flex-direction: column; align-items: center; padding-top: 4px; gap: 2px;
  flex-shrink: 0; z-index: 200;
}
.bb-accessbar-left { border-right: 1px solid var(--bb-border); }
.bb-accessbar-right { border-left: 1px solid var(--bb-border); }
.bb-access-icon {
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border-radius: 3px; cursor: pointer; position: relative;
}
.bb-access-icon:hover { background: var(--bb-hover); }
.bb-access-icon.bb-active { background: var(--bb-active); box-shadow: inset 2px 0 0 var(--bb-accent); }
.bb-access-icon svg { width: 19px; height: 19px; stroke: #c5c5c5; fill: none; stroke-width: 1.5; }
.bb-access-icon.bb-active svg { stroke: var(--bb-accent-hover); }

/* ---- Side panels ---- */
.bb-sidepanel {
  width: 300px; min-width: 180px; max-width: 60vw; background: var(--bb-panel);
  display: flex; flex-direction: column; flex-shrink: 0; position: relative; z-index: 150;
}
.bb-sidepanel-left { border-right: 1px solid var(--bb-border); }
.bb-sidepanel-right { border-left: 1px solid var(--bb-border); }
.bb-panel-header {
  display: flex; align-items: center; height: 28px; padding: 0 4px 0 10px;
  background: var(--bb-panel-head); border-bottom: 1px solid var(--bb-border);
  font-weight: 600; flex-shrink: 0; gap: 4px;
}
.bb-panel-header .bb-panel-title { flex: 1; }
.bb-panel-body { flex: 1; overflow: auto; min-height: 0; position: relative; }
.bb-panel-toolbar {
  display: flex; align-items: center; padding: 2px 4px; gap: 1px;
  border-bottom: 1px solid var(--bb-border); background: var(--bb-panel-head); flex-shrink: 0;
  flex-wrap: wrap;
}
.bb-panel-resizer {
  position: absolute; top: 0; bottom: 0; width: 5px; cursor: ew-resize; z-index: 10;
}
.bb-panel-resizer:hover, .bb-panel-resizer.bb-dragging { background: var(--bb-accent-dim); }
.bb-sidepanel-left .bb-panel-resizer { right: -2px; }
.bb-sidepanel-right .bb-panel-resizer { left: -2px; }

/* ---- Bottom panel ---- */
.bb-bottompanel {
  height: 240px; min-height: 100px; max-height: 70vh; background: var(--bb-panel);
  border-top: 1px solid var(--bb-border); display: flex; flex-direction: column;
  position: relative; flex-shrink: 0; z-index: 150;
}
.bb-bottompanel .bb-panel-resizer-h {
  position: absolute; left: 0; right: 0; top: -3px; height: 6px; cursor: ns-resize; z-index: 10;
}
.bb-bottompanel .bb-panel-resizer-h:hover { background: var(--bb-accent-dim); }

/* ---- Generic tree/list styling (bookmarks, layers, etc.) ---- */
.bb-tree { padding: 4px 0; }
.bb-tree-item {
  display: flex; align-items: center; gap: 4px; padding: 2px 8px; cursor: default; min-height: 22px;
}
.bb-tree-item:hover { background: var(--bb-hover); }
.bb-tree-item.bb-selected { background: var(--bb-active); }
.bb-tree-toggle { width: 14px; text-align: center; color: var(--bb-text-dim); cursor: pointer; flex-shrink: 0; }
.bb-list-empty { color: var(--bb-text-dim); text-align: center; padding: 24px 12px; }

/* ---- Thumbnails panel ---- */
.bb-thumbs { display: flex; flex-wrap: wrap; gap: 10px; padding: 10px; justify-content: center; }
.bb-thumb { display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; position: relative; }
.bb-thumb canvas, .bb-thumb .bb-thumb-ph {
  border: 2px solid transparent; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.bb-thumb.bb-current canvas, .bb-thumb.bb-current .bb-thumb-ph { border-color: var(--bb-accent); }
.bb-thumb.bb-selected canvas, .bb-thumb.bb-selected .bb-thumb-ph { outline: 2px solid var(--bb-accent-hover); }
.bb-thumb-label { font-size: var(--bb-font-size-sm); color: var(--bb-text-dim); max-width: 120px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-thumb.bb-dragover-before::before,
.bb-thumb.bb-dragover-after::after {
  content: ""; position: absolute; top: 0; bottom: 18px; width: 3px; background: var(--bb-accent);
}
.bb-thumb.bb-dragover-before::before { left: -6px; }
.bb-thumb.bb-dragover-after::after { right: -6px; }

/* ---- Markups list ---- */
.bb-mlist { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.bb-mlist-toolbar {
  display: flex; align-items: center; gap: 2px; padding: 2px 6px;
  background: var(--bb-panel-head); border-bottom: 1px solid var(--bb-border); flex-shrink: 0;
}
.bb-mlist-search { width: 160px; padding: 2px 6px; }
.bb-mlist-scroll { flex: 1; overflow: auto; min-height: 0; }
.bb-mlist table { border-collapse: collapse; width: max-content; min-width: 100%; font-size: var(--bb-font-size-sm); }
.bb-mlist th {
  position: sticky; top: 0; background: var(--bb-panel-head); color: var(--bb-text);
  text-align: left; padding: 4px 8px; border-right: 1px solid var(--bb-border);
  border-bottom: 1px solid var(--bb-border); cursor: pointer; white-space: nowrap; z-index: 5;
}
.bb-mlist th:hover { background: #4a4a4a; }
.bb-mlist td {
  padding: 3px 8px; border-right: 1px solid rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.05); white-space: nowrap;
  max-width: 340px; overflow: hidden; text-overflow: ellipsis;
}
.bb-mlist tr.bb-mrow { background: var(--bb-recessed); cursor: default; }
.bb-mlist tr.bb-mrow:nth-child(even) { background: var(--bb-recessed2); }
.bb-mlist tr.bb-mrow:hover { background: #3a3f44; }
.bb-mlist tr.bb-mrow.bb-selected { background: var(--bb-active); }
.bb-mlist tr.bb-group-header td {
  background: #45494e; font-weight: 600; border-top: 1px solid var(--bb-border-light);
}
.bb-mlist tr.bb-reply-row td:first-child { padding-left: 30px; }
.bb-mlist .bb-color-dot { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -2px; }
.bb-mlist-filterrow input, .bb-mlist-filterrow select {
  width: 100%; min-width: 60px; padding: 1px 4px; font-size: var(--bb-font-size-sm);
}

/* ---- Tool chest ---- */
.bb-toolchest-set { border-bottom: 1px solid var(--bb-border); }
.bb-toolchest-sethead {
  display: flex; align-items: center; gap: 4px; padding: 4px 8px; background: var(--bb-panel-head);
  font-weight: 600;
}
.bb-tc-settoggle {
  display: flex; align-items: center; gap: 4px; min-width: 0; flex: 1; padding: 0;
  border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer;
}
.bb-tc-setname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.bb-tc-count { min-width: 20px; color: var(--bb-text-dim); font-size: var(--bb-font-size-sm); text-align: right; }
.bb-tc-toolbar { padding: 4px 6px; }
.bb-tc-search { width: 100%; min-width: 0; }
.bb-toolchest-sets { min-height: 0; }
.bb-toolchest-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; padding: 7px; }
.bb-tc-tool {
  width: 100%; min-height: 46px; height: auto; display: flex; align-items: center; justify-content: flex-start;
  border: 1px solid var(--bb-border); border-radius: 4px; cursor: pointer; position: relative;
  background: var(--bb-recessed); color: var(--bb-text); padding: 8px 12px 8px 8px; gap: 8px; min-width: 0;
}
.bb-tc-label { font-size: 12px; font-weight: 500; line-height: 1.25; text-align: left; overflow-wrap: anywhere; }
.bb-tc-tool svg { flex: 0 0 26px; }
.bb-tc-tool:focus-visible { outline: 2px solid var(--bb-accent); outline-offset: 1px; }
.bb-tc-tool:hover { border-color: var(--bb-accent); background: var(--bb-hover); }
.bb-tc-tool.bb-active { border-color: var(--bb-accent); background: var(--bb-active); box-shadow: inset 3px 0 0 var(--bb-accent); }
.bb-tc-tool svg { width: 26px; height: 26px; stroke: var(--bb-text); fill: none; stroke-width: 1.5; background: transparent !important; }
.bb-tc-tool .bb-tool-bitmap { opacity: .96; }
.bb-tc-tool .bb-tc-hotkey {
  position: absolute; bottom: 0; right: 1px; font-size: 9px; color: var(--bb-text-dim);
}
.bb-tc-tool .bb-tc-mode {
  position: absolute; top: 0; right: 1px; font-size: 8px; color: var(--bb-accent-hover);
}
.bb-tc-tool .bb-tc-sequence { top: auto; bottom: 0; left: 1px; right: auto; color: #f3a712; }
.bb-tc-addset { margin: 10px; }

/* ---- Properties panel ---- */
.bb-props-section { border-bottom: 1px solid var(--bb-border); }
.bb-props-title {
  padding: 5px 10px; background: var(--bb-panel-head); font-weight: 600; cursor: pointer;
  display: flex; align-items: center;
}
.bb-props-title .bb-tree-toggle { margin-right: 4px; }
.bb-props-grid {
  display: grid; grid-template-columns: 45% 55%; gap: 5px 6px; padding: 8px 10px; align-items: center;
}
.bb-props-grid label { color: var(--bb-text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-props-grid input, .bb-props-grid select { width: 100%; }
.bb-props-row2 { grid-column: 1 / -1; display: flex; gap: 6px; align-items: center; }

/* ---- Search panel ---- */
.bb-search-result {
  display: flex; gap: 8px; padding: 6px 8px; border-bottom: 1px solid var(--bb-border); cursor: pointer;
  align-items: flex-start;
}
.bb-search-result:hover { background: var(--bb-hover); }
.bb-search-result.bb-selected { background: var(--bb-active); }
.bb-search-snippet { flex: 1; color: var(--bb-text-dim); font-size: var(--bb-font-size-sm);
  overflow: hidden; max-height: 46px; }
.bb-search-snippet b { color: var(--bb-accent-hover); }
