* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #10b981;
    --accent: #f59e0b;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.3);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: var(--transition);
}

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

/* 导航栏 */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

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

.nav-brand a {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

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

.nav-menu li a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
}

.nav-menu li a:hover,
.nav-menu li a.active {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.1);
}

.nav-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text);
}

/* 汉堡菜单 */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }

    .nav-menu {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--bg-card);
        padding: 20px;
        box-shadow: var(--shadow-lg);
        border-bottom: 1px solid var(--border);
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-menu li {
        margin: 5px 0;
    }
}

/* 头部横幅 */
.hero {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 80px 0;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 30px;
}

.hero-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

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

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

.btn-secondary {
    background: transparent;
    color: white;
    border: 2px solid white;
}

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

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* 搜索与筛选 */
.search-filter {
    background: var(--bg-card);
    padding: 30px 0;
    border-bottom: 1px solid var(--border);
}

.search-bar {
    display: flex;
    max-width: 600px;
    margin: 0 auto 20px;
    background: var(--bg);
    border-radius: 50px;
    padding: 5px;
    border: 1px solid var(--border);
}

.search-bar i {
    padding: 12px 15px;
    color: var(--text-muted);
}

.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px;
    font-size: 1rem;
    background: transparent;
    color: var(--text);
}

.search-bar button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
}

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

.filter-options {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

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

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

.filter-group select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
}

/* 课程卡片网格 */
.courses-section {
    padding: 60px 0;
}

.courses-section h2 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 2rem;
    color: var(--text);
}

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

.course-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--border);
}

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

.card-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.course-card:hover .card-image img {
    transform: scale(1.05);
}

.badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge.free {
    background: var(--secondary);
    color: white;
}

.badge.paid {
    background: var(--accent);
    color: white;
}

.card-body {
    padding: 20px;
}

.card-body h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--text);
}

.card-body p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.card-meta i {
    color: var(--accent);
    margin-right: 5px;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.tag {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.card-body .btn {
    margin-right: 8px;
    margin-top: 5px;
}

/* 统计 */
.stats-section {
    background: var(--bg-card);
    padding: 60px 0;
    border-top: 1px solid var(--border);
}

.stats-section h2 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 25px;
}

.stat-card {
    text-align: center;
    padding: 30px;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.stat-card i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 15px;
}

.stat-card h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
}

.stat-card p {
    color: var(--text-muted);
    margin-top: 5px;
}

/* 热力图 */
.heatmap-section {
    padding: 60px 0;
}

.heatmap-section h2 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 2rem;
}

.heatmap-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
    gap: 3px;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 3px;
    transition: var(--transition);
    cursor: pointer;
}

.heatmap-cell:hover {
    transform: scale(1.2);
    z-index: 1;
}

/* 页脚 */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 40px 0;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary);
}

.social-share {
    margin-bottom: 20px;
}

.social-share span {
    color: var(--text-muted);
    margin-right: 10px;
}

.share-btn {
    color: var(--text-muted);
    font-size: 1.5rem;
    margin: 0 10px;
    transition: var(--transition);
}

.share-btn:hover {
    color: var(--primary);
    transform: scale(1.1);
}

.copyright {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.copyright a {
    color: var(--primary);
    text-decoration: none;
}

/* 主题切换 */
.theme-switcher {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
}

#themeToggle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

#themeToggle:hover {
    transform: scale(1.1);
}

.theme-panel {
    position: absolute;
    bottom: 60px;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 15px;
    box-shadow: var(--shadow-lg);
    display: none;
    min-width: 150px;
}

.theme-panel.active {
    display: block;
}

.theme-panel h4 {
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.theme-option {
    display: block;
    width: 100%;
    padding: 8px 12px;
    margin: 5px 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
}

.theme-option:hover {
    background: var(--primary);
    color: white;
}

/* 管理后台 */
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.admin-header h1 {
    font-size: 2rem;
}

.admin-actions {
    display: flex;
    gap: 10px;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
}

.admin-card h2 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.full-width {
    grid-column: 1 / -1;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.help-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 5px 0;
}

.alert {
    padding: 15px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

table th,
table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text-muted);
}

table tr:hover {
    background: rgba(37, 99, 235, 0.02);
}

.login-form {
    max-width: 400px;
    margin: 100px auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-form h2 {
    text-align: center;
    margin-bottom: 30px;
}

.back-link {
    text-align: center;
    margin-top: 20px;
}

.back-link a {
    color: var(--primary);
    text-decoration: none;
}

/* 内页通用 */
.page-hero {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 60px 0;
    text-align: center;
}

.page-hero h1 {
    font-size: 2.2rem;
    margin-bottom: 15px;
}

.page-content {
    padding: 60px 0;
}

.page-content h2 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--text);
}

.page-content p {
    color: var(--text-muted);
    margin-bottom: 15px;
    line-height: 1.8;
}

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: var(--transition);
}

.faq-item:hover {
    box-shadow: var(--shadow);
}

.faq-item h3 {
    font-size: 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item p {
    margin-top: 10px;
    display: none;
    color: var(--text-muted);
}

.faq-item.active p {
    display: block;
}

.blog-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
}

.blog-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}

.blog-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.blog-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.blog-card-body {
    padding: 20px;
}

.blog-card-body h3 {
    margin-bottom: 10px;
}

.blog-card-body .meta {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

/* 响应式 */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.8rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .filter-options {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .course-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .admin-grid {
        grid-template-columns: 1fr;
    }

    .admin-header {
        flex-direction: column;
        text-align: center;
    }

    .footer-links {
        flex-direction: column;
        gap: 10px;
    }
}

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

    .hero {
        padding: 50px 0;
    }

    .hero h1 {
        font-size: 1.5rem;
    }
}