/* ===== 博客风格样式 ===== */

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f0f2f5;
    --text-primary: #1a1a1a;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --sidebar-width: 260px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ===== 博客布局 ===== */

.blog-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.blog-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 20px;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.blog-header-content {
    max-width: 800px;
    margin: 0 auto;
}

.blog-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.blog-subtitle {
    font-size: 15px;
    opacity: 0.95;
    font-weight: 400;
}

/* ===== 带侧边栏的布局 ===== */

.blog-layout {
    display: flex;
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 24px 20px;
    gap: 24px;
}

/* ===== 侧边栏 ===== */

.blog-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    position: sticky;
    top: 24px;
    align-self: flex-start;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.blog-sidebar::-webkit-scrollbar {
    width: 4px;
}

.blog-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.sidebar-section {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.sidebar-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* ===== 搜索框 ===== */

.search-box {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 8px 12px 8px 34px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.search-input:focus {
    border-color: var(--accent-blue);
    background: white;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-result-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    min-height: 18px;
}

/* ===== 日期导航 ===== */

.date-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 300px;
    overflow-y: auto;
}

.date-nav::-webkit-scrollbar {
    width: 3px;
}

.date-nav::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.date-nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.date-nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.date-nav-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
    font-weight: 600;
}

.date-nav-item .date-nav-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.date-nav-item .date-nav-count {
    font-size: 11px;
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 8px;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: 8px;
}

.date-nav-item.active .date-nav-count {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
}

.date-nav-item.today-item .date-nav-label {
    font-weight: 600;
}

/* ===== 分类导航 ===== */

.category-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.category-nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 13px;
    color: var(--text-secondary);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.category-nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.category-nav-item.active {
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-purple);
    font-weight: 600;
}

.category-nav-item .cat-count {
    font-size: 11px;
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 8px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.category-nav-item.active .cat-count {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-purple);
}

/* ===== 主内容区 ===== */

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

.blog-container {
    max-width: 800px;
}

.blog-date-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 20px;
    padding-bottom: 12px;
}

.post-count {
    font-size: 14px;
    color: var(--text-muted);
    background: white;
    padding: 6px 14px;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

/* ===== 搜索高亮 ===== */

mark {
    background: rgba(245, 158, 11, 0.3);
    color: inherit;
    padding: 1px 2px;
    border-radius: 2px;
}

/* ===== 内容图片 ===== */

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

.post-image {
    object-fit: cover;
}

/* ===== 文章卡片 ===== */

.blog-posts {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.blog-post {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    cursor: pointer;
    animation: fadeIn 0.3s ease-out;
}

.blog-post:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.post-header {
    display: flex;
    align-items: start;
    gap: 16px;
    margin-bottom: 12px;
}

.post-image {
    width: 100px;
    height: 75px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-tertiary);
}

.post-content {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.post-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.post-tag {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.tag-category {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
}

.tag-source {
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-purple);
}

.tag-date {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-orange);
}

.post-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.post-links {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.link-badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.link-badge.quark {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
}

.link-badge.baidu {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
}

.link-badge.image {
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-purple);
}

.view-details {
    font-size: 12px;
    color: var(--accent-blue);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* ===== 日期分组 ===== */

.date-group {
    margin-bottom: 28px;
    scroll-margin-top: 20px;
}

.date-group-today .date-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.date-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    margin-bottom: 12px;
}

.date-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.date-group-today .date-label {
    color: white;
}

.date-count {
    font-size: 12px;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.05);
    padding: 3px 8px;
    border-radius: 10px;
}

.date-group-today .date-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.date-posts {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ===== 更新提示 ===== */

.update-badge {
    display: inline-block;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    font-size: 13px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 14px;
    margin-right: 10px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.total-count {
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== 文章详情弹窗 ===== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 16px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
    border-radius: 16px 16px 0 0;
}

.modal-title {
    font-size: 17px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    color: var(--text-muted);
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-post-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 14px;
    line-height: 1.4;
}

.modal-section {
    margin-bottom: 20px;
}

.modal-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.modal-section-content {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.modal-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
    border: 1px solid var(--border-color);
}

.modal-link:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-blue);
    transform: translateX(4px);
}

.modal-link-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.modal-link-icon.quark {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.modal-link-icon.baidu {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
}

.modal-link-text {
    flex: 1;
    min-width: 0;
}

.modal-link-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
}

.modal-link-url {
    font-size: 11px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== 顶部QQ群横幅 ===== */

.top-contact-bar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-md);
}

.contact-qq-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 9px;
    text-decoration: none;
    color: white;
    transition: background 0.2s;
}

.contact-qq-link:hover {
    background: rgba(255, 255, 255, 0.2);
}

.contact-qq-link svg:first-child {
    flex-shrink: 0;
    opacity: 0.95;
}

.contact-qq-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.contact-qq-label {
    font-size: 13px;
    opacity: 0.9;
}

.contact-qq-name {
    font-size: 16px;
    font-weight: 600;
}

.contact-qq-btn {
    flex-shrink: 0;
    background: white;
    color: #667eea;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 20px;
    transition: transform 0.15s;
}

.contact-qq-link:hover .contact-qq-btn {
    transform: scale(1.05);
}

/* ===== 顶部广告横幅 ===== */

.top-ad-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    margin-bottom: 20px;
}

.ad-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-orange);
    background: rgba(245, 158, 11, 0.12);
    padding: 3px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}

.ad-text {
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== 页脚 ===== */

.blog-footer {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 16px;
}

.footer-disclaimer {
    margin-top: 12px;
    font-size: 13px;
    color: var(--accent-orange);
    font-weight: 500;
    opacity: 0.9;
}

.footer-copy {
    font-size: 12px;
    margin-top: 8px;
    opacity: 0.6;
}

/* ===== 空状态 ===== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    opacity: 0.3;
}

.empty-state-text {
    font-size: 15px;
}

/* ===== 移动端侧边栏切换按钮 ===== */

.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    z-index: 900;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.sidebar-toggle:active {
    transform: scale(0.92);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 800;
}

.sidebar-overlay.active {
    display: block;
}

/* ===== 动画 ===== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== 响应式 ===== */

@media (max-width: 900px) {
    .blog-layout {
        flex-direction: column;
        padding: 16px 12px;
        gap: 0;
    }

    .blog-sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        width: 280px;
        height: 100vh;
        max-height: 100vh;
        background: var(--bg-secondary);
        z-index: 850;
        padding: 20px 16px;
        transition: left 0.3s ease;
        overflow-y: auto;
        border-radius: 0;
        box-shadow: var(--shadow-lg);
    }

    .blog-sidebar.open {
        left: 0;
    }

    .sidebar-toggle {
        display: flex;
    }

    .blog-header {
        padding: 28px 16px;
    }

    .blog-title {
        font-size: 22px;
    }

    .blog-subtitle {
        font-size: 13px;
    }

    .blog-main {
        padding: 0;
    }

    .blog-container {
        max-width: 100%;
    }

    .blog-date-header {
        margin-bottom: 16px;
    }

    .blog-post {
        padding: 16px;
    }

    .post-header {
        flex-direction: column;
        gap: 10px;
    }

    .post-image {
        width: 100%;
        height: 140px;
    }

    .post-title {
        font-size: 15px;
    }

    .post-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .modal {
        border-radius: 12px;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-post-title {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .blog-header {
        padding: 24px 12px;
    }

    .blog-title {
        font-size: 20px;
    }

    .blog-post {
        padding: 14px;
        border-radius: 10px;
    }

    .date-header {
        padding: 8px 12px;
    }

    .date-label {
        font-size: 13px;
    }
}
