/* =========================================================
   RSS 订阅管理系统 - 前台样式
   完全对标 newsnow.world（v0.0.42）设计
   ========================================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #1c1c1e;            /* body 背景 rgb(28,28,30) */
  --text: #d4d4d4;          /* 主文字 rgb(212,212,212) */
  --text-dim: rgba(212,212,212,.7);
  --text-faint: rgba(212,212,212,.5);
  --primary: #F14D42;       /* 主题红 */
  --primary-soft: #f87171;  /* 激活浅红 rgb(248,113,113) */
  --primary-10: rgba(241,77,66,.1); /* hover 背景 */
  --blue: #60a5fa;          /* 蓝色标签 */
  --radius: 16px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ============ 顶栏（毛玻璃，3 段式） ============ */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(28, 28, 30, .75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.topbar-inner {
  display: flex; align-items: center; gap: 16px;
  max-width: 1600px; margin: 0 auto;
  padding: 16px 20px;
}

/* 品牌 */
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; min-width: 0; }
.brand-ico {
  width: 40px; height: 40px; border-radius: 999px; object-fit: cover;
  flex: 0 0 40px;
}
.brand-ico-fallback {
  width: 40px; height: 40px; border-radius: 999px; flex: 0 0 40px;
  background: linear-gradient(135deg, #F14D42, #ff8a7a);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px;
}
.brand-name {
  font-size: 24px; font-weight: 700; letter-spacing: .5px; color: var(--text);
  line-height: 1.1; white-space: nowrap;
}
.brand-name .accent { color: var(--primary); }
.brand-ver { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--text-faint); margin-top: 2px; }

/* 分类导航（对标 newsnow tab） */
.nav { display: flex; align-items: center; gap: 2px; flex: 1; justify-content: center; }
.nav a {
  color: var(--text); font-size: 14px; text-decoration: none;
  padding: 4px 10px; border-radius: 6px; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.nav a:hover { background: var(--primary-10); }
.nav a.active { color: var(--primary-soft); font-weight: 700; }

/* 右侧操作 */
.topbar-right { display: flex; align-items: center; gap: 14px; justify-content: flex-end; }
.update-time { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.admin-link {
  color: var(--text); font-size: 14px; text-decoration: none;
  padding: 4px 10px; border-radius: 6px; white-space: nowrap;
  transition: background .15s ease;
}
.admin-link:hover { background: var(--primary-10); }

/* ============ 主体 ============ */
main {
  margin-top: 8px;
  min-height: calc(100vh - 180px);
  max-width: 1600px; margin-left: auto; margin-right: auto;
  padding: 0 20px 32px;
}

.category { scroll-margin-top: 90px; margin-bottom: 32px; }
.category-title {
  display: flex; align-items: baseline; gap: 12px;
  font-size: 18px; font-weight: 700; color: var(--text);
  padding: 14px 8px 10px;
}
.category-title .count { font-size: 13px; font-weight: 400; color: var(--text-faint); }

/* 卡片网格（对标 newsnow ol.grid：gap-24 双列起） */
.feed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(400px, 100%), 1fr));
  gap: 24px;
  list-style: none;
}

/* 卡片（主题色由内联 --cc 驱动：有图标取图标主色，无图标现代色板） */
.feed-card {
  --cc: #60a5fa;
  display: flex; flex-direction: column;
  border-radius: var(--radius);
  padding: 16px;
  cursor: default;
  background: color-mix(in srgb, var(--cc) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--cc) 22%, transparent);
  transition: background .2s ease, border-color .2s ease;
}
.feed-card:hover {
  background: color-mix(in srgb, var(--cc) 16%, transparent);
  border-color: color-mix(in srgb, var(--cc) 45%, transparent);
}

/* 卡片头部 */
.feed-head {
  display: flex; justify-content: space-between; align-items: center;
  margin: 0 8px 8px; gap: 12px;
}
.feed-head-left { display: flex; gap: 12px; align-items: center; min-width: 0; }
.feed-icon, .feed-icon-fallback {
  width: 40px; height: 40px; border-radius: 999px; object-fit: cover; flex: 0 0 40px;
}
.feed-icon-fallback {
  background: var(--cc, #60a5fa); color: #fff; font-weight: 800; font-size: 18px;
  display: inline-flex; align-items: center; justify-content: center;
}
.feed-titles { display: flex; flex-direction: column; min-width: 0; }
.feed-name-row { display: flex; align-items: center; gap: 6px; }
.feed-name { font-size: 20px; font-weight: 700; line-height: 1.4; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-cat {
  font-size: 14px; color: var(--blue);
  background: rgba(28,28,30,.5); padding: 0 4px; border-radius: 4px;
  flex: 0 0 auto; line-height: 1.4;
}
.feed-badge {
  font-size: 10px; padding: 1px 6px; border-radius: 8px;
  flex: 0 0 auto; line-height: 1.4; font-weight: 500;
}
.badge-new { background: rgba(10,132,255,.2); color: #0a84ff; }
.badge-hot { background: rgba(255,149,0,.2); color: #ff9500; }
.feed-time { font-size: 12px; color: var(--text-dim); opacity: .7; line-height: 1.3; margin-top: 1px; }

/* ============ 卡片操作图标统一规范 ============
   尺寸 14px / 默认 #8f8f8f / 点击(激活) #5f5f5f / 统一 28×28 热区
   适用于：复制RSS、举报、历史文章等操作图标（心跳为状态指示，保留语义色） */
.feed-head-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.feed-head-right .icon-btn,
.feed-head-right .more-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0; margin: 0;
  border: none; border-radius: 8px;
  background: transparent;
  color: #8f8f8f;
  font-size: 14px; line-height: 1; text-decoration: none;
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}
.feed-head-right .icon-btn .fas,
.feed-head-right .more-link .fas { font-size: 14px; line-height: 1; }
.feed-head-right .icon-btn:hover,
.feed-head-right .more-link:hover,
.feed-head-right .icon-btn:active,
.feed-head-right .more-link:active { color: #5f5f5f; background: rgba(143,143,143,.14); }
.feed-head-right .icon-btn:focus-visible,
.feed-head-right .more-link:focus-visible { outline: 2px solid rgba(143,143,143,.6); outline-offset: 1px; }
/* 心跳：状态指示，正常红色动态 / 异常灰色静止；热区与其他图标一致 */
.heart {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; font-size: 14px; line-height: 1;
  flex: 0 0 auto; user-select: none;
}
.heart-on  { color: #ef4444; animation: heart-beat 1.2s ease-in-out infinite; }
.heart-off { color: #6b7280; }
@keyframes heart-beat {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.3); }
  45% { transform: scale(1); }
  60% { transform: scale(1.2); }
}

/* 加载更多按钮 */
.load-more-wrap { display: flex; justify-content: center; margin: 28px 0 10px; }
.load-more-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 28px;
  background: rgba(255,255,255,.06);
  color: #d4d4d4;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  font-size: 14px; cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all .2s ease;
}
.load-more-btn:hover {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.25);
  transform: translateY(-1px);
}
.load-more-btn:disabled { opacity: .6; cursor: not-allowed; }
.lm-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: lm-spin .8s linear infinite;
}
@keyframes lm-spin { to { transform: rotate(360deg); } }

/* 文章列表：精确显示 10 条（10×~31px），超出滚动（细滚动条跟随卡片主题色） */
.article-list {
  list-style: none; display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto; flex: 1; min-height: 0;
  max-height: 314px;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--cc) 35%, transparent) transparent;
}
.article-list::-webkit-scrollbar { width: 6px; }
.article-list::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--cc) 30%, transparent);
  border-radius: 3px;
}
.article-list::-webkit-scrollbar-track { background: transparent; }
.article-item {
  display: flex; align-items: baseline; gap: 10px;
  border-radius: 8px; padding: 3px 6px 3px 8px;
  transition: background .15s ease;
}
.article-item:hover { background: var(--primary-10); }
.article-item .a-index {
  font-size: 14px; color: var(--cc, var(--text-faint)); flex: 0 0 auto;
  font-family: ui-monospace, Consolas, monospace; min-width: 24px; text-align: right;
  opacity: .7;
}
.article-item a {
  color: var(--text); text-decoration: none; font-size: 15px; line-height: 1.45;
  display: block; min-width: 0; flex: 1;
  overflow: hidden;
}
.article-item .a-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.article-item .a-time {
  font-size: 12px; color: var(--text-faint); flex: 0 0 auto; font-family: ui-monospace, Consolas, monospace;
}
.no-article { color: var(--text-faint); font-size: 14px; padding: 8px; }

/* 空状态 */
.empty { text-align: center; padding: 90px 0; color: var(--text-dim); }
.empty .sub { color: var(--text-faint); font-size: 14px; margin-top: 8px; }

/* ============ 页脚 ============ */
.footer { border-top: 1px solid rgba(212,212,212,.08); padding: 24px 20px 32px; margin-top: 40px; }
.footer .container { max-width: 1600px; margin: 0 auto; text-align: center; }
.footer p { color: var(--text-faint); font-size: 13px; line-height: 1.9; }
.footer a { color: var(--text-faint); text-decoration: none; }
.footer a:hover { color: var(--text-dim); }
.copyright-row {
  display: flex; justify-content: center; align-items: center;
  gap: 16px; flex-wrap: wrap; margin-bottom: 8px;
}
.disclaimer { font-size: 12px; color: var(--text-faint); opacity: .7; max-width: 700px; margin: 0 auto; }

/* 返回顶部按钮 */
#backTop {
  position: fixed; right: 24px; bottom: 24px; z-index: 900;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(28,28,30,.85); color: #d4d4d4;
  border: 1px solid rgba(255,255,255,.12);
  font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .2s, transform .2s, visibility .2s;
  backdrop-filter: blur(8px);
}
#backTop.show { opacity: 1; visibility: visible; transform: translateY(0); }
#backTop:hover { background: rgba(28,28,30,1); color: #fff; }

/* 响应式 */
@media (max-width: 860px) {
  .nav { display: none; }
  .brand-name { font-size: 20px; }
  .topbar-inner { padding: 12px 14px; }
  .feed-grid { grid-template-columns: minmax(0, 1fr); }
  main { padding: 0 14px 24px; }
}

/* ============ 响应式设计 ============ */

/* 平板端（< 1024px） */
@media (max-width: 1024px) {
  .feed-grid {
    gap: 16px !important;
  }
  .topbar-inner {
    padding: 12px 16px !important;
  }
  .nav {
    gap: 12px !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
  }
  .nav::-webkit-scrollbar { display: none !important; }
}

/* 手机端（< 768px） */
@media (max-width: 768px) {
  main {
    padding: 0 12px 24px !important;
  }
  .feed-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
  }
  .topbar-inner {
    padding: 12px !important;
    gap: 8px !important;
  }
  .brand-name {
    font-size: 16px !important;
  }
  .brand-ver {
    display: none !important;
  }
  .update-time {
    display: none !important;
  }
  .category-title {
    font-size: 18px !important;
    padding: 0 12px !important;
  }
  .feed-card {
    border-radius: 12px !important;
    overflow: hidden !important;
  }
  .feed-head {
    padding: 12px !important;
  }
  .feed-icon {
    width: 32px !important;
    height: 32px !important;
  }
  .feed-name {
    font-size: 14px !important;
  }
  .feed-list {
    padding: 0 12px 12px !important;
  }
  .feed-list li {
    padding: 8px 0 !important;
    font-size: 13px !important;
    word-break: break-word !important;
  }
  .footer {
    padding: 24px 12px !important;
    font-size: 12px !important;
  }
  .back-top {
    width: 40px !important;
    height: 40px !important;
    font-size: 18px !important;
    bottom: 16px !important;
    right: 16px !important;
  }
}

/* 文章列表淡入动画（卡片填充后） */
.feed-card.visible .article-list {
  animation: fadeInUp 0.4s ease-out;
}
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/* ============ 卡片操作按钮（复制 / 举报 / 历史） ============
   具体规范见上方「卡片操作图标统一规范」，此处仅保留加载更多/API 动态
   卡片复用的兜底声明，防止动态插入的卡片漏样式 */
.feed-card .icon-btn,
.feed-card .more-link { color: #8f8f8f; }

/* 文章行右侧发布时间（10-26） */
.article-item .a-time {
  flex: 0 0 auto; padding-left: 8px;
  font-size: 12px; color: var(--text-faint);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
