/* 博客系统前端样式 */

/* 基础样式重置 */
* {
    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: #f8f9fa;
}

/* 导航栏样式 */
.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

.navbar-dark.bg-primary {
    background: linear-gradient(135deg, #1a365d 0%, #2d3748 100%) !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* 文章卡片样式 */
.article-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    height: 100%;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 25px rgba(0,0,0,0.15);
}

.article-card .card-body {
    padding: 1.5rem;
}

.article-card .card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.article-card .card-title a {
    color: #2d3748;
    text-decoration: none;
    transition: color 0.3s ease;
}

.article-card .card-title a:hover {
    color: #3b82f6;
}

.article-card .card-text {
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* 文章详情页样式 */
.blog-post {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
}

.post-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1a365d;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.post-meta {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.post-excerpt {
    border-left: 4px solid #3b82f6;
    background-color: #f0f9ff;
}

/* Markdown内容样式 */
.post-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #4a5568;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

.post-content p {
    margin-bottom: 1.5rem;
    text-align: justify;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    color: #1a365d;
    margin: 2rem 0 1rem 0;
    font-weight: 600;
    line-height: 1.3;
}

.post-content h1 {
    font-size: 1.8rem;
    border-bottom: 3px solid #3b82f6;
    padding-bottom: 0.5rem;
}

.post-content h2 {
    font-size: 1.6rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

.post-content h3 {
    font-size: 1.4rem;
}

.post-content h4 {
    font-size: 1.2rem;
}

.post-content h5 {
    font-size: 1.1rem;
}

.post-content h6 {
    font-size: 1rem;
    color: #6b7280;
}

.post-content ul,
.post-content ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.post-content li {
    margin-bottom: 0.5rem;
    position: relative;
}

.post-content ul li:before {
    content: "•";
    color: #3b82f6;
    font-weight: bold;
    position: absolute;
    left: -1rem;
}

.post-content ol {
    counter-reset: li-counter;
}

.post-content ol li {
    counter-increment: li-counter;
}

.post-content ol li:before {
    content: counter(li-counter) ".";
    color: #3b82f6;
    font-weight: bold;
    position: absolute;
    left: -1rem;
}

.post-content blockquote {
    border-left: 4px solid #3b82f6;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    padding: 1.5rem 2rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #4a5568;
    border-radius: 0 8px 8px 0;
    position: relative;
}

.post-content blockquote:before {
    content: "❝";
    font-size: 3rem;
    color: #3b82f6;
    opacity: 0.3;
    position: absolute;
    top: -1rem;
    left: 0.5rem;
}

.post-content code {
    background-color: #f1f5f9;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 0.9em;
    border: 1px solid #e2e8f0;
}

.post-content pre {
    background: linear-gradient(135deg, #1a202c, #2d3748);
    color: #e2e8f0;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid #4a5568;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.post-content pre code {
    background: none;
    padding: 0;
    color: inherit;
    border: none;
    font-size: 0.95em;
}

.post-content a {
    color: #3b82f6;
    text-decoration: none;
    border-bottom: 1px dotted #3b82f6;
    transition: all 0.3s ease;
}

.post-content a:hover {
    color: #1d4ed8;
    border-bottom-style: solid;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin: 1rem 0;
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.post-content th,
.post-content td {
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    text-align: left;
}

.post-content th {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: white;
    font-weight: 600;
}

.post-content tr:nth-child(even) {
    background-color: #f8fafc;
}

.post-content hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, #3b82f6, transparent);
    margin: 2rem 0;
}

/* 侧边栏样式 */
.sidebar .card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.sidebar .card-header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
}

.sidebar .card-body {
    padding: 1.25rem;
}

.sidebar ul li {
    border-bottom: 1px solid #f1f5f9;
    padding: 0.5rem 0;
}

.sidebar ul li:last-child {
    border-bottom: none;
}

.sidebar ul li a {
    color: #4a5568;
    text-decoration: none;
    transition: color 0.3s ease;
    font-size: 0.9rem;
}

.sidebar ul li a:hover {
    color: #3b82f6;
}

/* 页脚样式 */
footer {
    margin-top: 4rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .post-title {
        font-size: 1.5rem;
    }
    
    .blog-post {
        padding: 1.5rem;
        margin: 0 -15px;
        border-radius: 0;
    }
    
    .article-card {
        margin-bottom: 1rem;
    }
    
    .sidebar {
        margin-top: 2rem;
    }
}

@media (max-width: 576px) {
    .post-title {
        font-size: 1.3rem;
    }
    
    .blog-post {
        padding: 1rem;
    }
    
    .post-content {
        font-size: 1rem;
    }
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 工具类 */
.text-gradient {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-custom {
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.border-gradient {
    border: 2px solid transparent;
    background: linear-gradient(white, white) padding-box,
                linear-gradient(135deg, #3b82f6, #8b5cf6) border-box;
}

/* 按钮样式增强 */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.4);
}

.btn-outline-primary {
    border: 2px solid #3b82f6;
    color: #3b82f6;
}

.btn-outline-primary:hover {
    background: #3b82f6;
    transform: translateY(-2px);
}

/* 卡片样式增强 */
.card {
    border: none;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

/* 表格样式 */
.table {
    border-radius: 8px;
    overflow: hidden;
}

.table th {
    background-color: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    color: #4a5568;
}

.table-hover tbody tr:hover {
    background-color: #f7fafc;
}

/* 徽章样式 */
.badge {
    font-weight: 500;
    border-radius: 6px;
}

/* 表单样式 */
.form-control, .form-select {
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
}

/* 警报样式 */
.alert {
    border: none;
    border-radius: 8px;
    border-left: 4px solid;
}

.alert-success {
    border-left-color: #10b981;
    background-color: #ecfdf5;
    color: #065f46;
}

.alert-danger {
    border-left-color: #ef4444;
    background-color: #fef2f2;
    color: #991b1b;
}

.alert-info {
    border-left-color: #3b82f6;
    background-color: #eff6ff;
    color: #1e40af;
}

.alert-warning {
    border-left-color: #f59e0b;
    background-color: #fffbeb;
    color: #92400e;
}