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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
}

.main-title {
    color: white;
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    margin-bottom: 10px;
    animation: fadeInDown 1s ease-out;
}

.main-title i {
    margin-right: 15px;
    color: #a8e6cf;
    animation: rotate 4s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

/* 主导航区域 */
.navigation-tree {
    flex: 1;
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    padding: 30px;
    backdrop-filter: blur(10px);
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 目录项样式 */
.directory-item {
    margin-bottom: 20px;
    border-radius: 10px;
    overflow: hidden;
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.directory-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.directory-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    position: relative;
    outline: none;
}

.directory-header:hover {
    background: linear-gradient(135deg, #43a3f5 0%, #00e9f5 100%);
}

.directory-header:focus {
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5);
}

/* .directory-icon,
.directory-icon-open {
    font-size: 1.2rem;
    margin-right: 12px;
    transition: all 0.3s ease;
}

.directory-icon {
    display: inline-block;
}

.directory-icon-open {
    display: none;
}

.directory-header.expanded .directory-icon {
    display: none;
}

.directory-header.expanded .directory-icon-open {
    display: inline-block;
    color: #ffd700;
} */

.directory-icon {
    display: inline-block !important; /* 默认显示 */
    font-size: 1.2rem;
    margin-right: 12px;
    transition: all 0.3s ease;
}

.directory-icon-open {
    display: none !important; /* 默认隐藏 */
    font-size: 1.2rem;
    margin-right: 12px;
    transition: all 0.3s ease;
}

.directory-header.expanded .directory-icon {
    display: none !important; /* 当存在 .expanded 类时，隐藏 .directory-icon */
}

.directory-header.expanded .directory-icon-open {
    display: inline-block !important; /* 当存在 .expanded 类时，显示 .directory-icon-open */
    color: #ffd700;
}

.directory-name {
    flex: 1;
    font-weight: 600;
    font-size: 1.1rem;
}

.expand-icon {
    transition: transform 0.3s ease;
    font-size: 0.9rem;
}

.directory-header.expanded .expand-icon {
    transform: rotate(90deg);
}

/* 子菜单样式 */
.submenu {
    display: none;
    background: white;
    animation: slideDown 0.3s ease-out;
    border-top: 1px solid #e9ecef;
}

.submenu.active {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 500px;
        transform: translateY(0);
    }
}

.submenu-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.back-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.back-button:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateX(-3px);
}

.submenu-header h2 {
    color: #495057;
    font-size: 1.3rem;
    font-weight: 600;
}

/* 链接列表样式 */
.link-list {
    padding: 20px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    margin-bottom: 10px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    text-decoration: none;
    color: #495057;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.nav-link:hover::before {
    left: 100%;
}

.nav-link:hover {
    transform: translateX(5px);
    border-color: #4facfe;
    background: linear-gradient(135deg, #f8f9ff 0%, #e3f2fd 100%);
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.2);
}

.nav-link i:first-child {
    font-size: 1.1rem;
    margin-right: 15px;
    color: #4facfe;
    width: 20px;
    text-align: center;
}

.nav-link span {
    flex: 1;
    font-weight: 500;
}

.external-icon {
    font-size: 0.8rem;
    opacity: 0.6;
    transition: all 0.3s ease;
}

.nav-link:hover .external-icon {
    opacity: 1;
    transform: translateX(3px);
}

.direct-links {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e9ecef;
}

.direct-link {
    margin-bottom: 15px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    padding: 15px 20px;
    border: 2px solid #e9ecef; 
    border-radius: 10px;
}

.direct-link:hover {
    transform: translateY(-5px); /* 向上移动 5px */
}

/* 为图标和文本添加样式 */
.direct-link i {
    margin-right: 10px; /* 图标与文本之间的间距 */
}

.direct-link span {
    flex: 1; /* 文本占据剩余空间 */
}

.direct-link .external-icon {
    margin-left: auto; /* 将外部链接图标推到最右侧 */
}

.section-title {
    color: #495057;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.section-title i {
    margin-right: 10px;
    color: #4facfe;
}


/* 页脚样式 */
footer {
    text-align: center;
    padding: 30px 20px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    margin-top: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    backdrop-filter: blur(10px);
    animation: fadeInUp 1s ease-out 0.6s both;
}

footer a {
    color: #a8e6cf;
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #7ed6df;
    text-decoration: underline;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .main-title {
        font-size: 2rem;
    }
    
    .navigation-tree {
        padding: 20px;
    }
    
    .directory-header {
        padding: 12px 15px;
    }
    
    .directory-name {
        font-size: 1rem;
    }
    
    .nav-link {
        padding: 12px 15px;
    }
    
    .submenu-header {
        padding: 15px;
    }
    
    .link-list {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 1.8rem;
    }
    
    .main-title i {
        margin-right: 10px;
    }
    
    .directory-header {
        padding: 10px 12px;
    }
    
    .nav-link {
        padding: 10px 12px;
        font-size: 0.95rem;
    }
    
    .nav-link i:first-child {
        margin-right: 12px;
    }
}

/* 无障碍性和键盘导航 */
.directory-header:focus-visible,
.nav-link:focus-visible,
.back-button:focus-visible {
    outline: 2px solid #4facfe;
    outline-offset: 2px;
}

/* 加载动画 */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .navigation-tree {
        background: rgba(255, 255, 255, 0.95);
    }
    
    .directory-item {
        background: #f1f3f4;
    }
    
    .submenu-header {
        background: #f1f3f4;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .directory-header {
        background: #000;
        color: #fff;
    }
    
    .nav-link {
        border-color: #333;
    }
    
    .nav-link:hover {
        background: #f0f0f0;
        border-color: #000;
    }
}