/* ==========================================================================
   Left Toolbar — Flyout submenu, items, sections, light theme, body:has
   ========================================================================== */

/* ── Flyout submenu ── */
.dt-flyout {
    position: fixed;
    left: 44px;
    min-width: 248px;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--ui-panel, #1e222d);
    color: var(--ui-fg, #e5e7eb);
    border: 1px solid var(--ui-panel-border, #333);
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.35);
    padding: 4px 0;
    z-index: 9000;
    display: none;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.1s ease, transform 0.1s ease;
    scrollbar-width: thin;
    scrollbar-color: var(--ui-button-hover) transparent;
}
.dt-flyout::-webkit-scrollbar { width: 4px; }
.dt-flyout::-webkit-scrollbar-thumb { background: var(--ui-button-hover); border-radius: 2px; }
.dt-flyout.visible {
    display: block;
    pointer-events: all;
    opacity: 1;
    transform: translateX(0);
}

/* ── Flyout menu items ── */
.dt-fly-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 14px;
    background: transparent;
    border: none;
    color: var(--ui-fg, #e5e7eb);
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    text-align: left;
    transition: background 0.1s;
    white-space: nowrap;
}
.dt-fly-item:hover,
.dt-fly-item.active {
    background: var(--ui-primary, #2962ff);
    color: #ffffff;
}
.dt-fly-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: inherit;
}
.dt-fly-icon svg {
    width: 16px;
    height: 16px;
}
.dt-fly-label {
    flex: 1;
}
/* Section group header */
.dt-fly-section {
    padding: 10px 14px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ui-muted);
    pointer-events: none;
    user-select: none;
}
.dt-fly-section:not(:first-child) {
    border-top: 1px solid var(--ui-panel-border);
    margin-top: 4px;
}
/* Keyboard shortcut hint on the right */
.dt-fly-shortcut {
    margin-left: 16px;
    font-size: 11px;
    color: var(--ui-muted);
    opacity: 0.75;
    white-space: nowrap;
    flex-shrink: 0;
}
.dt-fly-item:hover .dt-fly-shortcut,
.dt-fly-item.active .dt-fly-shortcut {
    opacity: 0.75;
}

/* Light theme adjustments */
.dt-flyout {
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

/* Hide crosshairs while a tool flyout is open */
body:has(.dt-flyout.visible) #crosshair-x,
body:has(.dt-flyout.visible) #crosshair-y,
body:has(.dt-flyout.visible) #axis-label-x,
body:has(.dt-flyout.visible) #axis-label-y { display: none !important; }
