/* ============================================================
   assets/css/global.css  —  全局样式
   v1.3  默认浅色，跟随系统暗色，禁用蓝色焦点框
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&family=Syne:wght@700;800&display=swap');

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

/* ── 禁用所有蓝色焦点框 ──────────────────────────────────── */
*:focus { outline: none !important; }
*:focus-visible { outline: none !important; box-shadow: none !important; }

/* ── 浅色（默认）────────────────────────────────────────── */
:root {
  color-scheme: light;
  --bg:        #f4f4f8;
  --surface:   #ffffff;
  --surface2:  #efeff4;
  --border:    #e0e0ea;
  --accent:    #0ea574;
  --accent2:   #0891b2;
  --accent3:   #db2777;
  --text:      #18181b;
  --muted:     #6b6b80;
  --danger:    #dc2626;
  --warning:   #d97706;
  --success:   #059669;
  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 2px 16px rgba(0,0,0,0.07);
  --shadow-lg: 0 6px 36px rgba(0,0,0,0.11);
  --deco1: rgba(14,165,116,0.07);
  --deco2: rgba(219,39,119,0.05);
}

/* ── 深色（跟随系统）────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg:        #09090f;
    --surface:   #13131c;
    --surface2:  #1c1c28;
    --border:    #252535;
    --accent:    #43e8b0;
    --accent2:   #6ee7f7;
    --accent3:   #f472b6;
    --text:      #eeeef5;
    --muted:     #7070a0;
    --danger:    #f87171;
    --warning:   #fbbf24;
    --success:   #34d399;
    --shadow:    0 8px 32px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 48px rgba(0,0,0,0.5);
    --deco1: rgba(67,232,176,0.08);
    --deco2: rgba(244,114,182,0.07);
  }
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans SC', sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── 背景装饰 ─────────────────────────────────────────── */
.bg-deco { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bg-deco::before {
  content: ''; position: absolute; top: -200px; left: -150px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, var(--deco1) 0%, transparent 70%);
}
.bg-deco::after {
  content: ''; position: absolute; bottom: -150px; right: -100px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, var(--deco2) 0%, transparent 70%);
}

/* ── 卡片 ─────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}

/* ── 表单 ─────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--muted); margin-bottom: 8px; letter-spacing: 0.3px;
}
.form-control {
  width: 100%; padding: 12px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 14px; font-family: inherit;
  outline: none !important; box-shadow: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}
.form-control:focus {
  border-color: var(--accent);
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(14,165,116,0.13) !important;
}
@media (prefers-color-scheme: dark) {
  .form-control:focus { box-shadow: 0 0 0 3px rgba(67,232,176,0.12) !important; }
}
.form-control::placeholder { color: var(--muted); opacity: 0.7; }
textarea.form-control { resize: vertical; min-height: 80px; }

.input-group { position: relative; }
.input-group .form-control { padding-right: 114px; }
.input-group .btn-inline {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  padding: 6px 12px; font-size: 12px;
}

/* ── 按钮 ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; text-decoration: none;
  transition: all 0.18s; white-space: nowrap;
  outline: none !important;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 2px 10px rgba(14,165,116,0.22);
}
@media (prefers-color-scheme: dark) {
  .btn-primary { color: #09090f; box-shadow: 0 0 18px rgba(67,232,176,0.28); }
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.07); transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); filter: brightness(0.96); }

.btn-ghost {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
  background: rgba(220,38,38,0.08); color: var(--danger);
  border: 1px solid rgba(220,38,38,0.2);
}
.btn-danger:hover { background: rgba(220,38,38,0.14); }

.btn-full { width: 100%; }

/* ── 消息提示 ─────────────────────────────────────────── */
.msg { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; margin-top: 12px; display: none; line-height: 1.6; }
.msg.show { display: block; }
.msg.success { background: rgba(5,150,105,0.08);  color: var(--success); border: 1px solid rgba(5,150,105,0.22); }
.msg.error   { background: rgba(220,38,38,0.08);  color: var(--danger);  border: 1px solid rgba(220,38,38,0.22); }
.msg.info    { background: rgba(8,145,178,0.08);  color: var(--accent2); border: 1px solid rgba(8,145,178,0.22); }

/* ── 验证码 ───────────────────────────────────────────── */
.captcha-wrap { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.captcha-wrap img { height: 60px; border-radius: 10px; cursor: pointer; border: 1px solid var(--border); flex-shrink: 0; }

/* ── 分隔线 ───────────────────────────────────────────── */
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 20px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

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

/* ── 动画 ─────────────────────────────────────────────── */
@keyframes fadeUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }
.fade-up { animation: fadeUp 0.45s ease both; }
@keyframes spin { to { transform: rotate(360deg); } }

.loader {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(14,165,116,0.25); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}

/* ── Toast ────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 100px;
  padding: 12px 24px; font-size: 13px; box-shadow: var(--shadow-lg);
  opacity: 0; transition: all 0.28s; pointer-events: none; z-index: 9999; white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.ok  { border-color: var(--accent); color: var(--accent); }
#toast.err { border-color: var(--danger); color: var(--danger); }

/* ── select ───────────────────────────────────────────── */
select.form-control {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6b80' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}

@media (max-width: 480px) {
  .card { padding: 22px 16px; }
  .btn  { padding: 11px 16px; }
}
