/* 王富贵个人博客 - 白色简约风格 */

:root {
    --primary-color: #333;
    --secondary-color: #666;
    --light-color: #999;
    --border-color: #eee;
    --bg-color: #fff;
    --bg-light: #f9f9f9;
    --accent-color: #007bff;
    --success-color: #28a745;
    --error-color: #dc3545;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--primary-color);
    background-color: var(--bg-color);
}

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

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

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 30px;
}

/* Header */
.header {
    border-bottom: 1px solid var(--border-color);
    padding: 20px 0;
    margin-bottom: 40px;
    position: sticky;
    top: 0;
    background: var(--bg-color);
    z-index: 100;
}

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

.logo {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-img {
    height: 36px;
    width: auto;
    border-radius: 6px;
}

.logo-text {
    display: inline-block;
}

@media (max-width: 768px) {
    .logo-img {
        height: 30px;
    }
    .logo-text {
        display: none;
    }
}

.nav {
    display: flex;
    gap: 30px;
}

.nav a {
    color: var(--secondary-color);
    font-size: 15px;
}

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

/* Main Content */
.main {
    min-height: calc(100vh - 200px);
    padding-bottom: 60px;
}

/* Article List */
.article-list {
    list-style: none;
}

.article-item {
    padding: 30px 0;
    border-bottom: 1px solid var(--border-color);
}

.article-item:first-child {
    padding-top: 0;
}

.article-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.4;
}

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

.article-meta {
    color: var(--light-color);
    font-size: 14px;
    margin-bottom: 12px;
}

.article-meta span {
    margin-right: 15px;
}

.article-summary {
    color: var(--secondary-color);
    font-size: 15px;
    line-height: 1.7;
}

.article-top {
    display: inline-block;
    background: var(--accent-color);
    color: #fff;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 3px;
    margin-right: 8px;
}

/* Article Detail */
.article-header {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.article-header h1 {
    font-size: 32px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 15px;
}

.article-content {
    font-size: 16px;
    line-height: 1.8;
    color: var(--primary-color);
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    margin: 30px 0 15px;
    font-weight: 600;
}

.article-content h2 {
    font-size: 24px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.article-content h3 {
    font-size: 20px;
}

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

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

.article-content pre {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 16px;
    overflow-x: auto;
    margin: 20px 0;
    font-size: 14px;
    line-height: 1.5;
}

.article-content code {
    background: var(--bg-light);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 14px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.article-content pre code {
    background: none;
    padding: 0;
}

.article-content blockquote {
    border-left: 4px solid var(--border-color);
    padding-left: 20px;
    margin: 20px 0;
    color: var(--secondary-color);
    font-style: italic;
}

.article-content ul,
.article-content ol {
    margin: 16px 0;
    padding-left: 24px;
}

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

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.article-content th,
.article-content td {
    border: 1px solid var(--border-color);
    padding: 12px;
    text-align: left;
}

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

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.pagination a:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.pagination .current {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.pagination .disabled {
    color: var(--light-color);
    cursor: not-allowed;
}

/* Messages / Guestbook */
.message-form {
    background: var(--bg-light);
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 40px;
}

.message-form h3 {
    font-size: 18px;
    margin-bottom: 20px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--secondary-color);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s;
}

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

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

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

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

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

.btn:hover {
    background: #444;
}

.btn:disabled {
    background: var(--light-color);
    cursor: not-allowed;
}

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

.message-item {
    padding: 25px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.message-author {
    font-weight: 600;
    font-size: 15px;
}

.message-time {
    color: var(--light-color);
    font-size: 13px;
}

.message-content {
    color: var(--secondary-color);
    line-height: 1.7;
}

.message-reply {
    margin-top: 15px;
    padding: 15px;
    background: var(--bg-light);
    border-radius: 6px;
    font-size: 14px;
}

.message-reply-label {
    color: var(--accent-color);
    font-weight: 600;
    margin-bottom: 8px;
}

/* Alert */
.alert {
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
}

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

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

/* Footer */
.footer {
    border-top: 1px solid var(--border-color);
    padding: 30px 0;
    text-align: center;
    color: var(--light-color);
    font-size: 14px;
}

/* Category Badge */
.category-badge {
    display: inline-block;
    background: var(--bg-light);
    color: var(--secondary-color);
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 20px;
    margin-right: 10px;
}

/* Page Title */
.page-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 10px;
}

.page-description {
    color: var(--secondary-color);
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--light-color);
}

.empty-state p {
    font-size: 16px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--light-color);
}

/* ========== 首页Hero区域 ========== */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 50px 40px;
    border-radius: 16px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 40px;
}

.hero-content h1 {
    font-size: 32px;
    margin-bottom: 8px;
}

.hero-content > p {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 15px;
}

.hero-desc {
    font-size: 14px !important;
    opacity: 0.8 !important;
    line-height: 1.7;
    max-width: 500px;
}

.hero-stats {
    display: flex;
    gap: 30px;
}

.stat-item {
    text-align: center;
    background: rgba(255,255,255,0.15);
    padding: 20px 25px;
    border-radius: 12px;
}

.stat-num {
    display: block;
    font-size: 28px;
    font-weight: 700;
}

.stat-label {
    font-size: 13px;
    opacity: 0.8;
}

/* ========== 分类入口卡片 ========== */
.category-cards {
    display: flex;
    gap: 15px;
    margin-bottom: 35px;
}

.category-card {
    flex: 1;
    background: var(--bg-light);
    padding: 25px 20px;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.category-card:hover {
    border-color: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.cat-icon {
    display: block;
    font-size: 32px;
    margin-bottom: 10px;
}

.cat-name {
    display: block;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.cat-count {
    font-size: 13px;
    color: var(--light-color);
}

/* ========== 首页双栏布局 ========== */
.home-layout {
    display: flex;
    gap: 40px;
}

.main-content {
    flex: 1;
    min-width: 0;
}

.section-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
}

/* ========== 文章卡片 ========== */
.article-cards {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.article-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    position: relative;
    transition: all 0.3s;
}

.article-card:hover {
    border-color: var(--accent-color);
    box-shadow: 0 5px 20px rgba(0,0,0,0.06);
}

.article-card .article-top {
    position: absolute;
    top: -1px;
    right: 20px;
    border-radius: 0 0 6px 6px;
}

.article-card .article-title {
    font-size: 18px;
    margin-bottom: 12px;
}

.article-card .article-summary {
    font-size: 14px;
    color: var(--secondary-color);
    margin-bottom: 15px;
    line-height: 1.7;
}

.article-card .article-meta {
    margin-bottom: 0;
}

/* ========== 侧边栏 ========== */
.sidebar {
    width: 280px;
    flex-shrink: 0;
    align-self: flex-start;
    position: sticky;
    top: 80px;
}

.sidebar-widget {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}

.widget-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.widget-header h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    color: var(--primary-color);
}

.widget-body {
    padding: 20px;
}

/* 关于博主 */
.about-me {
    text-align: center;
}

.about-me .avatar {
    font-size: 50px;
    margin-bottom: 10px;
}

.about-me .avatar-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 12px;
}

.about-me h4 .name-en {
    font-size: 12px;
    font-weight: normal;
    color: var(--light-color);
}

.about-me .identity {
    font-size: 12px;
    color: var(--accent-color);
    margin-bottom: 10px;
    font-weight: 500;
}

.about-me h4 {
    font-size: 18px;
    margin-bottom: 10px;
}

.about-me p {
    font-size: 13px;
    color: var(--secondary-color);
    line-height: 1.7;
    margin-bottom: 15px;
}

.blog-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
    padding: 15px 0;
    border-top: 1px dashed var(--border-color);
    border-bottom: 1px dashed var(--border-color);
}

.blog-stat {
    text-align: center;
    font-size: 12px;
    color: var(--light-color);
}

.blog-stat span {
    display: block;
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 2px;
}

.btn-small {
    display: inline-block;
    padding: 8px 20px;
    background: var(--accent-color);
    color: #fff !important;
    border-radius: 20px;
    font-size: 13px;
    transition: background 0.2s;
}

.btn-small:hover {
    background: #0056b3;
}

/* 热门文章列表 */
.hot-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.hot-list li {
    padding: 12px 0;
    border-bottom: 1px dashed var(--border-color);
    position: relative;
    padding-left: 30px;
}

.hot-list li:last-child {
    border-bottom: none;
}

.hot-rank {
    position: absolute;
    left: 0;
    top: 12px;
    width: 20px;
    height: 20px;
    background: var(--accent-color);
    color: #fff;
    font-size: 12px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hot-list li:nth-child(1) .hot-rank { background: #ff6b6b; }
.hot-list li:nth-child(2) .hot-rank { background: #ffa94d; }
.hot-list li:nth-child(3) .hot-rank { background: #ffd43b; color: #333; }

.hot-list a {
    font-size: 14px;
    line-height: 1.5;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hot-views {
    display: block;
    font-size: 12px;
    color: var(--light-color);
    margin-top: 3px;
}

/* 最新留言预览 */
.message-preview-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.message-preview-list li {
    padding: 12px 0;
    border-bottom: 1px dashed var(--border-color);
}

.message-preview-list li:last-child {
    border-bottom: none;
}

.message-preview-list strong {
    font-size: 14px;
    color: var(--primary-color);
}

.message-preview-list p {
    font-size: 13px;
    color: var(--secondary-color);
    margin: 5px 0 0;
    line-height: 1.5;
}

.view-all {
    display: block;
    text-align: center;
    padding-top: 10px;
    font-size: 13px;
    color: var(--accent-color);
}

.empty-tip {
    font-size: 14px;
    color: var(--light-color);
    text-align: center;
}

/* ========== 响应式 ========== */
@media (max-width: 960px) {
    .home-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 20px;
    }
    
    .nav {
        gap: 20px;
    }
    
    .hero {
        flex-direction: column;
        text-align: center;
        padding: 35px 25px;
    }
    
    .hero-content h1 {
        font-size: 26px;
    }
    
    .hero-stats {
        width: 100%;
        justify-content: center;
    }
    
    .stat-item {
        padding: 15px 20px;
    }
    
    .category-cards {
        flex-wrap: wrap;
    }
    
    .category-card {
        min-width: calc(50% - 10px);
    }
    
    .article-header h1 {
        font-size: 26px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .article-title {
        font-size: 20px;
    }
}

/* Footer Stats */
.footer-stats {
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--light-color);
}

.footer-stats span {
    margin: 0 15px;
}

.footer-stats strong {
    color: var(--primary-color);
}

/* 留言地理位置 */
.message-location {
    color: #888;
    font-size: 12px;
    margin-left: 10px;
}

/* 修复留言头部布局 */
.message-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.message-header .message-time {
    margin-left: auto;
}
