/**
 * 社区论坛主题 v1.0 by mimo
 */

:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --primary-light: #e8f0fe;
    --bg: #f5f5f5;
    --card-bg: #fff;
    --text: #333;
    --text-secondary: #666;
    --text-muted: #999;
    --border: #eee;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --radius: 8px;
    --danger: #e74c3c;
    --success: #27ae60;
    --warning: #f39c12;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
}

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

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

img {
    max-width: 100%;
}

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

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    height: 56px;
}

.logo-wrap {
    margin-right: 24px;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.logo img {
    height: 30px;
}

.nav {
    display: flex;
    align-items: center;
    flex: 1;
}

.nav a {
    padding: 16px 14px;
    font-size: 15px;
    color: var(--text-secondary);
    white-space: nowrap;
}

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

.nav-toggle {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text);
    margin-right: 12px;
}

.nav-toggle svg {
    width: 24px;
    height: 24px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.search-box {
    position: relative;
}

.search-box input {
    width: 200px;
    padding: 8px 12px 8px 34px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
}

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

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

.search-box::before {
    content: "";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23999'%3E%3Cpath d='M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E") no-repeat center;
}

.btn-post {
    padding: 8px 20px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-post:hover {
    background: var(--primary-dark);
    color: #fff;
}

.btn-login {
    padding: 8px 16px;
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-login:hover {
    background: var(--primary);
    color: #fff;
}

/* Main Layout */
.main {
    max-width: 1400px;
    margin: 16px auto;
    padding: 0 24px;
    display: flex;
    gap: 20px;
}

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

.sidebar {
    width: 320px;
    flex-shrink: 0;
}

/* Card */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

/* Category Tabs */
.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.category-tabs a {
    padding: 8px 16px;
    font-size: 14px;
    color: #666;
    border-radius: 6px;
    background: #f0f0f0;
    transition: all 0.2s;
}

.category-tabs a:hover {
    color: #333;
    background: #e0e0e0;
}

.category-tabs a.active {
    color: #fff;
    background: #666;
    font-weight: 500;
}

/* Post List */
.post-list {
    list-style: none;
}

.post-item {
    display: flex;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    gap: 16px;
}

.post-item:last-child {
    border-bottom: none;
}

.post-item:hover {
    background: #f8f9fa;
}

.post-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    background: var(--bg);
}

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

.post-title {
    font-size: 17px;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post-title a {
    color: var(--text);
}

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

.post-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    border-radius: 4px;
    margin-right: 8px;
    vertical-align: middle;
}

.post-badge.top {
    background: #fff0f0;
    color: var(--danger);
}

.post-badge.category {
    background: #f0f0f0;
    color: #666;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13px;
    color: var(--text-muted);
}

.post-meta a {
    color: var(--text-muted);
}

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

.post-stats {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.post-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.comment-count {
    color: #999;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    padding: 20px;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    background: #f5f5f5;
    color: #666;
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
}

.pagination span.current,
.pagination .current,
.pagination strong {
    background: #1a73e8 !important;
    border-color: #1a73e8 !important;
    color: #fff !important;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(26,115,232,0.3);
}

.pagination a:hover {
    background: #1a73e8;
    border-color: #1a73e8;
    color: #fff;
}

.pagination .dots {
    border: none;
    background: none;
}

/* emlog分页兼容 */
.em_pagination {
    display: flex;
    justify-content: center;
    padding: 20px;
    gap: 8px;
    flex-wrap: wrap;
}

.em_pagination a,
.em_pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    background: #f5f5f5;
    color: #666;
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
}

.em_pagination span.current,
.em_pagination .current,
.em_pagination strong {
    background: #1a73e8 !important;
    border-color: #1a73e8 !important;
    color: #fff !important;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(26,115,232,0.3);
}

.em_pagination a:hover {
    background: #1a73e8;
    border-color: #1a73e8;
    color: #fff;
}

/* Article Page */
.article {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.article-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

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

.article-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    font-size: 13px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.article-meta a {
    color: var(--text-muted);
}

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

.article-body {
    padding: 24px;
    font-size: 16px;
    line-height: 1.8;
    word-break: break-word;
    overflow-wrap: break-word;
}

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

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4 {
    margin: 24px 0 12px;
    font-weight: 600;
}

.article-body h1 { font-size: 22px; }
.article-body h2 { font-size: 19px; }
.article-body h3 { font-size: 17px; }
.article-body h4 { font-size: 15px; }

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

.article-body blockquote {
    border-left: 3px solid var(--primary);
    padding: 12px 16px;
    margin: 16px 0;
    background: #f8f8f8;
    color: var(--text-secondary);
}

.article-body pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 16px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 16px 0;
    font-size: 14px;
}

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

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

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    justify-content: flex-start;
    align-items: center;
}

.article-tags .tag-icon {
    color: #999;
    font-size: 14px;
}

.article-tags .tag-item {
    padding: 5px 12px !important;
    background: #f0f0f0 !important;
    color: #666 !important;
    border-radius: 4px !important;
    font-size: 13px !important;
    border: none !important;
    text-decoration: none !important;
    display: inline-block !important;
}

.article-tags .tag-item:hover {
    background: #e0e0e0 !important;
    color: #333 !important;
}

/* Neighbor Posts */
.neighbor-posts {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.neighbor-posts a {
    flex: 1;
    padding: 14px 16px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

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

/* Comments */
.comments-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.comments-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 16px;
    font-weight: 600;
}

.comment-list {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment-item {
    display: flex;
    gap: 12px;
    padding: 14px;
    background: #fafafa;
    border-radius: 8px;
    overflow: hidden;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    background: var(--bg);
}

.comment-body {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    word-break: break-word;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.comment-name {
    font-weight: 600;
    font-size: 14px;
}

.comment-badge {
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
}

.comment-badge.admin {
    background: #e3f2fd;
    color: #1565c0;
}

.comment-badge.editor {
    background: #fff8e1;
    color: #f57c00;
}

.comment-badge.author {
    background: #e8f5e9;
    color: #2e7d32;
}

.comment-badge.user {
    background: #f3e5f5;
    color: #7b1fa2;
}

.comment-badge.guest {
    background: #f0f0f0;
    color: var(--text-muted);
}

.comment-badge.level {
    background: #fff3e0;
    color: #e65100;
}

.comment-floor {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
}

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

.comment-content {
    font-size: 14px;
    line-height: 1.7;
    word-break: break-all;
    overflow-wrap: break-word;
    overflow: hidden;
}

.comment-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.comment-actions button {
    background: none;
    border: none;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.comment-actions button:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.comment-children {
    margin-left: 20px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #e0e0e0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
}

.comment-pagination {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

/* Comment Form */
.comment-form {
    padding: 20px;
    border-top: 1px solid var(--border);
}

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

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

.comment-form-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.comment-form-row input {
    flex: 1;
    min-width: 160px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
}

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

.comment-form-submit {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.comment-form-submit button {
    padding: 10px 24px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

.comment-form-submit button:hover {
    background: var(--primary-dark);
}

/* Sidebar Widgets */
.widget {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.widget-title {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
    font-weight: 600;
}

.widget-body {
    padding: 12px 16px;
}

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

.widget-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

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

.widget-list a {
    color: var(--text-secondary);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

/* User Widget */
.user-widget {
    text-align: center;
    padding: 20px 16px;
}

.user-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin-bottom: 10px;
    object-fit: cover;
    background: var(--bg);
}

.user-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
}

.user-stats {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.user-credits {
    font-size: 13px;
    color: var(--warning);
    font-weight: 500;
    margin-bottom: 12px;
}

.user-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.user-actions a {
    padding: 6px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.user-actions a:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.user-actions a.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.user-actions a.btn-primary:hover {
    background: var(--primary-dark);
}

/* Tags Widget */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tags-cloud a {
    padding: 4px 10px;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.tags-cloud a:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* Stats Widget */
.stats-widget {
    display: flex;
    justify-content: space-around;
    padding: 16px;
}

.stats-item {
    text-align: center;
}

.stats-number {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.stats-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Footer */
.footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding: 24px;
    margin-top: 24px;
}

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

.footer-stats {
    margin-bottom: 12px;
    font-size: 14px;
}

.footer-stats strong {
    font-size: 16px;
}

.footer-links {
    margin-bottom: 10px;
}

.footer-links a {
    color: var(--text-muted);
    margin: 0 10px;
}

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

/* Back to Top */
.back-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 42px;
    height: 42px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    z-index: 50;
    color: var(--text-muted);
}

.back-top:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Footer Link Widget for Mobile */
.footer-links-widget {
    display: none;
}

/* Mobile Search Widget */
.mobile-search-widget,
.mobile-search {
    display: none;
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        display: none;
    }
    
    .footer-links-widget {
        display: block;
    }
}

@media (max-width: 768px) {
    .header-inner {
        padding: 0 12px;
        justify-content: center;
    }
    
    .logo-wrap {
        margin-right: 0;
    }
    
    .logo {
        font-size: 18px;
        text-align: center;
    }
    
    .nav {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: var(--card-bg);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        max-height: 60vh;
        overflow-y: auto;
        z-index: 99;
    }

    .nav.active {
        display: flex;
    }

    .nav a {
        padding: 12px 16px;
        border-bottom: 1px solid var(--border);
        font-size: 14px;
    }
    
    .nav .mobile-search {
        display: block;
        padding: 12px 16px;
        border-bottom: 1px solid var(--border);
    }
    
    .nav .mobile-search input {
        width: 100%;
        padding: 10px 12px;
        border: 1px solid #eee;
        border-radius: 6px;
        font-size: 14px;
        background: #f5f5f5;
    }

    .nav-toggle {
        display: block;
        position: absolute;
        left: 12px;
    }

    .search-box {
        display: none;
    }
    
    .mobile-search-widget {
        display: none;
    }

    .header-right {
        position: absolute;
        right: 12px;
    }

    .btn-login {
        display: none;
    }

    .main {
        padding: 0 10px;
        margin: 10px auto;
    }

    .post-item {
        padding: 12px 14px;
        gap: 10px;
    }

    .post-avatar {
        width: 40px;
        height: 40px;
    }
    
    .post-title {
        font-size: 14px;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    
    .post-meta {
        font-size: 11px;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .post-stats {
        display: none;
    }
    
    .category-tabs {
        padding: 10px 12px;
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    
    .category-tabs a {
        padding: 4px 10px;
        font-size: 12px;
        flex-shrink: 0;
    }
    
    .article-header {
        padding: 18px 16px;
    }
    
    .article-title {
        font-size: 19px;
    }
    
    .article-meta {
        font-size: 12px;
        gap: 10px;
    }
    
    .article-body {
        padding: 16px;
        font-size: 15px;
    }
    
    .article-actions {
        gap: 12px;
        padding: 12px 16px;
        flex-wrap: wrap;
    }
    
    .action-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .article-tags {
        padding: 12px 16px;
    }

    .neighbor-posts {
        flex-direction: column;
    }

    .comment-list {
        padding: 8px;
    }
    
    .comment-item {
        gap: 10px;
        padding: 12px;
    }
    
    .comment-avatar {
        width: 36px;
        height: 36px;
    }
    
    .comment-children {
        margin-left: 10px;
        padding-left: 10px;
    }
    
    .comment-body {
        overflow: hidden;
    }
    
    .comment-content {
        font-size: 13px;
    }
    
    .comment-form {
        padding: 16px;
    }

    .comment-form-row {
        flex-direction: column;
    }

    .comment-form-row input {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .post-avatar {
        width: 36px;
        height: 36px;
    }
    
    .post-title {
        font-size: 13px;
    }
    
    .article-title {
        font-size: 17px;
    }
    
    .comment-floor {
        display: none;
    }
    
    .comment-children {
        margin-left: 8px;
        padding-left: 8px;
    }
    
    .comment-content {
        font-size: 12px;
        word-break: break-all;
    }
}
