/* ============================================================
   WMS 仓库管理系统 - 全局样式
   ============================================================ */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* 顶部导航 */
.navbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.navbar-brand {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.navbar-brand .logo {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 18px;
}
.navbar-links {
  display: flex;
  gap: 4px;
}
.navbar-links a {
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-light);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}
.navbar-links a:hover { background: var(--bg); color: var(--text); }
.navbar-links a.active { background: var(--primary); color: white; }

/* 导航栏用户信息 */
.navbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
}
.navbar-user-name {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

/* 主容器 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* 卡片 */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* 统计卡片网格 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-card .label {
  font-size: 13px;
  color: var(--text-light);
  font-weight: 500;
}
.stat-card .value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
}
.stat-card .icon {
  width: 40px; height: 40px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 4px;
}
.stat-card.blue .icon { background: #dbeafe; color: var(--primary); }
.stat-card.blue .value { color: var(--primary); }
.stat-card.yellow .icon { background: var(--warning-light); color: var(--warning); }
.stat-card.yellow .value { color: var(--warning); }
.stat-card.green .icon { background: var(--success-light); color: var(--success); }
.stat-card.green .value { color: var(--success); }
.stat-card.red .icon { background: var(--danger-light); color: var(--danger); }
.stat-card.red .value { color: var(--danger); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover:not(:disabled) { background: var(--bg); }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* 表格 */
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
th {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
tbody tr:hover { background: var(--bg); }

/* 状态标签 */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-pending { background: var(--bg); color: var(--text-light); }
.badge-packing { background: var(--warning-light); color: var(--warning); }
.badge-completed { background: var(--success-light); color: var(--success); }

/* 进度条 */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  background: var(--success);
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

/* 上传区域 */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: rgba(37,99,235,0.04);
}
.upload-zone .upload-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.upload-zone p { color: var(--text-light); margin-bottom: 4px; }

/* 提示消息 */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-success { background: var(--success-light); color: #15803d; }
.alert-error { background: var(--danger-light); color: #b91c1c; }
.alert-warning { background: var(--warning-light); color: #b45309; }
.alert-info { background: #dbeafe; color: var(--primary-dark); }

/* ============================================================
   打包工作站专用样式
   ============================================================ */
.packing-header {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.packing-header .order-info h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}
.packing-header .order-info .meta {
  display: flex;
  gap: 20px;
  font-size: 14px;
  color: var(--text-light);
}

/* 扫码区 */
.scan-area {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.scan-area .scan-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.scan-input-wrapper {
  position: relative;
  margin-bottom: 12px;
}
.scan-input {
  width: 100%;
  padding: 18px 20px 18px 52px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 20px;
  font-weight: 500;
  outline: none;
  transition: all 0.2s;
  letter-spacing: 1px;
}
.scan-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.15);
}
.scan-input.success-flash {
  border-color: var(--success);
  background: var(--success-light);
  box-shadow: 0 0 0 4px rgba(22,163,74,0.15);
}
.scan-input.error-flash {
  border-color: var(--danger);
  background: var(--danger-light);
  box-shadow: 0 0 0 4px rgba(220,38,38,0.15);
}
.scan-input.warning-flash {
  border-color: var(--warning);
  background: var(--warning-light);
  box-shadow: 0 0 0 4px rgba(217,119,6,0.15);
}
.scan-input-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
}

/* 扫码反馈 */
.scan-feedback {
  padding: 16px 20px;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 600;
  display: none;
  align-items: center;
  gap: 10px;
  animation: feedbackIn 0.2s ease;
}
.scan-feedback.show { display: flex; }
.scan-feedback.success { background: var(--success-light); color: #15803d; border: 1px solid #86efac; }
.scan-feedback.error { background: var(--danger-light); color: #b91c1c; border: 1px solid #fca5a5; }
.scan-feedback.warning { background: var(--warning-light); color: #b45309; border: 1px solid #fcd34d; }
.scan-feedback .icon { font-size: 24px; }

@keyframes feedbackIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 进度概览 */
.progress-overview {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 24px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.progress-overview .progress-text {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.progress-overview .progress-bar {
  flex: 1;
  height: 12px;
}

/* 商品列表 */
.items-list {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.items-list .list-title {
  padding: 16px 24px;
  font-size: 16px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.item-row {
  display: flex;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
  transition: background 0.15s;
}
.item-row:last-child { border-bottom: none; }
.item-row.highlight { background: var(--success-light); }
.item-row .item-status {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.item-row.done .item-status { background: var(--success); color: white; }
.item-row.partial .item-status { background: var(--warning); color: white; }
.item-row.pending .item-status { background: var(--bg); color: var(--text-light); border: 2px solid var(--border); }
.item-row .item-info { flex: 1; }
.item-row .item-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}
.item-row .item-barcode {
  font-size: 13px;
  color: var(--text-light);
  font-family: 'Courier New', monospace;
}
.item-row .item-qty {
  text-align: right;
  min-width: 80px;
}
.item-row .item-qty .qty-num {
  font-size: 18px;
  font-weight: 700;
}
.item-row .item-qty .qty-label {
  font-size: 12px;
  color: var(--text-light);
}

/* 完成打包按钮区 */
.complete-section {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--text); }
.empty-state p { font-size: 14px; margin-bottom: 16px; }

/* 扫码找单区 */
.find-order-area {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
  border: 2px solid var(--primary);
}
.find-order-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.find-order-input-wrapper {
  position: relative;
  margin-bottom: 0;
}
.find-order-input {
  width: 100%;
  padding: 18px 20px 18px 52px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 20px;
  font-weight: 500;
  outline: none;
  transition: all 0.2s;
  letter-spacing: 1px;
}
.find-order-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.15);
}
.find-order-input.success-flash {
  border-color: var(--success);
  background: var(--success-light);
  box-shadow: 0 0 0 4px rgba(22,163,74,0.15);
}
.find-order-input.error-flash {
  border-color: var(--danger);
  background: var(--danger-light);
  box-shadow: 0 0 0 4px rgba(220,38,38,0.15);
}
.find-order-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
}
.find-order-feedback {
  padding: 16px 20px;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 600;
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  animation: feedbackIn 0.2s ease;
}
.find-order-feedback.show { display: flex; }
.find-order-feedback.success { background: var(--success-light); color: #15803d; border: 1px solid #86efac; }
.find-order-feedback.error { background: var(--danger-light); color: #b91c1c; border: 1px solid #fca5a5; }
.find-order-feedback.warning { background: var(--warning-light); color: #b45309; border: 1px solid #fcd34d; }
.find-order-feedback .icon { font-size: 24px; }

/* 自定义弹窗 */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: feedbackIn 0.2s ease;
}
.modal-overlay.show { display: flex; }
.modal-dialog {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 32px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-dialog .modal-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--warning-light);
  color: var(--warning);
  font-size: 32px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.modal-dialog .modal-icon.success {
  background: var(--success-light);
  color: var(--success);
}
.modal-dialog .modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}
.modal-dialog .modal-body {
  font-size: 15px;
  color: var(--text-light);
  margin-bottom: 24px;
  line-height: 1.6;
}
.modal-dialog .modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.modal-dialog .modal-actions .btn { min-width: 120px; }
.modal-progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 20px;
}
.modal-progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
}

/* 搜索栏 */
.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  align-items: center;
  flex-wrap: wrap;
}.search-bar .form-control { flex: 1; min-width: 200px; }
.search-bar select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: white;
  cursor: pointer;
}

/* 分页 */
.pagination {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.page-btn:hover:not(:disabled):not(.active) {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(37,99,235,0.04);
}
.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.page-btn:disabled, .page-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.page-ellipsis {
  padding: 0 6px;
  color: var(--text-light);
  font-size: 14px;
}
.page-info {
  margin-left: 12px;
  font-size: 13px;
  color: var(--text-light);
  white-space: nowrap;
}

/* ============================================================
   批量选择 / 批量操作栏
   ============================================================ */
.col-check {
  width: 44px;
  text-align: center;
}
.col-check input[type="checkbox"],
input.order-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
  vertical-align: middle;
}

/* 选中行高亮 */
tbody tr.row-selected {
  background: #eff6ff;
}
tbody tr.row-selected:hover {
  background: #dbeafe;
}

/* 批量操作栏（选中后显示） */
.bulk-actions {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
}
.bulk-actions.show {
  display: flex;
}
.bulk-info {
  font-size: 14px;
  color: var(--text);
}
.bulk-info strong {
  color: var(--primary);
  font-size: 16px;
  margin: 0 2px;
}
.bulk-hint {
  margin-left: 6px;
  font-size: 12px;
  color: var(--text-light);
}
.bulk-btns {
  display: flex;
  gap: 8px;
}

/* 每页显示条数切换 */
.page-size-select {
  margin-left: 10px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  cursor: pointer;
  outline: none;
}
.page-size-select:hover,
.page-size-select:focus {
  border-color: var(--primary);
}

/* ============================================================
   订单列表标题栏 · 状态切换（待处理 / 已完成）
   ============================================================ */
.card-title-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-tabs {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.status-tab {
  padding: 6px 22px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border: none;
  background: #fff;
  color: var(--text-light);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.status-tab + .status-tab {
  border-left: 1px solid var(--border);
}
.status-tab:hover:not(.active) {
  background: #f8fafc;
  color: var(--text);
}
.status-tab.active {
  background: var(--primary);
  color: #fff;
}

/* 响应式 */
@media (max-width: 768px) {
  .container { padding: 16px; }
  .navbar { padding: 0 12px; }
  .navbar-links a { padding: 6px 10px; font-size: 13px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .scan-input { font-size: 16px; }
  .packing-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .card-title { flex-wrap: wrap; gap: 10px; }
  .status-tab { padding: 6px 14px; font-size: 13px; }
}
