/* ============================================================
   漫剧部门项目管理系统 — 共享设计系统
   来源:ui-ux-pro-max skill 实测输出(内部生产管理工具 / 仪表盘 / 专业)
   风格:Micro-interactions(微交互)  配色:专业蓝 + 状态色
   ============================================================ */

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

:root {
  /* ---- 主色板(skill 推荐) ---- */
  --color-primary: #2563EB;
  --color-primary-600: #1D4ED8;
  --color-primary-700: #1E40AF;
  --color-on-primary: #FFFFFF;
  --color-secondary: #3B82F6;
  --color-accent: #059669;
  --color-accent-600: #047857;

  /* ---- 背景 / 前景 ---- */
  --color-background: #F8FAFC;
  --color-surface: #FFFFFF;
  --color-foreground: #0F172A;
  --color-muted: #F1F5FD;
  --color-muted-fg: #64748B;
  --color-border: #E4ECFC;
  --color-ring: #2563EB;

  /* ---- 状态色(红榜核心:绿/琥珀/红) ---- */
  --status-ok: #059669;        /* 正常 / 进行中 */
  --status-ok-bg: #ECFDF5;
  --status-warn: #D97706;      /* 快超时 */
  --status-warn-bg: #FFFBEB;
  --status-danger: #DC2626;    /* 已超时 */
  --status-danger-bg: #FEF2F2;
  --status-info: #2563EB;      /* 提交审核 / 一般 */
  --status-info-bg: #EFF6FF;
  --status-client: #7C3AED;    /* 等甲方 */
  --status-client-bg: #F5F3FF;
  --status-idle: #64748B;      /* 未开始 */
  --status-idle-bg: #F1F5F9;

  /* ---- 字体 ---- */
  --font-heading: 'Fira Code', ui-monospace, 'SFMono-Regular', monospace;
  --font-body: 'Fira Sans', system-ui, -apple-system, 'Segoe UI', 'Microsoft YaHei', sans-serif;

  /* ---- 字号刻度 ---- */
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-xl: 24px;
  --text-2xl: 32px;
  --text-3xl: 40px;

  /* ---- 间距(4/8 节奏) ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-8: 48px;

  /* ---- 圆角 / 阴影 ---- */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
  --shadow-primary: 0 8px 24px rgba(37, 99, 235, 0.25);

  /* ---- z-index 分层(避免混乱) ---- */
  --z-base: 0;
  --z-nav: 10;
  --z-sticky: 20;
  --z-overlay: 40;
  --z-modal: 100;
  --z-toast: 1000;

  /* ---- 动效(150-300ms) ---- */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 150ms;
  --dur-base: 220ms;
  --dur-slow: 320ms;
}

/* ============================================================
   基础重置
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-foreground);
  background: var(--color-background);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }

a { color: inherit; text-decoration: none; }

button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* 表格数字对齐用等宽数字 */
.tabular { font-variant-numeric: tabular-nums; }

/* ============================================================
   通用组件类
   ============================================================ */

/* --- 顶栏 --- */
.app-bar {
  position: sticky; top: 0; z-index: var(--z-nav);
  display: flex; align-items: center; gap: var(--space-4);
  height: 64px; padding: 0 var(--space-6);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--color-border);
}
.app-bar__brand { display: flex; align-items: center; gap: var(--space-3); font-family: var(--font-heading); font-weight: 700; font-size: var(--text-lg); }
.app-bar__logo { width: 32px; height: 32px; border-radius: var(--radius-sm); background: linear-gradient(135deg, var(--color-primary), var(--color-secondary)); display: grid; place-items: center; color: #fff; box-shadow: var(--shadow-primary); }

/* --- 主导航链接 --- */
.nav { display: flex; gap: var(--space-1); margin-left: var(--space-4); }
.nav a {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm);
  color: var(--color-muted-fg); font-size: var(--text-sm); font-weight: 500;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.nav a:hover { background: var(--color-muted); color: var(--color-foreground); }
.nav a.active { background: var(--status-info-bg); color: var(--color-primary); font-weight: 600; }

/* --- 页面容器 --- */
.page { max-width: 1280px; margin: 0 auto; padding: var(--space-6); }
.page__head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: var(--space-4); margin-bottom: var(--space-5); }
.page__title { font-size: var(--text-2xl); }
.page__subtitle { color: var(--color-muted-fg); font-size: var(--text-sm); margin-top: var(--space-1); }

/* --- 卡片 --- */
.card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.card--hover:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card__body { padding: var(--space-5); }

/* --- 按钮 --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4); min-height: 40px;
  border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: 600;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--color-ring); outline-offset: 2px; }
.btn--primary { background: var(--color-primary); color: var(--color-on-primary); box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--color-primary-600); box-shadow: var(--shadow-primary); }
.btn--accent { background: var(--color-accent); color: #fff; }
.btn--accent:hover { background: var(--color-accent-600); }
.btn--ghost { background: var(--color-muted); color: var(--color-foreground); }
.btn--ghost:hover { background: #E2E8F0; }
.btn--sm { min-height: 32px; padding: var(--space-1) var(--space-3); font-size: var(--text-xs); }

/* --- 状态徽章 --- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: var(--text-xs); font-weight: 600; white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--ok      { color: var(--status-ok);     background: var(--status-ok-bg); }
.badge--warn    { color: var(--status-warn);   background: var(--status-warn-bg); }
.badge--danger  { color: var(--status-danger); background: var(--status-danger-bg); }
.badge--info    { color: var(--status-info);   background: var(--status-info-bg); }
.badge--client  { color: var(--status-client); background: var(--status-client-bg); }
.badge--idle    { color: var(--status-idle);   background: var(--status-idle-bg); }

/* --- 头像 --- */
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-heading); font-size: var(--text-xs); font-weight: 600; color: #fff; flex-shrink: 0;
}
.avatar--a { background: #2563EB; }
.avatar--b { background: #059669; }
.avatar--c { background: #D97706; }
.avatar--d { background: #7C3AED; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -8px; border: 2px solid var(--color-surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* --- 顶栏用户块(全站统一,右上角"我") --- */
.me { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; }
.me__meta { display: flex; flex-direction: column; line-height: 1.2; }
.me__name { font-size: var(--text-sm); font-weight: 600; }
.me__role { font-size: var(--text-xs); color: var(--color-muted-fg); }
@media (max-width: 768px) { .me__meta { display: none; } }

/* --- 进度条 --- */
.progress { height: 8px; border-radius: 999px; background: var(--color-muted); overflow: hidden; }
.progress__bar { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--color-primary), var(--color-secondary)); transition: width var(--dur-slow) var(--ease-out); }

/* --- 网格工具 --- */
.grid { display: grid; gap: var(--space-4); }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* --- 空状态 --- */
.empty { text-align: center; padding: var(--space-8); color: var(--color-muted-fg); }

/* --- 分段切换(周/月) --- */
.segmented { display: inline-flex; background: var(--color-muted); border-radius: var(--radius-sm); padding: 3px; gap: 3px; }
.segmented button {
  padding: 6px 16px; border-radius: 6px; font-size: var(--text-sm); font-weight: 600; color: var(--color-muted-fg);
  transition: all var(--dur-fast) var(--ease-out);
}
.segmented button.active { background: var(--color-surface); color: var(--color-primary); box-shadow: var(--shadow-sm); }

/* --- Three.js 背景画布 --- */
.hero-canvas { position: absolute; inset: 0; z-index: var(--z-base); pointer-events: none; }

/* --- 入场动画 --- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.animate-in { animation: fadeUp var(--dur-slow) var(--ease-out) both; }
.stagger > * { animation: fadeUp var(--dur-slow) var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: 0.04s; }
.stagger > *:nth-child(2) { animation-delay: 0.08s; }
.stagger > *:nth-child(3) { animation-delay: 0.12s; }
.stagger > *:nth-child(4) { animation-delay: 0.16s; }
.stagger > *:nth-child(5) { animation-delay: 0.20s; }
.stagger > *:nth-child(6) { animation-delay: 0.24s; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.skeleton { background: var(--color-muted); border-radius: var(--radius-sm); animation: pulse 1.5s ease-in-out infinite; }

/* --- 无障碍:尊重减少动效 --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* --- 响应式 --- */
@media (max-width: 768px) {
  .page { padding: var(--space-4); }
  .nav { display: none; }
  .page__title { font-size: var(--text-xl); }
}
