/* 星河论坛 - 公共样式 */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --text: #1e293b;
  --text-soft: #64748b;
  --text-muted: #94a3b8;
  --border: #e5eaf1;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(15, 23, 42, .05);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, .12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
p { margin: 0; }
body.modal-open { overflow: hidden; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 17px; border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; white-space: nowrap; transition: .18s ease; user-select: none;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 3px 10px rgba(37, 99, 235, .22); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text-soft); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: #f8f9fc; color: var(--text); }
.btn-soft { background: var(--primary-light); color: var(--primary-dark); }
.btn-soft:hover:not(:disabled) { background: #dbeafe; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-sm { min-height: 30px; padding: 0 11px; font-size: 12px; border-radius: 7px; }
.btn-lg { min-height: 44px; padding: 0 24px; font-size: 15px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: none; border-radius: 8px;
  background: transparent; color: var(--text-muted); font-size: 16px; transition: .15s;
}
.icon-btn:hover { background: #f1f2f7; color: var(--text); }

/* 表单 */
.field { margin-bottom: 16px; }
.field-label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 600; color: #374151; }
.field-label .req { color: var(--danger); margin-left: 3px; }
.input, .textarea, .select {
  width: 100%; min-height: 40px; padding: 9px 13px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; outline: none; transition: .18s;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .11); }
.input::placeholder, .textarea::placeholder { color: #b8bdc8; }
.textarea { resize: vertical; min-height: 100px; line-height: 1.7; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.form-hint { margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.form-error { color: var(--danger); font-size: 13px; margin-bottom: 12px; }

/* 卡片 / 徽章 / 头像 */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 50%; color: #fff; font-weight: 700; line-height: 1; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 1.7; }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-success { background: #ecfdf5; color: #059669; }
.badge-warning { background: #fffbeb; color: #d97706; }
.badge-danger { background: #fef2f2; color: #dc2626; }
.badge-gray { background: #f3f4f6; color: #6b7280; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }

/* 空状态 / 加载 */
.empty-state { text-align: center; padding: 56px 20px; color: var(--text-muted); }
.empty-icon { font-size: 44px; margin-bottom: 12px; opacity: .8; }
.empty-state h3 { font-size: 16px; color: var(--text-soft); margin-bottom: 5px; }
.empty-state p { font-size: 13px; }
.loading-state { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 48px; color: var(--text-muted); }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
#toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; min-width: 200px; max-width: 360px;
  padding: 12px 16px; border-radius: 11px; background: #fff; color: var(--text);
  box-shadow: var(--shadow-lg); border: 1px solid var(--border); font-size: 13px;
  opacity: 0; transform: translateX(24px); transition: .25s ease;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast-icon { display: inline-flex; align-items: center; justify-content: center; width: 21px; height: 21px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 700; flex: none; }
.toast-success .toast-icon { background: var(--success); }
.toast-error .toast-icon { background: var(--danger); }
.toast-info .toast-icon { background: var(--primary); }

/* 模态框 */
.modal-overlay {
  position: fixed; inset: 0; z-index: 9000; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(17, 24, 39, .48); backdrop-filter: blur(3px); animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 440px; max-height: calc(100vh - 40px); overflow: auto;
  background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); animation: popIn .2s ease;
}
.modal-wide { max-width: 640px; }
@keyframes popIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 19px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 15px 22px; border-top: 1px solid var(--border); background: #fbfbfd; border-radius: 0 0 18px 18px; }
.confirm-text { color: var(--text-soft); font-size: 14px; line-height: 1.8; }

/* 分页 */
.pagination { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 20px; flex-wrap: wrap; }
.pagination button { min-width: 32px; height: 32px; padding: 0 9px; border: 1px solid var(--border); background: #fff; border-radius: 8px; font-size: 13px; color: var(--text-soft); }
.pagination button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination button:disabled { opacity: .45; cursor: not-allowed; }

@media (max-width: 640px) {
  #toast-wrap { top: 12px; right: 12px; left: 12px; }
  .toast { max-width: none; }
  .modal-body { padding: 18px; }
}
