/* ========================================
   全局变量
   ======================================== */
:root {
    --primary-color: #dc2626;
    --primary-dark: #991b1b;
    --primary-light: #fca5a5;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-light: #999999;
    --bg-white: #ffffff;
    --bg-light: #f9fafb;
    --bg-dark: #1a1a1a;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* ========================================
   全局样式
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    color: var(--text-primary);
    background: var(--bg-white);
    line-height: 1.6;
}

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

/* ========================================
   导航栏
   ======================================== */
.navbar {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1rem 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo {
    width: 40px;
    height: 40px;
}

.brand-text {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--text-primary);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-menu a {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    transition: var(--transition);
}

.nav-menu a:hover {
    color: var(--primary-color);
}

.btn-outline {
    padding: 0.5rem 1.5rem;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    color: var(--primary-color);
    transition: var(--transition);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

/* ========================================
   Hero区域
   ======================================== */
.hero {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: white;
    padding: 80px 0;
    text-align: center;
}

.hero-title {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.search-box {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    gap: 0;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    box-shadow: var(--shadow-lg);
}

.search-box input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    outline: none;
    font-size: 1rem;
}

.search-btn {
    padding: 1rem 2rem;
    background: var(--primary-color);
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
}

.search-btn:hover {
    background: var(--primary-dark);
}

/* ========================================
   通用区块
   ======================================== */
.section {
    padding: 80px 0;
}

.section-title {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 2rem;
    text-align: center;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.more-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.more-link:hover {
    color: var(--primary-dark);
}

/* ========================================
   分类网格
   ======================================== */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
}

.category-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.category-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.category-card .icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.category-card .name {
    font-weight: 500;
    color: var(--text-primary);
}

/* ========================================
   资源网格 - 两列展示
   ======================================== */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .resource-grid {
        grid-template-columns: 1fr;
    }
}

.resource-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
}

.resource-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-5px);
}

.resource-card .thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--bg-light);
}

.resource-card .content {
    padding: 1.5rem;
}

.resource-card .title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.resource-card .description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.resource-card .meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 10px;
}

.resource-card .content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.resource-card {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
}

.resource-icon-large {
    font-size: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: var(--bg-light);
    border-radius: 8px;
    flex-shrink: 0;
}

.resource-action {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    align-self: flex-start;
}

.resource-action:hover {
    background: var(--primary-dark);
}

.resource-card .tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: 20px;
    font-size: 0.75rem;
}

/* ========================================
   紧凑版资源卡片 - 降低高度，使用图标
   ======================================== */
.resource-card-compact {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
    min-height: 60px;
    align-items: center;
}

.resource-card-compact:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.resource-icon-small {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--bg-light);
    border-radius: 6px;
    flex-shrink: 0;
}

.content-compact {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

.title-compact {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

.meta-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-light);
}

.tag-small {
    display: inline-block;
    padding: 2px 6px;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: 12px;
    font-size: 0.7rem;
}

.meta-item {
    white-space: nowrap;
}

.resource-action-small {
    padding: 4px 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    align-self: flex-start;
    margin-top: 4px;
}

.resource-action-small:hover {
    background: var(--primary-dark);
}

/* ========================================
   文章列表 - 两列展示
   ======================================== */
.article-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .article-list {
        grid-template-columns: 1fr;
    }
}

.article-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    display: flex;
    gap: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
}

.article-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(5px);
}

.article-card .thumbnail {
    width: 200px;
    height: 150px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--bg-light);
}

.article-card .content {
    flex: 1;
}

.article-card .title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.article-card .excerpt {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.article-card .meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

/* ========================================
   页脚
   ======================================== */
.footer {
    background: var(--bg-dark);
    color: white;
    padding: 3rem 0;
    text-align: center;
}

/* ========================================
   二级页面样式
   ======================================== */

/* 页面标题 */
.page-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 60px 0;
    text-align: center;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.page-header p {
    font-size: 1.125rem;
    opacity: 0.9;
}

/* 筛选栏 */
.filter-bar {
    background: var(--bg-light);
    padding: 30px 0;
    border-bottom: 1px solid var(--border-color);
}

.filter-container {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-group label {
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-group select {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: var(--transition);
}

.filter-group select:hover {
    border-color: var(--primary-color);
}

/* 加载更多 */
.load-more {
    text-align: center;
    padding: 40px 0;
}

.btn-primary {
    padding: 12px 32px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* 导航栏激活状态 */
.nav-menu a.active {
    color: var(--primary-color);
    position: relative;
}

.nav-menu a.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .nav-menu {
        gap: 1rem;
        font-size: 0.875rem;
    }
    
    .article-card {
        flex-direction: column;
    }
    
    .article-card .thumbnail {
        width: 100%;
    }
    
    .filter-container {
        flex-direction: column;
    }
    
    .page-header h1 {
        font-size: 2rem;
    }
}

/* ========================================
   弹窗样式
   ======================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--primary-color);
}

.modal-content h2 {
    margin-bottom: 20px;
}

.login-qr {
    text-align: center;
}

.qr-code {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 8px;
}

.login-tip {
    margin-top: 15px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* 用户中心样式 */
.user-center .user-info {
    text-align: center;
    margin-bottom: 30px;
}

.user-avatar img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 10px;
}

.user-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.user-type {
    display: inline-block;
    padding: 4px 12px;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: 20px;
    font-size: 0.85rem;
}

.user-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.stat-item {
    flex: 1;
    text-align: center;
    padding: 15px;
    background: var(--bg-light);
    border-radius: 8px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* ========================================
   分类卡片二级目录样式
   ======================================== */
.category-card {
    cursor: pointer;
    transition: var(--transition);
    padding: 20px;
}

.category-card:hover {
    transform: translateY(-5px);
}

.category-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.category-tags {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.tag-badge {
    display: inline-block;
    padding: 4px 10px;
    background: var(--bg-light);
    color: var(--text-secondary);
    border-radius: 12px;
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.category-card:hover .tag-badge {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ========================================
   标签选择弹窗样式
   ======================================== */
.tag-modal {
    max-width: 500px;
}

.tag-selection {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.tag-option {
    padding: 12px 20px;
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.tag-option:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    color: var(--primary-color);
}
