/* ============================================================
   劳动防护用品管理系统 - 全局样式
   适配手机端 + 电脑端
   ============================================================ */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #f5f6fa;
  color: #333;
  font-size: 14px;
  line-height: 1.6;
}

/* ===== 顶部导航 ===== */
.topbar {
  background: linear-gradient(135deg, #1a73e8, #1557b0);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.topbar h1 { font-size: 16px; font-weight: 600; }
.topbar .user-info { font-size: 13px; display: flex; align-items: center; gap: 12px; }
.topbar .user-info span { opacity: 0.9; }
.topbar button {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}
.topbar button:hover { background: rgba(255,255,255,0.3); }

/* ===== 标签页导航 ===== */
.tabs {
  display: flex;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tabs button {
  flex: 1;
  min-width: 80px;
  padding: 12px 8px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: #666;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: all 0.2s;
}
.tabs button.active {
  color: #1a73e8;
  border-bottom-color: #1a73e8;
  font-weight: 600;
}

/* ===== 内容区 ===== */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== 卡片 ===== */
.card {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.card h3 {
  font-size: 15px;
  margin-bottom: 12px;
  color: #1a73e8;
  border-left: 3px solid #1a73e8;
  padding-left: 8px;
}

/* ===== 表单 ===== */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #555;
  font-size: 13px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  transition: border-color 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;
}
.form-row .form-group { flex: 1; }

/* 单选/复选组 */
.radio-group, .checkbox-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.radio-group label, .checkbox-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: normal;
  cursor: pointer;
  padding: 8px 16px;
  border: 1px solid #ddd;
  border-radius: 6px;
  transition: all 0.2s;
}
.radio-group label:has(input:checked),
.checkbox-group label:has(input:checked) {
  border-color: #1a73e8;
  background: #e8f0fe;
  color: #1a73e8;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.btn-primary { background: #1a73e8; color: #fff; }
.btn-primary:hover { background: #1557b0; }
.btn-success { background: #4caf50; color: #fff; }
.btn-success:hover { background: #3d8b40; }
.btn-danger { background: #f44336; color: #fff; }
.btn-danger:hover { background: #d32f2f; }
.btn-warning { background: #ff9800; color: #fff; }
.btn-warning:hover { background: #e68900; }
.btn-default { background: #f0f0f0; color: #333; border: 1px solid #ddd; }
.btn-default:hover { background: #e0e0e0; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-link { background: none; border: none; color: #1a73e8; padding: 0; cursor: pointer; text-decoration: underline; }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== 表格 ===== */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data-table th,
table.data-table td {
  border: 1px solid #e0e0e0;
  padding: 8px 10px;
  text-align: center;
}
table.data-table th {
  background: #f5f7fa;
  font-weight: 600;
  color: #555;
  white-space: nowrap;
}
table.data-table tr:hover { background: #f9f9f9; }
table.data-table input[type="number"] {
  width: 70px;
  padding: 4px;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-align: center;
}

/* ===== 状态标签 ===== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}
.badge-info { background: #e3f2fd; color: #1565c0; }
.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-warning { background: #fff3e0; color: #e65100; }
.badge-danger { background: #ffebee; color: #c62828; }
.badge-default { background: #f5f5f5; color: #666; }

/* ===== 签名画布 ===== */
.signature-canvas {
  width: 100%;
  height: 120px;
  border: 2px dashed #ccc;
  border-radius: 6px;
  background: #fff;
  touch-action: none;
  cursor: crosshair;
}
.signature-label {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
  text-align: center;
}

/* ===== 登录页 ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #1a73e8 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  top: -200px;
  right: -150px;
  border-radius: 50%;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
  bottom: -150px;
  left: -100px;
  border-radius: 50%;
}
.login-box {
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  position: relative;
  z-index: 1;
}
.login-box h2 {
  text-align: center;
  color: #1a73e8;
  margin-bottom: 8px;
  font-size: 20px;
}
.login-box .subtitle {
  text-align: center;
  color: #999;
  font-size: 13px;
  margin-bottom: 24px;
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #999;
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }

/* ===== 统计卡片 ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.stat-card .num {
  font-size: 28px;
  font-weight: 700;
  color: #1a73e8;
}
.stat-card .label {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
}

/* ===== 用品选择列表 ===== */
.supply-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
}
.supply-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.2s;
}
.supply-item:hover { background: #f5f7fa; }
.supply-item.selected { background: #e8f0fe; }
.supply-item .supply-name { flex: 1; font-weight: 500; font-size: 14px; min-width: 0; }
.supply-item .supply-spec { flex: 1; font-size: 12px; color: #999; min-width: 0; text-align: right; padding-right: 12px; }
.supply-item .stock { font-size: 13px; color: #1a73e8; font-weight: 600; white-space: nowrap; }
.supply-item .stock.low { color: #f44336; }

/* ===== 明细行 ===== */
.item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}
.item-row .name { flex: 1; font-size: 13px; }
.item-row input { width: 60px; padding: 4px; border: 1px solid #ddd; border-radius: 4px; text-align: center; }
.item-row .unit { font-size: 12px; color: #999; width: 30px; }

/* ===== 手机端优化 ===== */
@media (max-width: 600px) {
  .container { padding: 12px; }
  .card { padding: 12px; }
  .form-row { flex-direction: column; gap: 0; }
  .topbar h1 { font-size: 14px; }
  .topbar .user-info span { display: none; }
  table.data-table { font-size: 12px; }
  table.data-table th, table.data-table td { padding: 6px 4px; }
  .btn { padding: 10px 16px; font-size: 14px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== 打印优化 ===== */
@media print {
  .topbar, .tabs, .btn, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
