/* ============================================
   Swiss News — 每日资讯模块（卡片/骨架屏/详情浮层/引导/撤销条/激活页）
   依赖：variables.css, layout.css
   ============================================ */

/* ============================================
   News Module
   ============================================ */
.news-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-md);
}

.news-tab {
  padding: var(--sp-sm) var(--sp-lg);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all .15s;
}

.news-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.news-refresh {
  font-size: 11px;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.news-refresh:hover { color: var(--accent); }

/* 新闻卡片网格 — 桌面 2 列 / 手机 1 列 */
.news-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-md);
  height: auto;
  min-height: 320px;
  max-height: 560px;
  overflow-y: auto;
  overflow-x: hidden;
  align-content: start;
  transition: opacity 0.2s ease;
  padding: 2px;
}
.news-list.fading { opacity: 0; }

/* 新闻卡片 */
.news-item {
  display: flex;
  flex-direction: row;
  height: auto;
  min-height: 120px;
  gap: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
  background: var(--card);
  position: relative;
  align-items: stretch;
}
.news-item:hover {
  box-shadow: 0 0 0 1px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.06);
  border-color: var(--text-faint);
}

/* 卡片元素 */
.news-card-bar {
  width: 4px;
  flex-shrink: 0;
  align-self: stretch;
}

.news-card-body {
  flex: 1;
  min-width: 0;
  padding: var(--sp-md);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.news-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-card-title-en {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-card-summary {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.news-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-sm) var(--sp-md);
  border-top: 1px solid var(--border-light);
  font-size: 10px;
  margin-top: auto;
}

.news-card-source {
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

.news-card-time {
  font-size: 10px;
  color: var(--text-faint);
  white-space: nowrap;
  flex-shrink: 0;
}

.news-card-star {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 14px;
  color: var(--text-faint);
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 3px;
  transition: all 0.15s;
  z-index: 2;
  line-height: 1;
}
.news-card-star:hover {
  color: var(--accent);
  background: var(--accent-light);
}
.news-card-star.bookmarked { color: var(--accent); }

/* 简单列表项（稍后再看 / 收藏 Tab 用） */
.news-item-simple {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-md);
  height: auto;
  min-height: 48px;
  padding: var(--sp-sm) 0;
  border-bottom: 1px solid var(--border-light);
  grid-column: 1 / -1;
}

/* Tab 条目计数徽章 */
.news-tab-count {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-faint);
  background: var(--border-light);
  border-radius: 3px;
  padding: 0 5px;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 16px;
  min-width: 16px;
  text-align: center;
}
.news-tab.active .news-tab-count {
  background: var(--accent-light);
  color: var(--accent);
}

.news-meta {
  display: flex;
  gap: var(--sp-sm);
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 2px;
}

.news-loading,
.news-error,
.news-empty {
  text-align: center;
  padding: var(--sp-2xl);
  font-size: 12px;
  color: var(--text-secondary);
  grid-column: 1 / -1;
}

/* ============================================
   Skeleton Screen（骨架屏加载动画）
   ============================================ */
.skeleton-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-md);
  padding: 2px;
}

.skeleton-card {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 120px;
  overflow: hidden;
  flex-shrink: 0;
}

/* 模拟来源色条 */
.skeleton-card::before {
  content: '';
  width: 4px;
  flex-shrink: 0;
  background: var(--border-light);
}

.skeleton-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: var(--sp-md);
}

.skeleton-line {
  height: 13px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--border-light) 25%, var(--border) 37%, var(--border-light) 63%);
  background-size: 400% 100%;
  animation: skeletonPulse 1.6s ease-in-out infinite;
}

.skeleton-line:first-child { width: 85%; }

.skeleton-line:nth-child(2) { width: 95%; height: 11px; }

.skeleton-line:nth-child(3) { width: 50%; height: 10px; }

.skeleton-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  flex-shrink: 0;
  width: 80px;
  padding: var(--sp-md) var(--sp-md) var(--sp-md) 0;
}

.skeleton-meta .skeleton-line { width: 70%; height: 10px; }

.skeleton-meta .skeleton-line:last-child { width: 50%; }

@keyframes skeletonPulse {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ============================================
   C4: Onboarding 引导浮层
   ============================================ */
.onboarding-panel {
  max-width: 480px;
  width: 92%;
}

.onboarding-subjects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.onboarding-subject-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.onboarding-subject-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.onboarding-subject-chip.on {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.onboarding-suggested {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.onboarding-kw-chip {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.onboarding-kw-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.onboarding-kw-chip.on {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Loading spinner */
.onboarding-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

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

/* 新闻条目旧版样式（为兼容性保留部分类） */
.detail-title-en {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: -8px 0 14px 0;
  padding-right: 30px;
}

.news-source {
  font-size: 10px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.news-time {
  font-size: 10px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* 操作按钮（旧版兼容） */
.news-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.news-action-btn {
  font-size: 13px;
  padding: 2px 5px;
  border-radius: 3px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  transition: all .15s;
  line-height: 1;
}

.news-action-btn:hover { color: var(--accent); background: var(--accent-light); }

.news-action-btn.bookmarked { color: var(--accent); }

/* 模块头部操作区 */
.module-head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.news-settings-btn {
  font-size: 14px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  cursor: pointer;
  transition: all .15s;
  background: transparent;
}

.news-settings-btn:hover { color: var(--text); background: var(--border-light); }

/* 新闻底部 */
.news-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--sp-sm);
  border-top: 1px solid var(--border-light);
  margin-top: var(--sp-sm);
  grid-column: 1 / -1;
}

.news-footer-text {
  font-size: 10px;
  color: var(--text-faint);
}

.news-refresh-small {
  font-size: 10px;
  color: var(--text-faint);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
}

.news-refresh-small:hover { color: var(--accent); }

/* ============================================
   C3: Dislike 关闭按钮 + 动画 + 撤销条
   ============================================ */

/* 卡片关闭按钮 — 右上角，hover 显示 */
.news-card-close {
  position: absolute;
  top: 6px;
  right: 28px;
  font-size: 16px;
  color: var(--text-faint);
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 3px;
  transition: all 0.15s;
  z-index: 2;
  line-height: 1;
  opacity: 0;
}

.news-item:hover .news-card-close { opacity: 1; }

.news-card-close:hover {
  color: #9B4A3A;
  background: rgba(155, 74, 58, 0.08);
}

/* 卡片滑出动画 */
.news-item.removing {
  animation: slideOutRight 0.2s ease-in forwards;
  pointer-events: none;
}

/* 补位卡片滑入动画 */
.news-item.replacing {
  animation: slideInRight 0.2s ease-out;
}

@keyframes slideOutRight {
  0%   { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(60px); }
}

@keyframes slideInRight {
  0%   { opacity: 0; transform: translateX(60px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* ---- Undo Bar（底部撤销条）---- */
.undo-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: rgba(30, 30, 30, 0.92);
  color: #fff;
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 -2px 16px rgba(0,0,0,0.25);
}

.undo-bar.show { transform: translateY(0); }

.undo-bar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  max-width: 720px;
  margin: 0 auto;
  position: relative;
}

.undo-bar-text {
  font-size: 13px;
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.undo-bar-btn {
  font-size: 12px;
  font-weight: 650;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 4px;
  padding: 6px 16px;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.undo-bar-btn:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.7);
}

/* 倒计时进度条 */
.undo-bar-countdown {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255,255,255,0.15);
}

.undo-bar-countdown-fill {
  height: 100%;
  width: 100%;
  background: #CC3333;
  transition: width 5s linear;
}

/* 论文激活引导页 */
.news-activation {
  text-align: center;
  padding: var(--sp-2xl) var(--sp-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-sm);
  grid-column: 1 / -1;
}
.news-activation-icon {
  font-size: 44px;
  margin-bottom: var(--sp-sm);
}
.news-activation-title {
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
}
.news-activation-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 340px;
}
.news-activation-hint {
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 4px;
}

/* 激活表单 */
.news-activation-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.news-activation-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13px;
  font-family: var(--font-mono);
  background: var(--bg-warm);
  color: var(--text);
  transition: border-color .15s;
  max-width: 280px;
}

.news-activation-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--card);
}

.news-activation-input::placeholder {
  color: var(--text-faint);
  font-family: var(--font);
  font-size: 12px;
}

/* 激活状态提示 */
.news-activation-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  margin-top: 8px;
  padding: 4px 12px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity .2s;
}

.news-activation-status.visible { opacity: 1; }

.news-activation-status.success {
  background: rgba(46,125,50,0.08);
  color: #2E7D32;
}

.news-activation-status.error {
  background: rgba(204,51,51,0.08);
  color: #C62828;
}

/* ============================================
   Detail Overlay（资讯详情浮层）
   ============================================ */
.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 92vw;
  background: var(--card);
  box-shadow: var(--shadow-float);
  z-index: 210;
  overflow-y: auto;
  padding: var(--sp-xl) var(--sp-2xl);
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}

.overlay.show .detail-panel { transform: translateX(0); }

.detail-close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 22px;
  color: var(--text-faint);
  cursor: pointer;
  background: transparent;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color .12s;
}

.detail-close:hover { color: var(--text); }

.detail-title {
  font-size: 16px;
  font-weight: 650;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: var(--sp-lg);
  padding-right: 30px;
}

.detail-meta-row {
  display: flex;
  gap: var(--sp-sm);
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.5;
}

.detail-meta-label {
  color: var(--text-faint);
  flex-shrink: 0;
  min-width: 56px;
}

.detail-keywords { display: flex; flex-wrap: wrap; gap: 4px; }

.detail-tag {
  display: inline-block;
  font-size: 10px;
  padding: 2px 8px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 3px;
  white-space: nowrap;
}

.detail-divider {
  height: 1px;
  background: var(--border);
  margin: var(--sp-lg) 0;
}

.detail-summary {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  max-height: 40vh;
  overflow-y: auto;
}

.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-feedback-row {
  display: flex;
  gap: 6px;
  padding: 8px 0;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.detail-btn-feedback {
  flex: 1;
  padding: 5px 4px;
  font-size: 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.detail-btn-feedback:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

/* 反馈按钮 — 点击后变色 */
.detail-btn-feedback.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  pointer-events: none;
}

.detail-btn-feedback.active.like    { background: #2E7D32; border-color: #2E7D32; }
.detail-btn-feedback.active.neutral { background: #6D6D6D; border-color: #6D6D6D; }
.detail-btn-feedback.active.dislike { background: #9B4A3A; border-color: #9B4A3A; }

/* 详情浮层 — 💡 值得关注高亮块 */
.detail-highlight {
  background: rgba(204, 51, 51, 0.10);
  border: 1px solid rgba(204, 51, 51, 0.15);
  border-left: 3px solid #CC3333;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: var(--sp-md) 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.detail-highlight-icon {
  font-size: 16px;
  flex-shrink: 0;
  line-height: 1.5;
}

.detail-highlight-text {
  font-size: 12px;
  color: #5D4037;
  line-height: 1.6;
  font-weight: 500;
}

/* 原文链接 */
.detail-source-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  padding: 6px 0;
  transition: color .12s;
}

.detail-source-link:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

/* 详情浮层 — 底部反馈提示条（滑入动画） */
.detail-toast-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 220;
  background: var(--text);
  color: #fff;
  text-align: center;
  padding: 14px 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.15);
}

.detail-toast-bar.show {
  transform: translateY(0);
}

.detail-toast-bar.success { background: #2E7D32; }
.detail-toast-bar.info    { background: #37474F; }

/* 移动端详情浮层 */
@media (max-width: 480px) {
  .detail-panel {
    width: 100vw;
    max-width: 100vw;
    padding: var(--sp-lg);
  }

  .detail-title { font-size: 14px; }

  .news-tab {
    font-size: 11px;
    padding: var(--sp-sm) 6px;
  }

  /* 移动端：详情浮层底部固定操作栏 */
  .detail-actions {
    position: sticky;
    bottom: 0;
    background: var(--card);
    padding: 12px 0;
    margin-top: auto;
    border-top: 1px solid var(--border);
    z-index: 5;
  }
}
