/* 
    自定义样式文件 (Refined)
    说明:
    此文件包含对网站视觉风格的定制化CSS，补充了TailwindCSS的功能。
    主要定义了整体配色方案、字体、动画效果（如背景数据流、卡片辉光），
    以及一些特定组件的复杂样式。修改此文件可以改变网站的整体视觉感受。
*/

:root {
    --color-dark-blue: #0F172A;
    --color-tech-gray: #1E293B;
    --color-neon-blue: #3B82F6;
    --color-quantum-purple: #8B5CF6;
    --color-success-green: #10B981;
    --color-warning-orange: #F59E0B;
}

/* 全局字体和基础样式 */
html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--color-dark-blue);
    background-image: radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.02) 0%, transparent 20%),
                      radial-gradient(circle at 90% 80%, rgba(255, 255, 255, 0.02) 0%, transparent 20%);
    color: #cbd5e1; /* slate-300 */
    font-family: 'Noto Sans SC', sans-serif;
}

.font-orbitron {
    font-family: 'Orbitron', sans-serif;
}

/* 
    导航栏链接样式 (.nav-link) 已被移除。
    原样式已通过Tailwind工具类直接在 index.html 文件中实现。
    这是为了解决@apply指令在CDN环境下不生效的问题，确保样式正确加载。
*/

#navbar.scrolled {
    @apply bg-slate-900/80 backdrop-blur-sm shadow-lg;
}

/* 统一的章节标题样式 */
.section-title {
    @apply text-3xl md:text-4xl font-bold font-orbitron text-white uppercase;
    position: relative;
    padding-bottom: 15px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, var(--color-neon-blue), var(--color-quantum-purple));
    border-radius: 3px;
}

.section-subtitle {
    @apply mt-4 text-lg text-blue-400 max-w-2xl mx-auto;
    font-weight: 300;
    letter-spacing: 0.5px;
}

/* 
    全息卡片效果
    backdrop-filter 用于创建磨砂玻璃效果，对性能有一定影响，但视觉效果出色。
    z-index 已添加，用于解决卡片在hover状态下可能被邻近元素遮挡的问题。
*/
.holographic-card {
    background-color: rgba(30, 41, 59, 0.5); /* bg-slate-800/50 */
    border: 1px solid rgba(59, 130, 246, 0.3); /* border-blue-500/30 */
    border-radius: 0.75rem; /* rounded-xl */
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(4px);
    z-index: 1;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s forwards;
}

.holographic-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5), 0 0 40px rgba(139, 92, 246, 0.4);
    border-color: rgba(59, 130, 246, 0.8);
    z-index: 10; /* 提升层级，确保在其他卡片之上 */
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 为不同卡片设置不同的动画延迟 */
.holographic-card:nth-child(1) { animation-delay: 0.1s; }
.holographic-card:nth-child(2) { animation-delay: 0.2s; }
.holographic-card:nth-child(3) { animation-delay: 0.3s; }
.holographic-card:nth-child(4) { animation-delay: 0.4s; }
.holographic-card:nth-child(5) { animation-delay: 0.5s; }

/* 适用人群卡片样式 */
.audience-card {
    @apply relative overflow-hidden rounded-lg cursor-pointer transform transition-transform duration-300 hover:-translate-y-2;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}

.audience-image {
    @apply w-full h-full object-cover transition-transform duration-300;
}

.audience-card:hover .audience-image {
    transform: scale(1.1);
}

.audience-overlay {
    @apply absolute inset-0 bg-gradient-to-t from-black/80 via-black/40 to-transparent flex items-end p-4;
}

.audience-title {
    @apply text-white text-xl font-bold transition-colors duration-300;
}

.audience-card:hover .audience-title {
    color: var(--color-quantum-purple);
}


/* 知识图谱Canvas样式 */
#knowledge-graph-container canvas {
    width: 100%;
    height: 100%;
    font-family: 'Noto Sans SC', sans-serif;
}

/* 知识图谱悬停提示框样式 */
#knowledge-graph-container div[style*='position: absolute'] {
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    z-index: 100;
}

/* PDF 阅读器样式 */
.graph-link {
    stroke: var(--color-tech-gray);
    stroke-opacity: 0.6;
    transition: stroke-width 0.3s ease;
}

.graph-node circle {
    stroke: var(--color-quantum-purple);
    stroke-width: 2px;
    cursor: grab;
    transition: r 0.3s ease, fill 0.3s ease;
}

.graph-node circle:active {
    cursor: grabbing;
}

.graph-node text {
    fill: #cbd5e1; /* slate-300 */
    font-size: 12px;
    pointer-events: none; /* Text doesn't block dragging */
    text-shadow: 0 0 3px black;
    transition: font-size 0.3s ease, fill 0.3s ease;
}

/* 知识图谱节点悬停效果 */
.graph-node:hover circle {
    r: 15;
    fill: var(--color-neon-blue) !important;
}

.graph-node:hover text {
    font-size: 14px;
    fill: white;
    font-weight: bold;
}

.graph-node:hover + .graph-link,
.graph-link:hover {
    stroke-width: 3;
}

/* PDF 阅读器样式 */
.control-button {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    color: #cbd5e1; /* slate-300 */
    transition: all 0.3s ease;
    background-color: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(59, 130, 246, 0.3);
    cursor: pointer;
    position: relative;
    z-index: 20;
    font-weight: 500;
}
.control-button:hover:not(:disabled) {
    background-color: rgba(59, 130, 246, 0.2);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.control-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 页码信息样式 */
#page-info {
    color: #cbd5e1; /* slate-300 */
    font-size: 1rem;
    line-height: 1.5rem;
    display: flex;
    align-items: center;
    z-index: 20;
    position: relative;
}

/* PDF阅读器按钮容器 */
#pdf-viewer-container > div:first-child {
    position: relative;
    z-index: 15;
}

#pdf-viewer {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    padding: 20px;
    background-color: #0f172a; /* slate-900 */
    scrollbar-width: thin;
    scrollbar-color: var(--color-neon-blue) var(--color-tech-gray);
    position: relative;
    z-index: 10;
}

#pdf-viewer-container {
    position: relative;
    z-index: 5;
    overflow: auto; /* 允许滚动以适应放大后的PDF */
}
#pdf-viewer::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
#pdf-viewer::-webkit-scrollbar-track {
    background: var(--color-tech-gray);
}
#pdf-viewer::-webkit-scrollbar-thumb {
    background-color: var(--color-neon-blue);
    border-radius: 4px;
    border: 2px solid var(--color-tech-gray);
}

.loader {
    border: 4px solid var(--color-tech-gray);
    border-left-color: var(--color-neon-blue);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}


/* 背景数据流动画 */
#background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background-image:
        linear-gradient(var(--color-neon-blue) 1px, transparent 1px),
        linear-gradient(90deg, var(--color-neon-blue) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.05;
    animation: pan-background 60s linear infinite;
}

@keyframes pan-background {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 100% 100%;
    }
}

/* 为英雄区视频背景添加额外样式 */
#hero video {
    object-fit: cover;
    z-index: 0;
}

#hero .relative.z-10 {
    z-index: 10;
}

/* 目录相关样式 */
.toc-content {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    padding-right: 8px;
}

/* 自定义滚动条 */
.toc-content::-webkit-scrollbar {
    width: 6px;
}

.toc-content::-webkit-scrollbar-track {
    background: rgba(59, 130, 246, 0.1);
    border-radius: 3px;
}

.toc-content::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.5);
    border-radius: 3px;
}

.toc-content::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.8);
}

/* 目录列表样式 */
#toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-main-item {
    margin-bottom: 15px;
    padding: 5px 0;
}

.toc-child-list li {
    margin-bottom: 8px;
}

/* 目录项样式 */
.toc-item {
    display: block;
    padding: 6px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: 0.95rem;
    line-height: 1.4;
}

.toc-item:hover {
    background-color: rgba(59, 130, 246, 0.2);
    transform: translateX(2px);
}

/* 活动目录项高亮 */
.toc-item.text-white.font-bold {
    background-color: rgba(59, 130, 246, 0.3);
    border-left: 3px solid var(--color-neon-blue);
}

/* 展开/折叠指示器 */
.toc-toggle {
    display: inline-block;
    width: 16px;
    text-align: center;
    transition: transform 0.2s ease;
    font-size: 0.8rem;
    color: var(--color-neon-blue);
}

/* 子目录列表 */
.toc-child-list {
    list-style: none;
    padding: 0;
    margin: 4px 0 4px 12px;
    animation: fadeIn 0.2s ease;
}

.toc-child-list li {
    margin: 3px 0;
}

/* 控制按钮样式 */
.control-button {
    background-color: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--color-neon-blue);
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.control-button:hover {
    background-color: rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.control-button:active {
    transform: translateY(0);
}

/* 页码显示 */
.toc-item .text-sm.text-gray-400 {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* 移动端目录样式 */
@media (max-width: 1024px) {
    #toc-panel {
        transition: all 0.3s ease;
    }
    
    #toc-panel.fixed.inset-0 {
        padding: 20px;
    }
    
    #toc-panel.fixed.inset-0 .toc-content {
        max-height: calc(100vh - 100px);
    }
    
    #show-toc {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    #toggle-toc {
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: rgba(59, 130, 246, 0.2);
        border: 1px solid rgba(59, 130, 246, 0.3);
        border-radius: 4px;
        padding: 4px 8px;
        transition: all 0.2s ease;
    }
    
    #toggle-toc:hover {
        background-color: rgba(59, 130, 246, 0.4);
    }
}

@media (min-width: 1025px) {
    #show-toc {
        display: none;
    }
}

/* 淡入动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toc-third-level {
    margin-left: 30px; /* 增加缩进量以明确层级 */
    font-size: 0.9em;
    color: #93c5fd;
}