/**
 * 论坛页 — 腾讯云开发者社区顶栏与布局
 * https://cloud.tencent.com/developer
 */

/* ── 顶栏 ── */
body.page-forum-cloud .cdc-site-header,
body.page-forum-article .cdc-site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: #fff;
  box-shadow: 0 1px 0 #e7eaf0;
  overflow: visible;
}

body.page-forum-cloud .ac-site-header,
body.page-forum-article .ac-site-header {
  display: none !important;
}

.cdc-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px;
}

.cdc-topbar {
  border-bottom: 1px solid #e7eaf0;
}

.cdc-topbar .cdc-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 56px;
}

.cdc-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  text-decoration: none;
  color: #1f2329;
}

.cdc-logo img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.cdc-logo-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  line-height: 1;
}

.cdc-logo-name {
  font-weight: 700;
  color: #1f2329;
}

.cdc-logo-sep {
  color: #c9cdd4;
  font-weight: 300;
}

.cdc-logo-sub {
  font-weight: 500;
  color: #4e5969;
}

.cdc-search {
  flex: 1;
  min-width: 0;
  max-width: 520px;
  margin: 0 auto;
}

.cdc-search-box {
  display: flex;
  align-items: center;
  height: 36px;
  border: 1px solid #d0d5dd;
  border-radius: 2px;
  background: #fff;
  overflow: hidden;
}

.cdc-search-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  padding: 0 12px;
  font-size: 14px;
  outline: none;
  background: transparent;
}

.cdc-search-btn {
  flex: 0 0 40px;
  height: 100%;
  border: 0;
  background: #0052d9;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cdc-header-user {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 0 0 auto;
}

.cdc-toplink {
  font-size: 14px;
  color: #4e5969;
  text-decoration: none;
  white-space: nowrap;
}

.cdc-toplink:hover {
  color: #0052d9;
}

.cdc-login-btn {
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 2px;
  background: #0052d9;
  color: #fff !important;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.cdc-publish-top {
  height: 32px;
  padding: 0 14px;
  border: 1px solid #0052d9;
  border-radius: 2px;
  background: #fff;
  color: #0052d9 !important;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.cdc-publish-top:hover {
  background: #f0f5ff;
}

.cdc-header-user .dropdown {
  position: relative;
}

.cdc-header-user .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
}

.cdc-nav-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #4e5969;
  cursor: pointer;
}

.cdc-nav-toggle .icon-close {
  display: none;
}

.cdc-nav-toggle.is-open .icon-menu {
  display: none;
}

.cdc-nav-toggle.is-open .icon-close {
  display: block;
}

/* 子导航 */
.cdc-subnav {
  background: #fff;
  border-bottom: 1px solid #e7eaf0;
  overflow: visible;
  position: relative;
  z-index: 199;
}

.cdc-subnav .cdc-wrap {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 48px;
  padding: 7px 0;
  overflow: visible;
}

.cdc-subnav-inner {
  justify-content: space-between;
  gap: 12px;
  overflow: visible;
}

.cdc-subnav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.cdc-subnav-links::-webkit-scrollbar {
  display: none;
}

.cdc-subnav-entry {
  position: relative;
  flex: 0 0 auto;
  z-index: 10;
}

.cdc-subnav-entry:has(.cdc-community-pill[aria-expanded="true"]) {
  z-index: 250;
}

.cdc-community-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px 0 8px;
  border: 1px solid rgba(0, 82, 217, 0.22);
  border-radius: 999px;
  background: linear-gradient(135deg, #f0f5ff 0%, #fff 100%);
  color: #0052d9;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}

.cdc-community-pill:hover,
.cdc-community-pill[aria-expanded="true"] {
  border-color: #0052d9;
  background: linear-gradient(135deg, #e8f0ff 0%, #fff 100%);
}

.cdc-community-pill-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #0052d9;
  color: #fff;
  flex-shrink: 0;
}

.cdc-community-pill-ico svg {
  width: 13px;
  height: 13px;
}

.cdc-community-pill-chevron {
  flex-shrink: 0;
  opacity: 0.7;
  transition: transform 0.15s;
}

.cdc-community-pill[aria-expanded="true"] .cdc-community-pill-chevron {
  transform: rotate(180deg);
}

.cdc-community-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: min(260px, calc(100vw - 32px));
  padding: 8px;
  border: 1px solid #e7eaf0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.14);
  z-index: 260;
}

.cdc-community-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.cdc-community-item:hover {
  background: #f0f5ff;
}

.cdc-community-item + .cdc-community-item {
  margin-top: 2px;
}

.cdc-community-item-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
}

.cdc-community-item-ico svg {
  width: 18px;
  height: 18px;
}

.cdc-community-item-ico--user {
  background: #eff6ff;
  color: #2563eb;
}

.cdc-community-item-ico--dev {
  background: #f0fdf4;
  color: #16a34a;
}

.cdc-community-item-ico--post {
  background: #fff7ed;
  color: #ea580c;
}

.cdc-community-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cdc-community-item-text strong {
  font-size: 14px;
  font-weight: 600;
  color: #1f2329;
  line-height: 1.3;
}

.cdc-community-item-text small {
  font-size: 12px;
  color: #86909c;
  line-height: 1.35;
}

.cdc-mobile-divider {
  display: block;
  padding: 16px 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: #86909c;
  letter-spacing: 0.04em;
  border-bottom: 0;
}

.cdc-subnav .cdc-wrap::-webkit-scrollbar {
  display: none;
}

.cdc-subnav a {
  flex: 0 0 auto;
  font-size: 14px;
  color: #4e5969;
  text-decoration: none;
  white-space: nowrap;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.cdc-subnav a:hover {
  color: #0052d9;
}

.cdc-subnav a.is-active {
  color: #0052d9;
  font-weight: 600;
  border-bottom-color: #0052d9;
}

.cdc-mobile-nav {
  display: none;
}

/* 论坛页右侧浮动工具栏（腾讯云风格） */
body.page-forum-cloud .ac-float-dock,
body.page-forum-article .ac-float-dock {
  right: 4px;
  top: auto;
  bottom: 80px;
  transform: none;
  z-index: 1200;
}

body.page-forum-cloud .ac-float-dock .ac-float-btn-top,
body.page-forum-article .ac-float-dock .ac-float-btn-top {
  color: #0052d9;
}

body.page-forum-cloud .ac-float-dock .ac-float-btn-top .ac-float-ico svg,
body.page-forum-article .ac-float-dock .ac-float-btn-top .ac-float-ico svg {
  stroke: #0052d9;
}

body.page-forum-cloud .app-main.ac-tsx-main,
body.page-forum-article .app-main.ac-tsx-main {
  padding: 0;
  min-height: calc(100vh - 100px);
}

@media (max-width: 960px) {
  .cdc-toplink,
  .cdc-publish-top {
    display: none;
  }

  .cdc-search {
    max-width: none;
  }
}

@media (max-width: 768px) {
  .cdc-topbar .cdc-wrap {
    height: 52px;
    gap: 10px;
  }

  .cdc-logo-sub {
    display: none;
  }

  .cdc-logo-sep {
    display: none;
  }

  .cdc-header-user .cdc-toplink,
  .cdc-header-user .cdc-login-btn {
    display: none;
  }

  .cdc-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .cdc-subnav {
    display: none;
  }

  .cdc-mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 8px 16px 16px;
    background: #fff;
    border-bottom: 1px solid #e7eaf0;
  }

  .cdc-mobile-nav:not([hidden]) {
    display: flex;
  }

  .cdc-mobile-nav a,
  .cdc-mobile-nav button {
    display: block;
    width: 100%;
    padding: 12px 0;
    border: 0;
    border-bottom: 1px solid #eef0f4;
    background: transparent;
    text-align: left;
    font-size: 15px;
    color: #1f2329;
    text-decoration: none;
    cursor: pointer;
  }
}
