/* ============================================================
   全球冯氏智能寻根平台 - 主样式表
   响应式设计 · PC + 移动端全适配
   ============================================================ */

/* ===== 基础重置 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    color: #333; background: #F5F0E6; line-height: 1.6; min-height: 100vh;
    display: flex; flex-direction: column;
}
a { color: #8B6914; text-decoration: none; transition: color 0.2s; }
a:hover { color: #5C4033; }
img { max-width: 100%; height: auto; }
ul, ol { list-style: none; }

/* ===== 容器 ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ===== 头部导航 ===== */
.site-header {
    background: linear-gradient(135deg, #4A3728 0%, #5C4033 100%);
    color: #fff; position: sticky; top: 0; z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.header-inner {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px; max-width: 1200px; margin: 0 auto;
    flex-wrap: wrap; gap: 10px;
}
.logo { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 18px; font-weight: 700; flex-shrink: 0; }
.logo:hover { color: #D4A574; }
.logo-icon { font-size: 28px; }
.logo-text { white-space: nowrap; }

/* Logo图片样式 */
.site-logo-img {
    max-height: 40px;
    width: auto;
    object-fit: contain;
    filter: brightness(1.1);
}

.main-nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.nav-link {
    color: rgba(255,255,255,0.85); padding: 6px 12px; border-radius: 6px;
    font-size: 14px; transition: all 0.2s; white-space: nowrap;
}
.nav-link:hover, .nav-link.active { color: #fff; background: rgba(255,255,255,0.15); }

.user-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.username { font-size: 13px; color: rgba(255,255,255,0.9); }
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%; object-fit: cover;
    border: 2px solid rgba(255,255,255,0.5);
}
.default-avatar {
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.3); color: #fff; font-size: 14px; font-weight: 600;
}

/* 通知铃铛 */
.notification-bell {
    position: relative;
    font-size: 20px;
    color: rgba(255,255,255,0.9);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    padding: 4px;
}
.notification-bell:hover {
    color: #FFD700;
    transform: scale(1.1);
}
.notification-badge {
    position: absolute;
    top: -4px;
    right: -8px;
    background: #C41230;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
    padding: 0 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.menu-toggle {
    display: none; background: none; border: none; cursor: pointer;
    flex-direction: column; gap: 5px; padding: 5px;
}
.menu-toggle span {
    display: block; width: 24px; height: 2px; background: #fff;
    transition: all 0.3s; border-radius: 2px;
}

/* ===== 移动端菜单 ===== */
.mobile-menu {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 2000;
}
.mobile-menu.active { display: block; }
.mobile-menu-inner {
    position: fixed; top: 0; right: 0; width: 280px; height: 100vh;
    background: #fff; padding: 60px 0 20px; box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    overflow-y: auto;
}
.mobile-menu-inner a {
    display: block; padding: 14px 24px; color: #333; font-size: 15px;
    border-bottom: 1px solid #f0f0f0;
}
.mobile-menu-inner a:hover { background: #f8f8f8; color: #8B6914; }

/* ===== 主内容区 ===== */
.site-main { flex: 1; padding: 30px 0; }

/* ===== 英雄区 ===== */
.hero {
    background: linear-gradient(135deg, #4A3728 0%, #5C4033 50%, #6B4423 100%);
    color: #fff; padding: 80px 0; text-align: center;
    position: relative; overflow: hidden;
}
.hero::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.05) 0%, transparent 70%);
    pointer-events: none;
}
.hero-content { position: relative; z-index: 1; }
.hero h1 { font-size: 40px; margin-bottom: 16px; letter-spacing: 2px; }
.hero p { font-size: 18px; opacity: 0.9; max-width: 600px; margin: 0 auto 30px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ===== 按钮 ===== */
.btn {
    display: inline-block; padding: 10px 24px; background: #5C4033;
    color: #fff; border-radius: 8px; font-size: 14px; font-weight: 500;
    transition: all 0.2s; border: none; cursor: pointer; text-decoration: none;
}
.btn:hover { background: #4A3728; color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-success { background: #28a745; }
.btn-success:hover { background: #218838; }
.btn-warning { background: #ffc107; color: #333; }
.btn-warning:hover { background: #e0a800; color: #333; }
.btn-danger { background: #dc3545; }
.btn-danger:hover { background: #c82333; }
.btn-outline {
    background: transparent; border: 1px solid rgba(255,255,255,0.5);
    color: #fff;
}
.btn-outline:hover { background: rgba(255,255,255,0.1); }

/* ===== 卡片 ===== */
.card {
    background: #fff; border-radius: 12px; padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-bottom: 24px;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #f0f0f0;
    flex-wrap: wrap; gap: 10px;
}
.card-title { font-size: 16px; font-weight: 600; }

/* ===== 统计卡片 ===== */
.stats-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
    margin-bottom: 30px;
}
.stat-card {
    background: #fff; border-radius: 12px; padding: 24px;
    text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: all 0.3s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); }
.stat-number { font-size: 36px; font-weight: 700; color: #8B6914; line-height: 1.2; }
.stat-label { font-size: 14px; color: #999; margin-top: 6px; }

/* ===== 功能入口卡片 ===== */
.feature-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
    margin-bottom: 30px;
}
.feature-card {
    display: block; background: #fff; border-radius: 12px; padding: 28px 24px;
    text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: all 0.3s; text-decoration: none; color: #333;
}
.feature-card:hover {
    transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    color: #333;
}
.feature-icon { font-size: 48px; margin-bottom: 12px; }
.feature-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; color: #5C4033; }
.feature-desc { font-size: 13px; color: #999; line-height: 1.6; }

/* ===== 族谱卡片 ===== */
.genealogy-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.genealogy-card {
    background: #fff; border-radius: 12px; overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06); transition: all 0.3s;
}
.genealogy-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.genealogy-card-header {
    background: linear-gradient(135deg, #5C4033, #7A5C47);
    color: #fff; padding: 20px;
}
.genealogy-card-header h3 { font-size: 18px; margin-bottom: 4px; }
.genealogy-card-header .hall-name { font-size: 13px; opacity: 0.8; }
.genealogy-card-body { padding: 16px 20px; }
.genealogy-card-body p { font-size: 14px; margin-bottom: 6px; color: #555; }
.genealogy-card-footer {
    padding: 12px 20px; border-top: 1px solid #f0f0f0;
    display: flex; align-items: center; justify-content: space-between;
}
.genealogy-card-footer .meta { font-size: 12px; color: #999; }

/* ===== 表格 ===== */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #f0f0f0; }
.table th { font-weight: 600; color: #666; font-size: 13px; background: #f8f9fa; }
.table tr:hover { background: #fafafa; }
.table-responsive { overflow-x: auto; }

/* ===== 徽章 ===== */
.badge {
    display: inline-block; padding: 4px 10px; border-radius: 12px;
    font-size: 12px; font-weight: 500;
}
.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-secondary { background: #e9ecef; color: #495057; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; color: #555; }
.form-control {
    width: 100%; padding: 10px 14px; border: 1px solid #ddd;
    border-radius: 8px; font-size: 14px; transition: all 0.2s;
    background: #fff;
}
.form-control:focus {
    outline: none; border-color: #8B6914;
    box-shadow: 0 0 0 3px rgba(139,105,20,0.1);
}
.form-hint { font-size: 12px; color: #999; margin-top: 4px; }

/* ===== 提示框 ===== */
.alert {
    padding: 14px 20px; border-radius: 8px; margin-bottom: 20px;
    font-size: 14px; line-height: 1.6;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ===== 空状态 ===== */
.empty-state { text-align: center; padding: 40px 20px; }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state p { color: #999; font-size: 15px; margin-bottom: 8px; }

/* ===== 分页 ===== */
.pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 6px; margin-top: 20px; flex-wrap: wrap;
}
.page-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px; padding: 0 10px;
    border: 1px solid #ddd; border-radius: 6px; font-size: 13px;
    color: #666; transition: all 0.2s;
}
.page-btn:hover { border-color: #8B6914; color: #8B6914; }
.page-btn.active { background: #8B6914; color: #fff; border-color: #8B6914; }
.page-info { font-size: 13px; color: #999; margin-left: 8px; }

/* ===== 族谱树 ===== */
.tree { padding: 20px; overflow-x: auto; }
.tree ul { padding-left: 30px; }
.tree li { position: relative; margin: 8px 0; padding-left: 30px; }
.tree li::before, .tree li::after {
    content: ''; position: absolute; left: 0;
    border-left: 2px solid #8B6914; border-bottom: 2px solid #8B6914;
}
.tree li::before { top: 0; height: 100%; width: 20px; }
.tree li::after { top: 12px; width: 20px; border-left: none; }
.tree li:last-child::before { border-left: none; }
.tree-node {
    display: inline-block; padding: 8px 16px; background: #fff;
    border: 2px solid #8B6914; border-radius: 8px; font-size: 14px;
    transition: all 0.2s; cursor: default;
}
.tree-node:hover { background: #8B6914; color: #fff; }

/* ===== 时间线 ===== */
.timeline { padding: 20px 0; }
.timeline-item { position: relative; padding-left: 40px; margin-bottom: 24px; }
.timeline-item::before {
    content: ''; position: absolute; left: 0; top: 6px;
    width: 12px; height: 12px; background: #8B6914;
    border-radius: 50%; box-shadow: 0 0 0 2px #8B6914;
}
.timeline-item::after {
    content: ''; position: absolute; left: 5px; top: 18px;
    width: 2px; height: calc(100% + 6px); background: #ddd;
}
.timeline-item:last-child::after { display: none; }
.timeline-date { font-size: 13px; color: #999; margin-bottom: 4px; }
.timeline-content { font-size: 14px; line-height: 1.6; }

/* ===== 匹配卡片 ===== */
.match-card {
    padding: 16px; border-radius: 10px; margin-bottom: 12px;
    border-left: 4px solid #ddd; background: #fafafa;
}
.match-card.high { border-left-color: #28a745; background: #f0fff0; }
.match-card.medium { border-left-color: #ffc107; background: #fffdf0; }
.match-card.low { border-left-color: #dc3545; background: #fff0f0; }
.match-score {
    min-width: 60px; height: 60px; display: flex; align-items: center;
    justify-content: center; border-radius: 50%; font-size: 16px;
    font-weight: 700; color: #fff;
}
.match-score.high { background: #28a745; }
.match-score.medium { background: #ffc107; color: #333; }
.match-score.low { background: #dc3545; }

/* ===== 页脚 ===== */
.site-footer {
    background: #2C2416; color: rgba(255,255,255,0.7);
    padding: 40px 0 20px;
}
.footer-inner {
    display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px;
    margin-bottom: 30px;
}
.footer-brand h3 { color: #D4A574; font-size: 18px; margin-bottom: 8px; }
.footer-brand p { font-size: 14px; line-height: 1.8; }
.footer-links h4, .footer-info h4 { color: rgba(255,255,255,0.9); font-size: 14px; margin-bottom: 12px; }
.footer-links a { display: block; color: rgba(255,255,255,0.6); font-size: 13px; margin-bottom: 8px; transition: color 0.2s; }
.footer-links a:hover { color: #D4A574; }
.footer-info p { font-size: 13px; margin-bottom: 4px; }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 16px; text-align: center;
}
.footer-bottom p { font-size: 13px; color: rgba(255,255,255,0.4); }

/* ===== 搜索框 ===== */
.search-box {
    display: flex; max-width: 600px; margin: 0 auto;
    border-radius: 10px; overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.search-box input {
    flex: 1; padding: 14px 20px; border: none; font-size: 15px;
    outline: none;
}
.search-box button {
    padding: 14px 28px; background: #5C4033; color: #fff;
    border: none; font-size: 15px; cursor: pointer; transition: background 0.2s;
}
.search-box button:hover { background: #4A3728; }

/* ===== 响应式 - 平板 ===== */
@media (max-width: 992px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .feature-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-inner { grid-template-columns: 1fr 1fr; }
}

/* ===== 响应式 - 手机 ===== */
@media (max-width: 768px) {
    /* 头部导航 */
    .header-inner { padding: 10px 16px; flex-wrap: wrap; }
    .main-nav { display: none; }
    .menu-toggle { display: flex; }
    .user-info { gap: 8px; }
    .username { display: none; }

    /* 英雄区 */
    .hero { padding: 50px 0; }
    .hero h1 { font-size: 24px; letter-spacing: 1px; }
    .hero p { font-size: 15px; }
    .hero-actions { flex-direction: column; align-items: center; }
    .hero-actions .btn { width: 100%; max-width: 280px; text-align: center; }

    /* 统计 */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .stat-card { padding: 16px 12px; }
    .stat-number { font-size: 28px; }
    .stat-label { font-size: 12px; }

    /* 功能入口 */
    .feature-grid { grid-template-columns: 1fr; gap: 12px; }
    .feature-card { padding: 20px 16px; }
    .feature-icon { font-size: 36px; }
    .feature-title { font-size: 16px; }

    /* 族谱卡片 */
    .genealogy-grid { grid-template-columns: 1fr; }

    /* 卡片 */
    .card { padding: 16px; margin-bottom: 16px; }
    .card-header { flex-direction: column; align-items: flex-start; }

    /* 页脚 */
    .footer-inner { grid-template-columns: 1fr; gap: 20px; }
    .site-footer { padding: 30px 0 16px; }

    /* 主内容 */
    .site-main { padding: 20px 0; }

    /* 搜索框 */
    .search-box { flex-direction: column; }
    .search-box button { width: 100%; }
}

/* ===== 响应式 - 小屏手机 ===== */
@media (max-width: 480px) {
    .container { padding: 0 12px; }
    .hero h1 { font-size: 20px; }
    .hero p { font-size: 14px; }
    .stat-number { font-size: 24px; }
    .stat-label { font-size: 11px; }
}

/* ===== 打印样式 ===== */
@media print {
    .site-header, .site-footer, .menu-toggle, .mobile-menu { display: none !important; }
    .site-main { padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}
