/* ========== 全局样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a6fa5;
    --secondary-color: #e07a5f;
    --success-color: #81b29a;
    --background-color: #f9f9f9;
    --text-color: #333;
    --text-light: #666;
    --border-color: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========== 导航栏 ========== */
.navbar {
    background-color: #fff;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--primary-color);
}

.logo-icon {
    font-size: 1.5rem;
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s;
    position: relative;
}

.nav-links a:hover {
    color: var(--primary-color);
}

.nav-links a.active {
    color: var(--primary-color);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--primary-color);
}

.nav-links a.disabled {
    color: #ccc;
    cursor: not-allowed;
}

/* ========== 主内容区 ========== */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    width: 100%;
}

/* ========== Hero 区域 ========== */
.hero {
    text-align: center;
    padding: 60px 0;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-light);
    margin-bottom: 30px;
}

.cta-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1.1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
}

.cta-button:hover {
    background-color: #3a5a95;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* ========== 方法卡片 ========== */
.method-section {
    margin: 80px 0;
}

.method-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 40px;
}

.method-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.method-card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.3s;
}

.method-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.method-card h3 {
    font-size: 1.25rem;
    margin-bottom: 15px;
    color: var(--primary-color);
}

/* ========== 学习模块 ========== */
.modules-section {
    margin: 80px 0;
}

.modules-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 40px;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.module-card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s;
    cursor: pointer;
    display: block;
    text-align: center;
}

.module-card:hover:not(.disabled) {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.module-card.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.module-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.module-card h3 {
    font-size: 1.25rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.module-card p {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* ========== 资源区域 ========== */
.resources-section {
    margin: 80px 0;
}

.resources-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 40px;
}

.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.resource-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.resource-card h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.resource-card p {
    color: var(--text-light);
    margin-bottom: 15px;
}

.read-more {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.read-more:hover {
    text-decoration: underline;
}

/* ========== 主题选择页面 ========== */
.topics-main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    width: 100%;
}

.topics-header {
    text-align: center;
    margin-bottom: 40px;
}

.topics-header h1 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.topics-header p {
    color: var(--text-light);
}

.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.topic-card {
    background: white;
    padding: 30px 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.topic-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.topic-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.topic-card h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.topic-card p {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* ========== 加载和错误提示 ========== */
.loading-message,
.error-message {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message button {
    margin-top: 20px;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.error-message button:hover {
    background-color: #3a5a95;
}

/* ========== 页脚 ========== */
.footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: auto;
}

.footer-content p {
    margin: 5px 0;
    font-size: 0.9rem;
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
    .nav-links {
        gap: 15px;
        font-size: 0.9rem;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .method-cards,
    .module-grid {
        grid-template-columns: 1fr;
    }
    
    .topics-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0 10px;
    }
    
    .nav-links {
        gap: 10px;
        font-size: 0.8rem;
    }
    
    .logo-text {
        display: none;
    }
    
    .main-content {
        padding: 20px 10px;
    }
}