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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 网站标题样式 */
.site-title {
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    padding: 10px 20px 10px 0;
    white-space: nowrap;
}

/* 导航栏样式 - 包含搜索功能 */
nav .container {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
}

/* 导航列表样式 - 放在左边 */
nav .nav-list {
    margin-right: auto;
    margin-left: 0;
}

/* 搜索框样式 - 放置在导航栏右侧 */
nav .search-box {
    display: flex;
    flex-direction: row;
    margin: 0 0 0 20px;
    width: auto;
    max-width: 400px;
    align-items: center;
}

.search-box input {
    width: 100%;
    max-width: 350px;
    padding: 10px;
    border: none;
    border-radius: 5px 0 0 5px;
    font-size: 16px;
    height: 40px;
    box-sizing: border-box;
}

.search-box button {
    padding: 0 20px;
    background-color: #3498db;
    color: #fff;
    border: none;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
    height: 40px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: top;
    white-space: nowrap;
    width: auto;
    min-width: 60px;
}

.search-box button:hover {
    background-color: #2980b9;
}

/* 导航栏样式 */
nav {
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 15px 0;
}

/* 导航栏切换按钮样式 */
.nav-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    z-index: 101;
    background: transparent;
    border: none;
    padding: 0;
    margin-left: 10px;
    height: 40px;
    width: 40px;
    justify-content: center;
    align-items: center;
}

.nav-toggle span {
    width: 25px;
    height: 3px;
    background-color: #333;
    margin: 3px 0;
    transition: 0.3s;
    display: block;
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
    background-color: #3498db;
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
    background-color: #3498db;
}

.toggle-icon,
.toggle-text {
    display: none;
}

.nav-list {
    display: flex;
    list-style: none;
    justify-content: flex-start;
    flex-wrap: nowrap;
    margin: 0;
    padding: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
    align-items: center;
}

.nav-item {
    margin: 0 10px;
}

.nav-item a {
    display: block;
    padding: 10px;
    color: #333;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease, border-bottom 0.3s ease;
    border-bottom: 3px solid transparent;
}

.nav-item a:hover, .nav-item a.active {
    color: #3498db;
    border-bottom-color: #3498db;
}

/* 主要内容样式 */
main {
    padding: 20px 0;
}

.category {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    padding: 20px;
}

.category h2 {
    color: #2c3e50;
    font-size: 2rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

.sub-category {
    margin-bottom: 30px;
}

.sub-category h3 {
    color: #3498db;
    font-size: 1.5rem;
    margin-bottom: 15px;
    padding-left: 10px;
    border-left: 4px solid #3498db;
}

.resource-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.resource-item {
    background-color: #f9f9f9;
    border-radius: 6px;
    padding: 15px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #eee;
    display: block;
    text-decoration: none;
    color: inherit;
}

.resource-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.resource-item h4 {
    color: #2c3e50;
    text-decoration: none;
    font-size: 1.2rem;
    transition: color 0.3s ease;
    margin-bottom: 10px;
}

.resource-item:hover h4 {
    color: #3498db;
}

.resource-item p {
    color: #666;
    font-size: 0.95rem;
}

/* 页脚样式 */
footer {
    background-color: #3a7bc8;
    color: #fff;
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
}

footer p {
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    /* 导航栏容器在小屏幕上不换行，水平排列 */
    nav .container {
        flex-wrap: nowrap;
        align-items: center;
    }
    
    /* 网站标题在小屏幕上左对齐 */
    .site-title {
        font-size: 1.2rem;
        padding: 10px 0;
        width: auto;
        text-align: left;
        flex-shrink: 0;
    }
    
    /* 搜索和菜单按钮容器 - 水平排列，靠右 */
    nav .search-menu-container {
        display: flex;
        align-items: center;
        flex-direction: row;
        justify-content: flex-end;
        width: auto;
        height: auto;
        background-color: transparent;
        padding: 0;
        box-sizing: border-box;
        margin-left: auto;
    }
    
    /* 搜索框在小屏幕上调整 */
    nav .search-box {
        margin: 0;
        width: auto;
        max-width: 250px;
        flex-shrink: 1;
        margin-right: 20px;
    }
    
    .search-box input {
        width: 100%;
        max-width: 250px;
    }
    
    /* 显示导航栏切换按钮 - 放在最右边 */
    nav .nav-toggle {
        display: flex;
        align-items: center;
        margin: 0;
        width: 40px;
        height: 40px;
        white-space: nowrap;
        flex-shrink: 0;
        cursor: pointer;
    }
    
    /* 导航列表默认隐藏 - 从导航栏底部开始显示 */
    nav .nav-list {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        width: 50%;
        height: auto;
        max-height: calc(100vh - 100%);
        background-color: #fff;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        padding: 20px;
        margin: 0;
        transform: translateX(0);
        transition: transform 0.3s ease;
        z-index: 102;
        overflow-y: auto;
    }
    
    /* 导航列表展开状态 */
    nav .nav-list.active {
        display: flex;
    }
    
    .nav-item {
        margin: 10px 0;
        width: 100%;
    }
    
    .nav-item a {
        display: block;
        padding: 10px 0;
        width: 100%;
        text-align: left;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .category h2 {
        font-size: 1.7rem;
    }
    
    .sub-category h3 {
        font-size: 1.3rem;
    }
    
    .resource-list {
        grid-template-columns: 1fr;
    }
    

}

@media (max-width: 480px) {
    /* 确保搜索框和菜单按钮在同一行 */
    nav .search-box {
        margin: 0;
        width: calc(75% - 70px);
        max-width: none;
        flex-shrink: 1;
    }
    
    .search-box {
        flex-direction: row;
        align-items: center;
    }
    
    .search-box input {
        width: 100%;
        border-radius: 5px 0 0 5px;
        margin-bottom: 0;
    }
    
    .search-box button {
        width: auto;
        border-radius: 0 5px 5px 0;
    }
    
    .container {
        padding: 0 10px;
    }
    
    .category {
        padding: 15px;
    }
}

/* 搜索和筛选相关样式 */
.hidden {
    display: none;
}

.no-results {
    text-align: center;
    padding: 50px 20px;
    color: #666;
    font-size: 1.2rem;
}