/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* 容器 */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 导航栏 */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    margin-bottom: 1rem;
}

.logo {
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
}

.navbar-menu {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    align-items: center;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Auth Dropdown */
.auth-dropdown {
    position: absolute;
    top: 60px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 200;
    min-width: 150px;
}

.auth-btn {
    display: block;
    width: 100%;
    padding: 10px 15px;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
    color: #333;
    transition: background-color 0.2s ease;
}

.auth-btn:hover {
    background-color: #f0f0f0;
}

.auth-btn:first-child {
    border-radius: 8px 8px 0 0;
}

.auth-btn:last-child {
    border-radius: 0 0 8px 8px;
}

/* 页面 */
.page {
    min-height: 400px;
    padding: 2rem 0;
}

/* 表单样式 */
.auth-form {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    margin: 2rem auto;
}

.auth-form h2 {
    margin-bottom: 1.5rem;
    color: #667eea;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 按钮样式 */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 0.5rem;
    margin-top: 1rem;
}

.btn-primary {
    background-color: #667eea;
    color: white;
}

.btn-primary:hover {
    background-color: #5567d8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background-color: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background-color: #d0d0d0;
}

/* 文章容器 */
.posts-container {
    display: grid;
    gap: 1.5rem;
    margin: 2rem 0;
}

.post-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-left: 4px solid #667eea;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.post-card h3 {
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.post-meta {
    color: #999;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.post-content {
    color: #666;
    line-height: 1.8;
    max-height: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 评论区域 */
.comments-section {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.comments-section h4 {
    color: #333;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.comments-list {
    margin-bottom: 1rem;
}

.comment-item {
    background: #f9f9f9;
    padding: 0.8rem;
    border-radius: 4px;
    margin-bottom: 0.8rem;
}

.comment-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.comment-meta strong {
    color: #333;
}

.comment-date {
    color: #999;
    font-size: 0.85rem;
}

.comment-content {
    color: #666;
    line-height: 1.6;
    word-break: break-word;
}

.comment-form {
    margin-top: 1rem;
}

.comment-input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    resize: vertical;
}

.comment-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* 创建文章表单 */
.create-form {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    margin: 2rem auto;
}

.create-form h1 {
    color: #667eea;
    margin-bottom: 1.5rem;
}

#post-content {
    resize: vertical;
}

/* 消息提示 */
.message {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 4px;
    text-align: center;
    font-weight: 500;
    display: none;
}

.message.success {
    display: block;
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    display: block;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 2rem;
    color: #999;
    display: none;
}

.loading.active {
    display: block;
}

/* 标题 */
h1 {
    color: #333;
    margin-bottom: 1.5rem;
    text-align: center;
    padding-top: 1rem;
}

/* 页脚 */
.footer {
    background-color: #f0f0f0;
    color: #666;
    text-align: center;
    padding: 2rem 0;
    margin-top: 4rem;
    border-top: 1px solid #ddd;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar-menu {
        gap: 1rem;
    }

    .auth-form {
        margin: 1rem 0;
    }

    .posts-container {
        gap: 1rem;
    }

    .container {
        padding: 0 10px;
    }
}
