/* ========== CSS 变量与主题 ========== */
:root {
  --bg: #f0f2f5;
  --bg-card: #ffffff;
  --bg-hover: #f8f9fa;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --primary: #4f6df5;
  --primary-light: #e8ecff;
  --primary-dark: #3b5bdb;
  --border: #e8eaed;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 6px 20px rgba(79, 109, 245, 0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.25s ease;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117;
    --bg-card: #1a1d29;
    --bg-hover: #242838;
    --text: #e4e6eb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --primary: #6b8aff;
    --primary-light: #1e2a5e;
    --primary-dark: #4f6df5;
    --border: #2a2e3d;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 6px 20px rgba(107, 138, 255, 0.2);
  }
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

input, button, textarea, select {
  font-family: inherit;
  font-size: inherit;
  outline: none;
  border: none;
}

button {
  cursor: pointer;
}

/* ========== 通用组件 ========== */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 15px;
}

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--text);
  color: var(--bg);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  z-index: 9999;
  transition: transform 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.success { background: #10b981; color: white; }
.toast.error { background: #ef4444; color: white; }

/* ========== Modal ========== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px;
  width: 90%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.92);
  transition: transform 0.25s ease;
}

.modal-overlay.show .modal {
  transform: scale(1);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
}

.modal-body {
  margin-bottom: 20px;
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ========== Form ========== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  transition: var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-textarea {
  resize: vertical;
  min-height: 70px;
}

/* ========== Buttons ========== */
.btn {
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-danger {
  background: #ef4444;
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .modal {
    width: 95%;
    padding: 20px;
  }
}
