/* 全局样式 */
* {
    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: #f8f9fa;
}

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

a {
    text-decoration: none;
    color: #0066cc;
    transition: color 0.3s ease;
}

a:hover {
    color: #004080;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    background-color: #0066cc;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    text-align: center;
}

.btn:hover {
    background-color: #004080;
    color: white;
}

.btn-large {
    padding: 12px 24px;
    font-size: 1.1em;
}

/* 头部样式 */
header {
    background-color: #0066cc;
    color: white;
    padding: 40px 0;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
}

/* 导航栏样式 */
nav {
    background-color: #004080;
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

nav ul {
    display: flex;
    list-style: none;
    justify-content: center;
}

nav ul li {
    margin: 0 15px;
}

nav ul li a {
    color: white;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 3px;
    transition: background-color 0.3s ease;
}

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

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

section {
    margin-bottom: 50px;
}

section h2 {
    font-size: 1.8em;
    margin-bottom: 20px;
    color: #004080;
    text-align: center;
    position: relative;
}

section h2:after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background-color: #0066cc;
    margin: 10px auto;
}

/* 介绍部分 */
.intro {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 40px;
}

.intro p {
    margin-bottom: 15px;
    font-size: 1.1em;
}

/* 分类网格 */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.category-card {
    background-color: white;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

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

.category-card h3 {
    color: #004080;
    margin-bottom: 10px;
    font-size: 1.3em;
}

.category-card p {
    margin-bottom: 20px;
    flex-grow: 1;
}

.more-converters {
    text-align: center;
    margin-top: 20px;
}

/* 热门换算工具 */
.popular-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.popular-item {
    background-color: white;
    padding: 15px;
    border-radius: 5px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.popular-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    color: #0066cc;
}

/* 知识卡片 */
.knowledge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.knowledge-card {
    background-color: white;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.knowledge-card:hover {
    transform: translateY(-5px);
}

.knowledge-card h3 {
    color: #004080;
    margin-bottom: 10px;
}

.knowledge-card p {
    margin-bottom: 15px;
}

/* 页脚样式 */
footer {
    background-color: #004080;
    color: white;
    padding: 40px 0 20px;
}

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

.footer-section h3 {
    margin-bottom: 15px;
    font-size: 1.2em;
}

.footer-section ul {
    list-style: none;
}

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

.footer-section a {
    color: #b3d1ff;
}

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

.copyright {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.9em;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header {
        padding: 30px 0;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    nav ul {
        flex-direction: column;
        align-items: center;
    }
    
    nav ul li {
        margin: 5px 0;
    }
    
    .category-grid, .knowledge-grid {
        grid-template-columns: 1fr;
    }
    
    .popular-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

/* 换算工具页面样式 */
.converter-container {
    background-color: white;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    margin: 0 auto;
}

.converter-form {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 15px;
    align-items: center;
    margin-bottom: 25px;
}

.converter-input {
    display: flex;
    flex-direction: column;
}

.converter-input label {
    margin-bottom: 5px;
    font-weight: 500;
}

.converter-input input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
}

.converter-arrow {
    font-size: 1.5em;
    color: #0066cc;
    text-align: center;
}

.converter-result {
    background-color: #f0f7ff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    text-align: center;
    font-size: 1.2em;
}

.converter-formula {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-family: monospace;
}

.converter-explanation {
    margin-bottom: 30px;
}

.converter-explanation h3 {
    margin-bottom: 10px;
    color: #004080;
}

.converter-tabs {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

.converter-tab {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.converter-tab:hover {
    background-color: #f0f7ff;
}

.converter-tab.active {
    border-bottom-color: #0066cc;
    font-weight: 500;
}

/* 知识页面样式 */
.knowledge-section {
    margin-bottom: 40px;
}

.knowledge-section h3 {
    color: #004080;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.knowledge-section p {
    margin-bottom: 15px;
}

.knowledge-section ul, .knowledge-section ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.knowledge-section li {
    margin-bottom: 8px;
}

.knowledge-image {
    max-width: 100%;
    height: auto;
    margin: 20px 0;
    border-radius: 5px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

/* 广告容器样式 */
.ad-container {
    margin: 30px 0;
    text-align: center;
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #0066cc;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.back-to-top.visible {
    opacity: 1;
}

.back-to-top:hover {
    background-color: #004080;
}