/* ═══════════════════════════════════════════
   通用组件样式 — Shared Components
   ═══════════════════════════════════════════ */

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: var(--font-md);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  border: none;
  transition: all var(--transition-base);
  line-height: 1;
}
.btn:hover { opacity: 0.9; }
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--brand-primary); color: #fff; }
.btn-primary:hover { background: var(--brand-primary-hover); }

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

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

.btn-outline-danger { background: #fff; border: 2px solid var(--warning-text); color: var(--warning-text); }
.btn-outline-danger:hover { background: var(--warning-bg); }

.btn-text { background: none; border: none; color: var(--brand-primary); padding: 6px 8px; }
.btn-text:hover { background: var(--brand-primary-light); }

.btn-ghost { background: var(--brand-primary-light); color: var(--brand-primary); border: none; }
.btn-ghost:hover { background: #d4e5ff; }

.btn-sm { padding: 6px 12px; font-size: var(--font-sm); }
.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-round { border-radius: 20px; }

.btn[disabled], .btn.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ─── Mobile Full-width Button ─── */
.btn-mobile {
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: var(--fw-semibold);
  text-align: center;
  cursor: pointer;
  border: none;
}

/* ─── Cards ─── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-card);
}

.card-compact { padding: var(--space-lg); }

/* ─── Tags / Badges ─── */
.tag {
  display: inline-flex;
  align-items: center;
  font-size: var(--font-xs);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-weight: var(--fw-medium);
  line-height: 1.5;
}
.tag-sm { font-size: 10px; padding: 1px 6px; }

.tag-green { background: var(--success-bg); color: var(--success-text); }
.tag-red { background: var(--danger-bg); color: var(--danger-text); }
.tag-blue { background: var(--info-bg); color: var(--info-text); }
.tag-orange { background: var(--warning-bg); color: var(--warning-text); }
.tag-gray { background: #f0f0f0; color: #888; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: var(--fw-bold);
  color: #fff;
  padding: 0 5px;
}
.badge-red { background: var(--danger); }
.badge-blue { background: var(--brand-primary); }

/* ─── Status Dot ─── */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot-green { background: var(--success); }
.status-dot-orange { background: var(--warning); }
.status-dot-red { background: var(--danger); }
.status-dot-blue { background: var(--brand-primary); }
.status-dot-gray { background: #ccc; }

/* ─── Form Controls ─── */
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--font-md);
  color: var(--text-primary);
  background: #fff;
  transition: border-color var(--transition-fast);
}
.form-input:focus { outline: none; border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(27, 120, 248, 0.1); }
.form-input::placeholder { color: var(--text-placeholder); }
.form-input-error { border-color: var(--danger); }

.form-select {
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--font-base);
  color: var(--text-primary);
  background: #fff url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3e%3cpath fill='%23999' d='M3 5l3 3 3-3'/%3e%3c/svg%3e") no-repeat right 10px center;
  appearance: none;
  cursor: pointer;
}

.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--font-base);
  resize: none;
  font-family: inherit;
}
.form-textarea:focus { outline: none; border-color: var(--brand-primary); }
.form-textarea::placeholder { color: var(--text-placeholder); }

.form-label { font-size: var(--font-md); font-weight: var(--fw-medium); color: var(--text-primary); margin-bottom: 6px; display: block; }
.form-required { color: var(--danger); margin-left: 2px; }
.form-hint { font-size: var(--font-sm); color: var(--text-muted); margin-top: 4px; }
.char-count { text-align: right; font-size: var(--font-xs); color: var(--text-muted); margin-top: 4px; }

/* ─── Checkbox (Prototype) ─── */
.checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid #ccc;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.checkbox.checked { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; font-size: var(--font-sm); }

/* ─── Tables ─── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-base);
}
.table th {
  background: #f8f9fc;
  padding: 10px 12px;
  text-align: left;
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
  border-bottom: 2px solid var(--divider);
}
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}
.table tr:hover { background: #fafbfd; }

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state .empty-text { font-size: var(--font-md); margin-bottom: 16px; }

/* ─── Section (Mobile Card Block) ─── */
.section {
  background: var(--bg-card);
  margin: var(--mobile-card-gap) var(--mobile-padding);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.section-title {
  padding: 12px 14px 8px;
  font-size: var(--font-md);
  font-weight: var(--fw-semibold);
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--border-light);
}
.section-item {
  padding: 10px 14px;
  font-size: var(--font-base);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #f8f8f8;
}
.section-item:last-child { border-bottom: none; }

/* ─── Thumbnail ─── */
.thumb {
  width: 44px;
  height: 44px;
  background: #e8e8e8;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ─── Progress Bar ─── */
.progress-bar {
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--brand-primary);
  border-radius: 3px;
  transition: width var(--transition-slow);
}

/* ─── Tabs ─── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border-light);
}
.tab {
  padding: 10px 20px;
  font-size: var(--font-md);
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color var(--transition-fast);
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); font-weight: var(--fw-semibold); }

/* ─── Tabs (Mobile Pill) ─── */
.tabs-pill {
  display: flex;
  gap: 0;
  background: var(--border-light);
  border-radius: 8px;
  padding: 3px;
}
.tab-pill {
  flex: 1;
  padding: 8px 0;
  text-align: center;
  font-size: var(--font-base);
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
}
.tab-pill.active { background: #fff; color: var(--brand-primary); font-weight: var(--fw-semibold); box-shadow: var(--shadow-sm); }

/* ─── Search Box ─── */
.search-box {
  position: relative;
}
.search-box input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--font-base);
  background: #fff;
}
.search-box::before {
  content: '🔍';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
}

/* ─── Filter Bar ─── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ─── Score Card (Gradient) ─── */
.score-card-gradient {
  background: linear-gradient(135deg, var(--brand-primary), #3b9cff);
  color: #fff;
  padding: 14px 12px;
  margin: var(--mobile-padding);
  border-radius: var(--radius-lg);
  display: flex;
  justify-content: space-around;
  text-align: center;
}
.score-card-gradient .item { font-size: var(--font-sm); }
.score-card-gradient .item .num { font-size: var(--font-3xl); font-weight: var(--fw-bold); display: block; }

/* ─── Avatar ─── */
.avatar {
  border-radius: var(--radius-round);
  background: #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-weight: var(--fw-semibold);
  flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 12px; }
.avatar-md { width: 36px; height: 36px; font-size: 14px; }
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }
.avatar-xl { width: 64px; height: 64px; font-size: 24px; }

/* ─── Stat Box ─── */
.stat-box {
  background: #f8f9fc;
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}
.stat-box .stat-value { font-size: var(--font-5xl); font-weight: var(--fw-bold); color: var(--brand-primary); }
.stat-box .stat-label { font-size: var(--font-sm); color: var(--text-muted); margin-top: 4px; }

/* ─── List Item ─── */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.list-item:hover { background: #fafbfd; }
.list-item:last-child { border-bottom: none; }

/* ─── Status Color Stripe (Mobile Card) ─── */
/* ─── Status Color Stripe (Mobile Card) ─── */
.card-stripe {
  border-left: 4px solid transparent;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  padding: 14px;
  margin: 0 var(--mobile-padding);
  margin-bottom: var(--space-sm);
}
.card-stripe-blue { border-left-color: var(--brand-primary); }
.card-stripe-gray { border-left-color: #ccc; }
.card-stripe-green { border-left-color: var(--success); }

/* ─── Toast (Prototype Only) ─── */
.toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 10px 24px;
  border-radius: 20px;
  font-size: var(--font-base);
  z-index: 3000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  white-space: nowrap;
}
.toast.show { opacity: 1; }

/* ─── Utility ─── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: var(--font-sm); }
.text-xs { font-size: var(--font-xs); }
.fw-bold { font-weight: var(--fw-bold); }
.fw-semibold { font-weight: var(--fw-semibold); }
.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 90%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-size: var(--font-lg);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}
.modal-body {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
}
.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
}
.btn-icon:hover { color: var(--text-primary); }