* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

nav {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: white;
    text-decoration: none;
    padding: 0.5rem;
}

.nav-links a:hover {
    color: #3498db;
}

.login-btn {
    padding: 5px 15px;
    font-size: 1rem;
    background-color: #2c3e50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    position: absolute; /* 使按钮脱离正常文档流 */
    top: 25px; /* 相对 header 的垂直居中 */
    right: 20px; /* 距离右侧 20px */
    transform: translateY(-50%); /* 调整位置居中 */
    text-decoration: none;
}

.login-btn:hover {
    background-color: #2c3e50;
}

.search-container {
    background: white;
    padding: 1rem;
    margin: 1rem auto;
    max-width: 1200px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.search-box {
    display: flex;
    gap: 1rem;
}

.search-input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.search-button {
    background: #3498db;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
}

.search-button:hover {
    background: #2980b9;
}

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    flex:1;
}

.post {
    background: white;
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.post-title {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.post-meta {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.post-content {
    margin-bottom: 1.5rem;
}

.read-more {
    color: #3498db;
    text-decoration: none;
    font-weight: bold;
}

.tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.tag {
    background: #e1f0fa;
    color: #3498db;
    padding: 0.2rem 0.6rem;
    border-radius: 15px;
    font-size: 0.8rem;
    text-decoration: none;
}

.tag:hover {
    background: #3498db;
    color: white;
}

.sidebar {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    height: fit-content;
}

.sidebar h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.categories {
    list-style: none;
    margin-bottom: 2rem;
}

.categories li {
    margin-bottom: 0.5rem;
}

.categories a {
    color: #666;
    text-decoration: none;
}

.categories a:hover {
    color: #3498db;
}

.comments {
    background: white;
    padding: 1.5rem;
    margin-top: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.comment {
    border-bottom: 1px solid #eee;
    padding: 1rem 0;
}

.comment:last-child {
    border-bottom: none;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.comment-author {
    font-weight: bold;
    color: #2c3e50;
}

.comment-date {
    color: #666;
    font-size: 0.8rem;
}

.comment-form {
    margin-top: 1rem;
}

.comment-input {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
}

.comment-submit {
    background: #3498db;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
}

.comment-submit:hover {
    background: #2980b9;
}

footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 1rem;
    margin-top: 2rem;


}

footer a {
    background-color: #2c3e50;
    color: white;
    text-align: center;
}

@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
    }

    .nav-links {
        display: none;
    }
}