/* ATF Header Topbar v1.2.2 —— 最终修正版
 * 修复：
 * 1. 搜索框切换按钮可见（点击弹下拉选「全站搜/栏目搜」）
 * 2. 登录态用户按钮去边框，纯透明底，hover 变浅灰
 * 3. 无痕模式不重写按钮（保持主题原有酸绿色「免费试用」）
 * Desktop only（>=1024px）
 */
@media (min-width: 1024px) {

  .site-header-wrapper .search-toolbar {
    display: none !important;
  }

  /* ───── 顶部工具条：纯白底 + 淡边框 ───── */
  .atf-topbar {
    background: #FFF;
    border-bottom: 1px solid #F0F0F0;
    padding: 0 40px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
    font-size: 13px;
    color: #333;
    box-sizing: border-box;
  }

  /* ───── 主 header ───── */
  .site-header-wrapper .main-header {
    padding-top: 20px !important;
    padding-bottom: 20px !important;
    background: #FFF !important;
  }
  .site-header-wrapper .main-header > .wp-block-group {
    display: grid !important;
    grid-template-columns: 1fr auto 1fr;
    align-items: center !important;
    gap: 24px;
  }
  .site-header-wrapper .main-header .header-logo {
    justify-self: start;
    grid-column: 1;
  }
  .site-header-wrapper .main-header .center-navigation {
    justify-self: center;
    grid-column: 2;
  }
  .site-header-wrapper .main-header .header-right-space {
    justify-self: end;
    grid-column: 3;
    min-width: 0;
  }
  .site-header-wrapper .main-header .header-right-space.atf-moved {
    display: none !important;
  }

  /* 主导航 */
  .site-header-wrapper .primary-navigation .nav-menu {
    gap: 32px !important;
  }
  .site-header-wrapper .primary-navigation .nav-menu > .menu-item > a {
    font-size: 15px;
    letter-spacing: 0.02em;
  }

  /* ───── 搜索框：320px ───── */
  .atf-topbar .header-search-form.atf-topbar-search {
    display: inline-flex !important;
    align-items: center;
    width: 320px;
    max-width: 320px;
    height: 34px;
    padding: 0 4px 0 14px;
    border: 1px solid #E5E5E5;
    border-radius: 17px;
    background: #FFF;
    transition: border-color .18s ease;
    box-sizing: border-box;
    margin: 0;
    flex: 0 0 auto;
    margin-right: auto;
  }
  .atf-topbar .header-search-form.atf-topbar-search:focus-within {
    border-color: #999;
  }
  .atf-topbar .atf-topbar-search .search-controls {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
  }

  /* 搜索切换：两个按钮并排显示，激活态有背景色 */
  .atf-topbar .atf-topbar-search .search-tabs-capsule {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    background: #F5F5F5;
    border-radius: 14px;
    padding: 2px;
    margin: 0;
    gap: 0;
  }
  .atf-topbar .atf-topbar-search .search-tabs-capsule::after {
    content: "";
    position: absolute;
    right: -7px;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 14px;
    background: #E0E0E0;
  }
  .atf-topbar .atf-topbar-search .search-tab {
    display: inline-flex !important;
    align-items: center;
    background: transparent;
    border: none;
    padding: 4px 10px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    line-height: 1;
    border-radius: 12px;
    transition: background .15s, color .15s;
    height: 24px;
    box-sizing: border-box;
  }
  .atf-topbar .atf-topbar-search .search-tab:hover {
    color: #333;
  }
  .atf-topbar .atf-topbar-search .search-tab.active {
    background: #FFF;
    color: #111;
    font-weight: 500;
  }
  .atf-topbar .atf-topbar-search .search-tab.active::after {
    content: none;
  }
  /* 下拉菜单不再需要 */
  .atf-topbar .atf-topbar-search .search-tabs-dropdown {
    display: none !important;
  }

  .atf-topbar .atf-topbar-search .search-input-wrapper {
    flex: 1 1 auto;
    min-width: 0;
    padding-left: 14px;
  }
  .atf-topbar .atf-topbar-search .search-input {
    border: none !important;
    outline: none !important;
    background: transparent !important;
    width: 100% !important;
    height: 28px !important;
    padding: 0 !important;
    font-size: 14px !important;
    color: #111 !important;
    box-shadow: none !important;
  }
  .atf-topbar .atf-topbar-search .search-input::placeholder {
    color: #888 !important;
    font-size: 14px !important;
    opacity: 1 !important;
  }
  .atf-topbar .atf-topbar-search .search-icon-btn {
    flex: 0 0 auto;
    display: inline-flex;
  }
  .atf-topbar .atf-topbar-search .search-icon-btn button {
    background: transparent;
    border: none;
    padding: 4px 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
  }
  .atf-topbar .atf-topbar-search .search-icon-btn button:hover {
    background: #F0F0F0;
  }
  .atf-topbar .atf-topbar-search .search-icon-btn svg {
    width: 16px;
    height: 16px;
  }

  /* ───── 右侧账户区：不重写，保持主题原样 ───── */
  .atf-topbar .header-right-space {
    display: inline-flex !important;
    align-items: center;
    flex: 0 0 auto;
    gap: 16px;
    margin: 0;
    padding: 0;
    background: transparent !important;
  }

  /* 登录态用户按钮：去边框，纯透明底，hover 变浅灰。排除 .atf-auth-open 保留主题原样。 */
  .atf-topbar .atf-member-entry button:not(.atf-auth-open),
  .atf-topbar .atf-member-entry a:not(.atf-auth-open) {
    background: transparent !important;
    border: none !important;
    padding: 6px 12px !important;
    border-radius: 14px !important;
    font-size: 13px !important;
    color: #333 !important;
    transition: background .15s;
  }
  .atf-topbar .atf-member-entry button:not(.atf-auth-open):hover,
  .atf-topbar .atf-member-entry a:not(.atf-auth-open):hover {
    background: #F5F5F5 !important;
  }

  /* ───── 语言切换 ───── */
  .atf-lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: 14px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    background: transparent;
    border: 1px solid transparent;
    transition: background .18s, border-color .18s, color .18s;
    line-height: 1;
    text-decoration: none;
    height: 28px;
    box-sizing: border-box;
  }
  .atf-lang-switch:hover {
    background: #F8F8F8;
    border-color: #E5E5E5;
    color: #111;
  }
  .atf-lang-switch .atf-lang-icon {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.6;
  }
  .atf-lang-switch .atf-lang-label {
    font-weight: 500;
    letter-spacing: 0.02em;
  }
}

.atf-lang-hint {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #111;
  color: #FFF;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.atf-lang-hint.show {
  opacity: 1;
}
