/* ============================================================
   base.css - 公共基础样式
   ============================================================ */

:root {
  --primary: #1677ff;
  --primary-dark: #0958d9;
  --success: #52c41a;
  --warning: #faad14;
  --danger: #ff4d4f;
  --text-primary: #1a1a1a;
  --text-secondary: #666;
  --text-placeholder: #aaa;
  --border: #e8e8e8;
  --bg: #f5f5f5;
  --white: #ffffff;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--primary); text-decoration: none; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: 15px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { opacity: 0.9; }
.btn-primary:disabled { background: #a0c4ff; cursor: not-allowed; }

.btn-success {
  background: var(--success);
  color: var(--white);
}
.btn-danger {
  background: var(--danger);
  color: var(--white);
}
.btn-outline {
  background: var(--white);
  color: var(--primary);
  border: 1px solid var(--primary);
}
.btn-outline:hover { background: #f0f5ff; }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; }

/* 卡片 */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

/* 表单 */
.form-group {
  margin-bottom: 16px;
}
.form-label {
  display: block;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}
.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
  background: var(--white);
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(22,119,255,0.1);
}
.form-control.error { border-color: var(--danger); }

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* 徽章 */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
}
.badge-normal  { background: #f6ffed; color: var(--success); border: 1px solid #b7eb8f; }
.badge-abnormal { background: #fff2f0; color: var(--danger); border: 1px solid #ffccc7; }
.badge-pending { background: #fffbe6; color: var(--warning); border: 1px solid #ffe58f; }
.badge-resolved { background: #f6ffed; color: var(--success); border: 1px solid #b7eb8f; }
.badge-unresolved { background: #fff2f0; color: var(--danger); border: 1px solid #ffccc7; }

/* 提示 */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-error   { background: #fff2f0; color: #cf1322; border: 1px solid #ffccc7; }
.alert-success { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.alert-info    { background: #e6f4ff; color: #0958d9; border: 1px solid #91caff; }

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-secondary);
  font-size: 14px;
  gap: 8px;
}
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 空状态 */
.empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-secondary);
  font-size: 14px;
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }

/* 分割线 */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* 照片上传区域 */
.photo-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
  background: #fafafa;
}
.photo-upload-area:hover { border-color: var(--primary); }
.photo-upload-area.dragover { border-color: var(--primary); background: #e6f4ff; }

.photo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.photo-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}
.photo-item .delete-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: rgba(0,0,0,0.6);
  color: white;
  border-radius: 50%;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* 图片灯箱 */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.lightbox img {
  max-width: 95vw;
  max-height: 90vh;
  object-fit: contain;
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  color: white;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
}

/* 隐藏 */
.hidden { display: none !important; }
