/* ===== 检查系统自定义样式 ===== */

/* 基础排版 */
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 导航激活态 */
.nav-link.active {
  background-color: rgb(239 246 255);
  color: rgb(29 78 216);
  font-weight: 600;
}

.nav-link.active svg {
  color: rgb(29 78 216);
}

/* 卡片 */
.card {
  background: white;
  border-radius: 0.75rem;
  border: 1px solid rgb(226 232 240);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.03);
  transition: box-shadow 0.2s;
}
.card:hover {
  box-shadow: 0 4px 12px -2px rgb(0 0 0 / 0.06);
}

/* 树形指标 */
.tree {
  font-size: 0.9rem;
}
.tree-node {
  position: relative;
}
.tree-node-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}
.tree-node-content:hover {
  background-color: rgb(241 245 249);
}
.tree-node-content.selected {
  background-color: rgb(219 234 254);
  border-color: rgb(147 197 253);
}
.tree-node-content .toggle {
  width: 1.25rem;
  height: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgb(100 116 139);
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}
.tree-node-content .toggle:hover {
  color: rgb(59 130 246);
}
.tree-node-content .toggle.empty {
  visibility: hidden;
}
.tree-node-content .icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  color: rgb(100 116 139);
}
.tree-node-content .label {
  flex: 1;
  font-weight: 500;
  color: rgb(30 41 59);
  word-break: break-all;
}
.tree-node-content .code {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.75rem;
  color: rgb(100 116 139);
  background: rgb(241 245 249);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
}
.tree-node-content .actions {
  display: none;
  gap: 0.25rem;
}
.tree-node-content:hover .actions {
  display: flex;
}
.tree-children {
  margin-left: 1.25rem;
  padding-left: 0.75rem;
  border-left: 1px dashed rgb(203 213 225);
}

/* 状态色块 */
.status-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-normal { background: #10b981; }
.status-issue { background: #f59e0b; }
.status-serious { background: #ef4444; }

/* 严重度徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 500;
  white-space: nowrap;
}
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-gray   { background: #f1f5f9; color: #475569; }
.badge-cyan   { background: #cffafe; color: #155e75; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary { background: #2563eb; color: white; }
.btn-primary:hover:not(:disabled) { background: #1d4ed8; }
.btn-secondary { background: white; color: #334155; border-color: #cbd5e1; }
.btn-secondary:hover:not(:disabled) { background: #f8fafc; }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-ghost { background: transparent; color: #475569; }
.btn-ghost:hover:not(:disabled) { background: #f1f5f9; }
.btn-sm { padding: 0.25rem 0.625rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }

/* 输入框 */
.input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
}
.input:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

label.field {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #334155;
  margin-bottom: 0.375rem;
}

/* 模态框 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.15s;
}
.modal-panel {
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  max-width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s;
}
.modal-panel.w-sm { width: 24rem; }
.modal-panel.w-md { width: 32rem; }
.modal-panel.w-lg { width: 48rem; }
.modal-panel.w-xl { width: 64rem; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Toast */
.toast {
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 280px;
  max-width: 400px;
  font-size: 0.875rem;
  border-left: 4px solid #3b82f6;
  animation: slideIn 0.2s;
}
.toast.success { border-left-color: #10b981; }
.toast.error   { border-left-color: #ef4444; }
.toast.warn    { border-left-color: #f59e0b; }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #94a3b8;
}
.empty-state .icon { font-size: 3rem; margin-bottom: 0.5rem; opacity: 0.5; }

/* 表格 */
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
table.data-table thead {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
table.data-table th {
  text-align: left;
  padding: 0.625rem 0.75rem;
  font-weight: 600;
  color: #475569;
  font-size: 0.8125rem;
  white-space: nowrap;
}
table.data-table td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}
table.data-table tbody tr:hover {
  background: #f8fafc;
}

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* 数字统计卡片 */
.stat-card {
  background: white;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 4px;
  background: var(--accent, #3b82f6);
}
.stat-card .stat-value {
  font-size: 1.875rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1;
}
.stat-card .stat-label {
  font-size: 0.8125rem;
  color: #64748b;
  margin-top: 0.5rem;
}
.stat-card .stat-icon {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  background: var(--accent-bg, #dbeafe);
  color: var(--accent, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 指标选择器（检查时使用） */
.indicator-selector {
  max-height: 60vh;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fafafa;
}
.indicator-selector .level-group {
  border-bottom: 1px solid #e2e8f0;
}
.indicator-selector .level-group:last-child {
  border-bottom: none;
}
.indicator-selector .level-header {
  background: #f1f5f9;
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
  border-bottom: 1px solid #e2e8f0;
}
.indicator-selector .indicator-item {
  padding: 0.5rem 0.875rem 0.5rem 1.5rem;
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.1s;
  position: relative;
}
.indicator-selector .indicator-item::before {
  content: "└";
  color: #cbd5e1;
  position: absolute;
  left: 0.625rem;
}
.indicator-selector .indicator-item:hover {
  background: white;
}
.indicator-selector .indicator-item.selected {
  background: #dbeafe;
  color: #1e40af;
  font-weight: 500;
}

/* 移动端优化 */
@media (max-width: 640px) {
  .btn { padding: 0.5rem 0.75rem; }
  .stat-card .stat-value { font-size: 1.5rem; }
}

/* 拖拽 */
.drag-over {
  background: #dbeafe !important;
  border: 2px dashed #3b82f6 !important;
}

/* 照片缩略图 */
.photo-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 0.375rem;
  border: 1px solid #e2e8f0;
}

/* 地图占位 */
.map-placeholder {
  background:
    linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
    linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, 10px 0px;
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  position: relative;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.map-placeholder .pin {
  position: absolute;
  width: 24px;
  height: 24px;
  background: #ef4444;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  border: 2px solid white;
}
