/* 三版文案对比（Codex / ClaudeAPI / Gemini-4-Neon）与主线美学优化 */
:root {
  --wb-radius-lg: 14px;
  --wb-radius-md: 10px;
  --wb-radius-sm: 8px;
  --wb-shadow-card: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
  --wb-shadow-hover: 0 4px 12px rgba(15, 23, 42, 0.08);
}

/* 顶部主线步骤条：找高赞 -> 做笔记 -> 发布管理 */
.wb-flow-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  padding: 4px 10px;
  background: var(--ui-surface-soft, #f5f7fa);
  border: 1px solid var(--ui-line, #e4e7ed);
  border-radius: 999px;
  font-size: 12px;
}
.wb-flow-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ui-secondary, #606266);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.16s ease;
}
.wb-flow-step:hover {
  color: var(--ui-text, #303133);
  background: var(--ui-surface, #ffffff);
}
.wb-flow-step.is-active {
  background: var(--ui-accent, #409eff);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(64, 158, 255, 0.28);
}
.wb-flow-step-num {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(128, 128, 128, 0.16);
  font-size: 11px;
  font-weight: 700;
}
.wb-flow-step.is-active .wb-flow-step-num {
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}
.wb-flow-arrow {
  color: var(--ui-muted, #909399);
  font-size: 12px;
  user-select: none;
}

/* 卡片与列表整体质感提升 */
.workspace .card,
.viral-notes,
.notes-overview {
  border-radius: var(--wb-radius-lg);
}
.workspace .card {
  box-shadow: var(--wb-shadow-card);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.workspace .card:hover {
  box-shadow: var(--wb-shadow-hover);
}

/* 三版文案生成与并排对比面板 */
.tri-copy-panel {
  grid-column: 1 / -1;
  background: var(--ui-surface, #ffffff);
  border: 1px solid var(--ui-line, #e4e7ed);
  border-radius: var(--wb-radius-lg);
  box-shadow: var(--wb-shadow-card);
  padding: 18px 20px;
  margin-bottom: 4px;
}
.tri-copy-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ui-line, #ebeef5);
}
.tri-copy-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tri-copy-title-wrap h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ui-text, #303133);
}
.tri-copy-badge {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--ui-accent-soft, #ecf5ff);
  color: var(--ui-accent, #409eff);
  font-size: 11px;
  font-weight: 600;
}
.tri-copy-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
}
.tri-copy-instruction {
  min-width: 240px;
  flex: 1;
  max-width: 440px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--ui-border, #dcdfe6);
  border-radius: var(--wb-radius-sm);
  background: var(--ui-surface-soft, #f8fafc);
  color: var(--ui-text, #303133);
  font-size: 13px;
}
.tri-copy-instruction:focus {
  outline: none;
  border-color: var(--ui-accent, #409eff);
  background: var(--ui-surface, #ffffff);
}
.tri-copy-run-btn {
  height: 36px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--wb-radius-sm);
  background: linear-gradient(135deg, #2563eb, #409eff);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
  transition: transform 0.12s ease, filter 0.15s ease;
}
.tri-copy-run-btn:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-1px);
}
.tri-copy-run-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.tri-copy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.tri-copy-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ui-line, #e4e7ed);
  border-radius: var(--wb-radius-md);
  background: var(--ui-surface-soft, #fafbfc);
  overflow: hidden;
  min-height: 240px;
  max-height: 360px;
}
.tri-copy-card.is-adopted {
  border-color: #67c23a;
  box-shadow: 0 0 0 1px rgba(103, 194, 58, 0.35);
}
.tri-copy-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: var(--ui-surface, #ffffff);
  border-bottom: 1px solid var(--ui-line, #ebeef5);
}
.tri-copy-model-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ui-text, #303133);
}
.tri-copy-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c0c4cc;
}
.tri-copy-dot.is-running { background: #e6a23c; animation: tri-pulse 1.2s infinite; }
.tri-copy-dot.is-succeeded { background: #67c23a; }
.tri-copy-dot.is-failed { background: #f56c6c; }
@keyframes tri-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.tri-copy-status {
  font-size: 11px;
  color: var(--ui-muted, #909399);
}
.tri-copy-card-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--ui-text, #303133);
  white-space: pre-wrap;
  word-break: break-word;
}
.tri-copy-placeholder {
  color: var(--ui-muted, #909399);
  font-size: 12px;
}
.tri-copy-error {
  color: #f56c6c;
  font-size: 12px;
}
.tri-copy-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 14px;
  background: var(--ui-surface, #ffffff);
  border-top: 1px solid var(--ui-line, #ebeef5);
}
.tri-copy-btn-sm {
  padding: 5px 11px;
  border: 1px solid var(--ui-border, #dcdfe6);
  border-radius: 6px;
  background: var(--ui-surface, #ffffff);
  color: var(--ui-secondary, #606266);
  font-size: 12px;
  cursor: pointer;
}
.tri-copy-btn-sm:hover:not(:disabled) {
  border-color: var(--ui-accent, #409eff);
  color: var(--ui-accent, #409eff);
}
.tri-copy-btn-adopt {
  background: var(--ui-accent-soft, #ecf5ff);
  border-color: var(--ui-accent-line, #b3d8ff);
  color: var(--ui-accent, #337ecc);
  font-weight: 600;
}
.tri-copy-btn-adopt:hover:not(:disabled) {
  background: var(--ui-accent, #409eff);
  color: #ffffff;
}
.tri-copy-btn-sm:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 1100px) {
  .tri-copy-grid { grid-template-columns: 1fr; }
  .wb-flow-stepper { display: none; }
}

/* 手机端专属优化：单手操作、大按钮、卡片化、一键复制 */
.wb-mobile-bottom-nav {
  display: none;
}
.wb-toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  z-index: 9999;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.9);
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.wb-toast.is-show {
  opacity: 1;
}
.wb-mobile-copy-bar {
  display: none;
}

@media (max-width: 760px) {
  body {
    padding-bottom: 16px;
  }
  input, textarea, select {
    font-size: 16px !important;
  }
  /* 已移除底部「1 找高赞 / 2 做笔记 / 3 发布管理」栏，保持隐藏 */
  .wb-mobile-bottom-nav,
  .wb-flow-stepper {
    display: none !important;
  }
  .wb-mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 0;
    background: transparent;
    color: var(--ui-secondary, #606266);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
  }
  .wb-mobile-nav-btn.is-active {
    color: var(--ui-accent, #409eff);
    font-weight: 700;
  }
  .wb-mobile-nav-num {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 11px;
    background: var(--ui-surface-soft, #f5f7fa);
  }
  .wb-mobile-nav-btn.is-active .wb-mobile-nav-num {
    background: var(--ui-accent, #409eff);
    color: #ffffff;
  }

  /* 手机端编辑页快捷复制条 */
  .wb-mobile-copy-bar {
    display: flex;
    gap: 8px;
    width: 100%;
    margin: 8px 0 4px;
  }
  .wb-mobile-copy-btn {
    flex: 1;
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid var(--ui-accent-line, #b3d8ff);
    border-radius: 10px;
    background: var(--ui-accent-soft, #ecf5ff);
    color: var(--ui-accent, #337ecc);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
  }
  .wb-mobile-copy-btn.is-primary {
    background: #409eff;
    border-color: #409eff;
    color: #ffffff;
  }

  /* 三版文案在手机上更易点按 */
  .tri-copy-panel {
    padding: 14px;
  }
  .tri-copy-controls {
    width: 100%;
  }
  .tri-copy-instruction {
    min-width: 0;
    width: 100%;
    max-width: none;
    height: 42px;
  }
  .tri-copy-run-btn {
    width: 100%;
    height: 44px;
    font-size: 15px;
  }
  .tri-copy-card {
    max-height: none;
    min-height: 180px;
  }
  .tri-copy-btn-sm {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 13px;
  }

  /* 手机端滚动与触摸修复：
     1. 绝不给外层滚动父级强加 overflow-y: auto，否则会把整页变成内部滚动容器，导致 iOS/安卓手势卡死或抢占表格横向滚动；
     2. 表格横向滚动容器明确 touch-action: pan-x pan-y + overflow-x: auto，42条笔记(el-table)和普通表格都可流畅左右/上下滑；
     3. 编辑页 .note-layout 的 .note-grid 在手机端恢复单列流式，避免被双列桌面规则挤成两窄栏重叠。 */
  html,
  body {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
  }
  #app,
  .main,
  .main-content,
  .workspace,
  .viral-notes,
  .notes-overview,
  #series42-panel,
  .series42-page {
    overflow: visible !important;
    max-width: 100%;
    touch-action: pan-x pan-y;
  }
  .sidebar,
  #sidebar {
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
  }
  /* 表格内按钮换行和横向容器内可触控，允许先左右再上下 */
  .viral-table-wrap,
  .notes-table-wrap,
  .series42-table-wrap,
  .series42-day,
  .series42-history-panel,
  .series42-vue-history-panel {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
  }
  /* 42条笔记 Element UI 表格：让内部 body-wrapper 不撑破外层宽度，可在手机屏内流畅左右滑 */
  .series42-vue-table {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
  }
  .series42-vue-table > .el-table__header-wrapper,
  .series42-vue-table > .el-table__body-wrapper {
    width: 780px !important;
    min-width: 780px !important;
    overflow: visible !important;
  }
  /* 编辑页手机端卡片流恢复为单列，不让两张卡左右重叠 */
  .note-layout {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
  }
  .note-layout .note-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    width: 100% !important;
  }
  .note-layout .note-grid > .card,
  .note-layout .reports-sidebar > .card {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
  }
  .viral-notes,
  .notes-overview {
    padding: 14px 12px 24px !important;
  }
  .viral-filters,
  .notes-list-heading {
    gap: 8px !important;
  }
  .viral-filters > *,
  .notes-list-heading > * {
    min-height: 40px;
  }
  .viral-star-filters,
  .viral-pending-kind-filters,
  .notes-publication-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .viral-star-filters::-webkit-scrollbar,
  .viral-pending-kind-filters::-webkit-scrollbar,
  .notes-publication-tabs::-webkit-scrollbar {
    display: none;
  }
  .track-filter-chip {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .viral-table .rewrite-copy-action,
  .notes-table button,
  .viewer-toolbar-actions > button {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 13px;
  }
  .list-note-viewer[open] {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }
}
