/**
 * 28APK AI 工具导航 · Impeccable UI v4
 * - 浅色：雪松白雾面 + 电光靛蓝点缀 + 弥散阴影（Bento / Glass）
 * - 深色：深空黑 + 极光青辅助（html.aihub-theme-dark）
 * - 字体：Inter（layout 已 preconnect）+ 系统栈回退；行距加大以提升可读性
 * Hub：application/index/view/aitools/hub.html；与 public/static/modern_static.css 令牌对齐
 */

/* -------------------------------------------------------------------------
   设计令牌（浅色默认）— 深邃蓝主色 + 呼吸留白
   ------------------------------------------------------------------------- */
:root.aihub-theme-light,
:root:not(.aihub-theme-dark) {
  --ai-page-bg: #eef2ff;
  --ai-page-bg-2: #e2e8f0;
  --ai-surface: rgba(255, 255, 255, 0.58);
  --ai-surface-solid: #fbfcff;
  --ai-glass: rgba(255, 255, 255, 0.62);
  --ai-text: #0b1220;
  --ai-muted: #5c6578;
  --ai-accent: #1e3a8a;
  --ai-accent-2: #0891b2;
  --ai-border-soft: rgba(15, 23, 42, 0.07);
  --ai-shadow-sm: 0 6px 28px rgba(15, 23, 42, 0.07);
  --ai-shadow-md: 0 20px 56px rgba(30, 58, 138, 0.12), 0 8px 24px rgba(15, 23, 42, 0.06);
  --ai-shadow-hover: 0 28px 72px rgba(30, 64, 175, 0.22), 0 14px 36px rgba(8, 145, 178, 0.12);
  --ai-radius-xl: 32px;
  --ai-radius-lg: 26px;
  --ai-radius-pill: 9999px;
  --ai-nav-pill-bg: rgba(255, 255, 255, 0.62);
  --ai-glow: rgba(56, 189, 248, 0.45);
  --ai-bento-gap: clamp(22px, 3.2vw, 40px);
}

:root.aihub-theme-dark {
  --ai-page-bg: #020617;
  --ai-page-bg-2: #0f172a;
  --ai-surface: rgba(15, 23, 42, 0.52);
  --ai-surface-solid: rgba(24, 33, 55, 0.94);
  --ai-glass: rgba(15, 23, 42, 0.68);
  --ai-text: #f8fafc;
  --ai-muted: #94a3b8;
  --ai-accent: #93c5fd;
  --ai-accent-2: #22d3ee;
  --ai-border-soft: rgba(148, 163, 184, 0.14);
  --ai-shadow-sm: 0 10px 36px rgba(0, 0, 0, 0.5);
  --ai-shadow-md: 0 22px 64px rgba(0, 0, 0, 0.58);
  --ai-shadow-hover: 0 32px 80px rgba(34, 211, 238, 0.18), 0 18px 48px rgba(0, 0, 0, 0.55);
  --ai-radius-xl: 32px;
  --ai-radius-lg: 26px;
  --ai-radius-pill: 9999px;
  --ai-nav-pill-bg: rgba(30, 41, 59, 0.55);
  --ai-glow: rgba(147, 197, 253, 0.5);
  --ai-bento-gap: clamp(22px, 3.2vw, 40px);
}

/* -------------------------------------------------------------------------
   页面衬底：抵消 layout 灰底（:has 现代浏览器）
   ------------------------------------------------------------------------- */
.site-main:has(.aihub-root),
.devhub-main:has(.aihub-root) {
  background: linear-gradient(180deg, var(--ai-page-bg) 0%, var(--ai-page-bg-2) 100%) !important;
}

/* -------------------------------------------------------------------------
   根容器：玻璃面板 + 超大圆角
   ------------------------------------------------------------------------- */
.aihub-root {
  --ai-font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-family: var(--ai-font);
  line-height: 1.75;
  color: var(--ai-text);
  background: var(--ai-surface);
  background: linear-gradient(148deg, rgba(255, 255, 255, 0.82), rgba(241, 245, 255, 0.92));
  border-radius: var(--ai-radius-xl);
  padding: clamp(22px, 3.2vw, 36px);
  margin-bottom: 12px;
  border: 1px solid var(--ai-border-soft);
  box-shadow: var(--ai-shadow-md);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  isolation: isolate;
}

:root.aihub-theme-dark .aihub-root {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.85), rgba(15, 23, 42, 0.92));
  box-shadow: var(--ai-shadow-md);
}

/* Bootstrap 文本色在 Hub 内收束 */
.aihub-root .text-muted {
  color: var(--ai-muted) !important;
}

.aihub-hint {
  font-size: 13px;
  line-height: 1.65;
  margin: -4px 0 20px;
  color: var(--ai-muted);
}

.aihub-hint strong {
  color: var(--ai-text);
  font-weight: 600;
}

/* -------------------------------------------------------------------------
   会员条
   ------------------------------------------------------------------------- */
.aihub-root--member {
  margin-bottom: 20px;
  padding: 14px 20px;
  border-radius: var(--ai-radius-lg);
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.08), rgba(14, 165, 233, 0.08));
  border: 1px solid var(--ai-border-soft);
  font-size: 13px;
  color: var(--ai-muted);
  text-align: center;
  box-shadow: var(--ai-shadow-sm);
}

.aihub-root--member strong {
  color: var(--ai-accent);
}

:root.aihub-theme-dark .aihub-root--member {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.15), rgba(14, 165, 233, 0.12));
}

/* -------------------------------------------------------------------------
   顶栏 + 主题切换（胶囊）
   ------------------------------------------------------------------------- */
.aihub-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.aihub-brand {
  font-weight: 800;
  letter-spacing: -0.035em;
  font-size: clamp(1.25rem, 2.5vw, 1.65rem);
  background: linear-gradient(110deg, #6366f1, #0ea5e9, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.aihub-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ai-muted);
  padding: 6px 8px 6px 14px;
  border-radius: var(--ai-radius-pill);
  background: var(--ai-nav-pill-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--ai-border-soft);
  box-shadow: var(--ai-shadow-sm);
}

.aihub-theme-toggle .aihub-theme-btn {
  border: none;
  background: transparent;
  color: var(--ai-muted);
  border-radius: var(--ai-radius-pill);
  padding: 8px 16px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.aihub-theme-toggle .aihub-theme-btn:hover {
  color: var(--ai-text);
}

.aihub-theme-toggle .aihub-theme-btn.is-active {
  background: linear-gradient(135deg, var(--ai-accent), var(--ai-accent-2));
  color: #fff !important;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.35);
}

/* -------------------------------------------------------------------------
   主布局：更宽侧栏 + 大 gutter
   ------------------------------------------------------------------------- */
.aihub-layout {
  display: grid;
  grid-template-columns: minmax(200px, 240px) 1fr;
  gap: var(--ai-bento-gap, clamp(22px, 3.2vw, 40px));
  align-items: start;
}

@media (max-width: 991px) {
  .aihub-layout {
    grid-template-columns: 1fr;
  }
}

/* -------------------------------------------------------------------------
   侧栏：毛玻璃 + 胶囊导航（非旧列表框）
   ------------------------------------------------------------------------- */
.aihub-nav {
  position: sticky;
  top: 80px;
  padding: 18px 14px;
  border-radius: var(--ai-radius-lg);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--ai-shadow-sm);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

:root.aihub-theme-dark .aihub-nav {
  background: rgba(15, 23, 42, 0.65);
  border-color: var(--ai-border-soft);
}

.aihub-nav__title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ai-muted);
  margin: 0 0 12px 10px;
}

.aihub-nav__btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ai-text);
  padding: 10px 14px;
  margin-bottom: 8px;
  border-radius: var(--ai-radius-pill);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.aihub-nav__btn:hover {
  background: rgba(99, 102, 241, 0.08);
  transform: translateX(4px);
}

.aihub-nav__btn.is-active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.18), rgba(14, 165, 233, 0.12));
  border-color: rgba(99, 102, 241, 0.25);
  color: var(--ai-accent);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.12);
  font-weight: 700;
}

:root.aihub-theme-dark .aihub-nav__btn.is-active {
  color: #e0e7ff;
}

.aihub-nav__ico {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--ai-accent);
  font-size: 13px;
  flex-shrink: 0;
}

.aihub-nav__ico .fa-solid {
  font-size: 13px;
  line-height: 1;
}

.aihub-nav__btn.is-active .aihub-nav__ico {
  background: linear-gradient(135deg, var(--ai-accent), var(--ai-accent-2));
  color: #fff;
}

.aihub-scenario-host {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--ai-border-soft);
}

.aihub-scenario-host .aihub-nav__title {
  margin-bottom: 8px;
}

.aihub-scenario-host .aihub-scenario a {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 4px;
  border-radius: var(--ai-radius-pill);
  font-size: 12px;
  color: var(--ai-accent);
  text-decoration: none;
  transition: background 0.15s ease;
}

.aihub-scenario-host .aihub-scenario a:hover {
  background: rgba(99, 102, 241, 0.08);
}

/* -------------------------------------------------------------------------
   Hub 导语：SEO 内链 + 编辑说明（浅色 / 深色可读）
   ------------------------------------------------------------------------- */
.aihub-lead {
  margin: 0 0 22px;
  padding: 16px 20px;
  border-radius: var(--ai-radius-lg);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(14, 165, 233, 0.05));
  border: 1px solid var(--ai-border-soft);
  box-shadow: var(--ai-shadow-sm);
  font-size: 14px;
  line-height: 1.75;
  color: var(--ai-text);
}

.aihub-lead p {
  margin: 0 0 10px;
}

.aihub-lead p:last-child {
  margin-bottom: 0;
}

.aihub-lead a {
  color: var(--ai-accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.aihub-lead__muted {
  font-size: 12px !important;
  color: var(--ai-muted) !important;
  line-height: 1.65 !important;
}

:root.aihub-theme-dark .aihub-lead {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(14, 165, 233, 0.08));
}

/* -------------------------------------------------------------------------
   网格：Product Hunt 级呼吸感
   ------------------------------------------------------------------------- */
.aihub-grid-wrap {
  min-width: 0;
}

.aihub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
  gap: var(--ai-bento-gap, clamp(22px, 3vw, 38px));
}

/* -------------------------------------------------------------------------
   卡片：无硬边框、超大圆角、弥散阴影、hover 上浮 + 光晕
   ------------------------------------------------------------------------- */
.aihub-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 200px;
  padding: 22px 22px 18px;
  border-radius: var(--ai-radius-lg);
  color: var(--ai-text) !important;
  background: var(--ai-surface-solid);
  border: none;
  box-shadow: var(--ai-shadow-sm);
  overflow: hidden;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.28s ease, outline-color 0.25s ease;
  outline: 1px solid transparent;
}

.aihub-card__main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  color: inherit !important;
  text-decoration: none !important;
}

.aihub-card__main:focus-visible {
  outline: 2px solid var(--ai-accent);
  outline-offset: 2px;
  border-radius: 12px;
}

.aihub-card__main:hover .aihub-card__title {
  color: var(--ai-accent);
}

:root.aihub-theme-dark .aihub-card {
  background: rgba(30, 41, 59, 0.75);
}

.aihub-card:hover {
  transform: translateY(-10px) scale(1.01);
  box-shadow: var(--ai-shadow-hover), 0 0 0 1px rgba(56, 189, 248, 0.2);
  outline-color: rgba(30, 64, 175, 0.35);
}

.aihub-card:focus-within {
  outline: 2px solid var(--ai-accent);
  outline-offset: 3px;
}

/* 微光描边（hover 增强） */
.aihub-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.28s ease;
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.25);
}

.aihub-card:hover::after {
  opacity: 1;
}

.aihub-card__icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 14px;
  background: linear-gradient(145deg, #4f46e5, #2563eb, #0ea5e9);
  color: #f8fafc;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
  letter-spacing: -0.02em;
}

.aihub-card__tags {
  position: absolute;
  top: 16px;
  right: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  max-width: 55%;
  pointer-events: none;
}

.aihub-tag {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: var(--ai-radius-pill);
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.aihub-tag--hot {
  background: linear-gradient(120deg, #fb923c, #ef4444, #f97316);
  background-size: 200% 200%;
  color: #fff;
  animation: aihub-shimmer-hot 2.4s ease-in-out infinite;
}

.aihub-tag--new {
  background: linear-gradient(120deg, #22c55e, #14b8a6, #10b981);
  background-size: 200% 200%;
  color: #fff;
  animation: aihub-shimmer-new 2.6s ease-in-out infinite;
}

@keyframes aihub-shimmer-hot {
  0%,
  100% {
    background-position: 0% 50%;
    filter: brightness(1);
    box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.35);
  }
  50% {
    background-position: 100% 50%;
    filter: brightness(1.08);
    box-shadow: 0 0 14px 2px rgba(249, 115, 22, 0.35);
  }
}

@keyframes aihub-shimmer-new {
  0%,
  100% {
    background-position: 100% 50%;
    filter: brightness(1);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.3);
  }
  50% {
    background-position: 0% 50%;
    filter: brightness(1.06);
    box-shadow: 0 0 12px 2px rgba(34, 197, 94, 0.35);
  }
}

.aihub-tag--free {
  background: rgba(14, 165, 233, 0.15);
  color: #0369a1;
  border: 1px solid rgba(14, 165, 233, 0.35);
  animation: none;
}

:root.aihub-theme-dark .aihub-tag--free {
  color: #7dd3fc;
}

.aihub-tag--cn {
  background: rgba(250, 204, 21, 0.2);
  color: #a16207;
  border: 1px solid rgba(234, 179, 8, 0.4);
  animation: none;
}

:root.aihub-theme-dark .aihub-tag--cn {
  color: #fde047;
}

.aihub-card__title {
  font-weight: 700;
  font-size: 16px;
  line-height: 1.35;
  margin: 0 0 10px;
  padding-right: 72px;
  letter-spacing: -0.02em;
}

.aihub-card__summary {
  font-size: 13px;
  color: var(--ai-muted);
  line-height: 1.6;
  margin: 0 0 14px;
  flex: 1;
}

.aihub-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.aihub-chip {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--ai-radius-pill);
  background: rgba(241, 245, 249, 0.9);
  color: var(--ai-muted);
  border: 1px solid var(--ai-border-soft);
}

:root.aihub-theme-dark .aihub-chip {
  background: rgba(15, 23, 42, 0.5);
}

.aihub-card__path {
  font-size: 11px;
  color: var(--ai-muted);
  word-break: break-all;
  opacity: 0.75;
  margin-bottom: 14px;
}

/* CTA 条：扁平渐变 + 幽灵次按钮 */
.aihub-card__actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 4px;
}

.aihub-card__btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  text-decoration: none !important;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  pointer-events: auto;
}

.aihub-card__btn--primary {
  background: linear-gradient(135deg, #4f46e5, #6366f1, #0ea5e9);
  color: #fff !important;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.35);
}

.aihub-card__btn--ghost {
  background: rgba(241, 245, 249, 0.95);
  color: var(--ai-text) !important;
  border: 1px solid var(--ai-border-soft);
}

:root.aihub-theme-dark .aihub-card__btn--ghost {
  background: rgba(30, 41, 59, 0.6);
}

.aihub-card:hover .aihub-card__btn--primary {
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.45);
}

/* -------------------------------------------------------------------------
   原生广告卡
   ------------------------------------------------------------------------- */
.aihub-ad-card {
  position: relative;
  border-radius: var(--ai-radius-lg);
  padding: 20px;
  background: linear-gradient(160deg, rgba(255, 251, 235, 0.95), rgba(254, 243, 199, 0.65));
  border: 1px solid rgba(251, 191, 36, 0.35);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: var(--ai-shadow-sm);
}

:root.aihub-theme-dark .aihub-ad-card {
  background: linear-gradient(160deg, rgba(30, 27, 15, 0.9), rgba(45, 35, 12, 0.85));
  border-color: rgba(251, 191, 36, 0.25);
}

.aihub-ad-card__label {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #b45309;
  text-transform: uppercase;
}

.aihub-ad-card .ad-slot {
  margin: 0;
}

/* -------------------------------------------------------------------------
   排行榜长文区域
   ------------------------------------------------------------------------- */
.aihub-ranking {
  margin-top: 40px;
  padding: clamp(22px, 3vw, 36px);
  border-radius: var(--ai-radius-xl);
  background: var(--ai-surface-solid);
  border: none;
  box-shadow: var(--ai-shadow-sm);
  line-height: 1.85;
  font-size: 15px;
  color: var(--ai-text);
}

:root.aihub-theme-dark .aihub-ranking {
  background: rgba(30, 41, 59, 0.65);
}

.aihub-ranking h2 {
  font-size: 1.35rem;
  margin: 0 0 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, var(--ai-accent), var(--ai-accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.aihub-ranking h3 {
  font-size: 1.08rem;
  margin: 28px 0 12px;
  font-weight: 700;
  color: var(--ai-accent);
}

.aihub-ranking p {
  margin: 0 0 14px;
  color: var(--ai-muted);
}

.aihub-ranking strong {
  color: var(--ai-text);
}

.aihub-card.is-hidden {
  display: none !important;
}

/* -------------------------------------------------------------------------
   Hub 内「关联工具」等与 Bootstrap 面板协调
   ------------------------------------------------------------------------- */
.aihub-root .related-tools {
  margin-top: 28px;
  border-radius: var(--ai-radius-lg);
  border: 1px solid var(--ai-border-soft) !important;
  box-shadow: var(--ai-shadow-sm);
  background: var(--ai-surface-solid) !important;
}

.aihub-root .related-tools__link {
  border-radius: var(--ai-radius-pill) !important;
}

/* -------------------------------------------------------------------------
   AI 子站进壳页：统一衬底与提示块（Index::aitoolShell + link_ai_hub_theme）
   ------------------------------------------------------------------------- */
.static-shell--aitools-sub {
  border-radius: var(--ai-radius-lg);
}

.devhub-main:has(.static-shell--aitools-sub) {
  background: linear-gradient(180deg, var(--ai-page-bg) 0%, var(--ai-page-bg-2) 100%) !important;
}

.static-shell--aitools-sub .ai-prompt-eng {
  border-radius: var(--ai-radius-lg) !important;
  border: 1px solid var(--ai-border-soft) !important;
  box-shadow: var(--ai-shadow-sm) !important;
}
