/* 全局样式 - 微信公众号风格 */
:root {
    --primary-color: #07c160;
    --primary-hover: #06ad56;
    --text-color: #333;
    --text-secondary: #666;
    --text-light: #999;
    --bg-color: #f5f5f5;
    --bg-white: #ffffff;
    --border-color: #e5e5e5;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

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

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

/* 头部导航 */
.header {
    background: var(--bg-white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    max-width: 800px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
}

.nav-menu {
    display: flex;
    gap: 16px;
    align-items: center;
}

.nav-menu a {
    color: var(--text-color);
    font-size: 14px;
}

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

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

/* 主内容区 */
.main-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 16px;
}

/* 文章卡片 - 微信公众号图文混排风格 */
.article-list {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.article-card {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.article-card:last-child {
    border-bottom: none;
}

.article-card:hover {
    background: #fafafa;
}

.article-card-link {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.article-info {
    flex: 1;
    min-width: 0;
}

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

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

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

.article-meta span:last-child {
    margin-right: 0;
}

.article-thumb {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    object-fit: cover;
    background: #eee;
    flex-shrink: 0;
}

.article-thumb-placeholder {
    background: linear-gradient(135deg, #f5f5f5 0%, #e5e5e5 100%);
}

/* 分类导航 - 横向滑动标签栏 */
.category-nav {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.category-nav::-webkit-scrollbar {
    display: none;
}

.category-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background: #f5f5f5;
    color: #666;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    margin-right: 8px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.category-tag:last-child {
    margin-right: 0;
}

.category-tag:hover {
    background: #e8f5e9;
    color: #07c160;
    transform: translateY(-1px);
}

.category-tag.active {
    background: linear-gradient(135deg, #07c160 0%, #06ad56 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(7, 193, 96, 0.3);
    border-color: #07c160;
    font-weight: 600;
}

.category-tag.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* 移动端分类导航优化 */
@media (max-width: 768px) {
    .category-nav {
        padding: 10px 12px;
        border-radius: 10px;
        margin-bottom: 12px;
    }
    
    .category-tag {
        padding: 7px 14px;
        font-size: 12px;
        margin-right: 6px;
        border-radius: 18px;
    }
}

/* 文章详情页 */
.article-detail {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

.article-detail .article-title {
    font-size: 24px;
    margin-bottom: 16px;
}

.article-detail .article-meta {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.article-body {
    font-size: 16px;
    line-height: 1.8;
}

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

.article-body img {
    max-width: 100%;
    width: auto;
    height: auto;
    border-radius: var(--radius);
    margin: 16px 0;
    display: block;
    object-fit: contain;
    object-position: center;
    background: #f5f5f5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* 富文本文章正文样式 */
.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4,
.article-body h5,
.article-body h6 {
    margin: 24px 0 16px;
    font-weight: 600;
    line-height: 1.4;
}

.article-body h1 { font-size: 28px; }
.article-body h2 { font-size: 24px; }
.article-body h3 { font-size: 20px; }
.article-body h4 { font-size: 18px; }

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

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

.article-body blockquote {
    margin: 16px 0;
    padding: 12px 16px;
    background: #f5f5f5;
    border-left: 4px solid #07c160;
    color: #666;
}

.article-body pre {
    background: #f5f5f5;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 14px;
}

.article-body code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
}

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

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

.article-body table th,
.article-body table td {
    padding: 10px;
    border: 1px solid #e5e5e5;
    text-align: left;
}

.article-body table th {
    background: #f5f5f5;
    font-weight: 600;
}

.article-body a {
    color: #07c160;
    text-decoration: underline;
}

.article-body hr {
    border: none;
    border-top: 1px solid #e5e5e5;
    margin: 24px 0;
}

.article-body video {
    max-width: 100%;
    border-radius: var(--radius);
    margin: 16px 0;
}

.article-body iframe {
    max-width: 100%;
    border: none;
    margin: 16px 0;
}

/* 评论区 */
.comments-section {
    margin-top: 32px;
}

.comments-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.comment-form {
    margin-bottom: 24px;
}

.comment-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    resize: vertical;
    min-height: 80px;
    font-size: 14px;
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

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

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.comment-author {
    font-weight: 500;
}

.comment-time {
    color: var(--text-light);
    font-size: 12px;
}

.comment-content {
    color: var(--text-secondary);
    font-size: 14px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
}

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

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

.form-group.checkbox {
    display: flex;
    align-items: center;
}

.form-group.checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-color);
}

.btn-danger {
    background: #ff4d4f;
    color: white;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* 登录/注册页面 */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #07c160 0%, #06ad56 100%);
}

.auth-container {
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    padding: 32px;
    width: 100%;
    max-width: 400px;
}

.auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-header h1 {
    font-size: 28px;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-links {
    margin-top: 16px;
    text-align: center;
    font-size: 14px;
}

.auth-links p {
    margin: 8px 0;
}

/* 提示信息 */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: #f0f9eb;
    color: #52c41a;
    border: 1px solid #b7eb8f;
}

.alert-error {
    background: #fff2f0;
    color: #ff4d4f;
    border: 1px solid #ffccc7;
}

/* 发帖页面 */
.post-form {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

.post-form .form-group textarea {
    min-height: 200px;
}

/* 用户中心 */
.profile-header {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.profile-info h2 {
    margin-bottom: 4px;
}

.profile-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* 管理后台 */
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

.admin-header {
    background: var(--bg-white);
    box-shadow: var(--shadow);
    padding: 16px 24px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-sidebar {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    margin-bottom: 16px;
}

.admin-sidebar ul {
    list-style: none;
}

.admin-sidebar li {
    margin-bottom: 8px;
}

.admin-sidebar a {
    display: block;
    padding: 10px 16px;
    color: var(--text-color);
    border-radius: var(--radius);
    transition: all 0.2s;
}

.admin-sidebar a:hover,
.admin-sidebar a.active {
    background: var(--primary-color);
    color: white;
}

.admin-content {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

/* 表格样式 */
.table {
    width: 100%;
    border-collapse: collapse;
}

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

.table th {
    background: var(--bg-color);
    font-weight: 600;
    font-size: 14px;
}

.table td {
    font-size: 14px;
}

.table tr:hover {
    background: #fafafa;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination a,
.pagination span {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-color);
}

.pagination a:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination .active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-inner {
        padding: 10px 12px;
    }
    
    .nav-menu {
        gap: 10px;
    }
    
    .main-container {
        padding: 12px;
    }
    
    .article-card {
        border-radius: 6px;
    }
    
    .article-detail {
        padding: 16px;
    }
    
    .auth-container {
        margin: 16px;
        padding: 24px;
    }
    
    .admin-container {
        padding: 12px;
    }
    
    .table {
        font-size: 12px;
    }
    
    .table th,
    .table td {
        padding: 8px;
    }
}

/* 页脚 */
.footer {
    background: var(--bg-white);
    padding: 24px;
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
    margin-top: 32px;
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 32px;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 搜索框 */
.search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-box input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 操作按钮组 */
.action-buttons {
    display: flex;
    gap: 8px;
}

/* 状态标签 */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.status-active {
    background: #f0f9eb;
    color: #52c41a;
}

.status-inactive {
    background: #fff2f0;
    color: #ff4d4f;
}

.status-pending {
    background: #fffbe6;
    color: #faad14;
}

/* 点赞和分享按钮样式 */
.interaction-btn {
    cursor: pointer;
    transition: transform 0.2s;
    user-select: none;
}

.interaction-btn:hover {
    transform: scale(1.1);
}

.interaction-btn.liked {
    color: #ff4d4f;
}

.like-count, .share-count {
    margin-left: 4px;
}

/* 分享弹窗 */
.share-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

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

.share-content {
    background: white;
    padding: 24px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.share-content h3 {
    margin-bottom: 16px;
    font-size: 18px;
}

.share-options {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
}

.share-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 12px;
    border-radius: 8px;
    transition: background 0.2s;
}

.share-option:hover {
    background: #f5f5f5;
}

.share-option span:first-child {
    font-size: 24px;
    margin-bottom: 6px;
}

.share-option span:last-child {
    font-size: 12px;
    color: #666;
}

.share-url {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.share-url input {
    flex: 1;
    padding: 8px;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    font-size: 12px;
}

.share-url button {
    padding: 8px 12px;
    background: #07c160;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.share-close {
    margin-top: 12px;
    padding: 8px 24px;
    background: #f5f5f5;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
}

/* 文章底部广告位样式 */
.article-ads {
    margin-top: 24px;
    padding: 0;
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.article-ads .ad-item {
    margin-bottom: 0;
    padding: 0;
    border-bottom: none;
}

.article-ads .ad-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.article-ads .ad-link {
    display: block;
    width: 100%;
    border-radius: 0;
    overflow: hidden;
    transition: opacity 0.2s;
    background: #f8f9fa;
}

.article-ads .ad-link:hover {
    opacity: 0.95;
    transform: none;
}

.article-ads .ad-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 0;
    object-fit: contain;
    object-position: center;
}

.article-ads .ad-text-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 0;
    transition: background 0.2s;
}

.article-ads .ad-text-link:hover {
    background: #e9ecef;
}

.article-ads .ad-label {
    display: inline-block;
    padding: 2px 6px;
    background: #e9ecef;
    color: #6c757d;
    border-radius: 4px;
    font-size: 11px;
    flex-shrink: 0;
}

.article-ads .ad-text {
    color: var(--text-color);
    font-size: 14px;
    text-decoration: none;
}

.article-ads .ad-text:hover {
    color: var(--primary-color);
}

/* 移动端图片和广告优化 */
@media (max-width: 768px) {
    .article-body img {
        margin: 12px 0;
        border-radius: 6px;
    }
    
    .article-ads {
        margin-top: 16px;
        border-radius: 8px;
    }
    
    .article-ads .ad-image {
        width: 100%;
        max-width: 100%;
    }
}

/* 小屏幕适配 */
@media (max-width: 480px) {
    .article-body img {
        margin: 10px 0;
        border-radius: 4px;
    }
    
    .article-ads {
        margin-top: 12px;
        border-radius: 6px;
    }
}

/* 顶部轮播广告样式 */
.top-banner-carousel {
    position: relative;
    background: #f8f9fa;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 16px;
}

.carousel-container {
    position: relative;
    width: 100%;
    min-height: 120px;
    max-height: 400px;
    overflow: hidden;
    background: #f8f9fa;
}

.carousel-slide {
    position: relative;
    width: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    display: none;
}

.carousel-slide.active {
    opacity: 1;
    display: block;
    z-index: 1;
}

.banner-image {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    display: block;
    background: #f8f9fa;
}

.banner-text-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 150px;
    background: linear-gradient(135deg, #07c160 0%, #06ad56 100%);
    color: white;
    text-decoration: none;
    padding: 20px;
}

.banner-text {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
}

/* 轮播指示器 */
.carousel-indicators {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.3s;
}

.indicator.active {
    background: #07c160;
    width: 24px;
    border-radius: 4px;
}

/* 轮播箭头 */
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    z-index: 10;
    transition: background 0.3s;
    opacity: 0;
}

.top-banner-carousel:hover .carousel-arrow {
    opacity: 1;
}

.carousel-arrow:hover {
    background: rgba(0, 0, 0, 0.6);
}

.carousel-prev {
    left: 12px;
}

.carousel-next {
    right: 12px;
}

/* 移动端轮播优化 */
@media (max-width: 768px) {
    .top-banner-carousel {
        margin-bottom: 12px;
        border-radius: 10px;
    }
    
    .banner-image {
        max-height: 300px;
    }
    
    .banner-text {
        font-size: 16px;
    }
    
    .carousel-arrow {
        width: 32px;
        height: 32px;
        font-size: 16px;
        opacity: 0.8; /* 移动端始终显示箭头 */
    }
    
    .carousel-prev {
        left: 8px;
    }
    
    .carousel-next {
        right: 8px;
    }
    
    .carousel-indicators {
        bottom: 8px;
    }
    
    .indicator {
        width: 6px;
        height: 6px;
    }
    
    .indicator.active {
        width: 18px;
    }
}

@media (max-width: 480px) {
    .top-banner-carousel {
        margin-bottom: 10px;
        border-radius: 8px;
    }
    
    .banner-image {
        max-height: 250px;
    }
    
    .banner-text {
        font-size: 14px;
        padding: 12px;
    }
    
    .carousel-container {
        min-height: 100px;
    }
}
