/* Measurement Tool Styles */

.measurements-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Children with pointer-events: auto will still receive events */
    z-index: 50;
}

.measurement-line {
    background: #ef4444;
    /* Bright Red */
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
    transition: background 0.2s ease;
}

.measurement-line.temporary {
    background: #3b82f6;
    /* Blue for active drawing */
    opacity: 0.8;
}

.measurement-endpoint {
    background: #ef4444;
    border: 2px solid white;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
    z-index: 52;
}

.measurement-line.temporary+.measurement-endpoint {
    background: #3b82f6;
}

.measurement-label {
    background: #ef4444;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    /* Enable clicks so double-click override works */
    z-index: 55;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
}

.measurement-line.temporary~.measurement-label {
    background: #3b82f6;
}

/* Measurement Bar specific enhancements */
#measurement-bar {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border-top: 1px solid #e2e8f0;
    padding: 10px 20px;
}

#measurement-bar .op-value {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-weight: 600;
}

.measurement-item {
    transition: background 0.2s ease;
}

.measurement-item:hover {
    background: #f1f5f9;
}

.measurement-item .btn-icon {
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.measurement-item:hover .btn-icon {
    opacity: 1;
}

/* Calibration Pulse */
@keyframes calibrate-pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }

    100% {
        opacity: 1;
    }
}

.measurement-line[style*="background: rgb(16, 185, 129)"] {
    animation: calibrate-pulse 1s infinite ease-in-out;
}