/* ===== 视频生成管理台公共样式（VideoGen Console）===== */
.vg-page { max-width: 1500px; }
.vg-hd { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.vg-hd h2 { font-size: 20px; font-weight: 700; color: #0f172a; margin: 0; }
.vg-hd .sub { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.vg-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.vg-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; margin-bottom: 16px; }
.vg-card-hd { padding: 12px 16px; border-bottom: 1px solid #eef2f7; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.vg-card-hd h3 { font-size: 14px; font-weight: 600; color: #1e293b; margin: 0; }
.vg-card-bd { padding: 14px 16px; }
.vg-card-bd.p0 { padding: 0; }

.vg-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.vg-input, .vg-select, .vg-textarea {
  border: 1px solid #cbd5e1; border-radius: 8px; padding: 6px 10px; font-size: 13px; background: #fff; color: #1e293b;
}
.vg-input:focus, .vg-select:focus, .vg-textarea:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.vg-textarea { width: 100%; min-height: 70px; font-family: inherit; }
.vg-input.w-sm { width: 140px; } .vg-input.w-md { width: 220px; } .vg-input.w-lg { width: 320px; }

.vg-btn { border: 1px solid #cbd5e1; background: #fff; color: #334155; border-radius: 8px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.vg-btn:hover { background: #f8fafc; }
.vg-btn-primary { background: #3b82f6; border-color: #3b82f6; color: #fff; }
.vg-btn-primary:hover { background: #2563eb; }
.vg-btn-danger { color: #dc2626; border-color: #fecaca; }
.vg-btn-sm { padding: 3px 8px; font-size: 12px; }

.vg-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.vg-table th { text-align: left; padding: 9px 12px; color: #64748b; font-weight: 600; background: #f8fafc; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
.vg-table td { padding: 9px 12px; border-bottom: 1px solid #f1f5f9; color: #334155; vertical-align: middle; }
.vg-table tr:hover td { background: #f8fafc; }
.vg-table .op a { color: #2563eb; cursor: pointer; margin-right: 8px; white-space: nowrap; }
.vg-table .op a.danger { color: #dc2626; }
.vg-mono { font-family: Consolas, 'Cascadia Code', monospace; font-size: 12px; color: #0f172a; }
.vg-sub { color: #94a3b8; font-size: 12px; }

.vg-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; line-height: 18px; border: 1px solid transparent; white-space: nowrap; }
.vg-badge.gray   { background: #f1f5f9; color: #475569; }
.vg-badge.blue   { background: #eff6ff; color: #1d4ed8; }
.vg-badge.green  { background: #ecfdf5; color: #047857; }
.vg-badge.amber  { background: #fffbeb; color: #b45309; }
.vg-badge.red    { background: #fef2f2; color: #b91c1c; }
.vg-badge.purple { background: #f5f3ff; color: #6d28d9; }

.vg-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.vg-kpi { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 14px 16px; }
.vg-kpi .lb { font-size: 12px; color: #94a3b8; }
.vg-kpi .val { font-size: 22px; font-weight: 700; color: #0f172a; margin-top: 4px; }

.vg-empty { text-align: center; color: #94a3b8; padding: 36px 0; font-size: 13px; }
.vg-empty i { display: block; font-size: 26px; margin-bottom: 8px; color: #cbd5e1; }

.vg-play-wrap { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.vg-play-main { flex: 1 1 640px; margin-bottom: 16px; }
.vg-play-main video { width: 100%; border-radius: 8px; background: #0f172a; display: block; }
.vg-play-meta { margin-top: 10px; font-size: 13px; color: #334155; display: flex; align-items: center; gap: 8px; }
.vg-play-side { flex: 0 1 300px; margin-bottom: 16px; }
.vg-play-item { cursor: pointer; }
.vg-play-item.on td { background: #eff6ff; }
.vg-play-item.on td b { color: #1d4ed8; }

.vg-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.vg-field label { display: block; font-size: 12px; color: #64748b; margin-bottom: 4px; }
.vg-field .vg-input, .vg-field .vg-select { width: 100%; }
.vg-field-full { grid-column: 1 / -1; }
.vg-chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.vg-chip-list label { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid #e2e8f0; border-radius: 999px; font-size: 12px; color: #334155; cursor: pointer; background: #fff; }
.vg-chip-list label.on { border-color: #3b82f6; background: #eff6ff; color: #1d4ed8; }
.vg-chip-list label.dis { opacity: .45; cursor: not-allowed; }

.vg-timeline { list-style: none; padding: 0; margin: 0; }
.vg-timeline li { position: relative; padding: 0 0 14px 18px; border-left: 2px solid #e2e8f0; margin-left: 6px; }
.vg-timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }
.vg-timeline li::before { content: ''; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: #3b82f6; }
.vg-timeline .t { font-size: 12px; color: #94a3b8; }
.vg-timeline .c { font-size: 13px; color: #334155; }
.vg-pre { background: #0f172a; color: #e2e8f0; border-radius: 8px; padding: 10px 12px; font-size: 12px; overflow: auto; max-height: 320px; white-space: pre-wrap; word-break: break-all; }

.vg-shots-editor { width: 100%; border-collapse: collapse; font-size: 12px; }
.vg-shots-editor th { background: #f8fafc; color: #64748b; padding: 6px 8px; border-bottom: 1px solid #e2e8f0; text-align: left; white-space: nowrap; }
.vg-shots-editor td { padding: 4px 6px; border-bottom: 1px solid #f1f5f9; }
.vg-shots-editor input, .vg-shots-editor select, .vg-shots-editor textarea { width: 100%; border: 1px solid #e2e8f0; border-radius: 6px; padding: 4px 6px; font-size: 12px; }
.vg-shots-editor textarea { min-height: 52px; }

.vg-modal-body { padding: 16px 20px; }
.vg-modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px; border-top: 1px solid #eef2f7; }
.vg-refs { display: flex; flex-wrap: wrap; gap: 8px; }
.vg-refs img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid #e2e8f0; }

/* ===== 独立后台：弹窗与基础布局 ===== */
body { background: #f1f5f9; margin: 0; }
.modal { display: none; position: fixed; inset: 0; z-index: 60; background: rgba(15, 23, 42, .45); align-items: flex-start; justify-content: center; padding: 40px 12px; overflow-y: auto; }
.modal.active { display: flex; }
.vg-shell { min-height: 100vh; }
.vg-topbar { height: 56px; background: #0f172a; color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; position: sticky; top: 0; z-index: 30; }
.vg-topbar .brand { font-weight: 700; font-size: 15px; }
.vg-topbar .nav { display: flex; align-items: center; gap: 12px; }
.vg-topbar a { color: #94a3b8; font-size: 13px; text-decoration: none; }
.vg-topbar a:hover { color: #fff; }
.vg-body { display: flex; min-height: calc(100vh - 56px); }
.vg-side { width: 208px; background: #fff; border-right: 1px solid #e2e8f0; padding: 14px 10px; flex-shrink: 0; }
.vg-side a { display: block; padding: 8px 10px; border-radius: 8px; color: #475569; font-size: 13px; text-decoration: none; margin-bottom: 2px; }
.vg-side a:hover { background: #f1f5f9; }
.vg-side a.on { background: #eff6ff; color: #1d4ed8; font-weight: 600; }
.vg-side .grp { font-size: 11px; color: #94a3b8; padding: 12px 10px 4px; }
.vg-main { flex: 1; padding: 20px; overflow-x: auto; }

/* ===== 移动端适配（手机/平板窄屏） ===== */
@media (max-width: 768px) {
  /* 顶栏：允许横向滚动，避免挤压换行 */
  .vg-topbar { padding: 0 12px; gap: 10px; overflow-x: auto; }
  .vg-topbar .brand { font-size: 13px; white-space: nowrap; }
  .vg-topbar .nav { gap: 10px; flex-shrink: 0; }
  .vg-topbar .nav a { font-size: 12px; white-space: nowrap; }

  /* 侧栏改为顶部横向滑动导航 */
  .vg-body { flex-direction: column; min-height: auto; }
  .vg-side {
    width: 100%; display: flex; flex-wrap: nowrap; align-items: center;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    border-right: 0; border-bottom: 1px solid #e2e8f0;
    padding: 8px 10px; gap: 6px;
  }
  .vg-side .grp { display: none; }
  .vg-side a { margin: 0; padding: 7px 12px; white-space: nowrap; background: #f8fafc; font-size: 12px; flex-shrink: 0; }

  .vg-main { padding: 12px; }

  /* 标题区与操作区 */
  .vg-hd h2 { font-size: 17px; }
  .vg-hd .sub { font-size: 11px; }
  .vg-actions { width: 100%; }
  .vg-actions .vg-btn { font-size: 12px; padding: 5px 10px; }
  .vg-actions .vg-input.w-sm, .vg-actions .vg-input.w-md, .vg-actions .vg-input.w-lg { width: 100%; }

  /* KPI 卡片更紧凑 */
  .vg-kpis { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; }
  .vg-kpi { padding: 10px 12px; border-radius: 10px; }
  .vg-kpi .lb { font-size: 11px; }
  .vg-kpi .val { font-size: 17px; }

  /* 表格卡片：宽表横向滚动，不撑破页面 */
  .vg-card-bd, .vg-card-bd.p0 { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .vg-table th, .vg-table td { padding: 8px 10px; }
  .vg-table .op a { margin-right: 10px; }

  /* 表单与弹窗 */
  .vg-form-grid { grid-template-columns: 1fr; }
  .vg-modal { padding: 14px 8px; }
  .vg-modal-body { padding: 12px; }
  .vg-modal-foot { padding: 10px 12px; }
  .vg-field label { font-size: 11px; }

  /* 播放页：上视频 + 下选集，列表限高可滑 */
  .vg-play-wrap { flex-direction: column; gap: 12px; }
  .vg-play-main, .vg-play-side { width: 100%; flex: 1 1 auto; margin-bottom: 0; }
  .vg-play-main video { max-height: 58vh; object-fit: contain; }
  .vg-play-meta { flex-wrap: wrap; font-size: 12px; }
  .vg-play-side .vg-card-bd.p0 { max-height: 42vh; overflow-y: auto; }
  .vg-play-item td { padding: 11px 12px; }

  /* 分镜编辑表：横向滚动 */
  .vg-shots-editor { min-width: 860px; }
  .vg-refs img { width: 56px; height: 56px; }
}

@media (max-width: 420px) {
  .vg-topbar .brand { font-size: 12px; }
  .vg-kpis { grid-template-columns: repeat(2, 1fr); }
  .vg-hd h2 { font-size: 16px; }
}
