/* CSS Variables */
:root {
    --primary-color: #1877f2;
    --primary-dark: #166fe5;
    --secondary-color: #606770;
    --text-color: #1c1e21;
    --text-light: #65676b;
    --background: #f0f2f5;
    --white: #ffffff;
    --border-color: #dddfe2;
    --success-color: #31a24c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 2px 12px rgba(0, 0, 0, 0.15);
    --radius: 8px;
    --radius-lg: 12px;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Base */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    color: var(--text-color);
    background: var(--background);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

a:hover {
    text-decoration: underline;
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.site-header {
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-color);
}

.logo:hover {
    text-decoration: none;
}

.logo-icon {
    font-size: 1.5rem;
}

.main-nav {
    display: flex;
    gap: 0.5rem;
}

.main-nav a {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    color: var(--text-color);
    font-weight: 500;
}

.main-nav a:hover {
    background: var(--background);
    text-decoration: none;
}

.main-nav a.active {
    background: var(--primary-color);
    color: var(--white);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem 0;
}

/* Hero */
.hero {
    text-align: center;
    padding: 3rem 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Stats Section */
.stats-section {
    margin-bottom: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    display: block;
    color: var(--text-light);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Search Form */
.search-section {
    margin-bottom: 2rem;
}

.search-form-large {
    display: flex;
    gap: 0.5rem;
    max-width: 700px;
    margin: 0 auto;
}

.search-input-large {
    flex: 1;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.2s;
}

.search-input-large:focus {
    border-color: var(--primary-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
}

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

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

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

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-block {
    width: 100%;
}

/* Groups */
.groups-section {
    margin-bottom: 2rem;
}

.groups-section h2,
.recent-section h2 {
    margin-bottom: 1rem;
}

.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.group-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
    display: block;
    color: var(--text-color);
}

.group-card:hover {
    box-shadow: var(--shadow-lg);
    text-decoration: none;
}

.group-card h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.group-card p {
    color: var(--text-light);
    font-size: 0.875rem;
}

.lang-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--background);
    border-radius: 4px;
    font-size: 0.75rem;
    text-transform: uppercase;
    margin-top: 0.5rem;
}

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

/* Posts List */
.posts-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.post-card {
    background: var(--white);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.post-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.post-author {
    font-weight: 600;
    color: var(--text-color);
}

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

.post-date {
    color: var(--text-light);
    font-size: 0.875rem;
}

.post-content {
    margin-bottom: 0.75rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.post-content.search-result mark {
    background: #fff3cd;
    padding: 0 2px;
    border-radius: 2px;
}

.no-text {
    color: var(--text-light);
}

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

.post-stats {
    display: flex;
    gap: 1rem;
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Posts Layout */
.posts-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
}

.filters-sidebar {
    background: var(--white);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    height: fit-content;
    position: sticky;
    top: 72px;
}

.filters-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.filter-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
}

.filter-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: var(--white);
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    padding: 1rem;
    background: var(--white);
    border-radius: var(--radius);
}

.pagination-link {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: var(--white);
    border-radius: var(--radius);
    font-weight: 500;
}

.pagination-link:hover {
    background: var(--primary-dark);
    text-decoration: none;
}

.pagination-info {
    color: var(--text-light);
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
}

.page-subtitle {
    color: var(--text-light);
    margin-top: 0.25rem;
}

/* Post Detail */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

.breadcrumb a {
    color: var(--text-light);
}

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

.post-detail {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.post-detail-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.post-author-large a {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
}

.post-meta {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    color: var(--text-light);
    font-size: 0.875rem;
}

.post-detail-content {
    padding: 1.5rem;
    font-size: 1.05rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

.post-detail-footer {
    padding: 1.5rem;
    background: var(--background);
    border-top: 1px solid var(--border-color);
}

.post-stats-large {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-icon {
    font-size: 1.25rem;
}

.stat-value {
    font-weight: 700;
    font-size: 1.25rem;
}

.stat-name {
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Author Page */
.author-header {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.author-header h1 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.author-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.author-period {
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Related Section */
.related-section {
    margin-top: 2rem;
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.related-section h2 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

/* Search Tips */
.search-tips {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.search-tips h2 {
    margin-bottom: 1rem;
}

.search-tips ul {
    list-style: none;
}

.search-tips li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.search-tips li:last-child {
    border-bottom: none;
}

/* Results Header */
.results-header {
    margin-bottom: 1.5rem;
}

.results-header h2 {
    font-size: 1.25rem;
}

.results-header p {
    color: var(--text-light);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    background: var(--white);
    border-radius: var(--radius);
}

.empty-state p {
    margin-bottom: 1rem;
    color: var(--text-light);
}

.empty-state .small {
    font-size: 0.875rem;
}

/* Error Page */
.error-page {
    text-align: center;
    padding: 4rem;
}

.error-page h1 {
    font-size: 5rem;
    color: var(--primary-color);
}

.error-page p {
    font-size: 1.25rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}

/* Footer */
.site-footer {
    background: var(--white);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: auto;
    text-align: center;
}

.site-footer p {
    color: var(--text-light);
}

.site-footer .small {
    font-size: 0.8125rem;
    margin-top: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .posts-layout {
        grid-template-columns: 1fr;
    }

    .filters-sidebar {
        position: static;
        margin-bottom: 1rem;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .search-form-large {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .post-stats-large {
        gap: 1rem;
    }

    .author-stats {
        gap: 1rem;
    }

    .main-nav {
        gap: 0.25rem;
    }

    .main-nav a {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
}

/* Screenshot Section */
.screenshot-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.screenshot-section h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.screenshot-container {
    max-width: 100%;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.screenshot-container img {
    width: 100%;
    height: auto;
    display: block;
}

.screenshot-loading {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
    background: var(--background);
    border-radius: 8px;
    justify-content: center;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.post-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.post-actions .btn {
    flex: 1;
    min-width: 200px;
    text-align: center;
}
