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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    /* 移动端优化 */
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    overflow-x: hidden;
    min-height: 100vh;
}

/* 移动端触摸优化 */
a, button, .nav-toggle, .category-item, .resource-btn {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* 防止移动端缩放 */
input, textarea, select {
    font-size: 16px;
}

/* 移动端滚动优化 */
.sidebar, .content-area {
    -webkit-overflow-scrolling: touch;
}

/* 移动端按钮优化 */
.nav-toggle, .sidebar-toggle, .resource-btn {
    min-height: 44px;
    min-width: 44px;
}

/* 移动端文本选择优化 */
.nav-toggle, .category-title, .resource-btn {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 导航栏样式 */
#navbar {
    background: white;
    color: #333;
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e9ecef;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    height: 60px;
    padding: 0 20px;
}

.nav-brand a {
    font-size: 24px;
    font-weight: bold;
    text-decoration: none;
    color: #333;
}

.nav-menu {
    display: flex;
    gap: 30px;
}

.nav-link {
    color: #333;
    text-decoration: none;
    transition: all 0.3s;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 20px;
}

.nav-link:hover,
.nav-link.active {
    background: #f8f9fa;
    color: #2c3e50;
    transform: translateY(-1px);
}

/* 移动端导航切换按钮 */
.nav-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.nav-toggle span {
    width: 25px;
    height: 3px;
    background: #333;
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

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

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

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

/* 主容器 */
.main-container {
    display: flex;
    margin-top: 60px;
    min-height: calc(100vh - 60px);
    width: 100%;
    max-width: 100vw;
}

/* 侧边栏样式 */
.sidebar {
    width: 250px;
    background: white;
    border-right: 1px solid #e9ecef;
    padding: 0;
    position: fixed;
    height: calc(100vh - 60px);
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
    transition: width 0.3s ease;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.sidebar-title {
    font-size: 18px;
    font-weight: bold;
    color: #495057;
    margin: 0;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.sidebar-toggle:hover {
    background-color: #e9ecef;
}

.sidebar-content {
    padding: 20px 0;
    transition: all 0.3s ease;
}

.sidebar-content.collapsed {
    display: none;
}

.category-group {
    margin-bottom: 15px;
}

.category-title {
    padding: 12px 20px;
    font-weight: 600;
    color: #495057;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s;
    user-select: none;
}

.category-title.collapsible {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-title.collapsible:hover {
    background-color: #f8f9fa;
    color: #2c3e50;
}

.toggle-icon {
    font-size: 12px;
    transition: transform 0.3s;
}

.category-items {
    transition: all 0.3s ease;
    overflow: hidden;
}

.category-items.collapsed {
    max-height: 0;
    padding: 0;
}

.category-item {
    display: block;
    padding: 10px 20px 10px 40px;
    color: #6c757d;
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    font-size: 14px;
}

.category-item:hover,
.category-item.active {
    background-color: #f8f9fa;
    color: #2c3e50;
    border-left-color: #2c3e50;
}

/* 侧边栏收起状态 */
.sidebar.collapsed {
    width: 60px;
}

.sidebar.collapsed .sidebar-content {
    display: none;
}

.sidebar.collapsed + .content-area {
    margin-left: 60px;
}

/* 内容区域 */
.content-area {
    flex: 1;
    margin-left: 250px;
    padding: 30px;
    width: calc(100% - 250px);
    max-width: calc(100vw - 250px);
    overflow-x: hidden;
}

/* 欢迎区域 */
.welcome-section {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(44, 62, 80, 0.2);
}

.welcome-section h1 {
    font-size: 48px;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 18px;
    margin-bottom: 30px;
    opacity: 0.9;
}

/* 统计数据样式 */
.stats-container {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: rgba(255,255,255,0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    min-width: 150px;
    transition: transform 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-5px);
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 5px;
    color: #fff;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
    color: #fff;
}

.search-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
    flex-wrap: wrap;
}

#searchInput {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    min-width: 200px;
    max-width: 100%;
}

#searchBtn {
    padding: 12px 25px;
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

#searchBtn:hover {
    background: rgba(255,255,255,0.3);
}

/* 资源区域 */
.resources-section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.section-header h2 {
    color: #495057;
    font-size: 28px;
    font-weight: 600;
}

.view-toggle {
    display: flex;
    gap: 5px;
}

.view-btn {
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    background: white;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 5px;
}

.view-btn.active,
.view-btn:hover {
    background: #2c3e50;
    color: white;
    border-color: #2c3e50;
}

/* 资源网格布局 */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    width: 100%;
}

.resources-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 资源卡片 */
.resource-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: all 0.3s;
    border: 1px solid #e9ecef;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

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

.resource-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.resource-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
}

.resource-title {
    font-size: 20px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
}

.resource-category {
    font-size: 12px;
    color: #6c757d;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 12px;
    display: inline-block;
}

.resource-description {
    color: #6c757d;
    margin-bottom: 20px;
    line-height: 1.6;
}

.resource-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.resource-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

.btn-primary {
    background: #2c3e50;
    color: white;
}

.btn-primary:hover {
    background: #34495e;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-outline {
    background: transparent;
    color: #2c3e50;
    border: 1px solid #2c3e50;
}

.btn-outline:hover {
    background: #2c3e50;
    color: white;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 40px 0;
}

.page-btn {
    padding: 10px 15px;
    border: 1px solid #dee2e6;
    background: white;
    color: #6c757d;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s;
}

.page-btn:hover,
.page-btn.active {
    background: #2c3e50;
    color: white;
    border-color: #2c3e50;
}

/* 页脚 */
.footer {
    background: #1a1a1a;
    color: white;
    padding: 40px 0 20px;
    margin-top: 60px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.footer-section h3 {
    margin-bottom: 15px;
    font-size: 18px;
    color: white;
}

.footer-section p {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    margin-bottom: 10px;
}

.footer-section a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: white;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section ul li {
    margin-bottom: 8px;
}

/* 热门关键词标签样式 */
.footer-section a[style*="background: #f0f0f0"] {
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    transition: all 0.3s;
    display: inline-block;
}

.footer-section a[style*="background: #f0f0f0"]:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: translateY(-1px);
}

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #495057;
    color: white;
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.3s;
}

.social-link:hover {
    background: #2c3e50;
    transform: translateY(-2px);
}

.footer-bottom {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
}

.footer-bottom p {
    margin: 5px 0;
    color: rgba(255, 255, 255, 0.8);
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    box-shadow: 0 5px 15px rgba(44, 62, 80, 0.3);
    transition: all 0.3s;
    opacity: 0;
    visibility: hidden;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: #34495e;
    transform: translateY(-2px);
}

/* 响应式设计 */
/* 大屏幕 (1200px+) */
@media (min-width: 1200px) {
    .nav-container {
        max-width: 1400px;
    }
    
    .content-area {
        max-width: calc(100% - 250px);
        padding: 40px;
    }
    
    .welcome-section {
        padding: 60px 40px;
    }
    
    .welcome-section h1 {
        font-size: 56px;
    }
    
    .subtitle {
        font-size: 20px;
    }
    
    .stats-container {
        gap: 60px;
    }
    
    .stat-item {
        min-width: 180px;
        padding: 25px;
    }
    
    .resources-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
    }
    
    .resource-card {
        padding: 30px;
    }
}

/* 中等屏幕 (992px - 1199px) */
@media (max-width: 1199px) and (min-width: 992px) {
    .sidebar {
        width: 220px;
    }
    
    .content-area {
        margin-left: 220px;
        padding: 25px;
        width: calc(100% - 220px);
        max-width: calc(100vw - 220px);
    }
    
    .resources-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 20px;
    }
    
    .welcome-section h1 {
        font-size: 44px;
    }
    
    .stats-container {
        gap: 30px;
        flex-wrap: wrap;
    }
}

/* 平板横屏 (768px - 991px) */
@media (max-width: 991px) and (min-width: 768px) {
    .sidebar {
        width: 200px;
    }
    
    .content-area {
        margin-left: 200px;
        padding: 25px;
        width: calc(100% - 200px);
        max-width: calc(100vw - 200px);
    }
    
    .welcome-section {
        padding: 40px 25px;
    }
    
    .welcome-section h1 {
        font-size: 36px;
    }
    
    .nav-brand a {
        font-size: 22px;
    }
    
    .stats-container {
        gap: 20px;
        flex-wrap: wrap;
    }
    
    .resources-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 18px;
    }
    
    .resource-card {
        padding: 20px;
    }
    
    .stat-item {
        min-width: 130px;
        padding: 15px;
        flex: 1;
    }
}

/* 平板竖屏和大屏手机 (576px - 767px) */
@media (max-width: 767px) and (min-width: 576px) {
    .main-container {
        flex-direction: column;
        width: 100%;
        max-width: 100vw;
    }
    
    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
    }
    
    .content-area {
        margin-left: 0;
        padding: 20px;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .welcome-section {
        padding: 30px 20px;
    }
    
    .welcome-section h1 {
        font-size: 32px;
    }
    
    .resources-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 15px;
    }
    
    .resource-card {
        padding: 18px;
    }
    
    .search-container {
        flex-direction: row;
        max-width: 400px;
    }
    
    .section-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 20px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        border-top: 1px solid #e9ecef;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-menu .nav-link {
        padding: 15px 0;
        text-align: center;
        border-bottom: 1px solid #e9ecef;
        color: #333;
    }
    
    .nav-menu .nav-link:last-child {
        border-bottom: none;
    }
    
    .nav-container {
        padding: 0 20px;
        position: relative;
        height: 60px;
    }
    
    .nav-brand a {
        font-size: 20px;
    }
    
    .stats-container {
        gap: 15px;
        justify-content: space-around;
    }
    
    .stat-item {
        min-width: 120px;
        padding: 15px 10px;
    }
    
    .resource-actions {
        justify-content: center;
    }
}

/* 小屏手机 (最大575px) */
@media (max-width: 575px) {
    .main-container {
        flex-direction: column;
        width: 100%;
        max-width: 100vw;
    }
    
    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
    }
    
    .content-area {
        margin-left: 0;
        padding: 15px;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .welcome-section {
        padding: 25px 15px;
    }
    
    .welcome-section h1 {
        font-size: 28px;
        line-height: 1.2;
    }
    
    .subtitle {
        font-size: 16px;
    }
    
    .resources-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        width: 100%;
    }
    
    .resource-card {
        padding: 18px;
    }
    
    .search-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .section-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .section-header h2 {
        font-size: 24px;
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 15px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        border-top: 1px solid #e9ecef;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-menu .nav-link {
        padding: 12px 0;
        text-align: center;
        border-bottom: 1px solid #e9ecef;
        color: #333;
    }
    
    .nav-menu .nav-link:last-child {
        border-bottom: none;
    }
    
    .nav-container {
        padding: 0 15px;
        position: relative;
        height: 55px;
    }
    
    .nav-brand a {
        font-size: 18px;
    }
    
    .stats-container {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .stat-item {
        min-width: 200px;
        padding: 15px;
    }
    
    .resource-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .resource-icon {
        margin: 0 auto 10px;
    }
    
    .resource-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .resource-btn {
        justify-content: center;
        width: 100%;
    }
    
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 20px;
        text-align: center;
    }
    
    .social-links {
        justify-content: center;
    }
}

/* 超小屏幕 (最大375px) */
@media (max-width: 375px) {
    html {
        font-size: 14px;
    }
    
    .nav-container {
        height: 50px;
        padding: 0 10px;
    }
    
    .nav-brand a {
        font-size: 16px;
    }
    
    .content-area {
        padding: 10px;
        width: 100%;
        max-width: 100vw;
    }
    
    .welcome-section {
        padding: 20px 10px;
        margin: 0 -5px 20px;
    }
    
    .welcome-section h1 {
        font-size: 24px;
        line-height: 1.2;
    }
    
    .subtitle {
        font-size: 14px;
        line-height: 1.4;
    }
    
    .resource-card {
        padding: 15px;
        margin: 0;
    }
    
    .resource-title {
        font-size: 18px;
        line-height: 1.3;
    }
    
    .stat-item {
        min-width: 120px;
        padding: 12px;
        flex: 1;
    }
    
    .stat-number {
        font-size: 24px;
    }
    
    #searchInput {
        padding: 12px 15px;
        font-size: 16px;
        min-width: 180px;
    }
    
    #searchBtn {
        padding: 12px 20px;
        font-size: 16px;
        min-height: 44px;
    }
    
    .resource-btn {
        min-height: 44px;
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .stats-container {
        gap: 10px;
        margin: 20px 0;
    }
}

/* 加载动画 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    font-size: 18px;
    color: #6c757d;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2c3e50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

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

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state h3 {
    margin-bottom: 10px;
    font-size: 24px;
}

.empty-state p {
    font-size: 16px;
    line-height: 1.6;
}