/* =========================================
   1. 全局变量与基础设置
   ========================================= */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --bg: #f3f4f6;
    --card-bg: #ffffff;
    --text: #1f2937;
    --border: #e5e7eb;
    --success: #10b981;
    --danger: #ef4444;
    --warning-bg: #fff7ed;
    --warning-border: #f59e0b;
    --mobile-cell-width: 50px; 
    --mobile-cell-height: 70px;
    --header-size: 35px;
}
body.cx-theme { --primary: #10b981; --primary-dark: #059669; --bg: #eef2f6; --text: #334155; --border: #e2e8f0; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); margin: 0; padding: 0; position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; overflow: hidden; display: flex; flex-direction: column; font-size: 14px; }

/* 2. 头部与导航 */
.header { background: var(--primary); color: white; padding: 0 12px; height: 44px; flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; z-index: 50; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.brand { font-size: 1rem; font-weight: bold; display: flex; align-items: center; }
.user-badge { background: rgba(255,255,255,0.2); padding: 1px 6px; border-radius: 10px; font-size: 0.7rem; margin-left: 6px; }
.header-actions { display: flex; gap: 8px; }
.btn-icon { background: rgba(255,255,255,0.2); border: none; color: white; width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 0.9rem; text-decoration: none; transition: 0.2s; }

/* 3. 入库页：库位设定面板 */
.loc-editor {
    background: white; border-bottom: 1px solid var(--border); flex-shrink: 0; transition: 0.3s ease-out; z-index: 40;
}
.loc-header {
    background: #f8fafc; padding: 8px 12px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; border-left: 3px solid var(--primary);
}
.loc-summary-text { font-size: 0.95rem; font-weight: bold; color: var(--primary); font-family: monospace; }
.loc-toggle-icon { transition: transform 0.3s; color: #94a3b8; font-size: 0.8rem; }
.loc-body { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out, opacity 0.3s; opacity: 0; }
.loc-editor.expanded .loc-body { max-height: 300px; opacity: 1; border-top: 1px solid #f1f5f9; }
.loc-editor.expanded .loc-toggle-icon { transform: rotate(180deg); }
.loc-inner-padding { padding: 10px; }
.loc-zone-row, .loc-inputs-row { display: flex; gap: 8px; margin-bottom: 10px; }
#inZone { flex: 1; padding: 6px; border: 1px solid var(--border); border-radius: 4px; background: white; font-size: 1rem; }
.btn-manage { width: 36px; background: white; border: 1px solid var(--border); border-radius: 4px; color: #6b7280; }
.loc-field { flex: 1; display: flex; flex-direction: column; align-items: center; }
.loc-field label { font-size: 0.7rem; color: #6b7280; margin-bottom: 2px; }
.loc-field input { width: 100%; padding: 6px 0; text-align: center; border: 1px solid var(--border); border-radius: 4px; font-size: 1.1rem; font-weight: bold; color: var(--primary); }
.strategy-section { display: flex; gap: 8px; }
.radio-card { flex: 1; position: relative; cursor: pointer; }
.radio-card input { position: absolute; opacity: 0; }
.card-content { border: 1px solid var(--border); border-radius: 4px; padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: #6b7280; background: white; font-size: 0.8rem; }
.radio-card input:checked + .card-content { border-color: var(--primary); background: #eff6ff; color: var(--primary); font-weight: bold; }
.config-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.config-row input { width: 60px; padding: 4px; border: 1px solid var(--border); border-radius: 4px; text-align: center; }

/* 4. 入库页：主布局与卡片 */
.main-container { flex: 1; display: flex; flex-direction: column; padding: 8px; gap: 8px; overflow: hidden; }
.card { background: var(--card-bg); border-radius: 8px; padding: 10px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); display: flex; flex-direction: column; }
.control-card { flex-shrink: 0; height: auto; }
.input-section label { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 5px; color: #4b5563; }
.scan-wrapper { display: flex; gap: 8px; }
.scan-input { flex: 1; padding: 10px; font-size: 1.1rem; border: 1px solid var(--primary); border-radius: 6px; outline: none; background: #eff6ff; }
.scan-input.editing { background-color: var(--warning-bg) !important; border-color: var(--warning-border) !important; color: #9a3412; }

/* 按钮样式组 */
.btn-delete-item { width: 45px; background: #fee2e2; border: 1px solid #fecaca; color: var(--danger); border-radius: 6px; font-size: 1.1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.btn-scan-camera { width: 45px; background: #3b82f6; color: white; border: none; border-radius: 6px; font-size: 1.2rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.btn-manual-submit { width: 45px; background: var(--success); color: white; border: none; border-radius: 6px; font-size: 1.2rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* 5. 地图区 (带动画) */
.map-card { flex: 0 1 auto; max-height: 40vh; overflow: hidden !important; position: relative; }
.map-grid {
    height: auto; overflow-y: auto;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
    align-content: start; gap: 1px; padding: 2px;
    border: 1px solid #f3f4f6; border-radius: 6px; background: #fafafa;
    transform-origin: center center; backface-visibility: hidden;
}
.grid-cell { aspect-ratio: 1; border: 1px solid var(--border); border-radius: 2px; background: white; position: relative; cursor: pointer; overflow: hidden; display: flex; flex-direction: column-reverse; }
.grid-cell.current { border: 2px solid var(--primary); z-index: 5; }
.layer-bit { flex: 1; width: 100%; border-top: 1px solid rgba(0,0,0,0.05); }
.layer-bit.occupied { background-color: #ef4444; }
.cell-num-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 900; color: rgba(0,0,0,0.4); pointer-events: none; }

/* 6. 日志与模态框 */
.log-card { flex: 1; min-height: 0; }
#logList { flex: 1; overflow-y: auto; font-size: 0.75rem; }
.log-item { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid #f3f4f6; }
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 2000; justify-content: center; align-items: center; }
.modal { background: white; width: 90%; max-width: 320px; padding: 15px; border-radius: 10px; }
.modal-header { display: flex; justify-content: space-between; font-weight: bold; margin-bottom: 10px; border-bottom: 1px solid #eee; padding-bottom: 5px; }
.close-btn { font-size: 1.5rem; line-height: 1rem; cursor: pointer; }
.zone-list { max-height: 200px; overflow-y: auto; margin-bottom: 10px; border: 1px solid var(--border); }
.zone-item { padding: 8px; border-bottom: 1px solid #f3f4f6; display: flex; justify-content: space-between; }
.add-zone-box { display: flex; gap: 6px; }
.add-zone-box input { flex: 1; padding: 6px; border: 1px solid var(--border); border-radius: 4px; }
.btn-add { background: var(--primary); color: white; border: none; padding: 0 12px; border-radius: 4px; }
.scanner-box { width: 95%; max-width: 400px; background: #000; color: white; border: 1px solid #333; }
.scanner-box .modal-header { border-bottom: 1px solid #333; color: white; }
#reader a { display: none !important; }

/* 7. 动画 */
.anim-out-left { animation: flyOutLeft 0.25s forwards ease-in; }
.anim-in-right { animation: flyInRight 0.25s forwards ease-out; }
.anim-out-right { animation: flyOutRight 0.25s forwards ease-in; }
.anim-in-left { animation: flyInLeft 0.25s forwards ease-out; }
@keyframes flyOutLeft { 0% { transform: translateX(0); opacity: 1; } 100% { transform: translateX(-100%); opacity: 0; } }
@keyframes flyInRight { 0% { transform: translateX(100%); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }
@keyframes flyOutRight { 0% { transform: translateX(0); opacity: 1; } 100% { transform: translateX(100%); opacity: 0; } }
@keyframes flyInLeft { 0% { transform: translateX(-100%); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }

/* 8. 查询页组件 (保留) */
.search-area { padding: 8px 10px; background: white; border-bottom: 1px solid var(--border); flex-shrink: 0; z-index: 40; display: flex; gap: 8px; align-items: center; }
.search-bar { flex: 1; display: flex; align-items: center; background: #f1f5f9; padding: 0 12px; border-radius: 8px; height: 36px; }
.search-bar input { border: none; outline: none; flex: 1; background: transparent; }
.nav-btn { display: flex; width: 36px; height: 36px; background: var(--primary); color: white; border: none; border-radius: 8px; align-items: center; justify-content: center; }
@media (max-width: 767px) { .nav-btn { display: none; } }

/* ... 前面的 CSS 保持不变 ... */

/* ====== 新增：扫码变焦样式 ====== */
.zoom-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 20px;
    background: #111;
    color: white;
    border-top: 1px solid #333;
}

/* 滑块轨道 */
#zoomSlider {
    flex: 1;
    -webkit-appearance: none;
    height: 4px;
    background: #444;
    border-radius: 2px;
    outline: none;
}

/* 滑块圆钮 (Chrome/Safari) */
#zoomSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary); /* 蓝色 */
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    border: 2px solid white;
}