/* public/css/style.css */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #f0f2f5;
  color: #333;
  min-height: 100vh;
}

/* ===== 登录页 ===== */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-container { width: 100%; max-width: 420px; padding: 20px; }
.login-card {
  background: #fff;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.login-header { text-align: center; margin-bottom: 30px; }
.logo-large { font-size: 64px; }
.login-header h1 { margin: 10px 0 5px; font-size: 22px; }
.login-header p { color: #888; font-size: 14px; }

/* ===== 布局 ===== */
.app-container { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  background: #fff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { font-size: 28px; }
.brand h1 { font-size: 18px; color: #333; }
.user-info { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.badge {
  background: #e8f5e9; color: #2e7d32; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 500;
}
.badge.admin { background: #fff3e0; color: #e65100; }

.layout { display: flex; flex: 1; }
.sidebar {
  width: 220px;
  background: #fff;
  padding: 20px 0;
  border-right: 1px solid #eee;
  min-height: calc(100vh - 60px);
}
.sidebar nav { display: flex; flex-direction: column; }
.nav-item {
  padding: 12px 24px;
  color: #555;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all 0.2s;
}
.nav-item:hover { background: #f5f5f5; color: #333; }
.nav-item.active { background: #e8f0fe; color: #1a73e8; border-left-color: #1a73e8; font-weight: 500; }

.main-content { flex: 1; padding: 24px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===== 卡片 ===== */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  margin-bottom: 20px;
}
.card h2 { font-size: 18px; margin-bottom: 20px; color: #222; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.card-header h2 { margin-bottom: 0; }

/* ===== 计数面板 ===== */
.count-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 30px; }
.count-box {
  text-align: center;
  padding: 24px;
  border-radius: 12px;
  color: #fff;
}
.count-box.total { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.count-box.scanned { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.count-box.missing { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.count-label { font-size: 14px; opacity: 0.9; margin-bottom: 8px; }
.count-value { font-size: 42px; font-weight: bold; }

.scan-section { margin-bottom: 20px; }
.scan-section h3 { font-size: 15px; margin-bottom: 12px; color: #555; }
.scanned-tags {
  min-height: 80px;
  border: 2px dashed #ddd;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.tag-chip {
  background: #e8f0fe; color: #1a73e8; padding: 4px 12px; border-radius: 16px; font-size: 13px;
  animation: pop 0.3s ease;
}
@keyframes pop {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.hint { color: #aaa; font-size: 14px; }

.actions { display: flex; gap: 12px; }

.missing-section { margin-top: 20px; }
.missing-section h3 { color: #d32f2f; margin-bottom: 12px; }
.missing-list { list-style: none; max-height: 200px; overflow-y: auto; }
.missing-list li {
  padding: 8px 12px; background: #fff5f5; border-left: 3px solid #f44336;
  margin-bottom: 6px; border-radius: 4px; font-family: monospace; font-size: 14px;
}

/* ===== 表格 ===== */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px; text-align: left; border-bottom: 1px solid #eee; font-size: 14px; }
.data-table th { background: #f8f9fa; font-weight: 600; color: #555; }
.data-table tr:hover { background: #fafafa; }
.status-badge { padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.status-badge.在养 { background: #e8f5e9; color: #2e7d32; }
.status-badge.已售出 { background: #e3f2fd; color: #1565c0; }
.status-badge.已屠宰 { background: #fff3e0; color: #e65100; }
.status-badge.已死亡 { background: #ffebee; color: #c62828; }
.loading { text-align: center; color: #888; padding: 30px; }

/* ===== 按钮 ===== */
.btn {
  padding: 8px 16px; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; transition: 0.2s;
  background: #e0e0e0; color: #333;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: #1a73e8; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-danger { background: #f44336; color: #fff; }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; color: #555; font-weight: 500; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; transition: border 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: #1a73e8; }
.form-row { display: flex; gap: 12px; margin-bottom: 12px; }
.form-row input { flex: 1; padding: 10px; border: 1px solid #ddd; border-radius: 6px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid input, .form-grid select { padding: 10px; border: 1px solid #ddd; border-radius: 6px; }

.filter-bar { margin-bottom: 16px; }
.filter-bar select { padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; }

.hint-text { color: #888; font-size: 12px; }
.mt-2 { margin-top: 10px; }

/* ===== 弹窗 ===== */
.modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal-content {
  background: #fff; padding: 30px; border-radius: 12px; width: 100%; max-width: 500px;
  position: relative; max-height: 90vh; overflow-y: auto;
}
.modal-content .close { position: absolute; top: 15px; right: 20px; font-size: 24px; cursor: pointer; color: #888; }

/* ===== 提示 ===== */
.alert { padding: 12px 16px; border-radius: 6px; font-size: 14px; margin-bottom: 12px; }
.alert-warning { background: #fff8e1; border: 1px solid #ffc107; color: #f57f17; }
.alert-error { background: #ffebee; border: 1px solid #f44336; color: #c62828; }

.admin-section { margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px solid #eee; }
.admin-section h3 { margin-bottom: 12px; font-size: 15px; color: #444; }

/* ===== 进出方向标签 ===== */
.tag-chip.chip-in { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.tag-chip.chip-out { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }

/* ===== 进出计数盒 ===== */
.count-box.inside { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.count-box.outside { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.alert-info { background: #e3f2fd; border: 1px solid #90caf9; color: #1565c0; }
.alert-success { background: #e8f5e9; border: 1px solid #a5d6a7; color: #2e7d32; }
.alert-error { background: #ffebee; border: 1px solid #ef9a9a; color: #c62828; }
