/* ============================================================
   高一（13）班暑期德育作业收集系统
   现代简洁风格 - 蓝紫渐变主题
   v3 — 彻底修复移动端滚动重叠

   核心修复：
   1. 移除所有 backdrop-filter（仅保留在 fixed 定位的遮罩上）
   2. 移除 will-change / translateZ(0) 等合成层 hack
   3. 入场动画改为纯 opacity（不用 transform，避免合成层冲突）
   4. 卡片使用纯白实色背景
   5. 移除已废弃的 -webkit-overflow-scrolling
   6. 补全 collect.js 所需的 CSS 变量
   ============================================================ */

/* ---------- 设计变量 ---------- */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #e0e7ff;
  --primary-lighter: #eef2ff;

  --accent: #8b5cf6;
  --accent-dark: #7c3aed;
  --accent-light: #ede9fe;

  --success: #10b981;
  --success-dark: #059669;
  --success-light: #d1fae5;
  --danger: #ef4444;
  --danger-dark: #dc2626;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;

  --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --gradient-hover: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --gradient-text: linear-gradient(120deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);

  --text: #1e1b4b;
  --text-secondary: #4338ca;
  --text-light: #6b7280;
  --text-muted: #9ca3af;

  /* 卡片：纯白实色，杜绝半透明背景导致滚动重叠 */
  --card-bg: #ffffff;
  --card-bg-solid: #ffffff;
  --card-border: rgba(99, 102, 241, 0.12);
  --card-border-hover: rgba(99, 102, 241, 0.35);

  /* collect.js 兼容变量（之前缺失导致后台透明背景） */
  --card: #ffffff;
  --bg: #f5f3ff;
  --border: rgba(99, 102, 241, 0.12);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(99, 102, 241, 0.06);
  --shadow: 0 4px 20px rgba(99, 102, 241, 0.08);
  --shadow-lg: 0 12px 40px rgba(99, 102, 241, 0.15);
  --shadow-glow: 0 0 0 4px rgba(99, 102, 241, 0.12);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition: 0.25s var(--ease);
}

/* ---------- 全局重置 ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* 不使用 -webkit-overflow-scrolling: touch（已废弃，会引起 iOS 合成层异常） */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Noto Sans CJK SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  /*
   * 背景：使用 scroll 模式（默认值），不用 fixed
   * fixed 在 iOS 上会导致背景与滚动内容不同步
   */
  background:
    radial-gradient(ellipse 80% 60% at 15% 0%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(ellipse 70% 60% at 85% 15%, rgba(139, 92, 246, 0.16), transparent 60%),
    radial-gradient(ellipse 60% 50% at 50% 100%, rgba(168, 85, 247, 0.10), transparent 55%),
    linear-gradient(160deg, #eef1ff 0%, #f5f3ff 45%, #faf5ff 100%);
  background-attachment: scroll;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

button, a, select, input, textarea, [role="button"] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ---------- 布局容器 ---------- */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
}

/* ---------- 头部标题 ---------- */
.header {
  text-align: center;
  padding: 28px 16px 18px;
  animation: fadeInDown 0.6s var(--ease) both;
}

.header-icon {
  width: 60px;
  height: 60px;
  vertical-align: middle;
  margin-right: 12px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  transition: transform var(--transition);
}

.header-icon:hover {
  transform: scale(1.08) rotate(-3deg);
}

.header h1 {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.5px;
  vertical-align: middle;
  background: var(--gradient-text);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 5s linear infinite;
}

@keyframes shimmer {
  to { background-position: 200% center; }
}

/* ============================================================
   卡片组件
   v3 核心修复：
   - 纯白实色背景，不用 backdrop-filter
   - 不用 will-change / translateZ(0)
   - 用 isolation: isolate 创建层叠上下文（不会产生合成层冲突）
   - 入场动画纯 opacity
   ============================================================ */
.card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 16px;
  animation: fadeInUp 0.4s var(--ease) both;
  transition: box-shadow var(--transition), border-color var(--transition);
  /* isolation 创建独立层叠上下文，替代 translateZ(0) hack
     不会创建合成层，不会与滚动冲突 */
  isolation: isolate;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
  pointer-events: none;
  z-index: 1;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--card-border-hover);
}

/* ============================================================
   步骤指示器
   ============================================================ */
.steps {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-bottom: 22px;
  flex-wrap: wrap;
  animation: fadeInDown 0.5s var(--ease) both;
}

.step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  transition: color var(--transition);
  white-space: nowrap;
}

.step.active {
  color: var(--primary);
  font-weight: 700;
}

.step.active .step-num {
  animation: pulse 1.8s var(--ease) infinite;
}

.step.done {
  color: var(--success);
  font-weight: 600;
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-light);
  transition: all var(--transition);
  flex-shrink: 0;
}

.step.active .step-num {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.16);
}

.step.done .step-num {
  background: var(--success);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
}

.step-line {
  width: 26px;
  height: 3px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.15);
  transition: background var(--transition);
  flex-shrink: 0;
}

.step.done + .step-line,
.step-line.done {
  background: linear-gradient(90deg, var(--success), var(--primary));
}

/* ============================================================
   区块标题
   ============================================================ */
.section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 18px;
  border-radius: var(--radius-full);
  background: var(--gradient);
  flex-shrink: 0;
}

/* ============================================================
   选项网格
   ============================================================ */
.option-grid {
  display: grid;
  gap: 12px;
}

.option-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.option-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.option-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.option-btn {
  padding: 16px 12px;
  border: 2px solid rgba(99, 102, 241, 0.14);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  min-height: 48px;
  transition: border-color var(--transition), background var(--transition), transform 0.1s var(--ease);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.option-btn::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 0;
  height: 3px;
  border-radius: var(--radius-full);
  background: var(--gradient);
  transform: translateX(-50%);
  transition: width var(--transition);
}

.option-btn:hover {
  border-color: var(--primary);
  background: var(--primary-lighter);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.option-btn:active {
  transform: scale(0.97);
}

.option-btn.selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
  color: var(--primary-dark);
  box-shadow: var(--shadow-glow);
}

.option-btn.selected::after {
  width: 70%;
}

/* ============================================================
   姓名选择下拉框
   ============================================================ */
.name-select {
  width: 100%;
  padding: 14px 44px 14px 16px;
  border: 2px solid rgba(99, 102, 241, 0.14);
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  background: #fff;
  cursor: pointer;
  min-height: 48px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10'%3E%3Cpath fill='%236366f1' d='M7 10L0 0h14z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.name-select:hover {
  border-color: var(--primary);
  background-color: var(--primary-lighter);
}

.name-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

/* ============================================================
   文本输入
   ============================================================ */
.text-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid rgba(99, 102, 241, 0.14);
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--text);
  background: #fff;
  min-height: 48px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.text-input::placeholder { color: var(--text-muted); }

.text-input:hover { border-color: rgba(99, 102, 241, 0.3); }

.text-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.input-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.input-hint {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 8px;
  line-height: 1.5;
}

/* ============================================================
   上传区域
   ============================================================ */
.upload-area {
  border: 2px dashed rgba(99, 102, 241, 0.3);
  border-radius: var(--radius);
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform 0.1s var(--ease);
  background: rgba(99, 102, 241, 0.04);
  position: relative;
}

.upload-area:hover {
  border-color: var(--primary);
  background: var(--primary-lighter);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.upload-area:active { transform: scale(0.99); }

.upload-area.dragover {
  border-color: var(--primary);
  border-style: solid;
  background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
  box-shadow: var(--shadow-glow);
  animation: bounce 0.6s var(--ease-bounce);
}

.upload-area.has-file {
  border-style: solid;
  border-color: var(--success);
  background: var(--success-light);
}

.upload-icon {
  font-size: 36px;
  margin-bottom: 10px;
  display: inline-block;
  animation: float 3s ease-in-out infinite;
}

.upload-area.dragover .upload-icon {
  animation: bounce 0.6s var(--ease-bounce);
}

.upload-text {
  font-size: 14px;
  color: var(--text-light);
  font-weight: 500;
}

.upload-text strong {
  color: var(--primary);
  font-weight: 700;
}

.upload-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 10px;
  padding: 7px 12px;
  background: var(--primary-light);
  border-radius: var(--radius-full);
  display: inline-block;
  line-height: 1.4;
}

/* ============================================================
   文件列表
   ============================================================ */
.file-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: var(--success-light);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 14px;
  animation: fadeInUp 0.35s var(--ease) both;
  transition: transform var(--transition);
}

.file-item:hover { transform: translateX(2px); }

.file-item .file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 500;
}

.file-item .file-size {
  color: var(--text-light);
  font-size: 12px;
  margin: 0 10px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.file-remove {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 18px;
  padding: 4px 6px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.file-remove:hover {
  background: var(--danger-light);
  transform: scale(1.15);
}

.file-remove:active { transform: scale(0.9); }

/* ============================================================
   心理感悟选择
   ============================================================ */
.psych-select {
  margin-top: 14px;
  padding: 14px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-sm);
  animation: fadeInUp 0.4s var(--ease) both;
}

.psych-select label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}

.psych-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.psych-option {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  min-height: 40px;
}

.psych-option:hover { background: rgba(245, 158, 11, 0.14); }

.psych-option input {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
}

/* ============================================================
   按钮
   ============================================================ */
.btn {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  min-height: 48px;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.1s var(--ease), box-shadow var(--transition),
    background var(--transition), opacity var(--transition);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.5px;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.3), transparent 70%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.btn:hover::after { opacity: 1; }

.btn:active {
  transform: scale(0.97);
  transition: transform 0.1s var(--ease);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn:disabled::after { display: none; }

.btn-primary {
  background: var(--gradient);
  background-size: 150% 150%;
  color: #fff;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  background-position: 100% 100%;
  box-shadow: 0 10px 28px rgba(99, 102, 241, 0.45);
  transform: translateY(-2px);
}

.btn-primary:disabled {
  background: rgba(99, 102, 241, 0.2);
  color: rgba(255, 255, 255, 0.8);
  box-shadow: none;
}

.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 2px solid rgba(99, 102, 241, 0.18);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-lighter);
  transform: translateY(-2px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), var(--danger-dark));
  color: #fff;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  box-shadow: 0 10px 28px rgba(239, 68, 68, 0.4);
  transform: translateY(-2px);
}

.btn-row {
  display: flex;
  gap: 12px;
}

.btn-row .btn { flex: 1; }

/* ============================================================
   成功页面
   ============================================================ */
.success-box {
  text-align: center;
  padding: 36px 20px;
  animation: fadeInUp 0.5s var(--ease) both;
}

.success-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--success), var(--success-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  color: #fff;
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.35);
  position: relative;
  animation: popIn 0.5s var(--ease-bounce) both;
}

.success-icon::after {
  content: '';
  width: 30px;
  height: 16px;
  border-left: 5px solid #fff;
  border-bottom: 5px solid #fff;
  transform: rotate(-45deg) scale(0);
  margin-top: -6px;
  animation: drawCheck 0.4s 0.3s var(--ease) forwards;
  border-radius: 2px;
}

@keyframes drawCheck {
  0% { transform: rotate(-45deg) scale(0); }
  100% { transform: rotate(-45deg) scale(1); }
}

.success-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 10px;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.success-msg {
  font-size: 15px;
  color: var(--text-light);
  margin-bottom: 20px;
  line-height: 1.7;
}

/* ============================================================
   提示框 Alert
   ============================================================ */
.alert {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeInDown 0.3s var(--ease) both;
  border: 1px solid transparent;
  line-height: 1.5;
}

.alert-error {
  background: var(--danger-light);
  color: var(--danger-dark);
  border-color: rgba(239, 68, 68, 0.2);
}

.alert-success {
  background: var(--success-light);
  color: var(--success-dark);
  border-color: rgba(16, 185, 129, 0.2);
}

.alert-warning {
  background: var(--warning-light);
  color: #92400e;
  border-color: rgba(245, 158, 11, 0.25);
}

/* ============================================================
   加载 / 旋转器
   ============================================================ */
.loading {
  text-align: center;
  padding: 44px 20px;
  color: var(--text-light);
  font-size: 15px;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(99, 102, 241, 0.15);
  border-top-color: var(--primary);
  border-right-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   进度条
   ============================================================ */
.progress-bar {
  width: 100%;
  height: 10px;
  background: rgba(99, 102, 241, 0.12);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 8px 0;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background:
    linear-gradient(45deg,
      rgba(255, 255, 255, 0.25) 25%, transparent 25%,
      transparent 50%, rgba(255, 255, 255, 0.25) 50%,
      rgba(255, 255, 255, 0.25) 75%, transparent 75%, transparent),
    var(--gradient);
  background-size: 28px 28px, 100% 100%;
  background-color: var(--primary);
  animation: progressStripes 0.8s linear infinite;
  transition: width 0.3s var(--ease);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

@keyframes progressStripes {
  from { background-position: 0 0; }
  to { background-position: 28px 0; }
}

.progress-text {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 6px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   模态框 / 对话框
   注意：modal-overlay 是 fixed 定位，不随页面滚动
   所以这里保留 backdrop-filter 不会引起滚动重叠
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 27, 75, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--card-bg-solid);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.92) translateY(12px);
  transition: transform 0.35s var(--ease-bounce);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(99, 102, 241, 0.12);
  background: linear-gradient(135deg, var(--primary-lighter), var(--accent-light));
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 22px;
  border-top: 1px solid rgba(99, 102, 241, 0.12);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-shrink: 0;
}

.modal-footer .btn {
  width: auto;
  min-width: 100px;
  padding: 11px 22px;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(99, 102, 241, 0.1);
  color: var(--text-light);
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--danger-light);
  color: var(--danger);
  transform: rotate(90deg);
}

/* 预览容器 */
.preview-container {
  width: 100%;
  min-height: 200px;
  max-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 27, 75, 0.04);
  border-radius: var(--radius);
  overflow: hidden;
}

.preview-image {
  max-width: 100%;
  max-height: 60vh;
  border-radius: var(--radius-sm);
  object-fit: contain;
  animation: fadeIn 0.4s var(--ease) both;
}

.preview-video {
  max-width: 100%;
  max-height: 60vh;
  border-radius: var(--radius-sm);
  background: #000;
}

.preview-iframe {
  width: 100%;
  height: 60vh;
  border: none;
  border-radius: var(--radius-sm);
  background: #fff;
}

/* 确认对话框 */
.confirm-dialog { max-width: 400px; }

.confirm-dialog .modal-body {
  text-align: center;
  padding: 28px 22px;
}

.confirm-dialog .confirm-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--danger-light);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.confirm-dialog .confirm-message {
  font-size: 15px;
  color: var(--text);
  line-height: 1.6;
}

.confirm-dialog .modal-footer .btn { flex: 1; }

/* ============================================================
   文件树（管理后台）
   ============================================================ */
.tree-node { margin-left: 0; }

.tree-folder { user-select: none; }

.tree-children {
  margin-left: 22px;
  border-left: 2px solid rgba(99, 102, 241, 0.15);
  padding-left: 14px;
  margin-top: 4px;
  margin-bottom: 4px;
}

.tree-item {
  padding: 10px 14px;
  margin: 5px 0;
  background: #fff;
  border: 1px solid rgba(99, 102, 241, 0.08);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  animation: fadeInUp 0.3s var(--ease) both;
  flex-wrap: wrap;
  gap: 6px;
}

.tree-item:hover {
  border-color: var(--card-border-hover);
  box-shadow: var(--shadow);
  transform: translateX(3px);
}

.tree-item .item-name {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.tree-item .item-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-item .item-meta {
  font-size: 12px;
  color: var(--text-light);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.tree-item.bak {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.2);
}

.tree-file { cursor: pointer; }

.tree-folder-toggle {
  cursor: pointer;
  user-select: none;
  transition: transform var(--transition);
  display: inline-flex;
  align-items: center;
}

.tree-folder-toggle.collapsed { transform: rotate(-90deg); }

.tree-folder-toggle.collapsed + .tree-children { display: none; }

.file-checkbox {
  margin-right: 8px;
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
}

/* ============================================================
   徽章
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-count { background: var(--primary-light); color: var(--primary-dark); }
.badge-bak { background: var(--warning-light); color: #92400e; }
.badge-image { background: rgba(16, 185, 129, 0.14); color: var(--success-dark); }
.badge-video { background: rgba(239, 68, 68, 0.14); color: var(--danger-dark); }
.badge-doc { background: rgba(37, 99, 235, 0.14); color: #1d4ed8; }
.badge-pptx { background: rgba(234, 88, 12, 0.14); color: #c2410c; }
.badge-zip { background: rgba(124, 58, 237, 0.14); color: var(--accent-dark); }

/* ============================================================
   Toast 通知
   ============================================================ */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: calc(100% - 32px);
  max-width: 420px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 0.4s var(--ease-bounce) both;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

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

.toast-success { background: linear-gradient(135deg, var(--success), var(--success-dark)); }
.toast-error { background: linear-gradient(135deg, var(--danger), var(--danger-dark)); }
.toast-warning { background: linear-gradient(135deg, var(--warning), #d97706); }
.toast-info { background: var(--gradient); }

/* ============================================================
   存储统计卡片
   ============================================================ */
.storage-stats {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.storage-location {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--text-light);
}

.storage-location strong {
  color: var(--text);
  font-weight: 700;
}

.storage-bar {
  width: 100%;
  height: 12px;
  background: rgba(99, 102, 241, 0.12);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.storage-bar .progress-fill { height: 100%; }

.storage-stats .storage-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-light);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   关键动画
   v3 修复：入场动画只用 opacity，不用 transform
   transform 动画会与浏览器滚动合成层冲突，导致上滑时元素重叠
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInDown {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* popIn 仅用于成功图标（一次性、不滚动区域内，可保留 transform） */
@keyframes popIn {
  0% { transform: scale(0); }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* pulse 用 box-shadow，不用 transform */
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0); }
}

/* bounce 仅用于拖拽时的即时反馈（不滚动时触发） */
@keyframes bounce {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.04); }
  60% { transform: scale(0.98); }
}

/* float 用于上传图标（小元素，不影响卡片合成层） */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* toast 滑入滑出（fixed 定位，不随滚动） */
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-120%); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-120%); }
}

/* ============================================================
   滚动条美化
   ============================================================ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(99, 102, 241, 0.25); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: rgba(99, 102, 241, 0.4); }

/* ============================================================
   移动端响应式（≤768px）
   ============================================================ */
@media (max-width: 768px) {
  .admin-container { padding: 12px; }

  .option-grid.cols-2,
  .option-grid.cols-3,
  .option-grid.cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .modal {
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--radius);
  }

  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; }

  .tree-children { margin-left: 16px; }
}

/* ============================================================
   小屏移动端（≤480px）
   ============================================================ */
@media (max-width: 480px) {
  .container { padding: 12px; }

  .header { padding: 22px 12px 14px; }
  .header h1 { font-size: 18px; }
  .header-icon { width: 44px; height: 44px; margin-right: 8px; border-radius: 12px; }

  .card {
    padding: 16px;
    border-radius: 14px;
  }

  .section-title { font-size: 15px; }

  .option-grid,
  .option-grid.cols-2,
  .option-grid.cols-3,
  .option-grid.cols-4 {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .option-btn { padding: 14px 12px; }

  .btn { padding: 14px; font-size: 15px; }

  .btn-row { flex-direction: column; gap: 10px; }
  .btn-row .btn { width: 100%; }

  .steps { gap: 4px; }
  .step { font-size: 11px; gap: 4px; }
  .step-num { width: 22px; height: 22px; font-size: 11px; }
  .step-line { width: 14px; }

  .upload-area { padding: 22px 12px; }
  .upload-icon { font-size: 30px; }

  .success-box { padding: 26px 14px; }
  .success-title { font-size: 19px; }

  .toast-container { top: 10px; width: calc(100% - 20px); }

  .tree-item { font-size: 13px; padding: 9px 11px; }
  .tree-children { margin-left: 12px; padding-left: 10px; }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* ============================================================
   可访问性：减少动画偏好
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.1s !important;
  }
}
