/* Measure Tool */
.btn.measure-active, .btn.annot-active {
    background: var(--accent) !important;
    box-shadow: 0 0 12px var(--accent-glow);
}

.measure-bar {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass-bg-solid);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 10px 18px;
    z-index: 150;
    display: none;
    align-items: center;
    gap: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    max-width: 90vw;
}

.measure-bar.show { display: flex; }

.measure-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    padding: 5px 10px;
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    white-space: nowrap;
}

.measure-item .val { font-weight: 600; color: #22d3ee; font-family: 'JetBrains Mono', 'SF Mono', monospace; }
.measure-item .sep { color: var(--text-muted); margin: 0 2px; }

.measure-item .del {
    cursor: pointer;
    opacity: 0.4;
    margin-left: 4px;
    font-size: 11px;
}
.measure-item .del:hover { opacity: 1; }

.measure-hint {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

.measure-label {
    position: fixed;
    background: rgba(0, 210, 240, 0.92);
    color: #000;
    font-size: 12px;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'SF Mono', monospace, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
    padding: 3px 8px;
    border-radius: 6px;
    pointer-events: none;
    z-index: 120;
    white-space: nowrap;
    transform: translate(-50%, -150%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.measure-cursor canvas { cursor: crosshair !important; }

/* Move bar axis groups */
.move-axis-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.move-axis-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--glass-border);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    transition: background 0.15s;
    white-space: nowrap;
}
.move-axis-btn:hover { background: rgba(255,255,255,0.16); }
.move-axis-btn:active { background: var(--accent); }

.move-field {
    width: 56px;
    text-align: center;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: #22d3ee;
    font-size: 12px;
    font-weight: 600;
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    padding: 6px 4px;
    outline: none;
}
.move-field:focus { border-color: var(--accent); }

.move-sep {
    width: 1px;
    height: 24px;
    background: var(--glass-border);
    margin: 0 4px;
}

/* Annotation Mode — full-screen in-place replacement of 3D viewport */
.annot-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    flex-direction: column;
    background: #0a0a14;
}
.annot-overlay.show { display: flex; }

.annot-toolbar {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    gap: 8px;
    background: var(--glass-bg-solid);
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
    z-index: 210;
}

.annot-toolbar-title { font-weight: 600; font-size: 14px; margin-right: 4px; }

.annot-sep {
    width: 1px;
    height: 24px;
    background: var(--glass-border);
    margin: 0 4px;
}

.annot-tools { display: flex; gap: 3px; }

.annot-tool {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    background: rgba(255,255,255,0.06);
    font-size: 15px;
    transition: all 0.15s;
}
.annot-tool:hover { background: rgba(255,255,255,0.12); }
.annot-tool.active { border-color: var(--accent); background: rgba(99,102,241,0.25); }

.annot-colors { display: flex; gap: 4px; }

.annot-color {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.1s;
}
.annot-color:hover { transform: scale(1.2); }
.annot-color.active { border-color: white; }

.annot-sizes { display: flex; gap: 3px; }

.annot-size {
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    background: rgba(255,255,255,0.06);
    border: 1px solid transparent;
    color: var(--text-secondary);
}
.annot-size:hover { background: rgba(255,255,255,0.12); }
.annot-size.active { border-color: var(--accent); color: white; }

.annot-input {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text);
    padding: 6px 12px;
    font-size: 13px;
    font-family: inherit;
    width: 200px;
}
.annot-input:focus { outline: none; border-color: var(--accent); }

.annot-canvas-area {
    flex: 1;
    position: relative;
    overflow: hidden;
    cursor: crosshair;
}

.annot-canvas-area canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.annot-canvas-area textarea {
    resize: both;
    overflow: hidden;
}

.annot-canvas-area textarea::-webkit-resizer {
    background: rgba(255,255,255,0.7);
    border-radius: 2px;
}

/* Thumbnail Crop Box */
.thumb-crop-box {
    position: absolute;
    border: 2px dashed rgba(255,255,255,0.8);
    cursor: move;
    z-index: 50;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.4);
}

.thumb-crop-actions {
    position: absolute;
    top: -32px;
    right: 0;
    display: flex;
    gap: 4px;
}

.thumb-crop-btn {
    background: var(--glass-bg-solid);
    border: 1px solid var(--glass-border);
    color: var(--text);
    cursor: pointer;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
}
.thumb-crop-btn:hover { background: rgba(255,255,255,0.12); }
.thumb-crop-capture { background: var(--accent); color: #fff; border-color: var(--accent); }
.thumb-crop-capture:hover { opacity: 0.9; }

.thumb-crop-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 2px;
    border: 1px solid rgba(0,0,0,0.3);
}
.thumb-crop-tl { top: -5px; left: -5px; cursor: nwse-resize; }
.thumb-crop-tr { top: -5px; right: -5px; cursor: nesw-resize; }
.thumb-crop-bl { bottom: -5px; left: -5px; cursor: nesw-resize; }
.thumb-crop-br { bottom: -5px; right: -5px; cursor: nwse-resize; }

/* Annotation GitHub dropdown — opens downward from toolbar */
.annot-gh-dropdown .view-dropdown-panel {
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    min-width: 170px;
}

/* Logo overlay on annotation canvas */
.annot-logo-overlay {
    position: absolute;
    bottom: 3%;
    right: 3%;
    width: 8%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    pointer-events: none;
    z-index: 5;
    border-radius: 4px;
    opacity: 0.85;
}
/* When LeckerCAD watermark is on, org logo moves to bottom-left */
.annot-logo-overlay.left {
    right: auto;
    left: 3%;
}

/* LeckerCAD brand watermark — icon + text, bottom-right.
   Sizes are relative to the canvas area dimensions (vw + clamp). */
.annot-brand-overlay {
    position: absolute;
    bottom: 3%;
    right: 3%;
    display: flex;
    align-items: center;
    gap: 6px;
    pointer-events: none;
    z-index: 5;
    opacity: 0.85;
}
.annot-brand-overlay img {
    width: clamp(28px, 4vw, 64px);
    aspect-ratio: 1;
    object-fit: contain;
}
.annot-brand-overlay span {
    color: #fff;
    font-weight: 600;
    font-size: clamp(13px, 1.6vw, 22px);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

/* Section View tristate buttons */
.section-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px 8px;
}

.section-btn {
    width: 36px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.06);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}
.section-btn:hover { background: rgba(255,255,255,0.12); }
.section-btn.state-plus {
    background: rgba(59, 130, 246, 0.3);
    border-color: #3b82f6;
    color: #93c5fd;
}
.section-btn.state-plus::after {
    content: '+';
    position: absolute;
    top: -2px;
    right: 1px;
    font-size: 9px;
    color: #60a5fa;
}
.section-btn.state-minus {
    background: rgba(239, 68, 68, 0.3);
    border-color: #ef4444;
    color: #fca5a5;
}
.section-btn.state-minus::after {
    content: '−';
    position: absolute;
    top: -2px;
    right: 1px;
    font-size: 9px;
    color: #f87171;
}

/* Section tree in panel-left */
.section-tree-row {
    border-top: 1px solid var(--glass-border);
    margin-top: 4px;
    padding-top: 4px;
}
.section-tree-row .tree-label {
    font-weight: 600;
    color: var(--text-bright);
}

/* =============================================
   DIFF VIEW
   ============================================= */

/* Diff button in commits panel header */
.diff-btn {
    background: none;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    border-radius: 6px;
    padding: 1px 7px;
    font-size: 12px;
    cursor: pointer;
    margin-left: auto;
    transition: all 0.2s;
}
.diff-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}
.diff-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

/* Commit selection badges during diff mode */
.gh-commit-item.diff-selectable {
    cursor: crosshair;
    border-left: 2px solid var(--accent);
}
.gh-commit-item.diff-a {
    background: rgba(255, 68, 68, 0.12);
    border-left: 3px solid #ff4444;
}
.gh-commit-item.diff-b {
    background: rgba(68, 204, 68, 0.12);
    border-left: 3px solid #44cc44;
}
.gh-commit-item.diff-a .gh-commit-dot,
.gh-commit-item.diff-b .gh-commit-dot {
    display: none;
}
.gh-commit-item.diff-a::before,
.gh-commit-item.diff-b::before {
    font-size: 10px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 8px;
}
.gh-commit-item.diff-a::before {
    content: 'A';
    background: #ff4444;
    color: #fff;
}
.gh-commit-item.diff-b::before {
    content: 'B';
    background: #44cc44;
    color: #fff;
}

/* Diff badge (reusable) */
.diff-badge {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.diff-badge-a { background: #ff4444; }
.diff-badge-b { background: #44cc44; }

/* Diff panel (inside panel-right-body) */
.diff-panel-content {
    padding: 8px 12px 12px;
}
.diff-panel-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 10px 0 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.diff-panel-label:first-child {
    margin-top: 0;
}
.diff-panel-group {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--glass-border);
}
.diff-slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}
.diff-slider-row .info-key {
    font-size: 11px;
    min-width: 70px;
}
.diff-slider-row .edge-slider {
    flex: 1;
}
.diff-slider-row .slider-val {
    min-width: 36px;
    text-align: right;
    font-size: 11px;
}
.diff-slider-inactive::-webkit-slider-thumb {
    background: #555 !important;
}
.diff-slider-inactive::-moz-range-thumb {
    background: #555 !important;
}
.diff-reset-opacity-btn {
    color: var(--text-muted) !important;
    font-size: 10px;
}
.diff-tolerance-hint {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}
.diff-toggle {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}
.diff-toggle input {
    margin: 0;
    width: 13px;
    height: 13px;
}

/* Diff panel commit items (non-interactive copies) */
#diffPanel .gh-commit-item {
    margin: 0 0 2px;
    border-radius: 6px;
    font-size: 11px;
}

/* Exit button */
.diff-quit-btn {
    color: #ff6b6b !important;
    border-color: #ff6b6b !important;
}
.diff-quit-btn:hover {
    background: rgba(255, 107, 107, 0.15) !important;
}

/* Diff legend (left panel, replaces model tree during diff) */
.diff-legend {
    padding: 0;
}
.diff-legend-body {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.diff-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}
.diff-legend-swatch {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.1);
}
