/* =============================================================
   测试工坊 —— 设计系统（全局）
   ============================================================= */

:root {
  /* 颜色系统 */
  --brand: #7C3AED;
  --brand-dark: #6D28D9;
  --brand-gradient: linear-gradient(135deg, #7C3AED, #6D28D9);
  --bg-user: #FAF7F2;
  --card-bg: #FFFFFF;
  --text-dark: #1F2937;
  --text-muted: #6B7280;
  --text-disabled: #9CA3AF;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --border: #E5E7EB;

  /* 圆角 */
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 4px;
  --radius-phone: 24px;

  /* 阴影 */
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.05);
  --shadow-input: 0 2px 12px rgba(0, 0, 0, 0.04);
  --shadow-modal: 0 24px 60px rgba(0, 0, 0, 0.25);

  /* 字体 */
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

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

html, body {
  font-family: var(--font-sans);
  color: var(--text-dark);
  background: var(--bg-user);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-weight: 700; }

button {
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-dark);
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-family: var(--font-mono); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.1s ease, box-shadow 0.1s ease, opacity 0.15s ease;
  white-space: nowrap;
  user-select: none;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.btn-secondary {
  background: #fff;
  color: var(--text-dark);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: #f9fafb; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { color: var(--text-dark); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #dc2626; }

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover { background: #059669; }

.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg { height: 56px; padding: 0 24px; font-size: 16px; border-radius: var(--radius-lg); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

/* ---------- 输入框 ---------- */
.input, .textarea, .select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 12px 16px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--brand);
  box-shadow: var(--shadow-input), 0 0 0 3px rgba(124, 58, 237, 0.12);
}
.input::placeholder, .textarea::placeholder { color: var(--text-disabled); }

.textarea { resize: vertical; min-height: 80px; line-height: 1.6; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}
.tag-gray { background: #f3f4f6; color: #6B7280; }
.tag-orange { background: #fef3c7; color: #b45309; }
.tag-green { background: #d1fae5; color: #047857; }
.tag-red { background: #fee2e2; color: #b91c1c; }
.tag-purple { background: #ede9fe; color: #6d28d9; }

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--text-dark);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
  font-size: 14px;
  max-width: 90vw;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toast-in 0.25s ease;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }
.toast .toast-action { color: #fff; text-decoration: underline; cursor: pointer; pointer-events: auto; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 模态框 ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fade-in 0.2s ease;
}
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 16px; }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ---------- 状态方块 ---------- */
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}
.dot-gray { background: #9CA3AF; }
.dot-orange { background: var(--warning); }
.dot-green { background: var(--success); }
.dot-red { background: var(--danger); }

/* ---------- 表格 ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table th {
  text-align: left;
  padding: 14px 20px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}
.table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafbfc; }
.table .row-rejected { background: #fef5f5; }
.table .row-rejected:hover td { background: #fdecec; }
.table .row-gone { opacity: 0.3; }

/* ---------- 链接/文字工具 ---------- */
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-brand { color: var(--brand); }
.text-muted { color: var(--text-muted); }
.text-disabled { color: var(--text-disabled); }

/* ---------- 帮助 ---------- */
.help-text { font-size: 12px; color: var(--text-disabled); margin-top: 6px; }

/* ---------- 图片占位 ---------- */
.image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--text-disabled);
  font-size: 13px;
  background: #fafbfc;
}
