:root {
    --top-pane-height: 44vh;
    --table-height: 28vh;
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --warning-color: #ffc107;
    --border-color: #ccc;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
}

* {
    box-sizing: border-box;
}

body {
    display: flex;
    margin: 0;
    height: 100vh;
    font-family: 'Microsoft YaHei', sans-serif;
    overflow: hidden;
}

/* 左侧画布区 */
#canvas-wrapper {
    flex: 1;
    background: #333;
    position: relative;
    overflow: hidden;
    cursor: grab;
}

#canvas-wrapper.grabbing {
    cursor: grabbing;
}

canvas {
    background: white;
    display: none;
    transform-origin: 0 0;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

#empty-tip {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #888;
    font-size: 18px;
    pointer-events: none;
}

#zoom-info {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
}

/* 右侧边栏 */
#sidebar {
    width: 460px;
    background: var(--bg-light);
    border-left: 1px solid var(--border-color);
    padding: 16px;
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    gap: 8px;
}

/* 上半部分 */
#topPane {
    height: var(--top-pane-height);
    min-height: 180px;
    overflow: auto;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: var(--bg-white);
    padding: 10px;
}

/* 分隔条 */
.resizer {
    height: 8px;
    cursor: row-resize;
    border-radius: 6px;
    background: repeating-linear-gradient(90deg, #d7dee6 0, #d7dee6 6px, #e7edf3 6px, #e7edf3 12px);
    box-shadow: inset 0 0 0 1px #cfd6dd;
    user-select: none;
}

.resizer.active {
    background: #c7d7e7;
    box-shadow: inset 0 0 0 1px #9fb8d3;
}

/* 下半部分 */
#bottomPane {
    flex: 1;
    min-height: 200px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

h3 {
    margin: 0 0 10px;
    color: #333;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
}

/* 步骤卡片 */
.step {
    margin-bottom: 14px;
    padding: 12px;
    background: var(--bg-white);
    border-radius: 6px;
    border: 1px solid #ddd;
}

.step.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.2);
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    font-size: 13px;
}

input[type="text"],
input[type="number"],
input[type="file"],
select {
    width: 100%;
    box-sizing: border-box;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.inline-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.inline-inputs .field {
    display: flex;
    flex-direction: column;
}

.inline-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.inline-row input[type="checkbox"] {
    transform: scale(1.1);
}

.muted {
    color: #666;
    font-size: 12px;
    margin-bottom: 4px;
}

/* 按钮样式 */
button {
    width: 100%;
    padding: 10px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 6px;
    font-size: 14px;
    transition: background 0.2s;
}

button:hover {
    background: #0069d9;
}

button.secondary {
    background: var(--secondary-color);
}

button.secondary:hover {
    background: #5a6268;
}

button.info {
    background: var(--info-color);
}

button.info:hover {
    background: #138496;
}

button.success {
    background: var(--success-color);
}

button.success:hover {
    background: #218838;
}

button.warning {
    background: var(--warning-color);
    color: #333;
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid #80bdff;
}

.btn-outline:hover {
    background: #e7f1ff;
}

/* 位置/纬度配置区 */
.location-config {
    background: #f1f8ff;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 10px;
    border: 1px solid #d0e3ff;
}

.location-config label {
    color: #0056b3;
    font-weight: bold;
    margin-bottom: 8px;
}

.location-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.location-row .field {
    flex: 1;
}

.location-row select,
.location-row input {
    margin-bottom: 0;
}

/* 表格区 */
#step-table {
    margin: 0;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: var(--bg-white);
}

#table-wrapper {
    height: var(--table-height);
    min-height: 120px;
    overflow: auto;
    border: 1px solid #eee;
    border-radius: 6px;
    background: var(--bg-white);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

thead th {
    position: sticky;
    top: 0;
    background: #f1f3f5;
    z-index: 1;
}

th,
td {
    border-bottom: 1px solid #eee;
    padding: 6px;
    text-align: left;
}

td input {
    width: 100%;
    padding: 6px;
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

td .btn-mini {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
}

.btn-danger {
    background: var(--danger-color);
    color: #fff;
}

.btn-danger:hover {
    background: #c82333;
}

/* 响应式 */
@media (max-width: 768px) {
    #sidebar {
        width: 100vw;
        position: absolute;
        right: 0;
        left: 0;
        bottom: 0;
        max-height: 60vh;
        overflow: hidden;
    }

    #topPane {
        max-height: 55vh;
    }

    #table-wrapper {
        max-height: 55vh;
    }
}