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

body {
    font-family: 'Microsoft YaHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

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

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header .container {
    display: flex;
    align-items: center;
    gap: 50px;
    flex-wrap: wrap;
}

.logo a {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo h1 {
    font-size: 24px;
    font-weight: bold;
}

.logo .slogan {
    font-size: 12px;
    opacity: 0.9;
}

.nav ul {
    display: flex;
    gap: 30px;
}

.nav a {
    padding: 8px 16px;
    border-radius: 4px;
    transition: background 0.3s;
}

.nav a:hover,
.nav a.active {
    background: rgba(255, 255, 255, 0.2);
}

.search-box {
    display: flex;
    gap: 10px;
}

.search-box input {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    width: 200px;
    outline: none;
}

.search-box button {
    padding: 8px 20px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

.search-box button:hover {
    background: #ee5a5a;
}

/* 主要内容区域 */
.main-content {
    padding: 40px 0;
}

/* 分类导航 */
.category-nav {
    margin-bottom: 50px;
}

.category-nav h2 {
    font-size: 28px;
    margin-bottom: 30px;
    color: #333;
    text-align: center;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.category-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.category-card .icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: white;
}

.html-icon { background: linear-gradient(135deg, #e44d26, #f16529); }
.css-icon { background: linear-gradient(135deg, #264de4, #2965f1); }
.js-icon { background: linear-gradient(135deg, #f7df1e, #f9dc2e); color: #333; }
.python-icon { background: linear-gradient(135deg, #3776ab, #ffd43b); }
.java-icon { background: linear-gradient(135deg, #007396, #5382a1); }
.sql-icon { background: linear-gradient(135deg, #00758f, #f29111); }
.git-icon { background: linear-gradient(135deg, #f05032, #de4c36); }
.react-icon { background: linear-gradient(135deg, #61dafb, #21a0c6); }
.ai-icon { background: linear-gradient(135deg, #667eea, #764ba2); }

.category-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: #333;
}

.category-card p {
    color: #666;
    margin-bottom: 10px;
    font-size: 13px;
}

.tutorial-count {
    display: inline-block;
    padding: 4px 12px;
    background: #f0f0f0;
    border-radius: 20px;
    font-size: 12px;
    color: #666;
}

/* 最新教程 */
.latest-tutorials {
    margin-bottom: 50px;
}

.latest-tutorials h2 {
    font-size: 28px;
    margin-bottom: 30px;
    color: #333;
}

.tutorial-list {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.tutorial-item {
    padding: 20px 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.3s;
}

.tutorial-item:last-child {
    border-bottom: none;
}

.tutorial-item:hover {
    background: #f9f9f9;
}

.tutorial-item .tag {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    color: white;
}

.tag.html { background: #e44d26; }
.tag.css { background: #264de4; }
.tag.javascript { background: #f7df1e; color: #333; }
.tag.python { background: #3776ab; }
.tag.java { background: #007396; }
.tag.sql { background: #00758f; }

.tutorial-item a {
    flex: 1;
    color: #333;
    transition: color 0.3s;
}

.tutorial-item a:hover {
    color: #667eea;
}

.tutorial-item .date {
    color: #999;
    font-size: 14px;
}

/* 推荐资源 */
.recommended h2 {
    font-size: 28px;
    margin-bottom: 30px;
    color: #333;
}

.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.resource-card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.resource-card h3 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #333;
}

.resource-card p {
    color: #666;
    margin-bottom: 20px;
}

.btn {
    display: inline-block;
    padding: 10px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 5px;
    transition: transform 0.3s;
}

.btn:hover {
    transform: translateY(-2px);
}

/* 页脚 */
.footer {
    background: #2c3e50;
    color: white;
    padding: 50px 0 20px;
    margin-top: 50px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 30px;
}

.footer-section h4 {
    font-size: 18px;
    margin-bottom: 20px;
}

.footer-section p {
    color: #bdc3c7;
    margin-bottom: 10px;
}

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

.footer-section a {
    color: #bdc3c7;
    transition: color 0.3s;
}

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

.copyright {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #34495e;
    color: #bdc3c7;
}

/* 搜索结果 */
.search-results {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.search-result-item {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item h3 {
    color: #667eea;
    margin-bottom: 5px;
}

.search-result-item p {
    color: #666;
    font-size: 14px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 20px;
    }

    .nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }

    .search-box {
        width: 100%;
    }

    .search-box input {
        flex: 1;
    }

    .category-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* 测验卡片样式 */
.quiz-section {
    margin-bottom: 60px;
}

.quiz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.quiz-card {
    background: white;
    border-radius: 10px;
    padding: 30px 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
    cursor: pointer;
}

.quiz-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.quiz-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: white;
}

.quiz-card h3 {
    margin-bottom: 10px;
    color: #333;
}

.quiz-card p {
    color: #666;
    font-size: 14px;
}

/* 测验图标颜色 */
.quiz-icon.html-icon { background: linear-gradient(135deg, #e44d26 0%, #f16529 100%); }
.quiz-icon.css-icon { background: linear-gradient(135deg, #264de4 0%, #2965f1 100%); }
.quiz-icon.js-icon { background: linear-gradient(135deg, #f7df1e 0%, #f9dc24 100%); color: #333; }
.quiz-icon.python-icon { background: linear-gradient(135deg, #3776ab 0%, #ffd43b 100%); }
.quiz-icon.java-icon { background: linear-gradient(135deg, #007396 0%, #f89820 100%); }
.quiz-icon.sql-icon { background: linear-gradient(135deg, #336791 0%, #f29111 100%); }
.quiz-icon.git-icon { background: linear-gradient(135deg, #f05032 0%, #de4c36 100%); }
.quiz-icon.react-icon { background: linear-gradient(135deg, #61dafb 0%, #00d8ff 100%); }
