/* ============================================================
   开纸助手 - 年轻化设计系统
   靛蓝/紫渐变主色 · 大圆角 · 柔和阴影 · 微动效
   ============================================================ */

:root {
  /* 主色：靛蓝 → 紫 */
  --primary: #6366f1;
  --primary-600: #4f46e5;
  --primary-300: #a5b4fc;
  --secondary: #8b5cf6;
  --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --gradient-soft: linear-gradient(135deg, #eef2ff 0%, #faf5ff 100%);

  /* 点缀色 */
  --cyan: #06b6d4;
  --coral: #fb7185;
  --amber: #fbbf24;
  --green: #10b981;
  --green-soft: #d1fae5;
  --red: #ef4444;
  --red-soft: #fee2e2;

  /* 中性色 */
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --text: #1e293b;
  --text-2: #64748b;
  --text-3: #94a3b8;
  --border: #e8ebf3;
  --border-2: #d8dded;

  /* 圆角与阴影 */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  --shadow-sm: 0 2px 8px rgba(99, 102, 241, 0.06);
  --shadow: 0 8px 28px rgba(99, 102, 241, 0.10);
  --shadow-hover: 0 14px 40px rgba(99, 102, 241, 0.18);
  --shadow-glow: 0 8px 24px rgba(99, 102, 241, 0.35);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
          'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  --mono: 'SF Mono', 'JetBrains Mono', 'DM Mono', Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  /* 年轻化：背景加柔和光斑 */
  background-image:
    radial-gradient(circle at 12% 8%, rgba(99, 102, 241, 0.07), transparent 32%),
    radial-gradient(circle at 88% 92%, rgba(139, 92, 246, 0.07), transparent 32%);
  background-attachment: fixed;
}

a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

/* ---------- 通用组件 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--r-sm);
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(99, 102, 241, 0.45); }

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border-2);
}
.btn-ghost:hover { border-color: var(--primary-300); color: var(--primary); }

.btn-soft {
  background: var(--gradient-soft);
  color: var(--primary-600);
}
.btn-soft:hover { background: #e0e7ff; }

.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: #fecaca; }

.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 9px; }
.btn-lg { padding: 14px 28px; font-size: 15px; border-radius: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

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

/* 输入框 */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 8px;
}
.input, .select, .textarea {
  width: 100%;
  padding: 12px 15px;
  border: 1.5px solid var(--border-2);
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.10);
}
.input::placeholder { color: var(--text-3); }

/* 徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-primary { background: var(--gradient-soft); color: var(--primary-600); }
.badge-green { background: var(--green-soft); color: #059669; }
.badge-amber { background: #fef3c7; color: #d97706; }
.badge-red { background: var(--red-soft); color: var(--red); }

/* Toast 通知 */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  max-width: 380px;
  padding: 14px 18px;
  background: var(--surface);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-hover);
  border-left: 4px solid var(--primary);
  font-size: 14px;
  animation: toastIn .3s cubic-bezier(.2,.8,.2,1);
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.info { border-left-color: var(--cyan); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* 加载遮罩 */
.loading-mask {
  position: fixed;
  inset: 0;
  background: rgba(246, 247, 251, .8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}
.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid var(--border-2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-3);
}
.empty-state .emoji {
  font-size: 48px;
  margin-bottom: 14px;
  opacity: .7;
}

/* 顶部导航栏 */
.topbar {
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 19px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.5px;
}
.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.brand-logo svg { width: 21px; height: 21px; }
.topbar-nav { display: flex; gap: 6px; margin-left: 20px; }
.topbar-nav a {
  padding: 8px 15px;
  border-radius: 10px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  transition: all .18s;
}
.topbar-nav a:hover, .topbar-nav a.active {
  background: var(--gradient-soft);
  color: var(--primary-600);
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}

/* 响应式 */
@media (max-width: 768px) {
  .topbar { padding: 12px 16px; }
  .topbar-nav { display: none; }
  .toast-container { top: 12px; right: 12px; left: 12px; }
  .toast { max-width: none; }
  .btn { padding: 10px 16px; }
}
