/* EQUIPMENT EDITOR — Overlay, Toolbar, Editor-specific bay overrides, Drag Handles, Glue, Popover */

.eq-editor-overlay {
    display: none;
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-dark);
    z-index: 200;
    flex-direction: column;
    overflow: hidden;
}
.eq-editor-overlay.open { display: flex; }

.eq-editor-hdr {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}
.eq-editor-hdr h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.2px;
}
.eq-editor-hdr .hdr-actions { display: flex; gap: 8px; align-items: center; }

.eq-editor-toolbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 10px 24px;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.btn-icon {
    padding: 5px 10px;
    background: var(--bg-shelf);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
    font-weight: 600;
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }
.btn-icon:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-all-bays {
    padding: 6px 14px;
    background: rgba(74,158,255,0.08);
    border: 1px solid rgba(74,158,255,0.5);
    border-radius: 6px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-all-bays:hover { background: rgba(74,158,255,0.18); border-color: var(--accent); }
.btn-all-bays.active { background: var(--accent); color: white; border-color: var(--accent); }

.eq-editor-main {
    flex: 1;
    overflow: auto;
    padding: 28px 24px 24px;
}
.eq-editor-bays {
    display: flex;
    gap: 0;
    align-items: flex-start;
    width: fit-content;
}

/* Editor-specific bay overrides (scoped to .eq-editor-bays) */
.eq-editor-bays .br-bay {
    transition: border-color 0.2s, box-shadow 0.2s;
}
.eq-editor-bays .br-bay.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 0 16px rgba(74,158,255,0.15);
}
.eq-editor-bays .br-bay-header {
    padding: 7px 10px;
    font-size: 10px;
    letter-spacing: 0.4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-radius: 5px 5px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.eq-editor-bays .br-shelf-label {
    font-size: 8px;
    opacity: 0.55;
}

/* Glue toggle — small button between adjacent bays */
.bay-glue-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    align-self: stretch;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
    position: relative;
}
.bay-glue-toggle .glue-icon {
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.4;
    transition: all 0.15s;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 2px 3px;
    line-height: 1;
}
.bay-glue-toggle:hover .glue-icon {
    opacity: 1;
    color: var(--accent);
    border-color: var(--accent);
}
.bay-glue-toggle.glued {
    width: 0;
    overflow: visible;
}
.bay-glue-toggle.glued .glue-icon {
    opacity: 0;
    color: var(--accent);
    background: rgba(74,158,255,0.15);
    border-color: var(--accent);
    position: absolute;
    z-index: 30;
}
.bay-glue-toggle.glued:hover .glue-icon {
    opacity: 1;
}

/* Bay header — shelf +/- controls */
.bay-shelf-ctrl {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}
.bsc-btn {
    padding: 1px 5px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    transition: all 0.15s;
}
.bsc-btn:hover { border-color: var(--accent); color: var(--accent); }
.bsc-val {
    font-size: 9px;
    color: var(--text-secondary);
    font-weight: 600;
    min-width: 14px;
    text-align: center;
}

/* Shelf drag line */
.shelf-drag-line {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 9px;
    cursor: ns-resize;
    z-index: 20;
}
.shelf-drag-line::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    border-radius: 2px;
    transition: background 0.1s;
}
.shelf-drag-line:hover::before,
.shelf-drag-line.dragging::before { background: var(--accent); }

.shelf-drag-line::after {
    content: attr(data-dim);
    position: absolute;
    right: 4px;
    bottom: 5px;
    font-size: 9px;
    font-weight: 700;
    color: var(--accent);
    background: var(--bg-dark);
    padding: 1px 4px;
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.1s;
    pointer-events: none;
    white-space: nowrap;
    border: 1px solid rgba(74,158,255,0.3);
}
.shelf-drag-line:hover::after,
.shelf-drag-line.dragging::after { opacity: 1; }

/* Bay edge resize handles */
.bay-edge-handle,
.bay-edge-handle-left {
    position: absolute;
    top: 0;
    width: 10px;
    height: 100%;
    cursor: ew-resize;
    z-index: 20;
}
.bay-edge-handle       { right: -5px; }
.bay-edge-handle-left  { left:  -5px; }

.bay-edge-handle::before,
.bay-edge-handle-left::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: transparent;
    transition: background 0.1s;
}
.bay-edge-handle::before      { left:  3px; }
.bay-edge-handle-left::before { right: 3px; }

.bay-edge-handle:hover::before,      .bay-edge-handle.dragging::before,
.bay-edge-handle-left:hover::before, .bay-edge-handle-left.dragging::before {
    background: var(--accent);
}

/* Floating dimension tooltip during drag */
#edDimTooltip {
    display: none;
    position: fixed;
    z-index: 1000;
    pointer-events: none;
    background: var(--accent);
    color: white;
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.4);
    white-space: nowrap;
}

/* Configure All Bays — popover */
.all-bays-popover {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 14px 16px 12px;
    z-index: 300;
    min-width: 280px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.all-bays-popover.open { display: block; }
.abp-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
    margin-bottom: 10px;
}
.abp-fields {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.abp-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.abp-field label {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.abp-field input {
    padding: 5px 8px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}
.abp-field input[type="number"] { width: 72px; }
.abp-field input[type="text"] { width: 150px; }
.abp-field input:focus { border-color: var(--accent); }
.abp-actions { display: flex; gap: 8px; }
