﻿/* ===================================================
   龙凤家谱网 · 布局样式
   =================================================== */

/* ── Header ─────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center;
  padding: 0 2rem;
  height: 60px;
  background: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.header-logo {
  display: flex; align-items: center; gap: .6rem;
  color: var(--gold-light); font-size: 1.1rem; font-weight: 700;
  text-decoration: none; flex-shrink: 0;
}
.header-logo:hover { color: var(--white); }
.header-logo img { border-radius: 4px; }

.header-nav {
  display: flex; gap: 1.6rem;
  margin-left: 2.5rem;
}
.header-nav a {
  color: rgba(255,255,255,.85); font-size: .95rem;
  padding: .2em 0;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
.header-nav a:hover,
.header-nav a.active {
  color: var(--gold-light);
  border-bottom-color: var(--gold);
}

/* header 登录按钮 — 确保不被覆盖 */
.header-login-btn {
  display: inline-flex !important;
  align-items: center;
  padding: .35em 1em;
  border: 1.5px solid var(--gold) !important;
  border-radius: 6px;
  color: var(--gold-light) !important;
  font-size: .88rem;
  font-weight: 600;
  text-decoration: none;
  transition: all .2s;
  flex-shrink: 0;
}
.header-login-btn:hover {
  background: var(--gold) !important;
  color: var(--primary) !important;
}

.header-right {
  margin-left: auto;
  display: flex; align-items: center; gap: 1rem;
}


.header-msg-btn {
  position: relative; color: rgba(255,255,255,.85);
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
}
.header-msg-btn:hover { color: var(--white); }
.header-msg-badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 16px; height: 16px;
  background: #e74c3c;
  color: #fff;
  font-size: .65rem;
  font-style: normal;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  padding: 0 3px;
  box-sizing: border-box;
  pointer-events: none;
}

.user-avatar-link {
  display: flex; align-items: center; gap: .5rem;
  color: rgba(255,255,255,.85); font-size: .9rem;
}
.user-avatar-link:hover { color: var(--white); }
.user-avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  object-fit: cover;
}

/* ── 我的家谱下拉菜单 ──────────────────────────────── */
.my-tree-dropdown {
  position: relative;
}
.my-tree-btn {
  display: flex; align-items: center; gap: .35rem;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 6px;
  color: rgba(255,255,255,.9);
  font-size: .85rem; font-weight: 600;
  padding: .3em .75em;
  cursor: pointer;
  transition: background .2s;
}
.my-tree-btn:hover {
  background: rgba(255,255,255,.22);
}
.my-tree-panel {
  display: none;
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 230px;
  background: #fff;
  border: 1px solid #eadfce;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  z-index: 200;
  overflow: hidden;
}
.my-tree-dropdown.open .my-tree-panel {
  display: block;
}
.my-tree-panel-user {
  display: flex; align-items: center; gap: .75rem;
  padding: .85rem 1rem;
  background: #faf6f0;
  border-bottom: 1px solid #efe1cf;
}
.my-tree-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  object-fit: cover;
  flex-shrink: 0;
}
.my-tree-nickname {
  font-weight: 700; color: #5a1010;
  font-size: .9rem; margin-bottom: .2rem;
}
.my-tree-badge {
  display: inline-block;
  padding: .12em .55em;
  border-radius: 999px;
  color: #fff; font-size: .72rem; font-weight: 700;
}
.my-tree-panel-meta {
  padding: .5rem 1rem;
  font-size: .78rem; color: #8a7560;
  border-bottom: 1px solid #f0e8da;
}
.my-tree-panel-meta strong { color: #8B1A1A; }
.my-tree-upgrade {
  float: right; color: #c9a84c; font-weight: 700;
  text-decoration: none; font-size: .75rem;
}
.my-tree-upgrade:hover { text-decoration: underline; }
.my-tree-panel-actions {
  padding: .4rem 0;
  display: flex; flex-direction: column;
}
.my-tree-action {
  display: flex; align-items: center; gap: .55rem;
  padding: .55rem 1rem;
  color: #5a3a1a; font-size: .85rem;
  text-decoration: none; transition: background .15s;
}
.my-tree-action:hover { background: #faf6f0; }
.my-tree-action.highlight {
  color: #8B1A1A; font-weight: 700;
}
.my-tree-action.logout { color: #999; margin-top: .2rem; border-top: 1px solid #f0e8da; }
.my-tree-action.logout:hover { background: #fff0f0; color: #c0392b; }

/* ── Main ───────────────────────────────────────────── */
.site-main { min-height: calc(100vh - 60px - 56px); }

/* ── Footer ─────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 1.1rem;
  background: var(--primary-dark);
  color: rgba(255,255,255,.6);
  font-size: .85rem;
}
.site-footer a { color: var(--gold-light); }

/* ── 容器 ───────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.container-sm { max-width: 760px; margin: 0 auto; padding: 0 1.2rem; }

/* ── 页面内边距 ──────────────────────────────────────── */
.page-body { padding: 2rem 1.5rem; }

/* ── 左右两栏布局 ────────────────────────────────────── */
.layout-sidebar {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.8rem;
  align-items: start;
}
@media (max-width: 768px) {
  .layout-sidebar { grid-template-columns: 1fr; }
}

/* ── 侧边栏 ──────────────────────────────────────────── */
.sidebar {
  position: sticky; top: 72px;
}
.sidebar-nav {
  list-style: none;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.sidebar-nav li a {
  display: block;
  padding: .85rem 1.2rem;
  color: var(--text);
  font-size: .95rem;
  border-bottom: 1px solid var(--bg-dark);
  transition: all var(--transition);
}
.sidebar-nav li a:hover,
.sidebar-nav li a.active {
  background: var(--bg-dark);
  color: var(--primary);
  padding-left: 1.5rem;
}
.sidebar-nav li:last-child a { border-bottom: none; }

/* ── 字母索引导航 ────────────────────────────────────── */
.alpha-nav {
  display: flex; flex-wrap: wrap; gap: .4rem;
  padding: 1rem 0;
}
.alpha-nav a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 600; color: var(--primary);
  transition: all var(--transition);
}
.alpha-nav a:hover, .alpha-nav a.active {
  background: var(--primary); color: var(--white);
  border-color: var(--primary);
}

/* ── 姓氏列表 ────────────────────────────────────────── */
.surname-group { margin-bottom: 2rem; }
.surname-group-title {
  font-size: 1.2rem; font-weight: 700;
  color: var(--primary); border-left: 4px solid var(--gold);
  padding-left: .7rem; margin-bottom: .8rem;
}
.surname-list {
  display: flex; flex-wrap: wrap; gap: .5rem;
}
.surname-list a {
  padding: .35em .9em;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: .95rem; color: var(--text);
  transition: all var(--transition);
}
.surname-list a:hover {
  background: var(--primary); color: var(--white);
  border-color: var(--primary);
}

/* ── 响应式 Header ───────────────────────────────────── */
@media (max-width: 768px) {
  .site-header { padding: 0 1rem; }
  .header-nav { display: none; }
  .header-logo span { display: none; }
}
