/* ===== 全局样式 ===== */
:root {
  --primary: #0d1b2a;
  --primary-light: #1b3a5b;
  --accent: #2d6a9f;
  --accent-light: #4ba3e0;
  --bg: #f5f7fa;
  --card-bg: #ffffff;
  --text: #1a1a1a;
  --text-light: #666;
  --text-muted: #999;
  --border: #e8ecf1;
  --success: #22c55e;
  --success-bg: #f0fdf4;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --shadow: 0 2px 16px rgba(0,0,0,0.06);
  --radius: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.8;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-light); }

/* ===== 导航栏 ===== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(13,27,42,0.95); backdrop-filter: blur(12px);
  padding: 0 40px; height: 64px; display: flex; align-items: center; justify-content: space-between;
}
.navbar .logo { display: flex; align-items: center; gap: 10px; color: white; font-weight: 700; font-size: 18px; }
.navbar .logo .icon { width: 32px; height: 32px; background: linear-gradient(135deg,var(--accent),var(--accent-light)); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.navbar .nav-links { display: flex; gap: 28px; align-items: center; }
.navbar .nav-links a { color: rgba(255,255,255,0.8); font-size: 14px; transition: color 0.2s; }
.navbar .nav-links a:hover { color: white; }
.navbar .nav-links .btn { padding: 8px 20px; border-radius: 8px; background: var(--accent); color: white; }
.navbar .nav-links .btn:hover { background: var(--accent-light); color: white; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 24px; border-radius: 8px; font-size: 14px; font-weight: 600;
  border: none; cursor: pointer; transition: all 0.2s; text-decoration: none;
}
.btn-primary { background: linear-gradient(135deg,var(--accent),var(--primary-light)); color: white; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(45,106,159,0.4); }
.btn-outline { background: white; color: var(--accent); border: 1px solid var(--accent); }
.btn-outline:hover { background: var(--accent); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 36px; font-size: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-label .required { color: var(--danger); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; transition: border-color 0.2s;
  background: white;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(45,106,159,0.1); }
.form-textarea { min-height: 80px; resize: vertical; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 13px; color: var(--danger); margin-top: 4px; }

/* ===== 卡片 ===== */
.card { background: var(--card-bg); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); border: 1px solid var(--border); }

/* ===== 标签 ===== */
.tag { display: inline-block; padding: 3px 12px; border-radius: 20px; font-size: 12px; }
.tag-success { background: var(--success-bg); color: #166534; }
.tag-warning { background: var(--warning-bg); color: #92400e; }
.tag-danger { background: var(--danger-bg); color: #991b1b; }
.tag-info { background: #eef4fb; color: var(--accent); }

/* ===== Toast ===== */
#toast-container { position: fixed; top: 80px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: 8px; color: white; font-size: 14px; box-shadow: 0 4px 16px rgba(0,0,0,0.15); animation: slideIn 0.3s ease; max-width: 400px; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--accent); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== Modal ===== */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 200; display: flex; align-items: center; justify-content: center; }
.modal { background: white; border-radius: 16px; padding: 32px; max-width: 500px; width: 90%; max-height: 90vh; overflow-y: auto; }
.modal-title { font-size: 20px; font-weight: 700; margin-bottom: 16px; }
.modal-close { float: right; cursor: pointer; font-size: 24px; color: var(--text-muted); }

/* ===== 工具类 ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-20 { margin-top: 20px; }
.mt-40 { margin-top: 40px; }
.mb-20 { margin-bottom: 20px; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-12 { gap: 12px; }
.gap-20 { gap: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }

/* ===== Toggle Switch ===== */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: #ccc; border-radius: 24px; transition: all 0.3s; }
.toggle-slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: all 0.3s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.toggle-switch input:checked + .toggle-slider { background: linear-gradient(135deg, #2d6a9f, #4ba3e0); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle-switch.loading { opacity: 0.5; pointer-events: none; }

/* ===== 移动端导航汉堡菜单 ===== */
.nav-toggle { display: none; width: 32px; height: 32px; background: none; border: none; cursor: pointer; flex-direction: column; justify-content: center; gap: 5px; z-index: 101; }
.nav-toggle span { display: block; width: 24px; height: 2px; background: white; border-radius: 2px; transition: all 0.3s; }
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== 全局移动端响应式 ===== */
@media(max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2,1fr); }
}

@media(max-width: 768px) {
  /* 导航栏 */
  .navbar { padding: 0 16px; }
  .navbar .logo { font-size: 15px; gap: 6px; }
  .navbar .logo .icon { width: 28px; height: 28px; font-size: 13px; }
  .nav-toggle { display: flex; }
  .navbar .nav-links {
    position: fixed; top: 64px; right: -100%; width: 240px; height: calc(100vh - 64px);
    flex-direction: column; background: rgba(13,27,42,0.98); backdrop-filter: blur(20px);
    padding: 20px; gap: 0; transition: right 0.3s ease; z-index: 99;
    align-items: stretch; overflow-y: auto;
  }
  .navbar .nav-links.open { right: 0; }
  .navbar .nav-links a { padding: 14px 0; font-size: 15px; border-bottom: 1px solid rgba(255,255,255,0.06); }
  .navbar .nav-links .btn { margin-top: 16px; text-align: center; border-bottom: none; }

  /* 工具类网格 */
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }

  /* 卡片 */
  .card { padding: 16px; }

  /* 按钮 */
  .btn-lg { padding: 12px 28px; font-size: 15px; }

  /* 模态框 */
  .modal { padding: 24px 20px; max-width: calc(100% - 32px); }
  .modal-title { font-size: 18px; }

  /* Toast */
  #toast-container { top: 72px; right: 12px; left: 12px; }
  .toast { max-width: none; font-size: 13px; padding: 10px 16px; }
}

@media(max-width: 480px) {
  .navbar .logo span { font-size: 13px; }
  .btn { padding: 9px 20px; font-size: 13px; }
  .btn-lg { padding: 11px 24px; font-size: 14px; }
  .card { padding: 14px; }
  .form-input, .form-select, .form-textarea { font-size: 16px; padding: 12px 14px; }
}
