/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 主题颜色 */
    --primary-color: #4285F4;
    --primary-dark: #3367D6;
    --secondary-color: #34A853;
    --accent-color: #EA4335;
    --warning-color: #FBBC05;
    
    /* 中性色 */
    --text-primary: #202124;
    --text-secondary: #5F6368;
    --text-tertiary: #80868B;
    --divider-color: #DADCE0;
    --background-color: #F8F9FA;
    --card-background: #FFFFFF;
    
    /* 尺寸 */
    --card-border-radius: 12px;
    --button-border-radius: 6px;
    --input-border-radius: 4px;
    
    /* 阴影 */
    --card-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    --button-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    --hover-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    
    /* 动画 */
    --transition-speed: 0.3s;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
}

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

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* 标签页 */
.tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--divider-color);
}

.tab-button {
    padding: 1rem 2rem;
    background: none;
    border: none;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: color var(--transition-speed);
}

.tab-button:hover {
    color: var(--primary-color);
}

.tab-button.active {
    color: var(--primary-color);
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 卡片样式 */
.card {
    background-color: var(--card-background);
    border-radius: var(--card-border-radius);
    box-shadow: var(--card-shadow);
    margin-bottom: 2rem;
    overflow: hidden;
    transition: box-shadow var(--transition-speed);
}

.card:hover {
    box-shadow: var(--hover-shadow);
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--divider-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
}

.card-header h2 .material-icons {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

.card-header p {
    color: var(--text-secondary);
    font-weight: 300;
    margin-top: 0.5rem;
}

.card-body {
    padding: 1.5rem;
}

.result-card {
    transition: all var(--transition-speed);
    transform-origin: top;
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from { 
        opacity: 0;
        transform: translateY(-20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* 表单样式 */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-wrapper {
    position: relative;
}

input[type="text"],
textarea,
select {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--divider-color);
    border-radius: var(--input-border-radius);
    font-family: 'Roboto', sans-serif;
    font-size: 1rem;
    transition: border var(--transition-speed);
}

input[type="text"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
}

.char-count {
    position: absolute;
    right: 10px;
    bottom: 10px;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

/* 滑块样式 */
.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: var(--divider-color);
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-speed);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider-value {
    font-weight: 500;
    color: var(--primary-color);
    min-width: 25px;
    text-align: center;
    border: none;
    background: transparent;
    width: 30px;
    padding: 0;
}

small {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

/* 按钮样式 */
.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: var(--button-border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.btn .material-icons {
    margin-right: 0.5rem;
    font-size: 1.2rem;
}

.btn.primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--button-shadow);
}

.btn.primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn.secondary {
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--divider-color);
}

.btn.secondary:hover {
    background-color: rgba(0, 0, 0, 0.05);
    border-color: var(--text-tertiary);
}

/* 示例问题标签 */
.example-questions {
    margin-top: 1rem;
}

.example-header {
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.example-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.example-tag {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background-color: #E8F0FE;
    color: var(--primary-color);
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.example-tag:hover {
    background-color: #D2E3FC;
    transform: translateY(-2px);
}

/* 统计徽章 */
.stats-badge {
    background-color: #E8F0FE;
    color: var(--primary-color);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.search-method-badge {
    background-color: #F0F8E8;
    color: var(--secondary-color);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* 加载动画 */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(66, 133, 244, 0.2);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 图谱容器 */
.graph-container {
    height: 600px;
    width: 100%;
    position: relative;
    background-color: #fcfcfc;
}

/* 最大化按钮 */
.maximize-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--divider-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed);
}

.maximize-btn:hover {
    transform: scale(1.1);
    background-color: var(--primary-color);
}

.maximize-btn:hover .material-icons {
    color: white;
}

.maximize-btn .material-icons {
    font-size: 20px;
    color: var(--primary-color);
}

/* 全屏时的特殊样式 */
:fullscreen .graph-container {
    height: 100vh;
    width: 100vw;
    border: none;
}

:-webkit-full-screen .graph-container {
    height: 100vh;
    width: 100vw;
    border: none;
}

:-ms-fullscreen .graph-container {
    height: 100vh;
    width: 100vw;
    border: none;
}

/* 问答结果样式 */
.answer-container {
    display: none;
}

.question-display {
    background-color: #F8F9FA;
    padding: 1rem;
    border-radius: var(--input-border-radius);
    margin-bottom: 1.5rem;
    font-style: italic;
    color: var(--text-secondary);
}

.answer-text {
    padding: 1rem;
    background-color: #E8F0FE;
    border-radius: var(--input-border-radius);
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

.related-movies {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.movie-card {
    background-color: #F8F9FA;
    border-radius: var(--input-border-radius);
    padding: 1rem;
    border-left: 4px solid var(--primary-color);
}

.movie-title {
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.movie-score {
    background-color: var(--warning-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
}

.movie-info {
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.movie-info strong {
    color: var(--text-primary);
}

.movie-relation {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background-color: rgba(66, 133, 244, 0.1);
    border-radius: 4px;
}

/* 页脚 */
footer {
    text-align: center;
    margin-top: 3rem;
    padding: 1.5rem 0;
    border-top: 1px solid var(--divider-color);
    color: var(--text-tertiary);
}

/* 响应式样式 */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .tabs {
        flex-direction: column;
        border-bottom: none;
    }
    
    .tab-button {
        padding: 0.8rem;
        border-bottom: 1px solid var(--divider-color);
    }
    
    .tab-button.active::after {
        display: none;
    }
    
    .tab-button.active {
        background-color: var(--primary-color);
        color: white;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .stats-badge, .search-method-badge {
        margin-top: 1rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .graph-container {
        height: 400px;
    }
    
    .related-movies {
        grid-template-columns: 1fr;
    }
}

/* 图谱区域样式 */
.graph-section {
    margin-top: 1.5rem;
    background-color: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    overflow: hidden;
}

.graph-title {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #eaeaea;
    background-color: #f9f9f9;
    display: flex;
    align-items: center;
    font-size: 1.1rem;
    margin: 0;
    color: #333;
    font-weight: 500;
}

/* 路径信息折叠/展开功能 */
.path-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.collapse-btn {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: rgba(0, 0, 0, 0.05);
}

.collapse-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.collapse-btn .material-icons {
    transition: transform 0.3s ease;
}

.collapse-btn.collapsed .material-icons {
    transform: rotate(-90deg);
}

.collapsible-content {
    overflow: hidden;
    transition: max-height 0.3s ease;
    max-height: 1000px; /* 默认展开状态的最大高度 */
}

.collapsible-content.collapsed {
    max-height: 0;
}

/* 路径节点显示优化 */
.path-nodes {
    margin-top: 0.5rem;
}

.path-nodes li {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    border-left: 3px solid var(--primary-color);
}

.additional-path {
    margin-bottom: 1rem;
    border-radius: 6px;
    overflow: hidden;
}

.additional-path-title {
    padding: 0.8rem;
    background-color: rgba(255, 255, 255, 0.8);
}

.additional-path-nodes {
    padding: 0 0.8rem 0.8rem 0.8rem;
}

.additional-path-nodes li {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
}

/* 横向路径显示 */
.horizontal-path {
    margin-top: 1rem;
    padding: 1rem;
    background-color: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.horizontal-path-nodes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 0.5rem;
}

.path-node {
    background-color: #f5f5f5;
    border-left: 3px solid var(--primary-color);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.95rem;
    position: relative;
    display: flex;
    align-items: center;
}

.path-node.movie {
    border-left-color: #FF8080;
}

.path-node.director {
    border-left-color: #80FF80;
}

.path-node.actor {
    border-left-color: #80C0FF;
}

.path-node.category {
    border-left-color: #FFFF80;
}

.path-node.district {
    border-left-color: #FF80FF;
}

.node-index {
    font-weight: bold;
    margin-right: 5px;
    color: #555;
    min-width: 15px;
}

.node-label {
    font-weight: 500;
}

.node-group {
    font-size: 0.8rem;
    color: #666;
    margin-left: 5px;
}

.node-arrow {
    margin: 0 5px;
    color: #aaa;
    font-size: 1.2rem;
}

/* 路径标题样式 */
.path-title {
    font-weight: 500;
    margin-bottom: 0.7rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid #eee;
    color: #333;
}

/* 额外路径横向显示 */
.additional-path-container {
    margin-bottom: 1.5rem;
}

.additional-path-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    background-color: #f8f9fa;
    border-radius: 6px 6px 0 0;
    margin-bottom: 0;
    border-left: 4px solid transparent;
}

.additional-path-body {
    padding: 1rem;
    background-color: white;
    border-radius: 0 0 6px 6px;
    border: 1px solid #eee;
    border-top: none;
}

.additional-path-nodes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 0.5rem;
} 