/* ============================================================
   抖研AI PPT - 基础样式与设计系统
   ============================================================ */
:root {
  --primary: #0071E3;
  --primary-deep: #0060C9;
  --primary-soft: #EAF3FF;
  --violet: #3A5199;
  --cyan: #30B0C7;
  --grad: linear-gradient(180deg, #0A84FF 0%, #0071E3 100%);
  --grad-soft: linear-gradient(120deg, #F5F5F7 0%, #FAFAFC 100%);
  --bg: #F5F5F7;
  --bg-deep: #E8E8ED;
  --card: #FFFFFF;
  --line: #D2D2D7;
  --line-strong: #C7C7CC;
  --text: #1D1D1F;
  --text-2: #515154;
  --text-3: #86868B;
  --danger: #D70015;
  --warn: #C93400;
  --success: #248A3D;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 4px 20px rgba(0,0,0,.06);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.12);
  --radius: 12px;
  --radius-lg: 18px;
  --ease: cubic-bezier(.4, 0, .2, 1);
  --transition: all .2s cubic-bezier(.4, 0, .2, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro SC", "SF Pro Text", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

#app { height: 100%; display: flex; flex-direction: column; }

a { color: var(--primary); text-decoration: none; }
button { font-family: var(--font); }

/* ---------- 图标系统（UI.icon 输出，替代 emoji） ---------- */
.ui-ico { display: inline-block; vertical-align: -0.16em; flex-shrink: 0; }
.ui-it { display: inline-flex; align-items: center; gap: 6px; }
.ui-it > .ui-ico { vertical-align: 0; }
button .ui-ico, .btn .ui-ico { vertical-align: -0.18em; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #C7C7CC; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #AEAEB2; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 顶部导航 ---------- */
.navbar {
  height: 62px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 12px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 20px;   /* 与导航链接保持 32px 视觉间距 */
  cursor: pointer;
  user-select: none;
}
.brand-logo {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: #1D1D1F;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: var(--shadow-sm);
}
.brand-name { font-size: 16.5px; font-weight: 700; letter-spacing: -0.01em; }
.brand-name em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.brand-tag { font-size: 10px; color: var(--text-3); border: 1px solid var(--line); padding: 1px 6px; border-radius: 20px; margin-left: 2px; }

.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-link {
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text-2);
  cursor: pointer;
  font-size: 13.5px;
  transition: var(--transition);
  user-select: none;
}
.nav-link:hover { background: var(--bg-deep); color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.nav-quota {
  font-size: 12.5px; color: var(--text-3);
  display: flex; align-items: center; gap: 6px;
  padding: 0; background: transparent;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.nav-quota b { color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }
/* 额度与会员/头像区之间的细分隔线 */
.nav-quota::after {
  content: '';
  width: 1px; height: 18px;
  background: var(--line);
  margin-left: 6px;
}
.nav-user { transition: var(--transition); }
.nav-user:hover { box-shadow: 0 0 0 3px var(--bg-deep); }

/* ---------- 主内容区 ---------- */
.page-container { flex: 1; overflow-y: auto; }
.page-inner { max-width: 1200px; margin: 0 auto; padding: 30px 28px 60px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  white-space: nowrap;
  background: var(--bg-deep);
  color: var(--text);
}
.btn:hover { filter: brightness(0.97); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--grad); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: #0077ED; filter: none; }
.btn-primary:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(0,113,227,.25); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-deep); color: var(--text); }
.btn-danger { background: #FDEBE8; color: var(--danger); }
.btn-danger:hover { background: #FBDCD6; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { padding: 13px 30px; font-size: 15px; border-radius: 12px; }
.btn-icon {
  width: 34px; height: 34px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; font-size: 15px;
}

/* ---------- 输入 ---------- */
.input, .select, .textarea {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  font-size: 13.5px;
  font-family: var(--font);
  color: var(--text);
  background: #fff;
  outline: none;
  transition: var(--transition);
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,113,227,.25);
}
.textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.select { cursor: pointer; }

.field { margin-bottom: 16px; }
.field-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 7px; }
.field-hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }

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

/* ---------- Toast ---------- */
.toast-box {
  position: fixed;
  top: 74px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  background: #1D1D1F;
  color: #fff;
  padding: 11px 20px;
  border-radius: 12px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-8px);
  transition: var(--transition);
  max-width: 550px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-icon { font-size: 14px; display: inline-flex; align-items: center; }
.toast-success .toast-icon { color: #4ADE80; }
.toast-error .toast-icon { color: #FF8A73; }
.toast-warn .toast-icon { color: #FBBF24; }
.toast-info .toast-icon { color: #93C5FD; }

/* ---------- 模态框 ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: var(--transition);
  padding: 30px;
}
.modal-overlay.show { opacity: 1; }
.modal {
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  width: 560px;
  max-width: 100%;
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  animation: modalIn .26s cubic-bezier(.22,1,.36,1);
}
@keyframes modalIn { from { transform: translateY(16px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-sm { width: 420px; }
.modal-lg { width: 760px; }
.modal-xl { width: 980px; }
.modal-header {
  padding: 20px 24px 14px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-header h3 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.modal-close {
  width: 30px; height: 30px; border: none; background: var(--bg-deep);
  border-radius: 8px; cursor: pointer; color: var(--text-2); font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.modal-close:hover { background: var(--line); color: var(--text); }
.modal-body { padding: 6px 24px 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 24px 20px;
  display: flex; justify-content: flex-end; gap: 10px;
  flex-shrink: 0;
}
.confirm-msg { color: var(--text-2); line-height: 1.65; font-size: 13.5px; }

/* ---------- 全局加载 ---------- */
.global-loading {
  position: fixed; inset: 0;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(3px);
  z-index: 9000;
  display: none;
  align-items: center; justify-content: center;
}
.loading-card {
  background: #fff;
  padding: 28px 40px;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.loading-text { font-size: 13.5px; color: var(--text-2); }
.spinner {
  width: 34px; height: 34px;
  border: 3.5px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-sm { width: 16px; height: 16px; border-width: 2.5px; display: inline-block; vertical-align: -3px; }

/* ---------- 空状态 ---------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}
/* 图标槽：既承载 UI.icon 的 SVG，也兼容旧的字符标记 */
.empty-state .empty-icon {
  display: flex; align-items: center; justify-content: center;
  min-height: 44px;
  margin-bottom: 14px;
  color: var(--text-3);
  font-size: 40px; line-height: 1;
  opacity: .75;
}
.empty-state p { font-size: 13.5px; line-height: 1.8; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 20px;
  background: var(--bg-deep);
  color: var(--text-2);
}
.tag-primary { background: var(--primary-soft); color: var(--primary); }
.tag-success { background: #E7F6EC; color: var(--success); }
.tag-warn { background: rgba(201,52,0,.09); color: var(--warn); }
.tag-danger { background: #FDEBE8; color: var(--danger); }

/* ---------- 下拉菜单 ---------- */
.dropdown-menu {
  position: fixed;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 2000;
  min-width: 160px;
  animation: modalIn .16s;
}
.dropdown-item {
  padding: 8px 13px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  display: flex; align-items: center; gap: 9px;
  white-space: nowrap;
  transition: var(--transition);
}
.dropdown-item:hover { background: var(--bg); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.disabled { color: var(--text-3); cursor: not-allowed; }
.dropdown-divider { height: 1px; background: var(--line); margin: 5px 8px; }

/* ---------- 进度条 ---------- */
.progress-bar {
  height: 8px;
  background: var(--bg-deep);
  border-radius: 6px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--grad);
  border-radius: 6px;
  transition: width .4s var(--ease);
}

/* ---------- 骨架屏 ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-deep) 25%, #F0F0F2 50%, var(--bg-deep) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- 开关 ---------- */
.switch { position: relative; width: 40px; height: 22px; cursor: pointer; flex-shrink: 0; }
.switch input { display: none; }
.switch .track {
  position: absolute; inset: 0;
  background: var(--line-strong);
  border-radius: 20px;
  transition: var(--transition);
}
.switch .thumb {
  position: absolute; top: 2.5px; left: 3px;
  width: 17px; height: 17px;
  background: #fff; border-radius: 50%;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.switch input:checked ~ .track { background: var(--primary); }
.switch input:checked ~ .thumb { left: 20px; }

/* ---------- 分段控制 ---------- */
.segmented {
  display: inline-flex;
  background: var(--bg-deep);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.segmented .seg {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
  border: none; background: transparent;
}
.segmented .seg.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); }
