/* ============================================================
   炸鸡进销发货系统 v8.0 - 全局样式
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #e67e22;
  --primary-dark: #d35400;
  --primary-light: #f39c12;
  --success: #27ae60;
  --danger: #e74c3c;
  --warning: #f1c40f;
  --info: #3498db;
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --border: #dcdde1;
  --sidebar: #2c3e50;
  --sidebar-hover: #34495e;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ========== 侧边栏 ========== */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 220px;
  background: var(--sidebar);
  color: #fff;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-header {
  padding: 20px 16px;
  font-size: 18px;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  text-align: center;
  letter-spacing: 1px;
}
.sidebar-header small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  opacity: 0.7;
  margin-top: 4px;
}
.sidebar-nav { padding: 8px 0; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: var(--sidebar-hover);
  color: #fff;
  border-left-color: var(--primary);
}
.sidebar-nav a .icon { font-size: 18px; width: 24px; text-align: center; }

/* ========== 主内容区 ========== */
.main-content {
  margin-left: 220px;
  padding: 24px;
  min-height: 100vh;
}

/* ========== 页面标题 ========== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}
.page-header h2 small {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-light);
  margin-left: 8px;
}

/* ========== 统计卡片 ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border-radius: 10px;
  padding: 20px;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card .label {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 6px;
}
.stat-card .value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
}
.stat-card .value.primary { color: var(--primary); }
.stat-card .value.success { color: var(--success); }
.stat-card .value.danger { color: var(--danger); }
.stat-card .value.info { color: var(--info); }

/* ========== 卡片 ========== */
.card {
  background: var(--card);
  border-radius: 10px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-body { padding: 20px; }

/* ========== 表格 ========== */
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th {
  background: #f8f9fa;
  font-weight: 600;
  color: var(--text-light);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
tr:hover { background: #f8f9fa; }

/* ========== 标签/徽章 ========== */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.badge-pending {
  background: #fff3cd;
  color: #856404;
}
.badge-paid {
  background: #cce5ff;
  color: #004085;
}
.badge-picked {
  background: #fef3c7;
  color: #d97706;
}
.badge-shipped {
  background: #d4edda;
  color: #155724;
}
.badge-cancelled {
  background: #f8d7da;
  color: #721c24;
}

/* ========== 表单 ========== */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 13px;
  color: var(--text);
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s;
  outline: none;
  background: #fff;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(230,126,34,0.15);
}
.form-control-sm {
  padding: 6px 10px;
  font-size: 13px;
}
select.form-control {
  appearance: auto;
}
textarea.form-control {
  resize: vertical;
  min-height: 80px;
}
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.form-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #219a52; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: #2980b9; }
.btn-warning { background: var(--warning); color: #333; }
.btn-warning:hover { background: #f0d000; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ========== 搜索框 ========== */
.search-box {
  display: flex;
  gap: 8px;
  align-items: center;
}
.search-box input {
  width: 260px;
}

/* ========== 提示消息 ========== */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ========== 无数据提示 ========== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }

/* ========== 模态框 ========== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-light);
  padding: 4px;
  line-height: 1;
}
.modal-body { padding: 20px; }
.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ========== 分页 ========== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 16px 0;
}
.pagination .page-info {
  font-size: 13px;
  color: var(--text-light);
}

/* ========== 运费信息展示 ========== */
.shipping-info {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 16px;
  margin: 12px 0;
}
.shipping-info .row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 14px;
}
.shipping-info .row .label { color: var(--text-light); }
.shipping-info .row .value { font-weight: 600; }

/* ========== 利润对比 ========== */
.profit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.profit-item {
  text-align: center;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.profit-item .label { font-size: 12px; color: var(--text-light); margin-bottom: 4px; }
.profit-item .value { font-size: 20px; font-weight: 700; }
.profit-item .value.green { color: var(--success); }
.profit-item .value.red { color: var(--danger); }
.profit-item .value.orange { color: var(--primary); }

/* ========== 偏差提示 ========== */
.deviation-warning {
  background: #fffbe6;
  border: 1px solid #ffe58f;
  color: #ad6800;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-top: 8px;
}

/* ========== 最近订单卡片 ========== */
.recent-orders-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.order-card-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  cursor: pointer;
  transition: all 0.15s;
}
.order-card-item:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  border-color: var(--primary-light);
  transform: translateY(-2px);
}
.order-card-item .oc-top {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.order-card-item .oc-order-no {
  font-size: 15px; font-weight: 600;
  color: var(--primary); text-decoration: none;
}
.order-card-item .oc-order-no:hover { text-decoration: underline; }
.order-card-item .oc-body {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 16px;
  font-size: 13px;
}
.order-card-item .oc-item {
  display: flex; justify-content: space-between; color: var(--text-light);
}
.order-card-item .oc-item span { font-size: 12px; }
.order-card-item .oc-item strong { color: var(--text); }
.order-card-item .oc-time {
  margin-top: 8px; font-size: 12px; color: var(--text-light);
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .recent-orders-cards {
    grid-template-columns: 1fr;
  }
  /* 侧边栏改为顶部水平导航 */
  .sidebar {
    position: relative;
    width: 100%;
    top: auto;
    bottom: auto;
    left: auto;
    overflow: visible;
  }
  .sidebar-header {
    padding: 8px 12px;
    font-size: 14px;
    display: none;
  }
  .sidebar-header small { display: none; }
  .sidebar-nav {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-around;
    padding: 4px 8px;
    gap: 2px;
  }
  .sidebar-nav a {
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 13px;
    gap: 5px;
    border-left: none;
    border-bottom: 3px solid transparent;
    border-radius: 4px 4px 0 0;
  }
  .sidebar-nav a:hover,
  .sidebar-nav a.active {
    border-left-color: transparent;
    border-bottom-color: var(--primary);
    background: var(--sidebar-hover);
  }
  .sidebar-nav a .icon { font-size: 15px; width: auto; }
  .sidebar-nav a span:last-child { white-space: nowrap; }

  .main-content { margin-left: 0; padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .search-box input { width: 180px; }

  /* 移动端表格：禁止横向滚动，自动换行 */
  .table-wrap { overflow-x: hidden; }
  th, td { padding: 8px 10px; font-size: 12px; white-space: normal; word-break: break-word; }
}
