/* ============================================================
   AuroraLock · Apple-style design system
   全站唯一公共样式表。页面级微调请写在各页面 <style> 中，
   不要修改本文件（多人协作约定）。
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* surfaces */
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --bg-dark: #161617;
  --bg-nav: rgba(251, 251, 253, 0.82);

  /* ink */
  --ink: #1d1d1f;
  --ink-secondary: #6e6e73;
  --ink-tertiary: #86868b;
  --ink-inverse: #f5f5f7;

  /* accent */
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-tint: rgba(0, 113, 227, 0.1);

  /* status (Apple system colors; 文字版为深色确保对比度) */
  --green: #34c759;
  --green-text: #1d7a35;
  --orange: #ff9500;
  --orange-text: #a65b00;
  --red: #ff3b30;
  --red-text: #d70015;
  --gray-status: #8e8e93;

  --border: #d2d2d7;
  --divider: rgba(0, 0, 0, 0.1);

  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 18px;
  --radius-pill: 980px;

  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-card-hover: 0 8px 28px rgba(0, 0, 0, 0.12);
  --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.22);

  --nav-h: 48px;
  --content-w: 1024px;
  --content-w-wide: 1240px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.47;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p { margin: 0; }
img, svg { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--accent-tint); }

/* ---------- Typography ---------- */
.display {
  font-size: clamp(44px, 7vw, 76px);
  line-height: 1.06;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.headline {
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.title {
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.16;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.subtitle {
  font-size: clamp(19px, 2.4vw, 24px);
  line-height: 1.3;
  font-weight: 400;
  color: var(--ink-secondary);
}

.eyebrow {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.text-secondary { color: var(--ink-secondary); }
.text-tertiary { color: var(--ink-tertiary); }
.text-center { text-align: center; }
.text-small { font-size: 14px; }

/* Apple 渐变字效果，用于重点标题 */
.gradient-text {
  background: linear-gradient(90deg, #0090f7, #5856d6 50%, #bc47e8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ---------- Layout ---------- */
.container {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 0 22px;
}

.container-wide {
  max-width: var(--content-w-wide);
  margin: 0 auto;
  padding: 0 22px;
}

.section { padding: 96px 0; }
.section-alt { background: var(--bg-alt); }
.section-dark {
  background: var(--bg-dark);
  color: var(--ink-inverse);
}
.section-dark .subtitle { color: #a1a1a6; }

.stack-s > * + * { margin-top: 8px; }
.stack-m > * + * { margin-top: 16px; }
.stack-l > * + * { margin-top: 28px; }

/* ---------- Global nav ---------- */
.global-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--bg-nav);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.global-nav.scrolled {
  border-bottom-color: var(--divider);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
}

.nav-content {
  max-width: var(--content-w);
  height: 100%;
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.nav-logo:hover { text-decoration: none; }
.nav-logo svg { width: 20px; height: 20px; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.nav-link {
  font-size: 13px;
  color: var(--ink);
  opacity: 0.82;
  transition: opacity 0.2s var(--ease);
}
.nav-link:hover { opacity: 1; text-decoration: none; }
.nav-link.active { opacity: 1; font-weight: 600; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

.nav-user {
  position: relative;
}

.nav-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink);
  padding: 6px 2px;
}

.nav-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}

.nav-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 200px;
  background: var(--bg);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-modal);
  border: 1px solid var(--divider);
  padding: 8px;
  display: none;
}
.nav-menu.open { display: block; animation: menu-in 0.18s var(--ease); }

@keyframes menu-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.nav-menu-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 6px;
}

.nav-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: none;
  background: none;
  border-radius: var(--radius-s);
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
}
.nav-menu-item:hover { background: var(--bg-alt); text-decoration: none; }
.nav-menu-item.danger { color: var(--red-text); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: var(--radius-pill);
  border: none;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s var(--ease), transform 0.15s var(--ease), opacity 0.2s;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }

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

.btn-secondary { background: rgba(0, 0, 0, 0.06); color: var(--ink); }
.btn-secondary:hover:not(:disabled) { background: rgba(0, 0, 0, 0.1); }

.btn-ghost {
  background: transparent;
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.btn-ghost:hover:not(:disabled) { background: var(--accent-tint); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #e0352b; }

.btn-lg { padding: 13px 28px; font-size: 17px; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* Apple 风格 “了解更多 >” 链接 */
.link-arrow {
  font-size: 17px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.link-arrow::after {
  content: "›";
  font-size: 1.1em;
  transition: transform 0.2s var(--ease);
}
.link-arrow:hover::after { transform: translateX(2px); }

/* ---------- Cards ---------- */
.card {
  background: var(--bg);
  border-radius: var(--radius-l);
  padding: 32px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.3s var(--ease), transform 0.3s var(--ease);
}
.card-hover:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-3px);
}
.card-bordered { box-shadow: none; border: 1px solid var(--border); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 7px;
  color: var(--ink);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 13px 16px;
  font-size: 17px;
  font-family: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}

.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5l3.5 3.5 3.5-3.5' fill='none' stroke='%236e6e73' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.field input::placeholder { color: var(--ink-tertiary); }

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
}

.field input.invalid { border-color: var(--red); }
.field input.invalid:focus { box-shadow: 0 0 0 4px rgba(255, 59, 48, 0.12); }

.field-hint { font-size: 13px; color: var(--ink-tertiary); margin-top: 6px; }
.field-error { font-size: 13px; color: var(--red-text); margin-top: 6px; }

.form-banner {
  padding: 12px 16px;
  border-radius: var(--radius-m);
  font-size: 14px;
  margin-bottom: 18px;
  display: none;
}
.form-banner.show { display: block; animation: menu-in 0.18s var(--ease); }
.form-banner.error { background: rgba(255, 59, 48, 0.08); color: var(--red-text); }
.form-banner.success { background: rgba(52, 199, 89, 0.1); color: var(--green-text); }

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: var(--ink-secondary);
}
.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--accent);
  flex-shrink: 0;
}

/* ---------- Auth pages ---------- */
.auth-shell {
  min-height: calc(100vh - var(--nav-h));
  background: var(--bg-alt);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 64px 22px 96px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-card);
  padding: 44px 40px;
}

.auth-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.015em;
  text-align: center;
  margin-bottom: 8px;
}

.auth-sub {
  font-size: 15px;
  color: var(--ink-secondary);
  text-align: center;
  margin-bottom: 30px;
}

.auth-foot {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--divider);
  font-size: 14px;
  color: var(--ink-secondary);
  text-align: center;
}

/* 演示提示框 */
.notice {
  background: var(--accent-tint);
  border-radius: var(--radius-m);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--ink-secondary);
  line-height: 1.6;
}
.notice strong { color: var(--ink); }
.notice code {
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.7);
  padding: 1px 6px;
  border-radius: 5px;
  color: var(--ink);
}

/* ---------- Stepper（找回密码等分步流程） ---------- */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 32px;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-tertiary);
}

.step-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-alt);
  color: var(--ink-tertiary);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s var(--ease);
}

.step.active { color: var(--ink); font-weight: 500; }
.step.active .step-dot { background: var(--accent); color: #fff; }
.step.done .step-dot { background: var(--green); color: #fff; }

.step-line {
  width: 40px;
  height: 1px;
  background: var(--border);
  margin: 0 12px;
}

/* ---------- Segmented control ---------- */
.segmented {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}

.segmented button {
  border: none;
  background: transparent;
  padding: 7px 18px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.segmented button.active {
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

/* ---------- Badges（状态始终「圆点 + 文字」，不靠颜色单独表意） ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-success { background: rgba(52, 199, 89, 0.13); color: var(--green-text); }
.badge-warning { background: rgba(255, 149, 0, 0.14); color: var(--orange-text); }
.badge-danger  { background: rgba(255, 59, 48, 0.1);  color: var(--red-text); }
.badge-info    { background: var(--accent-tint);       color: var(--accent); }
.badge-neutral { background: rgba(0, 0, 0, 0.06);      color: var(--ink-secondary); }

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  background: var(--bg);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-card);
}

table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  text-align: left;
  font-weight: 600;
  color: var(--ink-secondary);
  font-size: 13px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--divider);
  white-space: nowrap;
}

.table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background 0.15s var(--ease); }
.table tbody tr:hover { background: rgba(0, 0, 0, 0.02); }

/* ---------- Stat tiles ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat-tile {
  background: var(--bg);
  border-radius: var(--radius-l);
  padding: 24px 26px;
  box-shadow: var(--shadow-card);
}

.stat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-secondary);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-meta { font-size: 13px; color: var(--ink-tertiary); margin-top: 8px; }

/* ---------- Progress ---------- */
.progress {
  height: 6px;
  background: rgba(0, 0, 0, 0.07);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.4s var(--ease);
}

/* ---------- Toast ---------- */
.toast-region {
  position: fixed;
  top: calc(var(--nav-h) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: rgba(29, 29, 31, 0.92);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  color: #f5f5f7;
  font-size: 14px;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toast-in 0.3s var(--ease);
  max-width: min(90vw, 480px);
}

.toast.out { animation: toast-out 0.3s var(--ease) forwards; }

.toast-icon { font-size: 15px; line-height: 1; }
.toast.success .toast-icon { color: var(--green); }
.toast.error .toast-icon { color: var(--red); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(-8px) scale(0.97); }
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.4);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
}
.modal-backdrop.open { display: flex; animation: fade-in 0.2s var(--ease); }

.modal {
  background: var(--bg);
  border-radius: 20px;
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 32px;
  animation: modal-in 0.25s var(--ease);
}

.modal-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.modal-sub { font-size: 14px; color: var(--ink-secondary); margin-bottom: 22px; }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 26px;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 72px 22px;
  color: var(--ink-secondary);
}
.empty-state .empty-icon { font-size: 44px; margin-bottom: 14px; }
.empty-state h3 { font-size: 20px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.empty-state p { font-size: 14px; }

/* ---------- Admin layout ---------- */
.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  align-items: start;
  padding: 40px 0 96px;
}

.admin-side {
  position: sticky;
  top: calc(var(--nav-h) + 24px);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-side-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-m);
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-secondary);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s var(--ease);
}
.admin-side-item:hover { background: rgba(0, 0, 0, 0.04); color: var(--ink); }
.admin-side-item.active { background: var(--accent-tint); color: var(--accent); }

/* ---------- Code / 卡密 ---------- */
.code-chip {
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 13px;
  background: var(--bg-alt);
  border: 1px solid var(--divider);
  padding: 3px 9px;
  border-radius: 7px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

/* ---------- Reveal（滚动进入动画） ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--divider);
  padding: 28px 0;
  font-size: 12px;
  color: var(--ink-secondary);
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  align-items: center;
  justify-content: space-between;
}

.site-footer a { color: var(--ink-secondary); }
.site-footer a:hover { color: var(--ink); }

/* ---------- Utilities ---------- */
.hidden { display: none !important; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mt-48 { margin-top: 48px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.spin {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 833px) {
  .section { padding: 64px 0; }
  .nav-links { display: none; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-side {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .admin-side-item { white-space: nowrap; }
  .auth-card { padding: 36px 26px; }
}
