/* public/assets/css/life/measurement-tool.css */

.unit-select {
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-body);
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: 0.2s;
}
.unit-select:focus { border-color: var(--primary-color); }
[data-theme="dark"] .unit-select { background: #0f172a; border-color: #334155; }

.action-btn {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: var(--bg-body);
    color: var(--text-main);
    cursor: pointer;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.action-btn:hover { background: #e2e8f0; }
.action-btn.primary { background: var(--primary-color); color: #fff; border: none; box-shadow: 0 4px 10px rgba(0,102,204,0.2); }
.action-btn.primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
[data-theme="dark"] .action-btn { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .action-btn:hover { background: #334155; }
[data-theme="dark"] .action-btn.primary { color: #fff; background: var(--primary-color); }

.metrics-dashboard {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px 20px;
    text-align: center;
    margin-bottom: 24px;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05);
}

.metric-title {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.metric-value-wrap {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
}

#distValue {
    font-size: 4rem;
    font-weight: 900;
    color: var(--primary-color);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    line-height: 1;
    text-shadow: 0 4px 12px rgba(0, 102, 204, 0.15);
}

.metric-unit {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-muted);
}

/* 尺子工作区 */
.ruler-workspace {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px 20px 40px 20px;
    overflow-x: auto;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02);
}

.ruler-instruction {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    font-weight: 500;
}

.ruler-container {
    position: relative;
    width: 100%;
    min-width: 800px; /* 保证有一个基础宽度，移动端可以横向滚动 */
    height: 180px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

[data-theme="dark"] .ruler-container { background: #1e293b; border-color: #334155; }

#rulerCanvas {
    width: 100%;
    height: 60px; /* 刻度部分高度 */
    display: block;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
}
[data-theme="dark"] #rulerCanvas { background: #0f172a; }

/* 拖拽卡尺游标 */
.caliper {
    position: absolute;
    top: 0;
    height: 100%;
    width: 32px;
    margin-left: -16px; /* 居中对齐 */
    cursor: ew-resize;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.caliper-handle {
    width: 32px;
    height: 40px;
    background: var(--primary-color);
    border-radius: 6px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.8rem;
    box-shadow: 0 4px 8px rgba(0, 102, 204, 0.3);
    margin-top: 60px; /* 放置在刻度线下方 */
}

.caliper-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 15px; /* 居中于 32px */
    width: 2px;
    background: var(--primary-color);
    z-index: -1;
}

/* 两游标之间的填充测量区域 */
.caliper-fill {
    position: absolute;
    top: 60px; /* 在画布下方 */
    bottom: 0;
    background: rgba(0, 102, 204, 0.08);
    border-top: 2px dashed rgba(0, 102, 204, 0.4);
    pointer-events: none;
}
[data-theme="dark"] .caliper-fill { background: rgba(99, 102, 241, 0.15); border-top-color: rgba(99, 102, 241, 0.4); }

/* 模态框 */
.calib-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.6); z-index: 99999;
    display: none; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
}

.calib-modal-box {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    width: 90%; max-width: 500px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    overflow: hidden;
}

.calib-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 24px; background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
}
[data-theme="dark"] .calib-header { background: #1e293b; }

.calib-header h3 { margin: 0; font-size: 1.1rem; color: var(--text-main); font-weight: 700; }
.close-btn { background: none; border: none; font-size: 1.2rem; color: var(--text-muted); cursor: pointer; }
.close-btn:hover { color: #ef4444; }

.calib-body { padding: 24px; }
.calib-desc { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; margin-bottom: 24px; }

.calib-card-area {
    width: 100%;
    height: 120px;
    background: #f1f5f9;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    margin-bottom: 24px;
    position: relative;
    display: flex; align-items: center; justify-content: center;
}
[data-theme="dark"] .calib-card-area { background: #0f172a; border-color: #334155; }

/* 模拟信用卡框 */
.calib-card-preview {
    height: 80px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 0.85rem;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.4);
    text-align: center; padding: 0 10px;
}

.calib-controls input[type="range"] {
    width: 100%; margin-bottom: 24px; cursor: ew-resize;
}

.calib-actions {
    display: flex; justify-content: flex-end; gap: 12px;
}

@media (max-width: 768px) {
    .pc-text, .pc-only { display: none !important; }
    #distValue { font-size: 3rem; }
    .action-btn { padding: 8px 12px; }
}