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

/* 基础样式设置 */
body {
    font-family: Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    color: #1c1e21;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 顶部横幅样式 */
.header {
    height: 20vh;
    width: 100%;
    background-color: #1877f2;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .1);
}

.header h1 {
    color: #ffffff;
    font-weight: bold;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    text-align: center;
    margin: 0;
}

/* 主体内容区样式 */
.main {
    flex: 1;
    width: 100%;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* 卡片容器样式 */
.cards-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

/* 卡片样式 */
.card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .1), 0 8px 16px rgba(0, 0, 0, .1);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    border: none;
    outline: none;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, .15), 0 12px 24px rgba(0, 0, 0, .15);
    transform: translateY(-2px);
}

.card.active {
    border-top: 4px solid #1877f2;
    box-shadow: 0 4px 8px rgba(0, 0, 0, .15), 0 12px 24px rgba(0, 0, 0, .15);
}

.card h3 {
    color: #1c1e21;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    padding: 1rem;
    margin: 0;
}

/* 资源列表容器样式 */
.resources-container {
    background-color: #f0f2f5;
    border-radius: 0 0 8px 8px;
    padding: 1rem;
    min-height: 0;
    flex: 1;
    overflow-y: visible;
}

/* 移动端资源列表强制显示 */
@media (max-width: 768px) {
    .resources-container:not(.hidden) {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative;
        z-index: 10;
    }
}

.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.5rem;
}

/* 移动端资源网格优化 */
@media (max-width: 768px) {
    .resources-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 0;
    }
}

/* 资源链接样式 */
.resource-link {
    background-color: #fff;
    color: #1c1e21;
    padding: 0.75rem 1rem;
    display: block;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
    border: 1px solid #dddfe2;
}

.resource-link:hover {
    background-color: #f8f9fa;
    text-decoration: none;
    color: #1c1e21;
}

/* 底部页脚样式 */
.footer {
    height: 15vh;
    width: 100%;
    background-color: #fff;
    color: #737373;
    border-top: 1px solid #dddfe2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
}

.footer p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .cards-container {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .cards-container {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .main {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .cards-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .main {
        padding: 1rem;
        height: auto;
        min-height: 70vh;
        overflow-y: visible;
    }
    
    .resources-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 0.75rem;
    }
    
    .card {
        min-height: 110px;
        touch-action: manipulation;
    }
    
    .card h3 {
        font-size: 0.95rem;
        padding: 0.8rem;
    }
    
    .resource-link {
        padding: 1rem;
        font-size: 0.95rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        touch-action: manipulation;
    }
}

@media (max-width: 480px) {
    .cards-container {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .main {
        padding: 0.75rem;
        height: auto;
        min-height: 75vh;
        overflow-y: visible;
    }
    
    .resources-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .card {
        min-height: 120px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(24, 119, 242, 0.1);
    }
    
    .card h3 {
        font-size: 1rem;
        padding: 1rem;
        line-height: 1.4;
    }
    
    .resource-link {
        padding: 1.2rem;
        font-size: 1rem;
        min-height: 48px;
        display: flex;
        align-items: center;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(24, 119, 242, 0.1);
        border-radius: 6px;
    }
    
    .header {
        height: 18vh;
    }
    
    .footer {
        height: 12vh;
        padding: 0.75rem;
    }
    
    .footer p {
        font-size: 0.8rem;
        margin: 0.2rem 0;
    }
}

/* 移动端专用优化 */
@media (max-width: 768px) {
    .resources-container {
        margin-top: 1rem;
        padding: 1rem;
        background-color: #fff;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, .1);
        min-height: 200px;
        max-height: none;
        overflow-y: visible;
    }
    
    .cards-container {
        margin-bottom: 1rem;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .card {
        -webkit-tap-highlight-color: rgba(24, 119, 242, 0.1);
        touch-action: manipulation;
    }
    
    .card:hover {
        transform: none;
        box-shadow: 0 2px 4px rgba(0, 0, 0, .1), 0 8px 16px rgba(0, 0, 0, .1);
    }
    
    .card:active {
        transform: scale(0.98);
        box-shadow: 0 1px 2px rgba(0, 0, 0, .1), 0 4px 8px rgba(0, 0, 0, .1);
    }
    
    .resource-link:hover {
        background-color: #fff;
    }
    
    .resource-link:active {
        background-color: #f0f2f5;
        transform: scale(0.98);
    }
}

/* 隐藏资源列表的初始状态 */
.resources-container.hidden {
    display: none;
}

/* 平滑过渡动画 */
.resources-container {
    transition: all 0.3s ease;
}

/* 滚动条样式 */
.resources-container::-webkit-scrollbar {
    width: 8px;
}

.resources-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.resources-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.resources-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 移动端滚动条优化 */
@media (max-width: 768px) {
    .resources-container::-webkit-scrollbar {
        width: 6px;
    }
    
    .resources-container::-webkit-scrollbar-thumb {
        background: #1877f2;
        border-radius: 3px;
    }
    
    .resources-container::-webkit-scrollbar-track {
        background: rgba(24, 119, 242, 0.1);
        border-radius: 3px;
    }
}

/* 资源链接焦点状态优化 */
.resource-link:focus {
    outline: 2px solid #1877f2;
    outline-offset: 2px;
}

/* 卡片焦点状态优化 */
.card:focus {
    outline: 2px solid #1877f2;
    outline-offset: 2px;
}

/* 移动端加载动画优化 */
@media (max-width: 768px) {
    .resources-container {
        transition: opacity 0.3s ease, transform 0.3s ease;
    }
    
    .resources-container.hidden {
        display: none;
    }
    
    .resources-container:not(.hidden) {
        opacity: 1;
        transform: translateY(0);
        display: block;
    }
}

/* 桌面端保持原有动画效果 */
@media (min-width: 769px) {
    .resources-container {
        transition: all 0.3s ease;
    }
    
    .resources-container.hidden {
        display: none;
    }
    
    .card:hover {
        box-shadow: 0 4px 8px rgba(0, 0, 0, .15), 0 12px 24px rgba(0, 0, 0, .15);
        transform: translateY(-2px);
    }
    
    .resource-link:hover {
        background-color: #f8f9fa;
        text-decoration: none;
        color: #1c1e21;
    }
}
