/**
 * TBlog 响应式样式
 */

/* CSS 变量 */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --text-color: #334155;
    --text-light: #64748b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --max-width: 1200px;
    --header-height: 64px;
}

/* 重置样式 */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    min-height: 100vh;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
}

img {
    max-width: 100%;
    height: auto;
}

/* 布局容器 */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
}

.main-wrapper {
    display: flex;
    gap: 2rem;
    padding: 2rem 0;
}

.main-content {
    flex: 1;
    min-width: 0;
}

.sidebar {
    width: 300px;
    flex-shrink: 0;
}

/* 头部导航 */
.header {
    background: var(--card-bg);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo:hover {
    color: var(--primary-hover);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.nav-menu a {
    color: var(--text-color);
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--primary-color);
}

.nav-menu a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

/* 移动端菜单按钮 */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
}

/* 搜索框 */
.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-box button {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.25rem;
}

/* 卡片样式 */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-color);
}

.card-body {
    padding: 1.25rem;
}

/* 文章列表 */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.post-item {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.post-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.post-item-header {
    position: relative;
}

.post-cover {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.post-category {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.post-top-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #ef4444;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.post-item-body {
    padding: 1.5rem;
}

.post-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.post-title a {
    color: var(--text-color);
}

.post-title a:hover {
    color: var(--primary-color);
}

.post-summary {
    color: var(--text-light);
    font-size: 0.9375rem;
    line-height: 1.7;
    margin-bottom: 1rem;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-light);
    font-size: 0.875rem;
}

.post-meta span {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* 文章详情页 */
.post-detail {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.post-detail-header {
    padding: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.post-detail-title {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.post-detail-meta {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: var(--text-light);
    font-size: 0.9375rem;
}

.post-detail-cover {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
}

.post-detail-content {
    padding: 2rem;
    font-size: 1.0625rem;
    line-height: 1.9;
}

.post-detail-content h2,
.post-detail-content h3,
.post-detail-content h4 {
    margin: 2rem 0 1rem;
    font-weight: 600;
}

.post-detail-content p {
    margin-bottom: 1.25rem;
}

.post-detail-content ul,
.post-detail-content ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

.post-detail-content li {
    margin-bottom: 0.5rem;
}

.post-detail-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--text-light);
    font-style: italic;
}

.post-detail-content code {
    background: #f1f5f9;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

.post-detail-content pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: 1.25rem;
}

.post-detail-content pre code {
    background: none;
    padding: 0;
}

.post-detail-content img {
    border-radius: var(--radius);
    margin: 1.5rem 0;
}

/* 侧边栏 */
.widget {
    margin-bottom: 1.5rem;
}

.widget-list {
    list-style: none;
}

.widget-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.widget-list li:last-child {
    border-bottom: none;
}

.widget-list a {
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.widget-list a:hover {
    color: var(--primary-color);
}

.widget-list .count {
    color: var(--text-light);
    font-size: 0.875rem;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.75rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-color);
    font-size: 0.9375rem;
    transition: all 0.2s;
}

.page-link:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.page-link.current {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.page-ellipsis {
    color: var(--text-light);
    padding: 0 0.5rem;
}

/* 页脚 */
.footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: auto;
}

.footer-inner {
    text-align: center;
    color: var(--text-light);
    font-size: 0.9375rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.footer-links a {
    color: var(--text-light);
}

.footer-links a:hover {
    color: var(--primary-color);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

/* 面包屑导航 */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.9375rem;
    color: var(--text-light);
}

.breadcrumb a {
    color: var(--text-color);
}

.breadcrumb a:hover {
    color: var(--primary-color);
}

.breadcrumb-separator {
    opacity: 0.5;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-wrapper {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 56px;
    }
    
    html {
        font-size: 15px;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .nav-menu {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--card-bg);
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--shadow);
        gap: 0;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-menu li {
        width: 100%;
    }
    
    .nav-menu a {
        display: block;
        padding: 0.875rem 1rem;
        border-radius: var(--radius);
    }
    
    .nav-menu a:hover,
    .nav-menu a.active {
        background: var(--bg-color);
    }
    
    .nav-menu a.active::after {
        display: none;
    }
    
    .main-wrapper {
        padding: 1rem 0;
        gap: 1.5rem;
    }
    
    .post-detail-header {
        padding: 1.5rem;
    }
    
    .post-detail-title {
        font-size: 1.5rem;
    }
    
    .post-detail-content {
        padding: 1.5rem;
        font-size: 1rem;
    }
    
    .post-cover {
        height: 160px;
    }
    
    .post-item-body {
        padding: 1.25rem;
    }
    
    .post-title {
        font-size: 1.125rem;
    }
    
    .post-meta {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .pagination {
        gap: 0.25rem;
    }
    
    .page-link {
        min-width: 2.25rem;
        height: 2.25rem;
        padding: 0 0.5rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }
    
    .post-detail-title {
        font-size: 1.375rem;
    }
    
    .post-detail-content {
        padding: 1.25rem;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 0.75rem;
    }
}
