/* ===========================
   SVGLENGTH CALC PAGE STYLES
   Matches LaserLab dark theme
   =========================== */

.svglc-container {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 0;
    height: calc(100vh - 73px);
}

/* ===========================
   SIDEBARS
   =========================== */
.svglc-left-sidebar,
.svglc-right-sidebar {
    background: rgba(15, 23, 42, 0.6);
    padding: 20px;
    overflow-y: auto;
}

.svglc-left-sidebar {
    border-right: 1px solid rgba(148, 163, 184, 0.1);
}

.svglc-right-sidebar {
    border-left: 1px solid rgba(148, 163, 184, 0.1);
    display: flex;
    flex-direction: column;
    padding: 0;
}

.svglc-section {
    margin-bottom: 20px;
}

.svglc-section-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: #64748b;
    margin: 0 0 12px 0;
    text-transform: uppercase;
}

/* ===========================
   FILE INFO
   =========================== */
.svglc-file-info {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 8px;
    font-size: 12px;
    color: #cbd5e1;
    word-break: break-all;
}

.svglc-file-info.empty {
    color: #64748b;
    font-style: italic;
    text-align: center;
}

.svglc-file-stats {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: #64748b;
    margin-top: 6px;
}

/* ===========================
   TOOL BUTTONS / MODE SELECTOR
   =========================== */
.svglc-mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.svglc-mode-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 6px;
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    text-align: left;
    width: 100%;
}

.svglc-mode-btn:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(96, 165, 250, 0.4);
}

.svglc-mode-btn.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
    border-color: #60a5fa;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(96, 165, 250, 0.3);
}

.svglc-mode-btn .mode-icon {
    font-size: 16px;
}

.svglc-mode-btn .mode-desc {
    font-size: 10px;
    color: #64748b;
    display: block;
    margin-top: 2px;
}

.svglc-mode-btn.active .mode-desc {
    color: #94a3b8;
}

/* ===========================
   UNIT SELECTOR
   =========================== */
.svglc-unit-row {
    display: flex;
    gap: 4px;
}

.svglc-unit-btn {
    flex: 1;
    padding: 8px;
    background: transparent;
    border: 1px solid #475569;
    border-radius: 4px;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.svglc-unit-btn:hover {
    border-color: #60a5fa;
    color: #ffffff;
}

.svglc-unit-btn.active {
    background: rgba(96, 165, 250, 0.15);
    border-color: #60a5fa;
    color: #60a5fa;
}

/* ===========================
   CALIBRATION
   =========================== */
.svglc-cal-info {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 4px;
    padding: 8px 10px;
    margin-bottom: 8px;
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.4;
}

.svglc-cal-info strong {
    color: #cbd5e1;
}

.svglc-cal-status {
    display: inline-block;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.svglc-cal-status.auto {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.svglc-cal-status.manual {
    background: rgba(249, 115, 22, 0.15);
    color: #fb923c;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.svglc-cal-status.warning {
    background: rgba(234, 179, 8, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.svglc-cal-btn-row {
    display: flex;
    gap: 6px;
}

.svglc-cal-btn-row button {
    flex: 1;
    padding: 7px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 4px;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
}

.svglc-cal-btn-row button:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(96, 165, 250, 0.4);
    color: #ffffff;
}

/* ===========================
   ACTION BUTTONS
   =========================== */
.svglc-action-btn {
    display: block;
    width: 100%;
    padding: 9px 12px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 6px;
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
    margin-bottom: 6px;
    text-align: left;
}

.svglc-action-btn:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(96, 165, 250, 0.4);
    color: #ffffff;
}

.svglc-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.svglc-action-btn.primary {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25) 0%, rgba(139, 92, 246, 0.25) 100%);
    border-color: #60a5fa;
    color: #ffffff;
}

.svglc-action-btn.primary:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.4) 0%, rgba(139, 92, 246, 0.4) 100%);
}

/* ===========================
   TOGGLE SWITCH
   =========================== */
.svglc-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 12px;
    color: #cbd5e1;
}

.svglc-toggle {
    position: relative;
    width: 36px;
    height: 20px;
    background: #475569;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.svglc-toggle.on {
    background: #60a5fa;
}

.svglc-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: left 0.2s;
}

.svglc-toggle.on::after {
    left: 18px;
}

/* ===========================
   CANVAS AREA
   =========================== */
.svglc-canvas-area {
    background: #0a1020;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.svglc-canvas-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: rgba(15, 23, 42, 0.8);
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    font-size: 12px;
    color: #94a3b8;
    flex-shrink: 0;
}

.svglc-canvas-toolbar-left,
.svglc-canvas-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.svglc-zoom-btn {
    width: 28px;
    height: 28px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 4px;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.svglc-zoom-btn:hover {
    background: rgba(30, 41, 59, 1);
    border-color: rgba(96, 165, 250, 0.4);
    color: #fff;
}

.svglc-zoom-display {
    min-width: 50px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.svglc-canvas-host {
    flex: 1;
    overflow: hidden;
    cursor: grab;
    background-image:
        linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
}

.svglc-canvas-host.panning {
    cursor: grabbing;
}

.svglc-canvas-host svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Empty state */
.svglc-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #64748b;
    text-align: center;
    padding: 40px;
}

.svglc-empty-state.dragover {
    background: rgba(96, 165, 250, 0.05);
    border: 2px dashed rgba(96, 165, 250, 0.4);
}

.svglc-empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.svglc-empty-state h2 {
    color: #cbd5e1;
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 500;
}

.svglc-empty-state p {
    margin: 0 0 20px;
    font-size: 14px;
}

.svglc-empty-state .btn-primary {
    padding: 12px 32px;
    font-size: 15px;
}

/* ===========================
   PATH STYLING ON CANVAS
   =========================== */
.svglc-path {
    transition: stroke-width 0.15s, filter 0.15s, stroke 0.15s, opacity 0.15s;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none; /* events handled by .svglc-hit overlay */
    stroke: #64748b; /* dim grey when not selected */
    stroke-width: var(--normal-width, 1.5px);
    opacity: 0.7;
}

/* Invisible fat hit-area on top of each visible path so clicking is easy */
.svglc-hit {
    fill: none;
    stroke: transparent;
    stroke-linecap: round;
    stroke-linejoin: round;
    cursor: pointer;
    pointer-events: stroke;
    /* Fat width set inline based on viewBox in JS */
}

.svglc-path.hovering {
    stroke: #cbd5e1;
    stroke-width: var(--hover-width, 2);
    opacity: 1;
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.4));
}

.svglc-path.selected {
    stroke: #60a5fa; /* bright blue — clearly distinct from dim unselected */
    stroke-width: var(--selected-width, 4);
    opacity: 1;
    filter: drop-shadow(0 0 6px rgba(96, 165, 250, 0.7));
}

.svglc-path.recently-selected {
    stroke-dasharray: 8 5;
    animation: svglc-march 1s linear infinite;
}

@keyframes svglc-march {
    to {
        stroke-dashoffset: -13;
    }
}

/* Number badges */
.svglc-badge {
    pointer-events: none;
    user-select: none;
}

.svglc-badge-bg {
    fill: rgba(15, 23, 42, 0.9);
    stroke: #cbd5e1;
    stroke-width: 1;
}

.svglc-badge-text {
    fill: #fff;
    font-family: 'Segoe UI', sans-serif;
    font-weight: 600;
    text-anchor: middle;
    dominant-baseline: central;
}

.svglc-badge.selected .svglc-badge-bg {
    fill: rgba(96, 165, 250, 0.95);
    stroke: #fff;
    stroke-width: 1.5;
}

/* Tooltip */
.svglc-tooltip {
    position: fixed;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(96, 165, 250, 0.5);
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 12px;
    color: #fff;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    font-variant-numeric: tabular-nums;
}

.svglc-tooltip strong {
    color: #60a5fa;
}

/* Calibration overlay */
.svglc-cal-overlay {
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(249, 115, 22, 0.95);
    color: #fff;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 12px;
}

.svglc-cal-overlay button {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.svglc-cal-marker {
    fill: #fb923c;
    stroke: #fff;
    stroke-width: 1.5;
    pointer-events: none;
}

/* ===========================
   RIGHT SIDEBAR - TOTALS & PATH LIST
   =========================== */
.svglc-totals {
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    padding: 16px 20px;
    flex-shrink: 0;
}

.svglc-totals-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.svglc-totals-count {
    color: #94a3b8;
    font-size: 12px;
    margin-bottom: 4px;
}

.svglc-totals-main {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.svglc-totals-detail {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #94a3b8;
    padding: 3px 0;
    font-variant-numeric: tabular-nums;
}

.svglc-totals-detail.diff {
    color: #fbbf24;
    font-weight: 600;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
    padding-top: 6px;
    margin-top: 4px;
}

.svglc-totals-detail .label {
    color: #64748b;
}

.svglc-totals-buttons {
    display: flex;
    gap: 6px;
    margin-top: 12px;
}

.svglc-totals-buttons button {
    flex: 1;
    padding: 7px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 4px;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
}

.svglc-totals-buttons button:hover {
    background: rgba(30, 41, 59, 1);
    border-color: rgba(96, 165, 250, 0.4);
    color: #fff;
}

/* ===========================
   PATH LIST
   =========================== */
.svglc-list-header {
    padding: 12px 20px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.svglc-list-header .svglc-section-title {
    margin: 0;
}

.svglc-list-header-actions {
    display: flex;
    gap: 6px;
}

.svglc-list-header-actions button {
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #94a3b8;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.svglc-list-header-actions button:hover {
    border-color: rgba(96, 165, 250, 0.4);
    color: #60a5fa;
}

.svglc-path-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px 20px;
}

.svglc-path-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 4px;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid transparent;
    border-left: 3px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.15s;
}

.svglc-path-row:hover {
    background: rgba(30, 41, 59, 0.7);
    border-color: rgba(96, 165, 250, 0.3);
}

.svglc-path-row.selected {
    background: rgba(96, 165, 250, 0.12);
    border-color: rgba(96, 165, 250, 0.5);
    border-left-color: #60a5fa;
}

.svglc-path-row.hovering-from-canvas {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(96, 165, 250, 0.6);
}

.svglc-row-checkbox {
    width: 16px;
    height: 16px;
    border: 1.5px solid #64748b;
    border-radius: 3px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    transition: all 0.15s;
}

.svglc-path-row.selected .svglc-row-checkbox {
    background: #60a5fa;
    border-color: #60a5fa;
}

.svglc-row-checkbox::after {
    content: '';
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translateY(-1px);
    opacity: 0;
    transition: opacity 0.15s;
}

.svglc-path-row.selected .svglc-row-checkbox::after {
    opacity: 1;
}

.svglc-row-thumb {
    width: 44px;
    height: 44px;
    background: rgba(10, 16, 32, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.svglc-path-row.selected .svglc-row-thumb {
    border-color: #60a5fa;
}

.svglc-row-thumb svg {
    display: block;
    width: 100%;
    height: 100%;
}

.svglc-row-info {
    flex: 1;
    min-width: 0;
}

.svglc-row-top {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.svglc-row-num {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.svglc-path-row.selected .svglc-row-num {
    background: #60a5fa;
    color: #fff;
    border-color: #fff;
}

.svglc-row-type {
    font-size: 11px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.svglc-path-row.selected .svglc-row-type {
    color: #cbd5e1;
}

.svglc-row-length {
    font-size: 13px;
    color: #cbd5e1;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.svglc-path-row.selected .svglc-row-length {
    color: #fff;
    font-weight: 700;
}

.svglc-row-copy {
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #94a3b8;
    border-radius: 3px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
    font-size: 12px;
}

.svglc-row-copy:hover {
    background: rgba(96, 165, 250, 0.15);
    border-color: #60a5fa;
    color: #60a5fa;
}

.svglc-row-copy.copied {
    background: rgba(34, 197, 94, 0.2);
    border-color: #4ade80;
    color: #4ade80;
}

.svglc-list-empty {
    padding: 30px 20px;
    text-align: center;
    color: #64748b;
    font-size: 12px;
    font-style: italic;
}

/* ===========================
   MODAL
   =========================== */
.svglc-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.svglc-modal {
    background: #1e293b;
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: 8px;
    padding: 24px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.svglc-modal h2 {
    margin: 0 0 12px;
    color: #fff;
    font-size: 18px;
}

.svglc-modal p {
    color: #94a3b8;
    font-size: 13px;
    line-height: 1.5;
    margin: 0 0 16px;
}

.svglc-modal .input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.svglc-modal input[type="number"] {
    flex: 1;
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
}

.svglc-modal input[type="number"]:focus {
    outline: none;
    border-color: #60a5fa;
}

.svglc-modal select {
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
}

.svglc-modal-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.svglc-modal-buttons button {
    padding: 8px 18px;
    border-radius: 4px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: transparent;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.svglc-modal-buttons button:hover {
    border-color: #60a5fa;
    color: #fff;
}

.svglc-modal-buttons button.primary {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 1100px) {
    .svglc-container {
        grid-template-columns: 240px 1fr 280px;
    }
}

@media (max-width: 900px) {
    .svglc-container {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 73px);
    }

    .svglc-left-sidebar,
    .svglc-right-sidebar {
        max-height: none;
        border: none;
    }

    .svglc-canvas-area {
        min-height: 60vh;
    }
}
