/**
 * 蒋氏家族宗亲平台 - 前台主样式表
 * 
 * 家族风格设计：庄重典雅的中国传统风格，暖色调为主
 */

/* ===== CSS 变量 ===== */
:root {
    --jf-primary: #8B4513;        /* 檀木棕 - 主色调 */
    --jf-primary-dark: #6B3410;   /* 深棕 */
    --jf-primary-light: #A0522D;  /* 浅棕 */
    --jf-accent: #DAA520;         /* 金黄 - 点缀色 */
    --jf-accent-light: #F0C75E;   /* 浅金 */
    --jf-bg-warm: #FFF8F0;        /* 暖白背景 */
    --jf-bg-cream: #FFFDF7;       /* 奶油白 */
    --jf-dark: #2C1810;           /* 深黑棕 */
    --jf-border: #D4C5B9;         /* 边框色 */
    --jf-red: #C41E3A;            /* 朱红 */
    --jf-text: #3C2A20;           /* 文字色 */
    --jf-text-light: #8B7355;     /* 浅文字 */
}

/* ===== 通用 ===== */
body {
    font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    color: var(--jf-text);
    background: var(--jf-bg-cream);
    transition: background 0.3s;
}

a {
    color: var(--jf-primary);
    transition: color 0.2s;
}
a:hover { color: var(--jf-primary-dark); }

/* ===== 导航栏 ===== */
.bg-jf-primary {
    background: linear-gradient(135deg, var(--jf-primary-dark), var(--jf-primary)) !important;
}
.navbar-dark .navbar-nav .nav-link {
    color: rgba(255,255,255,0.85);
    transition: all 0.3s;
    padding: 0.5rem 1rem;
}
.navbar-dark .navbar-nav .nav-link:hover {
    color: var(--jf-accent-light);
    transform: translateY(-1px);
}
.navbar-brand { letter-spacing: 0.5px; }

/* ===== 页脚 ===== */
.bg-jf-dark {
    background: linear-gradient(135deg, #1a0f0a, var(--jf-dark)) !important;
}

/* ===== 普缘栏按钮 ===== */
.btn-jf-primary {
    background: linear-gradient(135deg, var(--jf-primary-dark), var(--jf-primary));
    color: white;
    border: none;
    transition: all 0.3s;
}
.btn-jf-primary:hover {
    background: linear-gradient(135deg, var(--jf-primary), var(--jf-primary-light));
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(139,69,19,0.3);
}
.btn-jf-outline {
    border: 2px solid var(--jf-primary);
    color: var(--jf-primary);
    background: transparent;
    transition: all 0.3s;
}
.btn-jf-outline:hover {
    background: var(--jf-primary);
    color: white;
}
.btn-jf-accent {
    background: linear-gradient(135deg, var(--jf-accent), var(--jf-accent-light));
    color: var(--jf-dark);
    border: none;
    font-weight: 600;
    transition: all 0.3s;
}
.btn-jf-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(218,165,32,0.4);
}

/* ===== 首页图轮播图 ===== */
#heroCarousel {
    max-height: 500px;
    overflow: hidden;
}
#heroCarousel .carousel-item {
    max-height: 500px;
}
#heroCarousel .carousel-item img {
    object-fit: cover;
    width: 100%;
    height: 500px;
}
.carousel-caption {
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 20px 30px;
}

/* ===== 家族数据统计卡片 ===== */
.stat-card {
    background: #fff;
    border: 2px solid var(--jf-border);
    border-radius: 16px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 12px rgba(139,69,19,0.06);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--jf-primary), var(--jf-accent));
    border-radius: 16px 16px 0 0;
}
.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 36px rgba(139,69,19,0.12);
    border-color: var(--jf-accent);
}
.stat-card .stat-icon {
    font-size: 2rem;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.stat-card:hover .stat-icon {
    transform: scale(1.2);
}

/* ===== 四大核心入口 ===== */
.entry-card {
    background: white;
    border-radius: 16px;
    padding: 30px 20px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 15px rgba(139,69,19,0.08);
    cursor: pointer;
    margin-bottom: 20px;
}
.entry-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(139,69,19,0.15);
}
.entry-card .entry-icon {
    font-size: 3rem;
    color: var(--jf-primary);
    margin-bottom: 15px;
    transition: transform 0.4s;
}
.entry-card:hover .entry-icon {
    transform: scale(1.15);
}
.entry-card .entry-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--jf-text);
    margin-bottom: 8px;
}
.entry-card .entry-desc {
    color: var(--jf-text-light);
    font-size: 0.9rem;
}

/* ===== 族谱树 ===== */
.genealogy-tree {
    overflow-x: auto;
    padding: 40px 20px;
    background: linear-gradient(135deg, #FFF8F0, #FFFDF7);
    border-radius: 12px;
    border: 1px solid var(--jf-border);
}
.family-tree-node {
    display: inline-block;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--jf-primary), var(--jf-primary-light));
    color: white;
    border-radius: 8px;
    margin: 5px;
    min-width: 100px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
}
.family-tree-node:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(139,69,19,0.3);
}
.family-tree-node.claimed {
    border: 2px solid var(--jf-accent);
}

/* ===== 虚拟宗祠 ===== */
.ancestral-hall-container {
    background: linear-gradient(180deg, #1a0f0a 0%, #2C1810 50%, #3C2317 100%);
    color: #E8D5B7;
    border-radius: 16px;
    padding: 20px;
    min-height: 500px;
    position: relative;
}
.ancestral-tablet {
    display: inline-block;
    padding: 20px 15px;
    background: linear-gradient(180deg, #3C2317, #2C1810);
    border: 2px solid #DAA520;
    border-radius: 4px;
    margin: 10px;
    text-align: center;
    min-width: 120px;
    transition: all 0.3s;
    cursor: pointer;
}
.ancestral-tablet:hover {
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(218,165,32,0.3);
}
.worship-btn {
    background: none;
    border: none;
    color: var(--jf-accent);
    cursor: pointer;
    font-size: 1.5rem;
    transition: all 0.3s;
    margin: 0 5px;
}
.worship-btn:hover {
    color: #FFD700;
    transform: scale(1.2);
}
/* 3D 场景容器 */
#ancestral-3d-container {
    width: 100%;
    height: 500px;
    border-radius: 12px;
    overflow: hidden;
    background: radial-gradient(ellipse at center, #2C1810 0%, #1a0f0a 70%);
}

/* ===== 纸质族谱阅读器 ===== */
.paper-reader {
    perspective: 2000px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 600px;
    background: linear-gradient(135deg, #2C1810, #3C2317);
    border-radius: 12px;
    padding: 40px;
}
.paper-page {
    background: linear-gradient(135deg, #FFF8DC, #F5DEB3);
    border: 1px solid #D2B48C;
    box-shadow: 5px 5px 20px rgba(0,0,0,0.3);
    border-radius: 2px 8px 8px 2px;
    padding: 40px;
    width: 100%;
    max-width: 800px;
    min-height: 500px;
    position: relative;
}
.paper-page::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(90deg, rgba(0,0,0,0.05), transparent);
}
.page-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}
.page-controls button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--jf-accent);
    background: transparent;
    color: var(--jf-accent);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
}
.page-controls button:hover {
    background: var(--jf-accent);
    color: var(--jf-dark);
}

/* ===== 时间轴 ===== */
.timeline {
    position: relative;
    padding: 30px 0;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--jf-primary), var(--jf-accent));
    transform: translateX(-50%);
}
.timeline-item {
    position: relative;
    margin-bottom: 40px;
    width: 50%;
}
.timeline-item:nth-child(odd) {
    padding-right: 50px;
    text-align: right;
}
.timeline-item:nth-child(even) {
    margin-left: 50%;
    padding-left: 50px;
}
.timeline-item::before {
    content: '';
    position: absolute;
    top: 20px;
    width: 16px;
    height: 16px;
    background: var(--jf-accent);
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 0 3px var(--jf-primary);
}
.timeline-item:nth-child(odd)::before {
    right: -8px;
}
.timeline-item:nth-child(even)::before {
    left: -8px;
}
.timeline-date {
    display: inline-block;
    background: var(--jf-primary);
    color: white;
    padding: 4px 16px;
    border-radius: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}
.timeline-content {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    transition: all 0.3s;
}
.timeline-content:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(139,69,19,0.12);
}

/* ===== 名人堂卡片 ===== */
.fame-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    margin-bottom: 30px;
    position: relative;
}
.fame-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 40px rgba(139,69,19,0.15);
}
.fame-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--jf-primary), var(--jf-accent));
}
.fame-card .fame-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--jf-accent);
    margin: -50px auto 15px;
    position: relative;
    z-index: 1;
}
.fame-card .fame-intro {
    padding: 0 20px 20px;
    text-align: center;
}

/* ===== 中国地图容器 ===== */
.china-map-container {
    width: 100%;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
}

/* ===== 家族分布卡片 ===== */
.region-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: all 0.3s;
}
.region-card:hover {
    box-shadow: 0 4px 20px rgba(139,69,19,0.1);
}
.region-rank {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--jf-accent);
    width: 50px;
    text-align: center;
}
.region-rank.top1 { color: #FFD700; }
.region-rank.top2 { color: #C0C0C0; }
.region-rank.top3 { color: #CD7F32; }

/* ===== 聊天界面 ===== */
.chat-container {
    display: flex;
    height: calc(100vh - 200px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    overflow: hidden;
}
.chat-list {
    width: 300px;
    border-right: 1px solid var(--jf-border);
    overflow-y: auto;
}
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #F8F5F0;
}
.chat-message {
    margin-bottom: 15px;
    max-width: 70%;
}
.chat-message.mine {
    margin-left: auto;
}
.chat-message .message-bubble {
    padding: 10px 16px;
    border-radius: 18px;
    position: relative;
}
.chat-message.mine .message-bubble {
    background: var(--jf-primary);
    color: white;
    border-bottom-right-radius: 4px;
}
.chat-message.other .message-bubble {
    background: white;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.chat-input-area {
    padding: 15px;
    border-top: 1px solid var(--jf-border);
    background: white;
}

/* ===== 公益进度条 ===== */
.charity-progress {
    height: 12px;
    border-radius: 6px;
    background: #E8D5B7;
    overflow: hidden;
}
.charity-progress .progress-bar {
    background: linear-gradient(90deg, var(--jf-primary), var(--jf-accent));
    border-radius: 6px;
    transition: width 1s ease;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .timeline::before {
        left: 20px;
    }
    .timeline-item {
        width: 100%;
        padding-left: 50px !important;
        text-align: left !important;
        margin-left: 0 !important;
    }
    .timeline-item::before {
        left: 12px !important;
    }
    .chat-container {
        flex-direction: column;
    }
    .chat-list {
        width: 100%;
        height: 150px;
    }
    .fame-card .fame-avatar {
        width: 80px;
        height: 80px;
        margin-top: -40px;
    }
}
