/* ============================================
   MBTI 功能与人格解析页面样式
   星尘心理 - 与主站完美融合的设计
   ============================================ */

/* ============================================
   注意：本文件依赖 style.css 中定义的 CSS 变量
   请确保在 HTML 中先引入 style.css，再引入本文件
   ============================================ */

/* ============================================
   Hero 区域 - 与主站欢迎页保持一致的风格
   ============================================ */
.hero {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.95), rgba(139, 92, 246, 0.95));
    padding: 80px 20px 60px;
    position: relative;
    overflow: hidden;
}

/* 背景装饰 - 使用与主站相同的光晕效果 */
.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255,255,255,0.05) 0%, transparent 50%);
    pointer-events: none;
}

.hero-content {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 3em;
    font-weight: 900;
    color: rgb(0, 0, 0);
    margin-bottom: 16px;
    text-shadow: 0 4px 12px rgba(0,0,0,0.2);
    animation: fadeInUp 0.6s ease;
}

.hero-subtitle {
    font-size: 1.3em;
    color: rgba(0, 0, 0, 0.95);
    margin-bottom: 40px;
    animation: fadeInUp 0.8s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   快速导航 - 类似主站的按钮组
   ============================================ */
.quick-nav {
    display: flex;
    gap: 16px;
    justify-content: center;
    animation: fadeInUp 1s ease;
    flex-wrap: wrap;
}

.quick-nav-btn {
    padding: 16px 32px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-full);
    color: rgb(149, 149, 149);
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-nav-btn .icon {
    font-size: 1.3em;
}

.quick-nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.quick-nav-btn.active {
    background: white;
    color: var(--primary);
    border-color: white;
    box-shadow: var(--shadow-xl);
}

/* ============================================
   主内容区域
   ============================================ */
.main-content {
    padding: 40px 20px 80px;
}

.content-section {
    display: none;
    animation: fadeIn 0.4s ease;
}

.content-section.active {
    display: block;
}

.section-header {
    text-align: center;
    margin-bottom: 48px;
}

.section-header h2 {
    font-size: 2.5em;
    color: rgb(3, 3, 3);
    margin-bottom: 12px;
    font-weight: 800;
    text-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.section-desc {
    font-size: 1.1em;
    color: rgba(0, 0, 0, 0.9);
}

/* ============================================
   功能筛选器 - 与主站 tab 风格一致
   ============================================ */
.function-filter {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid transparent;
    border-radius: var(--radius-full);
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.filter-btn.active {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* ============================================
   功能卡片网格 - 继承主站卡片风格
   ============================================ */
.functions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.function-card {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 32px 24px;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
}

/* 顶部装饰条 - 与主站 info-box 一致 */
.function-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.function-card:hover::before {
    transform: scaleX(1);
}

.function-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary-light);
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.25);
}

.function-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.function-icon {
    font-size: 3em;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.function-title-group h3 {
    font-size: 1.8em;
    color: var(--primary);
    margin-bottom: 4px;
    font-weight: 800;
}

.function-name {
    font-size: 0.95em;
    color: var(--text-secondary);
    font-weight: 600;
}

.function-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

/* 继承主站的 keyword-tag 风格 */
.keyword-tag {
    padding: 4px 12px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border-radius: var(--radius-sm);
    font-size: 0.85em;
    color: var(--primary);
    font-weight: 600;
}

.function-description {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 20px;
}

.function-personalities {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.mini-personality-badge {
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 0.9em;
    color: var(--primary);
    transition: var(--transition);
}

.mini-personality-badge:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
}

/* ============================================
   人格分组 - 大卡片设计
   ============================================ */
.personality-groups {
    display: flex;
    flex-direction: column;
    gap: 48px;
    max-width: 1200px;
    margin: 0 auto;
}

.personality-group {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-xl);
}

.group-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 3px solid var(--bg-tertiary);
}

.group-icon {
    font-size: 3.5em;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.group-info h3 {
    font-size: 2em;
    color: var(--primary);
    margin-bottom: 8px;
    font-weight: 800;
}

.group-info p {
    font-size: 1.05em;
    color: var(--text-secondary);
}

.personalities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.personality-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 28px 20px;
    text-align: center;
    transition: var(--transition);
    border: 2px solid transparent;
    cursor: pointer;
}

.personality-card:hover {
    background: var(--bg-primary);
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.personality-badge {
    display: inline-block;
    padding: 8px 20px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: var(--radius-full);
    font-weight: 900;
    font-size: 1.3em;
    letter-spacing: 2px;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.personality-card h4 {
    font-size: 1.4em;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-weight: 700;
}

.personality-subtitle {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-style: italic;
}

.personality-stack {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--radius);
    font-size: 0.85em;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 16px;
    font-family: 'Courier New', monospace;
}

.view-detail-btn {
    padding: 10px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95em;
}

.view-detail-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* ============================================
   模态框 - 继承主站模态框风格
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(4px);
}

.modal-container {
    position: relative;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    max-width: 900px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.4s ease;
    z-index: 1001;
}

.modal-container.personality-modal {
    max-width: 1000px;
}

/* 与主站一致的模态框关闭按钮 */
.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--bg-tertiary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5em;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--danger);
    color: white;
    transform: rotate(90deg);
}

.modal-content {
    padding: 48px 40px;
}

/* ============================================
   功能详情模态框内容
   ============================================ */
.function-detail-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 32px;
    border-bottom: 3px solid var(--bg-tertiary);
}

.function-detail-icon {
    font-size: 5em;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.function-detail-header h2 {
    font-size: 2.5em;
    color: var(--primary);
    margin-bottom: 8px;
    font-weight: 900;
}

.function-detail-name {
    font-size: 1.2em;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 16px;
}

.function-detail-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.detail-section {
    margin-bottom: 32px;
}

.detail-section h3 {
    font-size: 1.5em;
    color: var(--primary);
    margin-bottom: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 装饰性左边框 - 与主站 info-box 一致 */
.detail-section h3::before {
    content: '';
    width: 6px;
    height: 24px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 3px;
}

.detail-section p {
    line-height: 1.8;
    color: var(--text-secondary);
    font-size: 1.05em;
}

.detail-list {
    list-style: none;
    padding: 0;
}

.detail-list li {
    padding: 12px 0;
    padding-left: 32px;
    position: relative;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* 与主站 info-box li 一致的图标样式 */
.detail-list.strengths li::before {
    content: '✓';
    position: absolute;
    left: 8px;
    color: var(--success);
    font-weight: bold;
    font-size: 1.2em;
}

.detail-list.weaknesses li::before {
    content: '✗';
    position: absolute;
    left: 8px;
    color: var(--danger);
    font-weight: bold;
    font-size: 1.2em;
}

.detail-list.suggestions li::before {
    content: '→';
    position: absolute;
    left: 8px;
    color: var(--primary);
    font-weight: bold;
    font-size: 1.2em;
}

.position-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.position-item {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
    transition: var(--transition);
}

.position-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.position-item h4 {
    color: var(--primary);
    margin-bottom: 8px;
    font-size: 1.1em;
}

.position-item p {
    font-size: 0.95em;
    line-height: 1.6;
}

.related-personalities {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.related-personality-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(139, 92, 246, 0.05));
    border: 2px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.related-personality-card:hover {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.related-personality-card .personality-badge {
    background: var(--primary);
    color: white;
    padding: 6px 16px;
    font-size: 1.2em;
}

.related-personality-card:hover .personality-badge {
    background: white;
    color: var(--primary);
}

/* ============================================
   人格详情模态框内容
   ============================================ */
.personality-detail-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-xl);
    color: white;
    position: relative;
    overflow: hidden;
}

/* 继承主站 mbti-type-card 的脉冲效果 */
.personality-detail-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
}

.personality-detail-badge {
    font-size: 3.5em;
    font-weight: 900;
    letter-spacing: 8px;
    margin-bottom: 16px;
    text-shadow: 0 4px 12px rgba(0,0,0,0.2);
    position: relative;
    z-index: 1;
}

.personality-detail-title {
    font-size: 2em;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.personality-detail-subtitle {
    font-size: 1.2em;
    opacity: 0.9;
    margin-bottom: 20px;
    font-style: italic;
    position: relative;
    z-index: 1;
}

.personality-detail-stack {
    display: inline-block;
    padding: 12px 32px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-full);
    font-size: 1.3em;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    position: relative;
    z-index: 1;
}

/* 标签导航 - 继承主站 result-tabs 风格 */
.personality-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
    border-bottom: 2px solid var(--border);
    overflow-x: auto;
}

.personality-tab {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.personality-tab:hover {
    color: var(--primary);
}

.personality-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.personality-tab-content {
    display: none;
}

.personality-tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

.traits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.trait-item {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
    transition: var(--transition);
}

.trait-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.trait-item h4 {
    color: var(--primary);
    margin-bottom: 12px;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.function-stack-visual {
    display: grid;
    gap: 16px;
    margin-top: 20px;
}

.stack-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    transition: var(--transition);
}

.stack-item:hover {
    background: white;
    box-shadow: var(--shadow-md);
}

.stack-position {
    font-size: 2.5em;
    font-weight: 900;
    color: var(--primary);
    min-width: 60px;
    text-align: center;
}

.stack-function {
    flex: 1;
}

.stack-function h4 {
    font-size: 1.3em;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stack-label {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border-radius: var(--radius-sm);
    font-size: 0.85em;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 8px;
}

.stack-description {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ============================================
   导航栏 - 优化版
   ============================================ */
.nav-links {
    display: flex;
    gap: 12px;
    align-items: center;
}

.nav-link {
    padding: 8px 16px;
    background: rgba(99, 102, 241, 0.1);
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-full);
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary);
    transform: translateY(-1px);
}

/* ============================================
   滚动条美化
   ============================================ */
.modal-container::-webkit-scrollbar,
.personality-tabs::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.modal-container::-webkit-scrollbar-track,
.personality-tabs::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.modal-container::-webkit-scrollbar-thumb,
.personality-tabs::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

.modal-container::-webkit-scrollbar-thumb:hover,
.personality-tabs::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ============================================
   响应式设计 - 移动端优化
   ============================================ */
@media (max-width: 768px) {
    .hero {
        padding: 60px 16px 40px;
    }

    .hero-title {
        font-size: 2em;
    }

    .hero-subtitle {
        font-size: 1.1em;
    }

    .quick-nav {
        flex-direction: column;
        width: 100%;
    }

    .quick-nav-btn {
        width: 100%;
        justify-content: center;
    }

    .section-header h2 {
        font-size: 1.8em;
    }

    .functions-grid {
        grid-template-columns: 1fr;
    }

    .personality-group {
        padding: 24px 20px;
    }

    .group-header {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .personalities-grid {
        grid-template-columns: 1fr;
    }

    .modal-container {
        width: 95%;
        max-height: 90vh;
    }

    .modal-content {
        padding: 32px 24px;
    }

    .personality-detail-badge {
        font-size: 2.5em;
        letter-spacing: 4px;
    }

    .personality-tabs {
        gap: 8px;
    }

    .personality-tab {
        padding: 10px 16px;
        font-size: 0.9em;
    }

    .traits-grid,
    .position-grid,
    .related-personalities {
        grid-template-columns: 1fr;
    }

    /* 导航栏适配 */
    .header-content {
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
    }

    .logo {
        height: 40px;
    }

    .brand-name {
        font-size: 1.2em;
    }

    .nav-links {
        width: 100%;
        justify-content: space-between;
    }

    .nav-link,
    .channel-link {
        flex: 1;
        text-align: center;
        padding: 10px 12px;
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 50px 12px 30px;
    }

    .function-filter {
        flex-direction: column;
    }

    .filter-btn {
        width: 100%;
    }

    .group-icon {
        font-size: 2.5em;
    }

    .group-info h3 {
        font-size: 1.5em;
    }

    .personality-detail-header {
        padding: 30px 20px;
    }

    .function-detail-icon {
        font-size: 3.5em;
    }

    .function-detail-header h2 {
        font-size: 2em;
    }
}

/* ============================================
   打印样式
   ============================================ */
@media print {
    .hero,
    .quick-nav,
    .function-filter,
    .footer,
    .modal,
    .view-detail-btn,
    .nav-links {
        display: none;
    }

    body {
        background: white;
    }

    .main-content {
        padding: 0;
    }

    .personality-group {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid var(--border);
    }

    .function-card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid var(--border);
    }
}

/* ============================================
   暗色主题支持（预留）
   ============================================ */
@media (prefers-color-scheme: dark) {
    /* 如需支持暗色主题，在此添加样式覆盖 */
}

/* ============================================
   动画性能优化
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   工具类（继承主站）
   ============================================ */
.fade-in-up {
    animation: fadeInUp 0.6s ease;
}

.fade-in {
    animation: fadeIn 0.4s ease;
}

.slide-up {
    animation: slideUp 0.4s ease;
}

/* ============================================
   完成标记
   ============================================ */
/* MBTI.css - v2.0 - 完全融合主站设计语言 */

