/* ============================================================
   CP&PMx 自定义主站 — 前端样式
   ============================================================
   保留：布局 / 顶部导航 / 侧边栏 / 首页 Hero / 分类卡片
   广告轮播 / 欢迎页 / 页脚 / 响应式
   移除：编辑器 / 论坛详情 / 认证表单 / 审核 / 消息等论坛功能样式
   ============================================================ */

/* --- Design Tokens --- */
:root {
  --blue: rgb(45, 41, 161);
  --blue-2: #1f2a78;
  --blue-soft: #e9e8ff;
  --orange: #ff7a18;
  --orange-soft: #fff0e5;
  --teal: #18a999;
  --green: #22a85a;
  --ink: #202635;
  --muted: #667085;
  --line: #d9deea;
  --line-strong: #c9cfe2;
  --surface: #ffffff;
  --background: #f5f7fb;
  --danger: #c2410c;
  --shadow: 0 14px 38px rgba(24, 34, 66, 0.1);
  --radius: 8px;
  --topbar-h: 76px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
  color: var(--ink);
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(45, 41, 161, 0.045), transparent 230px),
    var(--background);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
}

button, input, textarea, select {
  font: inherit;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  height: auto;
}

/* --- Shared Buttons --- */
.ghost-button,
.primary-button,
.icon-button,
.nav-button,
.seg-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 580;
  white-space: nowrap;
  transition: background 0.15s, box-shadow 0.15s;
}

.ghost-button {
  background: transparent;
  color: var(--ink);
  padding: 8px 16px;
  border: 1px solid var(--line);
}
.ghost-button:hover {
  background: var(--blue-soft);
}

.primary-button {
  background: var(--blue);
  color: #fff;
  padding: 8px 18px;
}
.primary-button:hover {
  background: var(--blue-2);
}

.icon-button {
  padding: 8px;
  background: transparent;
  color: var(--muted);
  justify-content: center;
}
.icon-button:hover {
  color: var(--ink);
  background: var(--blue-soft);
}

.nav-button {
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  font-weight: 580;
}
.nav-button:hover,
.nav-button.active {
  color: var(--blue);
  background: var(--blue-soft);
}

.seg-button {
  padding: 5px 12px;
  background: var(--background);
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 13px;
}
.seg-button.active {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: var(--blue);
}

/* --- App Layout --- */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
  padding: 24px 32px;
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.layout.sidebar-collapsed {
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 18px;
}

.main {
  min-width: 0;
}

.main-stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* --- Footer --- */
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding: 16px 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.footer a {
  color: var(--muted);
}
.footer a:hover {
  color: var(--blue);
  text-decoration: underline;
}

/* --- Topbar --- */
.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 12px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.brand-logo {
  width: 110px;
  height: 62px;
  object-fit: contain;
  border-radius: 6px;
}

.brand-title {
  font-size: 20px;
  font-weight: 720;
  color: var(--ink);
  display: block;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--muted);
  display: block;
}

.top-nav {
  display: flex;
  gap: 4px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-search-form {
  margin-right: 4px;
}

.top-search-input {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  width: 200px;
  background: var(--background);
  color: var(--ink);
}
.top-search-input:focus {
  outline: none;
  border-color: var(--blue);
  background: var(--surface);
}

/* Language Switch */
.lang-switch {
  display: flex;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.lang-switch button {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  color: var(--muted);
}
.lang-switch button.active {
  background: var(--blue);
  color: #fff;
}

/* --- Sidebar --- */
.sidebar {
  align-self: start;
  position: sticky;
  top: calc(var(--topbar-h) + 24px);
  max-height: calc(100vh - var(--topbar-h) - 48px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar.collapsed .side-link span,
.sidebar.collapsed .category-link span,
.sidebar.collapsed .side-label,
.sidebar.collapsed .side-toggle span,
.sidebar.collapsed .side-parent-btn span,
.sidebar.collapsed .side-chevron,
.sidebar.collapsed .side-children {
  display: none;
}

.sidebar.collapsed .side-toggle {
  justify-content: center;
}

.sidebar.collapsed .side-link,
.sidebar.collapsed .category-link,
.sidebar.collapsed .side-parent-btn {
  justify-content: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 6px;
}

.side-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: var(--radius);
  width: 100%;
  text-align: left;
}
.side-toggle:hover {
  background: var(--blue-soft);
  color: var(--ink);
}

.side-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 0;
}
.side-section + .side-section {
  border-top: 1px solid var(--line);
}

.side-label {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 680;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.side-link,
.category-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--ink);
  transition: background 0.12s;
}
.side-link:hover,
.category-link:hover {
  background: var(--blue-soft);
  color: var(--blue);
}

.category-link {
  padding-left: 30px;
}

/* Sidebar: expandable parent */
.side-parent {
  display: flex;
  flex-direction: column;
}

.side-parent-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: var(--radius);
  width: 100%;
  text-align: left;
  transition: background 0.12s;
}
.side-parent-btn:hover {
  background: var(--blue-soft);
  color: var(--blue);
}
.side-parent-btn.expanded {
  font-weight: 620;
}

.side-chevron {
  margin-left: auto;
  color: var(--muted);
  display: flex;
  align-items: center;
}
.side-chevron .icon {
  width: 16px;
  height: 16px;
}

.side-children {
  display: flex;
  flex-direction: column;
}

.side-indent {
  width: 16px;
  min-width: 16px;
}

/* Sidebar: active/highlight */
.category-link.active,
.side-parent-btn.active {
  background: var(--blue-soft);
  color: var(--blue);
}

/* --- Section Panel --- */
.section-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-title {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 720;
  color: var(--ink);
}

.section-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

/* --- Hero --- */
.hero-panel {
  background: var(--blue);
  border-radius: 14px;
  overflow: hidden;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1fr 0.8fr;
  gap: 32px;
  padding: 44px 40px;
  align-items: center;
}

.hero-title {
  margin: 0 0 12px;
  font-size: 32px;
  font-weight: 760;
  color: #fff;
  line-height: 1.25;
}

.hero-copy {
  margin: 0 0 24px;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.65;
  max-width: 600px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.hero-actions .primary-button {
  background: var(--orange);
  font-size: 15px;
  padding: 10px 22px;
}
.hero-actions .primary-button:hover {
  background: #e66a00;
}
.hero-actions .ghost-button {
  border-color: rgba(255, 255, 255, 0.38);
  color: #fff;
}
.hero-actions .ghost-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.hero-graphic {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-graphic-title {
  padding: 28px 24px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  font-size: 17px;
  font-weight: 620;
  color: rgba(255, 255, 255, 0.88);
  text-align: center;
  line-height: 1.5;
}
.hero-graphic-title span {
  display: block;
  font-size: 14px;
  font-weight: 440;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 6px;
}

/* --- Category Hub Grid --- */
.category-hub-grid {
  display: grid;
  gap: 16px;
}

.category-hub-grid--single {
  grid-template-columns: 1fr;
  max-width: 600px;
}

.category-hub-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.category-hub-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* --- Category Cards --- */
.category-card,
.core-feature-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--category-color, var(--blue));
  border-radius: 10px;
  padding: 20px;
  transition: box-shadow 0.2s, transform 0.2s;
  cursor: pointer;
}

.category-card:hover,
.core-feature-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.category-card h3,
.core-feature-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 680;
  color: var(--ink);
}

.category-card p,
.core-feature-card p {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
  flex: 1;
}

.card-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--category-color, var(--blue));
}

/* --- Section Title Links (Homepage) --- */
.section-link {
  color: inherit;
}
.section-link:hover {
  color: var(--blue);
}

/* --- Breadcrumb --- */
.breadcrumb-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  font-size: 14px;
  color: var(--muted);
}
.breadcrumb-panel a {
  color: var(--blue);
}
.breadcrumb-panel a:hover {
  text-decoration: underline;
}
.breadcrumb-sep {
  color: var(--line-strong);
}
.breadcrumb-current {
  color: var(--ink);
  font-weight: 620;
}

/* --- Landing CTA Block --- */
.landing-cta-block {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.landing-desc {
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
  margin: 0;
}
.landing-hint {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  padding: 10px 14px;
  background: var(--background);
  border-radius: var(--radius);
  border-left: 3px solid var(--blue);
}
.landing-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 4px;
}
.landing-cta-btn {
  font-size: 16px !important;
  padding: 12px 28px !important;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

/* --- Sidebar Category Active --- */
.category-link.active {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 620;
}

/* Core Feature Grid */
.core-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.core-feature-card {
  border-top-color: var(--feature-color, var(--blue));
}

/* --- Ad Carousel --- */
.ad-carousel {
  overflow: hidden;
  border-radius: 10px;
}

.ad-track {
  display: flex;
  transition: transform 0.45s ease;
}

.ad-slide {
  flex: 0 0 100%;
  padding: 36px 32px;
  background: linear-gradient(135deg, #11183a, #1d2560);
  color: #fff;
}
.ad-slide.alt {
  background: linear-gradient(135deg, #0d1328, #182342);
}
.ad-slide h3 {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 720;
}
.ad-slide p {
  margin: 0;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.72);
  max-width: 520px;
}

.ad-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 14px 0;
}

.ad-dot {
  width: 10px;
  height: 10px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  cursor: pointer;
}
.ad-dot.active {
  background: var(--orange);
}

/* --- Welcome Page --- */
.welcome-app {
  background: #0a0f25;
  color: #fff;
}

.welcome-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 36px;
}

.welcome-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.welcome-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.welcome-brand img {
  width: 120px;
  height: 64px;
  object-fit: contain;
  border-radius: 6px;
}
.welcome-brand strong {
  font-size: 22px;
  font-weight: 740;
  color: #fff;
  display: block;
}
.welcome-brand small {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  display: block;
}

.welcome-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.welcome-actions .lang-switch {
  border-color: rgba(255, 255, 255, 0.22);
}
.welcome-actions .lang-switch button {
  color: rgba(255, 255, 255, 0.7);
}
.welcome-actions .lang-switch button.active {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.welcome-ghost {
  border-color: rgba(255, 255, 255, 0.3) !important;
  color: #fff !important;
}
.welcome-ghost:hover {
  background: rgba(255, 255, 255, 0.1) !important;
}

.welcome-hero {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}

.welcome-copy {
  max-width: 680px;
}

.welcome-copy h1 {
  font-size: 54px;
  font-weight: 760;
  margin: 0 0 18px;
  line-height: 1.2;
}
.welcome-copy > p:not(.welcome-signal) {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.68);
  margin: 0 0 32px;
  line-height: 1.7;
}

.welcome-signal {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.42);
  margin-top: 28px;
}

.welcome-cta-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.welcome-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  background: var(--orange);
  color: #fff;
  border: 0;
  border-radius: 10px;
  font-size: 17px;
  font-weight: 680;
  cursor: pointer;
  transition: background 0.2s;
}
.welcome-cta:hover {
  background: #e66a00;
}

.welcome-footer {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 20px 0 8px;
  color: rgba(255, 255, 255, 0.35);
  font-size: 13px;
}

/* --- Floating Message Button --- */
.floating-msg-btn {
  position: fixed;
  right: 24px;
  bottom: 28px;
  z-index: 150;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.floating-msg-btn:hover {
  transform: translateY(-2px);
  background: rgba(15, 23, 42, 0.98);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.28);
  color: #ffffff;
}

.floating-msg-btn .icon {
  width: 18px;
  height: 18px;
  flex: none;
}

/* 欢迎页深色背景：悬浮按钮使用浅色以保持可见 */
.welcome-app .floating-msg-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.welcome-app .floating-msg-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

/* --- Notice --- */
.notice {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius);
  font-size: 14px;
  z-index: 200;
  box-shadow: var(--shadow);
  animation: slideUp 0.3s ease;
}
.notice.error {
  background: var(--danger);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* --- SVG Icons --- */
.icon {
  width: 20px;
  height: 20px;
  flex: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1100px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 18px;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .layout.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: none;
  }

  .sidebar.collapsed {
    display: flex;
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    padding: 8px;
  }

  .sidebar.collapsed .side-section {
    display: flex;
    flex-direction: row;
    gap: 4px;
    padding: 0;
    border-top: 0;
  }

  .hero-inner {
    grid-template-columns: 1fr;
    padding: 28px 24px;
  }

  .core-feature-grid,
  .category-hub-grid--two,
  .category-hub-grid--three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .welcome-page {
    padding: 18px;
  }

  .welcome-nav,
  .welcome-actions,
  .welcome-cta-row,
  .welcome-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .welcome-actions .lang-switch,
  .welcome-ghost,
  .welcome-cta {
    width: 100%;
  }

  .welcome-copy h1 {
    font-size: 38px;
  }

  .brand-logo {
    width: 76px;
    height: 42px;
  }

  .brand-title {
    font-size: 18px;
  }

  .top-nav {
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .top-nav::-webkit-scrollbar {
    display: none;
  }

  .top-actions {
    flex-wrap: wrap;
  }

  .hero-title {
    font-size: 26px;
  }

  .hero-inner,
  .section-panel {
    padding: 16px;
  }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-actions > button,
  .hero-actions > a {
    width: 100%;
  }

  .core-feature-grid,
  .category-hub-grid--two,
  .category-hub-grid--three {
    grid-template-columns: 1fr;
  }

  .floating-msg-btn {
    right: 14px;
    bottom: 16px;
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
  }

  .floating-msg-text {
    display: none;
  }
}
