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

:root {
    --primary-color: #4a90e2;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-bg: #f8f9fa;
    --dark-text: #333;
    --border-color: #dee2e6;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--dark-text);
    background-color: #fff;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: #357abd;
}

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

/* 头部导航 */
.header {
    background: #fff;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-menu a {
    color: var(--dark-text);
    font-weight: 500;
    padding: 8px 0;
    position: relative;
}

.nav-menu a:hover {
    color: var(--primary-color);
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s;
}

.nav-menu a:hover::after {
    width: 100%;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

/* 主要内容区 */
.main-content {
    padding: 40px 0;
    min-height: calc(100vh - 200px);
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
}

/* 文章列表 */
.article-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.article-card {
    background: #fff;
    border-radius: 8px;
    padding: 25px;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

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

.article-card.featured {
    border-left: 4px solid var(--primary-color);
}

.article-title {
    font-size: 24px;
    margin-bottom: 10px;
}

.article-title a {
    color: var(--dark-text);
}

.article-title a:hover {
    color: var(--primary-color);
}

.article-meta {
    display: flex;
    gap: 20px;
    color: var(--secondary-color);
    font-size: 14px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.article-summary {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.8;
}

.article-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tag {
    display: inline-block;
    padding: 4px 12px;
    background: var(--light-bg);
    border-radius: 20px;
    font-size: 13px;
    color: var(--secondary-color);
}

.tag:hover {
    background: var(--primary-color);
    color: #fff;
}

/* 侧边栏 */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.widget {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.widget-title {
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

.widget-content ul {
    list-style: none;
}

.widget-content li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.widget-content li:last-child {
    border-bottom: none;
}

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

.pagination a {
    padding: 10px 15px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--dark-text);
}

.pagination a:hover,
.pagination a.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* 文章详情 */
.article-detail {
    background: #fff;
    border-radius: 8px;
    padding: 40px;
    box-shadow: var(--shadow);
}

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

.article-detail .article-title {
    font-size: 32px;
    margin-bottom: 15px;
}

.article-content {
    font-size: 16px;
    line-height: 1.8;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
    margin: 25px 0 15px;
}

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

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

.article-content pre {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 15px 0;
}

.article-content code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

.article-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 20px;
    margin: 20px 0;
    color: #666;
}

/* 评论区 */
.comments-section {
    margin-top: 40px;
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.comment-form {
    margin-bottom: 30px;
}

.comment-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comment-item {
    padding: 15px;
    background: var(--light-bg);
    border-radius: 8px;
}

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

.comment-author {
    font-weight: bold;
}

.comment-date {
    color: var(--secondary-color);
    font-size: 14px;
}

.comment-content {
    color: #666;
}

/* 回复按钮 */
.comment-reply-btn {
    margin-left: auto;
    color: var(--primary-color);
    font-size: 12px;
    text-decoration: none;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(74, 144, 226, 0.1);
    transition: all 0.2s;
    cursor: pointer;
}

.comment-reply-btn:hover {
    background: var(--primary-color);
    color: #fff;
    text-decoration: none;
}

/* 页脚 */
.footer {
    background: #2c3e50;
    color: #fff;
    padding: 40px 0 20px;
    margin-top: 60px;
}

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

.footer-section h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.footer-section p,
.footer-section ul {
    color: #bbb;
}

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

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

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

.footer-section a:hover {
    color: #fff;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #444;
    color: #bbb;
}

/* 登录注册页面 */
.auth-page {
    min-height: calc(100vh - 140px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-box {
    background: #fff;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.auth-box h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--dark-text);
}

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

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
    text-align: center;
}

.btn:hover {
    background: #357abd;
    color: #fff;
}

.btn-block {
    width: 100%;
}

.btn-secondary {
    background: var(--secondary-color);
}

.btn-success {
    background: var(--success-color);
}

.btn-danger {
    background: var(--danger-color);
}

.alert {
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

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

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

/* 响应式设计 */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        flex-direction: column;
        padding: 20px;
        box-shadow: var(--shadow);
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        order: -1;
    }
    
    .article-detail {
        padding: 20px;
    }
    
    .article-detail .article-title {
        font-size: 24px;
    }
}

/* 管理后台样式 */
.admin-layout {
    display: grid;
    grid-template-columns: 160px 1fr;
    min-height: calc(100vh - 60px);
}

.admin-sidebar {
    background: #2c3e50;
    color: #fff;
    padding: 20px 0;
}

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

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

.admin-menu li a {
    display: block;
    padding: 12px 20px;
    color: #bbb;
    transition: all 0.3s;
    font-size: 14px;
    line-height: 1.5;
}

.admin-menu li a:hover,
.admin-menu li a.active {
    background: #34495e;
    color: #fff;
}

.admin-content {
    padding: 30px;
    background: var(--light-bg);
}

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

.admin-header h2 {
    color: var(--dark-text);
}

.data-table {
    width: 100%;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--light-bg);
    font-weight: 600;
}

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

.action-btns {
    display: flex;
    gap: 10px;
}

.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.action-btn.edit {
    background: var(--primary-color);
    color: #fff;
}

.action-btn.delete {
    background: var(--danger-color);
    color: #fff;
}

@media (max-width: 768px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }
    
    .admin-sidebar {
        display: none;
    }
}
