/* toolbar.css — left tool rail, tool options, contextual toolbar, menus */

.toolbar {
  grid-area: tools;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px; background: var(--panel); border-right: 1px solid var(--border);
  overflow-y: auto; overflow-x: hidden; z-index: 30;
}
.toolbar::-webkit-scrollbar { width: 0; }
.tool-btn {
  position: relative; width: 44px; height: 44px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--text-dim);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), color var(--transition);
  flex: none;
}
.tool-btn:hover { background: var(--panel-hover); color: var(--text); }
.tool-btn.active { background: var(--accent-weak); color: var(--accent); }
.tool-btn.active .ic { stroke: var(--accent); }
.tool-btn .ic { width: 22px; height: 22px; }
.tool-btn.has-menu::after {
  content: ""; position: absolute; right: 3px; bottom: 3px; width: 0; height: 0;
  border-left: 4px solid transparent; border-bottom: 4px solid var(--text-faint);
}
.toolbar-sep { width: 28px; height: 1px; background: var(--border); margin: 4px 0; flex: none; }

/* flyout menu (shapes / lines / connectors / flowchart / teaching) */
.flyout {
  position: fixed; z-index: 120; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-2); padding: 8px;
  display: grid; grid-template-columns: repeat(4, 40px); gap: 4px; animation: pop var(--transition);
}
.flyout.wide { grid-template-columns: repeat(3, 1fr); width: 260px; }
.flyout .fly-item {
  width: 40px; height: 40px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: transparent; color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.flyout .fly-item:hover { background: var(--panel-hover); }
.flyout .fly-item.active { background: var(--accent-weak); color: var(--accent); }
.flyout .fly-item .ic { width: 22px; height: 22px; }
.flyout.wide .fly-item { width: 100%; height: 40px; justify-content: flex-start; gap: 8px; padding: 0 10px; font-size: 13px; }

/* tool options panel — floats near top-left of stage */
.tool-options {
  position: absolute; top: 10px; left: 10px; z-index: 25;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-2); padding: 8px 10px; display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; max-width: calc(100% - 20px);
}
.opt-group { display: flex; align-items: center; gap: 6px; }
.opt-group + .opt-group { border-left: 1px solid var(--border); padding-left: 10px; }
.opt-label { font-size: 11px; color: var(--text-dim); }

/* color swatches */
.swatches { display: flex; gap: 4px; }
.swatch {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); cursor: pointer;
  position: relative;
}
.swatch.active { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.swatch.custom { display: inline-flex; align-items: center; justify-content: center; background:
  conic-gradient(from 0deg, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
input[type=color].color-input { width: 30px; height: 30px; padding: 0; border: 1px solid var(--border-strong); border-radius: 6px; background: none; cursor: pointer; }

.size-dots { display: flex; align-items: center; gap: 5px; }
.size-dot { border-radius: 50%; background: var(--text); cursor: pointer; opacity: .5; }
.size-dot.active { opacity: 1; box-shadow: 0 0 0 2px var(--accent-weak); }

.slider { -webkit-appearance: none; appearance: none; height: 6px; width: 110px; border-radius: 6px; background: var(--border-strong); outline: none; }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 2px solid var(--panel); }
.slider::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 2px solid var(--panel); }

.mini-select { height: 32px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--text); padding: 0 6px; font-size: 12.5px; }
.opt-btn { height: 32px; min-width: 32px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--text); cursor: pointer; font-size: 12.5px; display: inline-flex; align-items: center; gap: 5px; }
.opt-btn:hover { background: var(--panel-hover); }
.opt-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* contextual toolbar (on selection) */
.context-toolbar {
  position: absolute; z-index: 26; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-2); padding: 6px; display: flex; gap: 4px; align-items: center;
  flex-wrap: wrap; max-width: 92vw;
}
.context-toolbar .sep { width: 1px; align-self: stretch; background: var(--border); margin: 2px 2px; }

/* context menu */
.context-menu {
  position: absolute; z-index: 130; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-2); padding: 6px; min-width: 190px; animation: pop var(--transition);
}
.context-menu .cm-item {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%;
  padding: 9px 10px; border: none; background: transparent; color: var(--text); cursor: pointer;
  border-radius: 6px; font-size: 13px; text-align: left;
}
.context-menu .cm-item:hover { background: var(--panel-hover); }
.context-menu .cm-item:disabled { opacity: .4; cursor: default; }
.context-menu .cm-item .sc { color: var(--text-faint); font-size: 11.5px; }
.context-menu .cm-sep { height: 1px; background: var(--border); margin: 5px 4px; }
