/*
 * kk-member-sidebar.css
 *
 * Replace the bottom 4-column tabbar with:
 *   - a top horizontal menu bar (3 items: 匹配 / 消息 / 充值中心)
 *   - a left vertical sidebar (7 items: 首页展示, 会员充值, 我的钱包,
 *     修改密码, 关于我们, 联系客服, 退出账号)
 *
 * The sidebar mirrors the items currently shown inside /profile's "动态设置"
 * area, but lifted out to a global sidebar that stays visible across member
 * pages.
 *
 * Mobile (< 900px): hide the sidebar; the top menu remains.
 * Desktop (>= 900px): sidebar pinned to the left, content shifted to the
 * right of it via flexbox on .member-content's parent.
 */

:root {
  --kk-sidebar-w: 232px;
  --kk-topbar-h: 56px;
}

/* ---- 1. Hide the original bottom tabbar entirely ---- */
.member-tabbar,
[class*="member-tabbar"] {
  display: none !important;
}

/* Don't reserve vertical space for the tabbar in .member-shell */
.member-shell {
  padding-bottom: 0 !important;
}

/* ---- 2. Top menu bar ---- */
.kk-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: var(--kk-topbar-h);
  padding: 0 16px;
  background: linear-gradient(180deg, rgba(14, 14, 24, .96), rgba(14, 14, 24, .88));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(124, 58, 237, .25);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
}

.kk-topbar-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  color: #b9b3c8;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .04em;
  text-decoration: none !important;
  cursor: pointer;
  border: 0;
  background: transparent;
  border-radius: 12px;
  transition: color .2s, background .2s, transform .2s;
  -webkit-tap-highlight-color: transparent;
}

.kk-topbar-item:hover {
  color: #ffffff;
  background: rgba(167, 139, 250, .12);
}

.kk-topbar-item.active {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(167, 139, 250, .25), rgba(124, 58, 237, .18));
  box-shadow: inset 0 -2px 0 rgba(196, 181, 253, .9);
}

.kk-topbar-item .kk-tb-ic {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
}

.kk-topbar-spacer { flex: 1; }

/* The top bar lives inside .member-shell so it can sit above .member-content
 * without overlapping the sticky .member-header. The header is rendered
 * earlier in the DOM and takes its own sticky slot; we position this
 * topbar at the top of the .member-content area. */
.member-content {
  padding-top: 0 !important;
}

/* ---- 3. Sidebar (desktop only) ---- */
.kk-sidebar {
  display: none;
}

@media (min-width: 900px) {
  .kk-sidebar {
    display: flex;
    flex-direction: column;
    width: var(--kk-sidebar-w);
    flex: 0 0 var(--kk-sidebar-w);
    padding: 18px 12px;
    gap: 4px;
    background: rgba(14, 14, 24, .82);
    border-right: 1px solid rgba(124, 58, 237, .22);
    min-height: calc(100vh - var(--kk-topbar-h));
    box-sizing: border-box;
    position: sticky;
    top: var(--kk-topbar-h);
    align-self: flex-start;
  }

  /* Lay the sidebar to the left of .member-content. The wrapper
   * .kk-member-body sits between .member-header and the (hidden)
   * .member-tabbar, and arranges the sidebar + content as a row. */
  .kk-member-body {
    width: 100%;
    display: flex;
    align-items: stretch;
    align-content: stretch;
    min-height: 0;
  }

  .kk-member-body > .member-content {
    flex: 1 1 auto;
    min-width: 0;
    max-width: calc(900px - var(--kk-sidebar-w));
    margin: 0 auto;
  }
}

.kk-sidebar-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #7c7493;
  padding: 10px 12px 6px;
}

.kk-sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  border-radius: 10px;
  color: #c8c0db;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  text-decoration: none !important;
  cursor: pointer;
  transition: background .18s, color .18s, transform .18s;
  -webkit-tap-highlight-color: transparent;
}

.kk-sidebar-item:hover {
  background: rgba(167, 139, 250, .12);
  color: #ffffff;
}

.kk-sidebar-item.active {
  background: linear-gradient(135deg, rgba(167, 139, 250, .28), rgba(124, 58, 237, .22));
  color: #ffffff;
  box-shadow: inset 3px 0 0 #c4b5fd;
}

.kk-sidebar-item .kk-sb-ic {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
  flex: 0 0 22px;
  color: inherit;
}

.kk-sidebar-item .kk-sb-lbl {
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kk-sidebar-item .kk-sb-arrow {
  width: 14px;
  height: 14px;
  opacity: .55;
  font-size: 12px;
  line-height: 1;
}

.kk-sidebar-item.kk-tone-gold   .kk-sb-ic { color: #f5cf6e; }
.kk-sidebar-item.kk-tone-rose   .kk-sb-ic { color: #f5a3a0; }
.kk-sidebar-item.kk-tone-blue   .kk-sb-ic { color: #93c5fd; }
.kk-sidebar-item.kk-tone-slate  .kk-sb-ic { color: #a3a3b8; }
.kk-sidebar-item.kk-tone-violet .kk-sb-ic { color: #c4b5fd; }
.kk-sidebar-item.kk-tone-mint   .kk-sb-ic { color: #86efac; }
.kk-sidebar-item.kk-tone-danger .kk-sb-ic { color: #fca5a5; }

.kk-sidebar-item.kk-tone-danger { color: #f5b5b0; }
.kk-sidebar-item.kk-tone-danger:hover { color: #ffd0cd; }

.kk-sidebar-divider {
  height: 1px;
  background: rgba(124, 58, 237, .18);
  margin: 8px 6px;
}

/* ---- 4. Make sure the (now hidden) tabbar doesn't reserve space and
 *    the original member-shell padding-bottom from the tabbar is gone ---- */
.member-shell {
  padding-bottom: 0 !important;
}

/* ---- 5. On /profile, the original submenu grid becomes redundant.
 *    Hide it; the sidebar now carries those items. ---- */
.profile-menu,
[class*="profile-menu"],
.profile-actions,
[class*="profile-actions"] {
  display: none !important;
}

/* ---- 6. Mobile (no sidebar) -- keep topbar only ---- */
@media (max-width: 899px) {
  .kk-topbar {
    padding: 0 8px;
  }
  .kk-topbar-item {
    padding: 0 10px;
    font-size: 13px;
  }
  .kk-topbar-item .kk-tb-ic { font-size: 16px; }
  .kk-topbar-item .kk-tb-txt { display: inline; }
}

/* ---- 7. SAFETY: the SPA toggles class 'kkdating-member-tabbar-visible'
 *    on <body> via a Vue watch. That class is supposed to mean "mobile
 *    tabbar shown" but the layout never recovers from it after the
 *    original tabbar is removed by this shim, leaving the whole body at
 *    display:none. Force the body visible whenever the shim is active. ---- */
body.kkdating-member-tabbar-visible {
  display: block !important;
}
