/* ============================================
   CMS前台系统 - 公共样式
   ============================================ */

/* 默认配色变量（可在页面中动态覆盖） */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --gradient-start: #667eea;
    --gradient-end: #764ba2;
    --text-dark: #2d3748;
    --text-light: #718096;
    --bg-light: #f7fafc;
    --bg-gray: #edf2f7;
    --white: #ffffff;
    --border-color: #e2e8f0;
    --shadow: 0 2px 10px rgba(0,0,0,0.05);
    --shadow-hover: 0 8px 25px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--white);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--secondary-color);
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 顶部导航 */
.site-header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
    gap: 30px;
}

.logo-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    vertical-align: middle;
}

.site-name {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-color);
}

.main-nav {
    display: flex;
    gap: 30px;
}

.main-nav a {
    color: var(--text-dark);
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s;
}

.main-nav a:hover, .main-nav a.active {
    color: var(--primary-color);
    background: rgba(102, 126, 234, 0.1);
}

.header-search {
    display: flex;
    gap: 5px;
}

.header-search input {
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    outline: none;
    width: 200px;
}

.header-search button {
    padding: 8px 15px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
}

/* 面包屑 */
.breadcrumb {
    background: var(--bg-gray);
    padding: 12px 0;
    font-size: 14px;
    color: var(--text-light);
}

.breadcrumb a {
    color: var(--text-light);
}

.breadcrumb a:hover {
    color: var(--primary-color);
}

/* 主内容区 */
.main-content {
    padding: 40px 0;
    min-height: 500px;
}

.content-wrapper {
    display: flex;
    gap: 30px;
}

.main-area {
    flex: 1;
    min-width: 0;
}

.sidebar {
    width: 300px;
    flex-shrink: 0;
}

/* 文章列表 */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.post-item {
    display: flex;
    gap: 20px;
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.post-item:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
}

.post-thumb {
    width: 200px;
    height: 140px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-category {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
}

.post-category-hot {
    background: #f56565;
}

.post-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-content h2 {
    font-size: 18px;
    margin-bottom: 10px;
    line-height: 1.4;
}

.post-content h2 a {
    color: var(--text-dark);
}

.post-content h2 a:hover {
    color: var(--primary-color);
}

.post-content p {
    color: var(--text-light);
    font-size: 14px;
    flex: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.post-meta {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: var(--text-light);
    margin-top: 10px;
}

.post-meta a {
    background: var(--bg-gray);
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 5px;
    font-size: 12px;
}

/* 分页 */
.pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 40px;
}

.pagination a, .pagination span {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-dark);
    text-decoration: none;
    transition: all 0.3s;
}

.pagination a:hover, .pagination .current {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 侧边栏组件 */
.widget {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.widget-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
}

/* 登录入口 */
.login-widget {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.login-widget .widget-title {
    color: white;
    border-bottom-color: rgba(255,255,255,0.3);
}

.login-content {
    text-align: center;
}

.login-content p {
    margin-bottom: 15px;
    font-size: 14px;
}

.login-btn {
    display: inline-block;
    background: white;
    color: var(--primary-color);
    padding: 12px 30px;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    color: var(--primary-color);
}

/* 标签云 */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: var(--bg-gray);
    padding: 6px 14px;
    border-radius: 15px;
    font-size: 13px;
    color: var(--text-light);
    transition: all 0.3s;
}

.tag:hover {
    background: var(--primary-color);
    color: white;
}

/* 热门文章 */
.hot-posts {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.hot-post {
    display: flex;
    gap: 12px;
}

.hot-post .rank {
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.hot-post:nth-child(1) .rank { background: #f56565; }
.hot-post:nth-child(2) .rank { background: #ed8936; }
.hot-post:nth-child(3) .rank { background: #48bb78; }

.hot-info h4 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 3px;
}

.hot-info h4 a {
    color: var(--text-dark);
}

.hot-info span {
    font-size: 12px;
    color: var(--text-light);
}

/* 友情链接 */
.friend-links {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.friend-link-item {
    display: flex;
    gap: 12px;
}

.friend-link-item .rank {
    width: 24px;
    height: 24px;
    background: var(--bg-gray);
    color: var(--text-light);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.friend-link-info h4 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 3px;
}

.friend-link-info h4 a {
    color: var(--text-dark);
}

.friend-link-info span {
    font-size: 12px;
    color: var(--text-light);
}

/* 联系我们 */
.contact-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-light);
}

.contact-item::before {
    content: "📧";
}

.contact-btn {
    display: block;
    text-align: center;
    background: var(--primary-color);
    color: white;
    padding: 10px;
    border-radius: 6px;
    font-weight: 500;
}

.contact-btn:hover {
    background: var(--secondary-color);
    color: white;
}

/* 文章统计 */
.article-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 12px 20px;
    background: var(--bg-gray);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-light);
}

/* 文章筛选 */
.article-filters {
    background: var(--white);
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-label {
    font-weight: 500;
    color: var(--text-dark);
    white-space: nowrap;
}

.filter-btn {
    padding: 6px 14px;
    background: var(--bg-gray);
    color: var(--text-light);
    border-radius: 15px;
    font-size: 13px;
    transition: all 0.3s;
}

.filter-btn:hover, .filter-btn.active {
    background: var(--primary-color);
    color: white;
}

/* 页脚 */
.site-footer {
    background: var(--text-dark);
    color: rgba(255,255,255,0.8);
    padding: 60px 0 30px;
}

.footer-inner {
    display: flex;
    gap: 60px;
    margin-bottom: 40px;
}

.footer-col {
    flex: 1;
}

.footer-col h4 {
    color: white;
    font-size: 18px;
    margin-bottom: 20px;
}

.footer-col p {
    font-size: 14px;
    line-height: 1.8;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 10px;
    font-size: 14px;
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 14px;
}

.footer-bottom a {
    color: rgba(255,255,255,0.6);
}

.footer-bottom a:hover {
    color: white;
}

/* 返回顶部 */
.back-to-top {
    position: fixed;
    right: 30px;
    bottom: 30px;
    width: 45px;
    height: 45px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    font-size: 18px;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--secondary-color);
    transform: translateY(-3px);
}

/* 响应式 */
@media (max-width: 991px) {
    .content-wrapper {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
    }
    
    .post-item {
        flex-direction: column;
    }
    
    .post-thumb {
        width: 100%;
        height: 200px;
    }
}

@media (max-width: 768px) {
    .header-layout {
        flex-wrap: wrap;
    }
    
    .main-nav {
        order: 3;
        width: 100%;
        justify-content: center;
        gap: 15px;
    }
    
    .header-search {
        order: 2;
    }
    
    .footer-inner {
        flex-direction: column;
        gap: 30px;
    }
}
