/* resource_index.css - 资源搜索页面样式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 
                 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.resource-index-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 40px 80px;
}

/* ========== 顶部标题栏 ========== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e8e8e8;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.back-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: #f5f5f5;
    border-color: #d0d0d0;
}

.back-btn svg {
    width: 20px;
    height: 20px;
    color: #666;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #1a1a1a;
    margin-right: auto;
}

/* ========== 资源标签区域（考研、考公等）========== */
.resource-tabs-section {
    margin-bottom: 20px;
}

.resource-tabs {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.resource-tab {
    display: inline-flex;
    align-items: center;
    padding: 10px 24px;
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 20px;
    font-size: 15px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.resource-tab:hover {
    border-color: #667eea;
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.resource-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* ========== 内容类型标签区域（全部、卡组、资料等）========== */
.category-tabs-section {
    margin-bottom: 24px;
}

.category-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.category-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: #f8f9fa;
    border: none;
    border-radius: 16px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.category-tab:hover {
    background: #e9ecef;
    color: #495057;
}

.category-tab.active {
    background: #667eea;
    color: white;
}

/* 内容类型图标 */
.category-tab .icon {
    font-size: 16px;
    line-height: 1;
}

/* ========== 搜索框区域 ========== */
.search-section {
    margin-bottom: 24px;
}

.search-box {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #999;
    pointer-events: none;
}

.search-box input {
    width: 100%;
    height: 48px;
    padding: 0 60px 0 48px;
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    font-size: 15px;
    color: #333;
    transition: all 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-box input::placeholder {
    color: #999;
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-btn:hover {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.search-btn svg {
    stroke: white;
}

/* ========== 主内容区 ========== */
.main-content {
    position: relative;
    min-height: 400px;
}

/* 搜索统计 */
.search-stats {
    margin-bottom: 24px;
}

.search-stats p {
    font-size: 16px;
    color: #666;
}

.search-stats strong {
    color: #667eea;
    font-weight: 600;
}

/* 分类过滤标签 */
.filter-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.filter-tabs::-webkit-scrollbar {
    height: 4px;
}

.filter-tabs::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

.filter-tab {
    padding: 10px 20px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 20px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-tab:hover {
    border-color: #667eea;
    color: #667eea;
}

.filter-tab.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.filter-tab .count {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}

.filter-tab.active .count {
    background: rgba(255, 255, 255, 0.2);
}

/* 搜索结果容器 */
.results-container {
    position: relative;
    min-height: 400px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

/* 资源卡片 */
.resource-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #e8e8e8;
    display: flex;
    flex-direction: column;
    position: relative;
}

.resource-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    border-color: #667eea;
}

/* 资源类型标签 */
.resource-type-badge {
    position: absolute;
    top: 0;
    right: 0;
    padding: 4px 12px;
    border-radius: 0 12px 0 8px;
    font-size: 12px;
    font-weight: 500;
    z-index: 10;
    color: white;
}

.resource-type-badge.card-group {
    background: linear-gradient(135deg, #e89fb8 0%, #d985a0 100%);
}

.resource-type-badge.lib,
.resource-type-badge.folder {
    background: linear-gradient(135deg, #8b94c5 0%, #7280b0 100%);
}

.resource-type-badge.practice {
    background: linear-gradient(135deg, #7db8d4 0%, #6aa3bf 100%);
}

.resource-type-badge.words {
    background: linear-gradient(135deg, #81c9a8 0%, #6cb492 100%);
}

.resource-type-badge.url {
    background: linear-gradient(135deg, #7bb5c4 0%, #68a0af 100%);
}

.resource-content {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.resource-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 12px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.resource-desc {
    font-size: 14px;
    color: #666;
    margin-bottom: 16px;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.resource-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #888;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1px solid #f5f5f5;
}

.knowledge-count {
    background: #f8f9fa;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.author {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 4px 8px;
    margin: -4px -8px;
    border-radius: 4px;
}

.author:hover {
    background: #f5f5f5;
    color: #333;
}

.author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #f0f0f0;
}

.create-time {
    margin-left: auto;
    color: #999;
    font-size: 12px;
}

/* ========== 加载状态 ========== */
.loading-state {
    text-align: center;
    padding: 80px 20px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-state p {
    color: #999;
    font-size: 15px;
}

/* ========== 空状态 ========== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 100px 20px;
}

.empty-state svg {
    margin-bottom: 24px;
    stroke: #ccc;
}

.empty-state h3 {
    font-size: 20px;
    color: #666;
    margin-bottom: 8px;
}

.empty-state p {
    color: #999;
    font-size: 14px;
}

/* ========== 错误状态 ========== */
.error-state {
    text-align: center;
    padding: 100px 20px;
}

.error-state p {
    color: #f56565;
    font-size: 16px;
}

/* ========== 响应式设计 ========== */
@media (max-width: 1024px) {
    .resource-index-container {
        padding: 16px 24px 60px;
    }
    
    .page-header h1 {
        font-size: 24px;
    }
    
    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .resource-index-container {
        padding: 16px 20px 60px;
    }
    
    .page-header {
        margin-bottom: 20px;
        padding-bottom: 16px;
    }
    
    .page-header h1 {
        font-size: 22px;
    }
    
    .resource-tabs-section {
        margin-bottom: 16px;
    }
    
    .resource-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }
    
    .resource-tab {
        flex-shrink: 0;
        white-space: nowrap;
    }
    
    .category-tabs-section {
        margin-bottom: 20px;
    }
    
    .category-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }
    
    .category-tab {
        flex-shrink: 0;
        white-space: nowrap;
    }
    
    .search-section {
        margin-bottom: 20px;
    }
    
    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px;
    }
    
    .filter-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }
    
    .filter-tab {
        flex-shrink: 0;
    }
}

@media (max-width: 600px) {
    .resource-index-container {
        padding: 12px 16px 60px;
    }
    
    .page-header h1 {
        font-size: 20px;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* ========== 动画效果 ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.resource-card {
    animation: fadeIn 0.4s ease-out forwards;
}

/* 每个卡片依次延迟出现 */
.resource-card:nth-child(1) { animation-delay: 0.05s; }
.resource-card:nth-child(2) { animation-delay: 0.1s; }
.resource-card:nth-child(3) { animation-delay: 0.15s; }
.resource-card:nth-child(4) { animation-delay: 0.2s; }
.resource-card:nth-child(5) { animation-delay: 0.25s; }
.resource-card:nth-child(6) { animation-delay: 0.3s; }
.resource-card:nth-child(7) { animation-delay: 0.35s; }
.resource-card:nth-child(8) { animation-delay: 0.4s; }

