/* 全局样式 */
:root {
    --primary-color: #333;
    --secondary-color: #666;
    --accent-color: #007aff;
    --background-color: #f5f5f5;
    --card-background: #fff;
    --text-color: #333;
    --border-color: #e5e5e5;
    --success-color: #34c759;
    --error-color: #ff3b30;
    --warning-color: #ff9500;
    --info-color: #007aff;
    --subtle-color: #8e8e93;
    --apple-gray-1: #f5f5f7;
    --apple-gray-2: #e5e5e5;
    --apple-gray-3: #d2d2d7;
    --apple-gray-4: #86868b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--apple-gray-1);
    color: var(--text-color);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: var(--accent-color);
}

a:hover {
    text-decoration: underline;
}

ul {
    list-style: none;
}

/* 容器 */
.container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏样式 */
.sidebar {
    width: 250px;
    background-color: #f9f9f9;
    color: var(--primary-color);
    padding: 20px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
}

.blog-title {
    font-size: 22px;
    font-weight: 600;
    text-align: center;
    padding: 10px 0;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.profile {
    text-align: center;
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border-color);
}

.avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 15px;
    border: 2px solid var(--apple-gray-2);
}

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

.username {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.stats {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
}

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

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-color);
}

.stat-label {
    font-size: 12px;
    color: var(--apple-gray-4);
}

.menu {
    padding: 20px 0;
}

.menu-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    color: var(--primary-color);
}

.menu-item:hover {
    background-color: var(--apple-gray-2);
}

.menu-item.active {
    background-color: rgba(0, 122, 255, 0.1);
    color: var(--accent-color);
}

.menu-icon {
    margin-right: 10px;
    font-size: 16px;
    width: 20px;
    text-align: center;
    color: inherit;
}

/* 内容区域样式 */
.content {
    flex: 1;
    margin-left: 250px;
    padding: 40px;
}

.article-list {
    max-width: 800px;
    margin: 0 auto;
}

.page-title {
    font-size: 24px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    color: var(--primary-color);
}

.article {
    background-color: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
    padding: 24px;
}

.article-header {
    margin-bottom: 15px;
}

.article-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 10px;
    line-height: 1.3;
}

.article-title a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

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

.article-meta {
    color: var(--apple-gray-4);
    font-size: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.article-meta a {
    color: var(--accent-color);
    text-decoration: none;
}

.article-meta a:hover {
    text-decoration: underline;
}

.article-content {
    margin-bottom: 20px;
    color: var(--secondary-color);
    font-size: 16px;
    line-height: 1.7;
}

.article-excerpt {
    text-align: justify;
}

.article-footer {
    display: flex;
    justify-content: flex-end;
}

.read-more {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}

.read-more:hover {
    opacity: 0.8;
    text-decoration: none;
}

/* 加载和错误提示 */
.loading, .error, .empty {
    padding: 20px;
    text-align: center;
    border-radius: 12px;
    margin: 20px 0;
}

.loading {
    background-color: var(--apple-gray-1);
    color: var(--apple-gray-4);
}

.error {
    background-color: rgba(255, 59, 48, 0.1);
    color: var(--error-color);
}

/* 文章编辑器样式 */
.article-editor {
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.editor-header {
    padding: 24px;
    background-color: var(--apple-gray-1);
    border-bottom: 1px solid var(--border-color);
}

.editor-header h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
}

.editor-subtitle {
    font-size: 15px;
    color: var(--apple-gray-4);
}

.modern-form {
    padding: 24px;
}

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

.form-row .form-group {
    flex: 1;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--primary-color);
    font-size: 15px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--apple-gray-3);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s ease;
    background-color: #fff;
    color: var(--primary-color);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

.select-wrapper {
    position: relative;
}

.select-wrapper select {
    appearance: none;
    padding-right: 30px;
}

.select-wrapper i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--apple-gray-4);
}

.editor-container {
    border: 1px solid var(--apple-gray-3);
    border-radius: 8px;
    overflow: hidden;
}

.editor-container .CodeMirror {
    height: 400px;
    font-family: "SF Mono", SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 14px;
    line-height: 1.6;
}

.editor-container .CodeMirror-scroll {
    min-height: 400px;
}

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

.primary-btn,
.secondary-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    border: none;
}

.primary-btn {
    background-color: var(--accent-color);
    color: white;
}

.primary-btn:hover {
    background-color: #0062cc;
}

.secondary-btn {
    background-color: var(--apple-gray-2);
    color: var(--primary-color);
}

.secondary-btn:hover {
    background-color: var(--apple-gray-3);
}

/* 预览容器样式 */
.preview-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.preview-content {
    background-color: white;
    border-radius: 12px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.preview-header h3 {
    font-size: 18px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.close-preview {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--apple-gray-4);
    transition: color 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-preview:hover {
    color: var(--error-color);
    background-color: var(--apple-gray-1);
}

.preview-title {
    font-size: 28px;
    margin-bottom: 15px;
    color: var(--primary-color);
    font-weight: 600;
}

.preview-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    color: var(--apple-gray-4);
    font-size: 14px;
}

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

/* 通知样式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 16px;
    border-radius: 10px;
    background-color: white;
    color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1100;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    max-width: 350px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background-color: rgba(52, 199, 89, 0.15);
    color: var(--success-color);
}

.notification.error {
    background-color: rgba(255, 59, 48, 0.15);
    color: var(--error-color);
}

.notification.warning {
    background-color: rgba(255, 149, 0, 0.15);
    color: var(--warning-color);
}

.notification.info {
    background-color: rgba(0, 122, 255, 0.15);
    color: var(--info-color);
}

.notification i {
    font-size: 18px;
}

/* 分类页面样式 */
.category-page, .category-detail-page {
    max-width: 900px;
    margin: 0 auto;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h2 {
    font-size: 28px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-subtitle {
    color: var(--apple-gray-4);
    font-size: 15px;
}

/* 分类列表 */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.category-card {
    background-color: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
}

.category-card:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.category-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background-color: var(--apple-gray-1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 18px;
    color: var(--accent-color);
}

.category-details {
    flex: 1;
}

.category-name {
    font-size: 17px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.category-count {
    font-size: 13px;
    color: var(--apple-gray-4);
    display: flex;
    align-items: center;
    gap: 5px;
}

.category-link {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
    transition: all 0.2s ease;
    background-color: transparent;
}

.category-link:hover {
    background-color: var(--apple-gray-1);
    text-decoration: none;
}

/* 加载动画 */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
    color: var(--apple-gray-4);
}

.loading-spinner {
    width: 30px;
    height: 30px;
    border: 2px solid rgba(0, 122, 255, 0.1);
    border-left-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.empty-icon {
    font-size: 48px;
    color: var(--apple-gray-3);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--apple-gray-4);
    margin-bottom: 20px;
    font-size: 15px;
}

/* 分类详情页 */
.category-detail-page .page-header {
    background-color: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
}

.header-nav {
    margin-bottom: 16px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-color);
    font-size: 14px;
    transition: opacity 0.2s;
}

.back-link:hover {
    opacity: 0.8;
    text-decoration: none;
}

.category-banner {
    display: flex;
    align-items: center;
    gap: 16px;
}

.category-banner .category-icon {
    width: 48px;
    height: 48px;
    font-size: 22px;
}

.category-info h2 {
    margin-bottom: 4px;
}

.category-meta {
    color: var(--apple-gray-4);
    font-size: 14px;
}

#article-count-badge {
    display: inline-block;
    background-color: var(--apple-gray-1);
    color: var(--apple-gray-4);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

/* 文章卡片网格 */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.article-card {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    padding: 20px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.article-card:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.article-card .article-header {
    margin-bottom: 12px;
}

.article-card .article-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
}

.article-card .article-title a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

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

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.tag {
    background-color: var(--apple-gray-1);
    color: var(--apple-gray-4);
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.article-card .article-meta {
    margin-bottom: 12px;
    color: var(--apple-gray-4);
    font-size: 13px;
    display: flex;
    gap: 12px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.article-card .article-excerpt {
    color: var(--secondary-color);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 16px;
    flex-grow: 1;
}

.article-card .article-footer {
    margin-top: auto;
    text-align: right;
}

.read-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-color);
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
}

.read-more-btn:hover {
    gap: 8px;
    text-decoration: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .content {
        margin-left: 0;
        padding: 20px;
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
    }
    
    .category-banner {
        flex-direction: column;
        text-align: center;
    }
}