/* ==================== 全民自学网 - 全局样式 ==================== */

/* CSS变量定义 */
:root {
    --primary: #4F46E5;
    --primary-light: #818CF8;
    --primary-dark: #3730A3;
    --secondary: #10B981;
    --secondary-light: #34D399;
    --accent: #F59E0B;
    --danger: #EF4444;
    --dark: #1F2937;
    --gray: #6B7280;
    --gray-light: #9CA3AF;
    --light: #F3F4F6;
    --white: #FFFFFF;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.2);
    
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--dark);
    line-height: 1.6;
    background: #F9FAFB;
}

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

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

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

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    border: none;
}

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

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

.btn-outline {
    background: transparent;
    border: 2px solid currentColor;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* 渐变按钮 */
.btn-gradient {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%) !important;
    color: white !important;
    border: none !important;
    position: relative;
    overflow: hidden;
}

.btn-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn-gradient:hover::before {
    left: 100%;
}

.btn-gradient:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3) !important;
}

/* 渐变边框按钮 */
.btn-gradient-outline {
    background: transparent !important;
    border: 2px solid var(--primary) !important;
    color: var(--primary) !important;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-gradient-outline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, #7C3AED 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.btn-gradient-outline:hover {
    color: white !important;
    border-color: transparent !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3) !important;
}

.btn-gradient-outline:hover::before {
    opacity: 1;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.1rem;
}

/* 卡片基础样式 */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

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

/* ==================== 导航栏 ==================== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 12px 0;
}

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

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

.logo-icon {
    font-size: 1.5rem;
}

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

.nav-menu {
    display: flex;
    gap: 32px;
}

.nav-menu a {
    font-weight: 500;
    color: var(--gray);
    padding: 8px 0;
    position: relative;
    transition: var(--transition);
}

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

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

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-search {
    display: flex;
    background: var(--light);
    border-radius: var(--radius);
    overflow: hidden;
}

.nav-search input {
    border: none;
    background: transparent;
    padding: 8px 12px;
    width: 200px;
    outline: none;
}

.nav-search button {
    background: var(--primary);
    border: none;
    padding: 8px 12px;
    cursor: pointer;
}

.mobile-nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.mobile-nav-toggle span {
    width: 24px;
    height: 2px;
    background: var(--dark);
    transition: var(--transition);
}

/* ==================== Hero 区域 ==================== */
.hero {
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
    padding: 60px 0 80px;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.hero-content h1 {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 20px;
}

.hero-content h1 span {
    color: var(--primary);
}

.hero-content p {
    font-size: 1.1rem;
    color: var(--gray);
    margin-bottom: 32px;
}

.hero-buttons {
    display: flex;
    gap: 16px;
    margin-bottom: 40px;
}

.hero-buttons .btn-lg {
    min-width: 160px;
    text-align: center;
}

.hero-stats {
    display: flex;
    gap: 40px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--gray);
}

.hero-wordcloud {
    height: 400px;
    background: linear-gradient(135deg, #C7D2FE 0%, #DDD6FE 100%);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

#wordcloud-canvas {
    width: 100%;
    height: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 40px;
}

.word-item {
    display: inline-block;
    animation: wordFloat 3s ease-in-out infinite;
    cursor: default;
}

@keyframes wordFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

/* ==================== 分类区域 ==================== */
.categories-section {
    padding: 80px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 48px;
}

.section-header h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.section-header p {
    color: var(--gray);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.category-card {
    padding: 32px 24px;
    text-align: center;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 2px solid transparent;
}

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

.category-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.category-card h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.category-card p {
    font-size: 0.9rem;
    color: var(--gray);
}

/* ==================== 课程区域 ==================== */
.courses-section {
    padding: 80px 0;
    background: #F9FAFB;
}

.courses-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

.course-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}

.course-image {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: #f0f0f0;
}

.course-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.course-tag {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.tag-hot {
    background: #EF4444;
    color: white;
}

.tag-new {
    background: #10B981;
    color: white;
}

.tag-free {
    background: #3B82F6;
    color: white;
}

.course-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.course-category {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 500;
    margin-bottom: 8px;
}

.course-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.course-meta {
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: 16px;
}

.course-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.course-author {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--gray);
}

.course-author-avatar {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #4FC3F7 0%, #2196F3 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.course-author-avatar svg {
    width: 16px;
    height: 16px;
}

.course-price {
    font-size: 0.9rem;
    color: var(--secondary);
    font-weight: 600;
}

/* 保存按钮样式 */
.course-price.save-btn {
    background: linear-gradient(135deg, #4FC3F7 0%, #2196F3 100%);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.course-price.save-btn:hover {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
}

/* ==================== 学习路径 ==================== */
.paths-section {
    padding: 80px 0;
}

.path-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

.path-card {
    padding: 32px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.path-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

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

.path-card:hover::before {
    transform: scaleX(1);
}

.path-number {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.path-content h3 {
    font-size: 1.2rem;
    margin-bottom: 12px;
}

.path-content p {
    font-size: 0.95rem;
    color: var(--gray);
    margin-bottom: 20px;
}

.path-stats {
    display: flex;
    gap: 24px;
}

.path-stat {
    display: flex;
    align-items: center;
    gap: 8px;
}

.path-stat-value {
    font-size: 1.2rem;
}

.path-stat-label {
    font-size: 0.85rem;
    color: var(--gray);
}

/* ==================== 社区区域 ==================== */
.community-section {
    padding: 80px 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.community-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.community-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.community-info h2 {
    font-size: 2rem;
    margin-bottom: 16px;
}

.community-info > p {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 24px;
}

.community-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 32px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
}

.feature-icon {
    font-size: 1.2rem;
}

.community-qrcode {
    display: flex;
    justify-content: center;
}

.qrcode-wrapper {
    background: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    text-align: center;
}

.qrcode-image {
    width: 180px;
    height: 180px;
    margin-bottom: 16px;
}

.qrcode-tips {
    color: var(--dark);
}

.tips-icon {
    font-size: 1.5rem;
}

.qrcode-tips p {
    font-size: 0.9rem;
    margin-top: 8px;
}

/* ==================== 页脚 ==================== */
.footer {
    background: var(--dark);
    color: white;
    padding: 60px 0 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 32px;
    margin-bottom: 40px;
}

.footer-brand h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    margin-bottom: 16px;
}

.footer-brand p {
    color: var(--gray-light);
    font-size: 0.95rem;
}

.footer-links h4 {
    font-size: 1rem;
    margin-bottom: 20px;
}

.footer-links ul li {
    margin-bottom: 12px;
}

.footer-links ul li a {
    color: var(--gray-light);
    font-size: 0.9rem;
    transition: var(--transition);
}

.footer-links ul li a:hover {
    color: white;
}

.footer-disclaimer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 30px;
    margin-bottom: 30px;
}

.footer-disclaimer h4 {
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.footer-disclaimer p {
    font-size: 0.85rem;
    color: var(--gray-light);
    margin-bottom: 12px;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-bottom p {
    font-size: 0.9rem;
    color: var(--gray-light);
}

/* ==================== 课程页面专用样式 ==================== */

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

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

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

/* 筛选栏 */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 32px;
    justify-content: center;
}

.filter-btn {
    padding: 10px 20px;
    border: 2px solid var(--light);
    background: var(--white);
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--gray);
    cursor: pointer;
    transition: all 0.3s ease;
}

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

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

/* 无结果提示 */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.no-results p {
    font-size: 1.1rem;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 1024px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .hero-wordcloud {
        height: 300px;
    }
    
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .courses-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .community-wrapper {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .community-features {
        justify-content: center;
    }
    
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .mobile-nav-toggle {
        display: flex;
    }
    
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 20px;
        gap: 16px;
        box-shadow: var(--shadow);
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-search {
        display: none;
    }
    
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .hero-buttons {
        flex-direction: column;
    }
    
    .hero-stats {
        justify-content: center;
    }
    
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .courses-grid {
        grid-template-columns: 1fr;
    }
    
    .path-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .page-header {
        padding: 40px 0;
    }
    
    .page-header h1 {
        font-size: 1.8rem;
    }
    
    .filter-bar {
        gap: 8px;
    }
    
    .filter-btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
}

/* ==================== 课程详情页播放按钮 ==================== */
.lesson-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #818CF8 0%, #4F46E5 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.lesson-icon svg {
    width: 12px;
    height: 12px;
    margin-left: 2px;
}

.lesson-icon svg circle {
    fill: rgba(255, 255, 255, 0.2);
}

.lesson-icon svg path {
    fill: white;
}

.lesson-item:hover .lesson-icon {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    background: linear-gradient(135deg, #6366F1 0%, #4338CA 100%);
}
