/* Application chrome: layout frame, menubar, toolbars, navbar, statusbar, tabs. */

.bb-app { display: flex; flex-direction: column; height: 100vh; width: 100vw; }
.bb-middle { display: flex; flex: 1; min-height: 0; }
.bb-center { display: flex; flex-direction: column; flex: 1; min-width: 0; }

/* ---- Menu bar ---- */
.bb-menubar {
  display: flex; align-items: stretch; height: var(--bb-menubar-h);
  background: var(--bb-chrome); border-bottom: 1px solid var(--bb-border);
  z-index: 500; flex-shrink: 0;
}
.bb-menu-title {
  display: flex; align-items: center; padding: 0 10px; cursor: default; white-space: nowrap;
}
.bb-menu-title:hover, .bb-menu-title.bb-open { background: var(--bb-hover); }
.bb-menu-title.bb-open { background: var(--bb-active); }
.bb-menu-logo {
  display: flex; align-items: center; padding: 0 10px; color: var(--bb-accent-hover);
  font-weight: 600; white-space: nowrap; flex-shrink: 0;
}
.bb-menu-logo svg { width: 18px; height: 18px; flex: 0 0 18px; stroke: var(--bb-accent); fill: none; stroke-width: 1.5; }

/* ---- Dropdown menus (shared with context menus) ---- */
.bb-menu {
  position: fixed; min-width: 200px; max-height: calc(100vh - 40px); overflow-y: auto;
  background: var(--bb-panel); border: 1px solid var(--bb-border-light); box-shadow: 0 4px 14px rgba(0,0,0,0.5);
  padding: 3px 0; z-index: 3000;
}
.bb-menu-item {
  display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 8px;
  cursor: default; white-space: nowrap; position: relative; min-height: 22px;
}
.bb-menu-item:hover:not(.bb-disabled) { background: var(--bb-active); }
.bb-menu-item.bb-disabled { color: var(--bb-text-disabled); }
.bb-menu-item.bb-disabled svg { opacity: 0.4; }
.bb-menu-item .bb-mi-icon { width: 18px; flex-shrink: 0; display: flex; justify-content: center; }
.bb-menu-item .bb-mi-icon svg { width: 15px; height: 15px; stroke: #cfcfcf; fill: none; stroke-width: 1.5; }
.bb-menu-item .bb-mi-label { flex: 1; }
.bb-menu-item .bb-mi-shortcut { color: var(--bb-text-dim); margin-left: 24px; font-size: var(--bb-font-size-sm); }
.bb-menu-item .bb-mi-arrow { margin-left: 12px; color: var(--bb-text-dim); }
.bb-menu-item .bb-mi-check { width: 14px; color: var(--bb-accent-hover); flex-shrink: 0; }
.bb-menu-sep { height: 1px; background: var(--bb-border-light); opacity: 0.4; margin: 3px 8px; }

/* ---- Properties toolbar ---- */
.bb-proptoolbar {
  display: flex; align-items: center; gap: 2px; height: var(--bb-proptoolbar-h);
  background: var(--bb-toolbar); border-bottom: 1px solid var(--bb-border);
  padding: 0 6px; flex-shrink: 0; overflow-x: auto; overflow-y: hidden; z-index: 400;
  scrollbar-width: thin;
}
.bb-proptoolbar > * { flex-shrink: 0; }
.bb-pt-label { color: var(--bb-text-dim); margin: 0 4px; white-space: nowrap; }
.bb-pt-value { color: var(--bb-text); margin-right: 8px; white-space: nowrap; }
.bb-pt-group { display: flex; align-items: center; gap: 2px; }
.bb-pt-field { width: 52px; }
.bb-color-swatch {
  width: 18px; height: 18px; border: 1px solid #777; border-radius: 2px; cursor: pointer;
  background-image: linear-gradient(45deg, #666 25%, transparent 25%, transparent 75%, #666 75%),
                    linear-gradient(45deg, #666 25%, transparent 25%, transparent 75%, #666 75%);
  background-size: 8px 8px; background-position: 0 0, 4px 4px; background-color: #999;
  position: relative; padding: 0;
}
.bb-color-swatch .bb-swatch-fill { position: absolute; inset: 0; }
.bb-format-glyph { color: #cfcfcf; font-size: 13px; line-height: 1; }

/* ---- Tab bar ---- */
.bb-tabbar {
  display: flex; align-items: flex-end; height: var(--bb-tabbar-h);
  background: var(--bb-chrome); border-bottom: 1px solid var(--bb-border);
  flex-shrink: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.bb-tabbar::-webkit-scrollbar { display: none; }
.bb-tab {
  display: flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  background: #333; border: 1px solid var(--bb-border); border-bottom: none;
  border-radius: 3px 3px 0 0; margin: 0 1px; cursor: default; max-width: 220px; min-width: 90px;
  position: relative; flex-shrink: 0;
}
.bb-tab.bb-active-tab {
  background: var(--bb-panel-head); border-top: 2px solid var(--bb-accent); height: 27px;
}
.bb-tab .bb-tab-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-tab .bb-tab-dirty { color: var(--bb-accent-hover); }
.bb-tab .bb-tab-close {
  width: 16px; height: 16px; display: flex; align-items: center; justify-content: center;
  border-radius: 2px; visibility: hidden; cursor: pointer; font-size: 13px; color: var(--bb-text-dim);
}
.bb-tab:hover .bb-tab-close { visibility: visible; }
.bb-tab .bb-tab-close:hover { background: var(--bb-danger); color: #fff; }

/* ---- Navigation bar ---- */
.bb-navbar {
  display: flex; align-items: center; height: var(--bb-navbar-h);
  background: var(--bb-toolbar); border-top: 1px solid var(--bb-border);
  padding: 0 6px; gap: 2px; flex-shrink: 0; z-index: 300;
}
.bb-nav-pageinput { width: 40px; text-align: center; padding: 2px 2px; }
.bb-nav-pagecount { color: var(--bb-text-dim); margin: 0 4px; white-space: nowrap; }
.bb-nav-zoominput { width: 52px; text-align: center; padding: 2px 2px; }
.bb-nav-zoomslider { width: 120px; margin: 0 6px; cursor: pointer; accent-color: var(--bb-accent); }
.bb-nav-scale { color: var(--bb-text-dim); cursor: pointer; padding: 2px 8px; white-space: nowrap; }
.bb-nav-scale:hover { background: var(--bb-hover); color: var(--bb-text); }

/* ---- Status bar ---- */
.bb-statusbar {
  display: flex; align-items: center; height: var(--bb-statusbar-h);
  background: var(--bb-chrome); border-top: 1px solid var(--bb-border);
  padding: 0 8px; gap: 2px; flex-shrink: 0; font-size: var(--bb-font-size-sm);
  color: var(--bb-text-dim);
}
.bb-status-hint { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-status-toggle {
  padding: 2px 8px; cursor: pointer; border-radius: 2px; white-space: nowrap;
}
.bb-status-toggle:hover { background: var(--bb-hover); }
.bb-status-toggle.bb-on { color: var(--bb-accent-hover); background: var(--bb-active); }
.bb-status-right { display: flex; align-items: center; gap: 10px; margin-left: auto; white-space: nowrap; }

/* ---- Toolbars (dockable strips) ---- */
.bb-toolstrip {
  display: flex; align-items: center; background: var(--bb-toolbar);
  border-bottom: 1px solid var(--bb-border); padding: 1px 4px; gap: 1px; flex-wrap: wrap;
  flex-shrink: 0;
}
.bb-toolbar-handle {
  width: 7px; align-self: stretch; cursor: move; display: flex; align-items: center;
  color: #777; font-size: 8px; letter-spacing: -1px; margin-right: 2px;
}

/* ---- Fullscreen exit ---- */
.bb-fs-exit {
  position: fixed; top: 10px; right: 10px; z-index: 4000;
  background: var(--bb-toolbar); border: 1px solid var(--bb-border-light);
  padding: 6px 14px; border-radius: 3px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.bb-toolbar-preview { display: flex; align-items: center; gap: 10px; min-height: 36px; margin-top: 8px; color: var(--bb-text); }
.bb-toolbar-preview svg { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; }
.bb-tool-art { background: transparent !important; border-radius: 3px; }
.bb-iconbtn .bb-tool-art { width: 22px; height: 22px; }
