/* ==================== 基础样式 ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #1a1a1a;        /* 主色-深黑 */
    --secondary: #333;         /* 次级-深灰 */
    --accent: #666;            /* 强调色-中灰 */
    --light: #f5f5f5;          /* 亮色-浅灰白 */
    --dark: #000;              /* 暗色-纯黑 */
    --card-bg: #fff;           /* 卡片背景-纯白 */
    --border: #e0e0e0;         /* 边框色-浅灰 */
    --text-dark: #1a1a1a;      /* 深色文字 */
    --text-light: #666;        /* 浅色文字 */
    --radius: 8px;             /* 圆角 */
    --shadow: 0 2px 8px rgba(0,0,0,0.08); /* 阴影 */
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.12); /* 悬停阴影 */
}

/* 【重要修改】body 设置 - 确保撑满整个视窗高度 */
html, body {
    height: 100%;
}

body {
    font-family: 'Helvetica Neue', Arial, 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--light);
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* 确保至少占满整个视窗高度 */
}

/* 【重要修改】主容器 - 添加 flex-grow 让内容区域自动伸展 */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ==================== 布局样式 ==================== */
.header {
    background: var(--card-bg);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 网站公告样式 */
.announcement {
    background: var(--primary);
    color: white;
    padding: 12px 15px;
    margin: 15px auto;
    max-width: 1200px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

/* 【重要修改】主内容区域 - 添加 flex-grow 确保页脚在底部 */
.main-container {
    flex: 1; /* 这个属性让内容区域自动伸展，把页脚推到下面 */
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
    width: 100%;
}

/* ==================== 分类与资源卡片样式 ==================== */
/* 网站说明样式 */
.guide-category {
    background: var(--card-bg);
    border-radius: var(--radius);
    margin-bottom: 15px;
    box-shadow: var(--shadow);
    overflow: hidden;
    border-left: 4px solid var(--accent);
}

.guide-category .category-header {
    background: linear-gradient(90deg, #f8f8f8, #f0f0f0);
    border-left-color: var(--accent);
}

.guide-category .category-title {
    color: var(--primary);
}

.guide-category .category-content {
    color: var(--text-light);
}

/* 普通分类样式 */
.category {
    background: var(--card-bg);
    border-radius: var(--radius);
    margin-bottom: 15px;
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.category:hover {
    box-shadow: var(--shadow-hover);
}

.category-header {
    background: var(--primary);
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s ease;
}

.category-header:hover {
    background: var(--secondary);
}

.category-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-count {
    font-size: 0.85rem;
    color: #ffcc00;
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
    border: 1px solid rgba(255,255,255,0.3);
}

.category-desc {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.8);
    margin-top: 4px;
    line-height: 1.4;
}

.toggle-btn {
    color: rgba(255,255,255,0.8);
    transition: transform 0.3s ease;
    font-size: 0.9rem;
}

.category.collapsed .toggle-btn {
    transform: rotate(-90deg);
}

.category-content {
    padding: 20px;
    line-height: 1.6;
    border-top: 1px solid var(--border);
}

.category.collapsed .category-content {
    display: none;
}

.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.category.collapsed .resources-grid {
    display: none;
}

.resource-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.resource-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
}

.resource-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--primary);
    word-break: break-word;
    flex: 1;
}

.resource-desc {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 15px;
    line-height: 1.4;
    flex: 2;
}

/* 【修改】下载按钮 - 统一文字为"查看链接" */
.download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: auto;
}

.download-btn:hover {
    background: var(--secondary);
    transform: translateY(-1px);
}

/* ==================== 页脚样式 ==================== */
/* 【重要修改】页脚 - 添加 margin-top: auto 确保始终在底部 */
.footer {
    background: var(--primary);
    color: white;
    padding: 25px 15px;
    margin-top: auto; /* 这个属性让页脚自动推到最下面 */
    text-align: center;
    font-size: 14px;
    border-top: 1px solid var(--border);
    width: 100%;
}

.footer a {
    color: #aaa;
    text-decoration: none;
}

.footer a:hover {
    color: white;
    text-decoration: underline;
}

/* ==================== 回到顶部按钮 ==================== */
.back-to-top {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 45px;
    height: 45px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    z-index: 1000;
    border: 1px solid var(--border);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--secondary);
    transform: translateY(-2px);
}

/* ==================== 资源详情模态框 ==================== */
.resource-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.resource-modal {
    background: var(--card-bg);
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    border: 1px solid var(--border);
}

.resource-modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--primary);
    color: white;
}

.resource-modal-title {
    font-size: 1.3rem;
    font-weight: 600;
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #aaa;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal-btn:hover {
    color: white;
}

.resource-modal-body {
    padding: 25px;
}

.resource-modal-links {
    margin-top: 20px;
}

.resource-link-item {
    background: #fafafa;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
}

.resource-link-item:hover {
    background: #f5f5f5;
}

.resource-link-name {
    font-weight: 500;
    color: var(--primary);
    margin-bottom: 4px;
}

.resource-link-url {
    font-size: 0.85rem;
    color: var(--text-light);
    word-break: break-all;
}

.view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.view-btn:hover {
    background: var(--secondary);
}

/* ==================== 加载动画 ==================== */
.loader {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.spinner {
    border: 4px solid rgba(0,0,0,0.1);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border-left-color: var(--primary);
    animation: spin 1s ease infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==================== 广告容器样式 ==================== */
.ad-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
    text-align: center;
}

.ad-container.top-ad {
    margin-bottom: 10px;
}

.ad-container.bottom-ad {
    margin-top: 20px;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .resources-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 12px;
    }
    
    .resource-card {
        padding: 15px;
    }
    
    .category-header {
        padding: 14px 16px;
    }
    
    .main-container {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .resources-grid {
        grid-template-columns: 1fr;
    }
    
    .category-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .toggle-btn {
        align-self: flex-end;
    }
    
    .category-count {
        font-size: 0.8rem;
        padding: 1px 6px;
    }
    
    .footer {
        padding: 20px 10px;
        font-size: 13px;
    }
}