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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

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

/* 头部导航样式 */
.header {
    background-color: #28a745;
    color: white;
    padding: 15px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    text-decoration: none;
    color: white;
}

.nav {
    display: flex;
    list-style: none;
}

.nav li {
    margin-left: 20px;
}

.nav a {
    color: white;
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

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

.user-menu {
    display: flex;
    align-items: center;
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}

/* 注册和登录表单样式 */
.register-form, .login-form {
    background-color: white;
    max-width: 500px;
    margin: 50px auto;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.register-form h2, .login-form h2 {
    text-align: center;
    color: #28a745;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

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

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.25);
}

/* 验证码样式 */
.captcha-group .captcha-container {
    display: flex;
    gap: 10px;
}

.captcha-img {
    width: 120px;
    height: 40px;
    cursor: pointer;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: #28a745;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background-color: #218838;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

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

/* 错误和成功信息样式 */
.error {
    color: #dc3545;
    font-size: 14px;
    margin-top: 5px;
    display: block;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    text-align: center;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    text-align: center;
}

/* 链接样式 */
.login-link, .register-link {
    text-align: center;
    margin-top: 20px;
}

.login-link a, .register-link a {
    color: #28a745;
    text-decoration: none;
    font-weight: 500;
}

.login-link a:hover, .register-link a:hover {
    text-decoration: underline;
}

/* 页脚样式 */
.footer {
    background-color: #343a40;
    color: white;
    padding: 30px 0;
    margin-top: 50px;
}

.footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.footer-content {
    text-align: center;
    margin-bottom: 20px;
}

.footer-links {
    list-style: none;
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.footer-links a {
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #28a745;
}

.footer-copyright {
    font-size: 14px;
    color: #adb5bd;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .nav li {
        margin: 0 10px;
    }
    
    .register-form, .login-form {
        margin: 30px 20px;
        padding: 20px;
    }
    
    .captcha-group .captcha-container {
        flex-direction: column;
    }
    
    .captcha-img {
        width: 100%;
        height: auto;
    }
}

/* 首页样式 */
.hero {
    background-color: #e8f5e8;
    padding: 40px 0;
    margin-bottom: 30px;
}

.hero-content {
    text-align: center;
}

.hero h1 {
    color: #28a745;
    margin-bottom: 10px;
    font-size: 36px;
}

.hero p {
    color: #666;
    font-size: 18px;
    margin-bottom: 20px;
}

/* 轮播图样式 */
.slider {
    max-width: 100%;
    height: 400px;
    margin: 0 auto 30px;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.slider img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 分类导航样式 */
.category-nav {
    background-color: white;
    padding: 20px 0;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
}

.category-nav::-webkit-scrollbar {
    height: 6px;
}

.category-nav::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.category-nav::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.category-nav::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.category-list {
    display: flex;
    gap: 20px;
    padding: 0 20px;
    min-width: max-content;
}

.category-item {
    padding: 10px 20px;
    background-color: #f8f9fa;
    border-radius: 20px;
    text-decoration: none;
    color: #555;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.category-item:hover, .category-item.active {
    background-color: #28a745;
    color: white;
}

/* 文章列表样式 */
.posts-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.post-item {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.post-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.post-cover {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.post-content {
    padding: 20px;
}

.post-category {
    display: inline-block;
    background-color: #e8f5e8;
    color: #28a745;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 10px;
}

.post-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
    text-decoration: none;
    display: block;
}

.post-title:hover {
    color: #28a745;
}

.post-excerpt {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #888;
}

.post-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.post-stats {
    display: flex;
    gap: 15px;
}

.post-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 文章详情页样式 */
.post-detail {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.post-detail-header {
    margin-bottom: 30px;
}

.post-detail-title {
    font-size: 32px;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.3;
}

.post-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.post-detail-content {
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    margin-bottom: 40px;
}

.post-detail-content img {
    max-width: 100%;
    height: auto;
    margin: 20px 0;
    border-radius: 4px;
}

.post-detail-content h1, .post-detail-content h2, .post-detail-content h3, 
.post-detail-content h4, .post-detail-content h5, .post-detail-content h6 {
    margin: 20px 0 15px;
    color: #28a745;
}

.post-detail-content p {
    margin-bottom: 15px;
}

.post-detail-content ul, .post-detail-content ol {
    margin: 15px 0;
    padding-left: 30px;
}

.post-detail-content li {
    margin-bottom: 8px;
}

/* 文章操作按钮样式 */
.post-actions {
    display: flex;
    gap: 20px;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: #f8f9fa;
    color: #555;
    text-decoration: none;
    border-radius: 20px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.action-btn:hover {
    background-color: #e8f5e8;
    color: #28a745;
}

.action-btn.active {
    background-color: #28a745;
    color: white;
}

/* 评论区样式 */
.comments-section {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.comments-title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
}

.comment-form {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid #eee;
}

.comment-form textarea {
    width: 100%;
    height: 120px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.3s ease;
    margin-bottom: 15px;
}

.comment-form textarea:focus {
    outline: none;
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.25);
}

.comment-list {
    list-style: none;
}

.comment-item {
    margin-bottom: 20px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.comment-item:hover {
    transform: translateX(10px);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 10px;
}

.comment-author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-author-info {
    display: flex;
    flex-direction: column;
}

.comment-author-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.comment-time {
    font-size: 12px;
    color: #888;
}

.comment-content {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
    margin-bottom: 10px;
}

.comment-actions {
    display: flex;
    gap: 15px;
    font-size: 12px;
}

.comment-action {
    color: #888;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.3s ease;
}

.comment-action:hover {
    color: #28a745;
}

/* 子评论样式 */
.sub-comment-list {
    margin-left: 40px;
    margin-top: 15px;
    list-style: none;
}

.sub-comment-item {
    margin-bottom: 15px;
    padding: 15px;
    background-color: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 个人中心样式 */
.profile {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.profile-header {
    text-align: center;
    margin-bottom: 40px;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
    border: 4px solid #28a745;
}

.profile-nickname {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.profile-username {
    color: #888;
    font-size: 14px;
    margin-bottom: 20px;
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 30px;
}

.profile-stat {
    text-align: center;
}

.profile-stat-number {
    font-size: 20px;
    font-weight: 700;
    color: #28a745;
}

.profile-stat-label {
    font-size: 12px;
    color: #888;
    margin-top: 5px;
}

.profile-tabs {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    border-bottom: 1px solid #eee;
}

.profile-tab {
    padding: 10px 20px;
    text-decoration: none;
    color: #555;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.profile-tab:hover, .profile-tab.active {
    color: #28a745;
    border-bottom-color: #28a745;
}

/* 管理后台样式 */
.admin-container {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 250px;
    background-color: #343a40;
    color: white;
    padding: 20px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.admin-sidebar-logo {
    padding: 0 20px 20px;
    border-bottom: 1px solid #495057;
    margin-bottom: 20px;
}

.admin-sidebar-logo h2 {
    font-size: 18px;
    color: #28a745;
    margin: 0;
}

.admin-menu {
    list-style: none;
}

.admin-menu-item {
    margin-bottom: 5px;
}

.admin-menu-link {
    display: block;
    padding: 12px 20px;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.admin-menu-link:hover, .admin-menu-link.active {
    background-color: #495057;
    border-left-color: #28a745;
}

.admin-content {
    flex: 1;
    padding: 30px;
    background-color: #f8f9fa;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.admin-title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.admin-user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.admin-main {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 表格样式 */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.table th, .table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.table th {
    background-color: #28a745;
    color: white;
    font-weight: 600;
}

.table tr:hover {
    background-color: #f8f9fa;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.pagination-link {
    padding: 8px 15px;
    background-color: white;
    color: #333;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.pagination-link:hover, .pagination-link.active {
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}

/* 表单样式 */
.form {
    max-width: 800px;
    margin: 0 auto;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-col {
    flex: 1;
}

.form-group {
    margin-bottom: 20px;
}

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

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.25);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    justify-content: flex-end;
}

/* 富文本编辑器样式 */
.editor-container {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
}

.editor-toolbar {
    background-color: #f8f9fa;
    padding: 10px;
    border-bottom: 1px solid #ddd;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.editor-btn {
    padding: 6px 12px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.editor-btn:hover {
    background-color: #e8f5e8;
    border-color: #28a745;
    color: #28a745;
}

.editor-btn.active {
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}

.editor-content {
    display: flex;
    min-height: 400px;
}

.editor-textarea {
    flex: 1;
    padding: 20px;
    border: none;
    resize: none;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

.editor-textarea:focus {
    outline: none;
}

.editor-preview {
    flex: 1;
    padding: 20px;
    background-color: #f8f9fa;
    border-left: 1px solid #ddd;
    overflow-y: auto;
}

/* 上传样式 */
.upload-area {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.upload-area:hover {
    border-color: #28a745;
    background-color: #e8f5e8;
}

.upload-area.active {
    border-color: #28a745;
    background-color: #d4edda;
}

.upload-area input[type="file"] {
    display: none;
}

.upload-placeholder {
    color: #888;
    font-size: 14px;
}

/* 标签样式 */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    background-color: #e8f5e8;
    color: #28a745;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.tag-remove {
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.tag-remove:hover {
    color: #dc3545;
}

/* 通知样式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.notification.success {
    background-color: #28a745;
}

.notification.error {
    background-color: #dc3545;
}

.notification.warning {
    background-color: #ffc107;
    color: #333;
}

.notification.info {
    background-color: #17a2b8;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
