/* ============================================
   化学学科专属样式 - 绿色主题
   ============================================ */

/* CSS变量定义 */
:root {
    --chem-primary: #2e7d32;
    --chem-primary-light: #4caf50;
    --chem-primary-dark: #1b5e20;
    --chem-secondary: #81c784;
    --chem-accent: #00c853;
    --chem-bg: #f1f8e9;
    --chem-bg-light: #ffffff;
    --chem-text: #212121;
    --chem-text-light: #616161;
    --chem-border: #c8e6c9;
    --chem-shadow: rgba(46, 125, 50, 0.15);
    --chem-molecule: rgba(129, 199, 132, 0.1);
}

/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: var(--chem-bg);
    color: var(--chem-text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   分子装饰背景
   ============================================ */
.molecule-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.molecule {
    position: absolute;
    opacity: 0.08;
    animation: float 20s infinite ease-in-out;
}

.molecule:nth-child(1) {
    top: 10%;
    left: 5%;
    animation-delay: 0s;
}

.molecule:nth-child(2) {
    top: 60%;
    right: 10%;
    animation-delay: -5s;
}

.molecule:nth-child(3) {
    top: 30%;
    right: 20%;
    animation-delay: -10s;
}

.molecule:nth-child(4) {
    bottom: 20%;
    left: 15%;
    animation-delay: -15s;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(10deg); }
}

/* 分子SVG样式 */
.molecule svg {
    width: 120px;
    height: 120px;
}

/* ============================================
   导航栏
   ============================================ */
.navbar {
    background: linear-gradient(135deg, var(--chem-primary) 0%, var(--chem-primary-dark) 100%);
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px var(--chem-shadow);
    position: relative;
    z-index: 100;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 600;
}

.nav-brand svg {
    width: 32px;
    height: 32px;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.nav-links a:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.nav-back {
    background: rgba(255, 255, 255, 0.2) !important;
}

/* ============================================
   主内容区
   ============================================ */
.main-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* ============================================
   英雄区（首页）
   ============================================ */
.hero-section {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, var(--chem-bg-light) 0%, var(--chem-bg) 100%);
    border-radius: 20px;
    margin-bottom: 3rem;
    box-shadow: 0 4px 20px var(--chem-shadow);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--chem-molecule) 0%, transparent 70%);
    border-radius: 50%;
}

.hero-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 1.5rem;
    color: var(--chem-primary);
}

.hero-title {
    font-size: 2.5rem;
    color: var(--chem-primary-dark);
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--chem-text-light);
    max-width: 600px;
    margin: 0 auto;
}

/* ============================================
   学科介绍
   ============================================ */
.intro-section {
    background: var(--chem-bg-light);
    padding: 2.5rem;
    border-radius: 16px;
    margin-bottom: 3rem;
    box-shadow: 0 2px 12px var(--chem-shadow);
    border-left: 4px solid var(--chem-primary);
}

.intro-section h2 {
    color: var(--chem-primary);
    font-size: 1.8rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.intro-section p {
    color: var(--chem-text-light);
    font-size: 1.05rem;
    line-height: 1.8;
}

/* ============================================
   元素周期表入口
   ============================================ */
.periodic-section {
    background: linear-gradient(135deg, var(--chem-primary-dark) 0%, var(--chem-primary) 100%);
    padding: 3rem;
    border-radius: 16px;
    margin-bottom: 3rem;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.periodic-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='20' cy='20' r='3' fill='rgba(255,255,255,0.1)'/%3E%3Ccircle cx='80' cy='40' r='4' fill='rgba(255,255,255,0.08)'/%3E%3Ccircle cx='40' cy='80' r='2' fill='rgba(255,255,255,0.1)'/%3E%3C/svg%3E");
    opacity: 0.5;
}

.periodic-section h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    position: relative;
}

.periodic-section p {
    opacity: 0.9;
    margin-bottom: 1.5rem;
    position: relative;
}

.periodic-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    color: var(--chem-primary);
    padding: 0.875rem 2rem;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
}

.periodic-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

/* ============================================
   知识模块卡片
   ============================================ */
.modules-section {
    margin-bottom: 3rem;
}

.section-title {
    font-size: 1.8rem;
    color: var(--chem-primary-dark);
    margin-bottom: 2rem;
    text-align: center;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.module-card {
    background: var(--chem-bg-light);
    border-radius: 16px;
    padding: 2rem;
    text-decoration: none;
    color: var(--chem-text);
    transition: all 0.3s ease;
    border: 1px solid var(--chem-border);
    position: relative;
    overflow: hidden;
}

.module-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--chem-primary), var(--chem-accent));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.module-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px var(--chem-shadow);
    border-color: var(--chem-primary-light);
}

.module-card:hover::before {
    transform: scaleX(1);
}

.module-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--chem-primary-light), var(--chem-primary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    color: white;
}

.module-icon svg {
    width: 28px;
    height: 28px;
}

.module-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--chem-primary-dark);
}

.module-desc {
    font-size: 0.95rem;
    color: var(--chem-text-light);
    line-height: 1.6;
}

.module-arrow {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    color: var(--chem-primary);
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
}

.module-card:hover .module-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================
   章节页面布局
   ============================================ */
.chapter-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    min-height: calc(100vh - 200px);
}

/* 侧边栏 */
.sidebar {
    background: var(--chem-bg-light);
    border-radius: 16px;
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 2rem;
    box-shadow: 0 2px 12px var(--chem-shadow);
    border: 1px solid var(--chem-border);
}

.sidebar-header {
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--chem-border);
    margin-bottom: 1rem;
}

.sidebar-title {
    font-size: 1.1rem;
    color: var(--chem-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 0.25rem;
}

.sidebar-nav a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--chem-text);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.sidebar-nav a:hover {
    background: var(--chem-bg);
    color: var(--chem-primary);
}

.sidebar-nav a.active {
    background: linear-gradient(135deg, var(--chem-primary), var(--chem-primary-light));
    color: white;
}

/* 内容区 */
.content-area {
    background: var(--chem-bg-light);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 2px 12px var(--chem-shadow);
    border: 1px solid var(--chem-border);
}

.content-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--chem-border);
}

.content-title {
    font-size: 2rem;
    color: var(--chem-primary-dark);
    margin-bottom: 0.5rem;
}

.content-subtitle {
    color: var(--chem-text-light);
    font-size: 1rem;
}

/* 占位内容 */
.placeholder-content {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--chem-text-light);
}

.placeholder-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    color: var(--chem-secondary);
}

.placeholder-content h3 {
    font-size: 1.5rem;
    color: var(--chem-primary);
    margin-bottom: 1rem;
}

.placeholder-content p {
    max-width: 500px;
    margin: 0 auto;
}

/* ============================================
   页脚
   ============================================ */
.footer {
    background: linear-gradient(135deg, var(--chem-primary-dark) 0%, var(--chem-primary) 100%);
    color: white;
    padding: 2rem;
    margin-top: 3rem;
    text-align: center;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
}

.footer-links {
    margin-bottom: 1rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    margin: 0 1rem;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: white;
}

.footer-icp {
    font-size: 0.875rem;
    opacity: 0.7;
}

.footer-icp a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 1024px) {
    .chapter-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
    }
    
    .nav-links {
        gap: 0.5rem;
    }
    
    .nav-links a {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .main-wrapper {
        padding: 1rem;
    }
    
    .hero-section {
        padding: 2rem 1rem;
    }
    
    .hero-title {
        font-size: 1.8rem;
    }
    
    .modules-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   动画效果
   ============================================ */
.fade-in {
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 悬停效果 */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px var(--chem-shadow);
}
