/* ============================================
   个人网站 - 极简风格样式
   ============================================ */

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

:root {
    --bg: #f9fafb;
    --surface: #ffffff;
    --border: #e5e7eb;
    --text: #1f2937;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    --accent: #374151;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.08);
    --max-width: 720px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* --- Homepage --- */
.home-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 80px 24px 48px;
}

.home-header {
    text-align: center;
    margin-bottom: 64px;
}

.site-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.site-tagline {
    margin-top: 8px;
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* --- Entry Cards --- */
.entry-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 64px;
}

.entry-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 36px 20px 28px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.entry-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.card-icon {
    width: 56px;
    height: 56px;
    color: var(--accent);
    margin-bottom: 16px;
    transition: color 0.2s ease;
}

.entry-card:hover .card-icon {
    color: #111827;
}

.card-icon svg {
    width: 100%;
    height: 100%;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.card-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* --- Recent Essays --- */
.recent-essays {
    border-top: 1px solid var(--border);
    padding-top: 40px;
}

.section-heading {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.essay-list {
    display: flex;
    flex-direction: column;
}

.essay-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    transition: padding-left 0.2s ease;
}

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

.essay-item:hover { padding-left: 8px; }

.essay-item-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
}

.essay-item-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: 16px;
}

.essay-cat {
    font-size: 0.75rem;
    padding: 2px 8px;
    background: var(--bg);
    border-radius: 4px;
    border: 1px solid var(--border);
}

.view-all {
    display: inline-block;
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.view-all:hover { color: var(--text); }

/* --- Footer --- */
.home-footer {
    text-align: center;
    margin-top: 64px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-light);
}

/* --- Sub Page Layout --- */
.page-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 48px 24px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 32px;
    transition: color 0.15s;
}

.back-link:hover { color: var(--text); }

.back-link svg {
    width: 16px;
    height: 16px;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 40px;
}

/* --- About Page --- */
.about-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    line-height: 1.8;
}

.about-content h2 { font-size: 1.3rem; margin: 24px 0 12px; }
.about-content h2:first-child { margin-top: 0; }
.about-content p { margin-bottom: 12px; color: #374151; }

/* --- Message Board --- */
.message-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 36px;
}

.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--bg);
    transition: border-color 0.15s, box-shadow 0.15s;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #9ca3af;
    box-shadow: 0 0 0 3px rgba(156,163,175,0.15);
    background: var(--surface);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border: 1px solid var(--text);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--text);
    color: #fff;
}

.btn:hover {
    background: #111827;
    border-color: #111827;
}

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

.btn-outline:hover {
    background: var(--text);
    color: #fff;
}

.btn-danger {
    background: #dc2626;
    border-color: #dc2626;
}

.btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.message-list { display: flex; flex-direction: column; gap: 0; }

.message-item {
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
}

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

.message-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.message-nickname {
    font-weight: 600;
    font-size: 0.9rem;
}

.message-time {
    font-size: 0.8rem;
    color: var(--text-light);
}

.message-content {
    font-size: 0.95rem;
    color: #374151;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-notice {
    text-align: center;
    padding: 24px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* --- Essays Page --- */
.essay-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.filter-link {
    font-size: 0.85rem;
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    transition: all 0.15s;
}

.filter-link:hover,
.filter-link.active {
    background: var(--text);
    color: #fff;
    border-color: var(--text);
}

.essays-list-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    transition: padding-left 0.2s ease;
}

.essays-list-item:hover { padding-left: 8px; }

/* --- Single Essay --- */
.essay-article {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px;
}

.essay-article-header {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.essay-article-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.essay-article-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    gap: 16px;
}

.essay-article-body {
    line-height: 1.9;
    font-size: 1rem;
    color: #374151;
}

.essay-article-body h2,
.essay-article-body h3 { margin: 28px 0 12px; font-size: 1.2rem; }

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

.essay-article-body img {
    max-width: 100%;
    border-radius: 8px;
    margin: 16px 0;
}

.essay-article-body ul,
.essay-article-body ol { margin: 12px 0 12px 24px; }

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

.essay-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 24px;
}

.essay-images img {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* --- Login --- */
.login-box {
    max-width: 380px;
    margin: 120px auto 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px;
    text-align: center;
}

.login-box h2 {
    font-size: 1.3rem;
    margin-bottom: 24px;
}

.login-box .form-group { text-align: left; }
.login-box .btn { width: 100%; margin-top: 8px; }

.login-error {
    color: #dc2626;
    font-size: 0.85rem;
    margin-bottom: 16px;
}

/* --- Admin --- */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 220px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 24px 0;
    flex-shrink: 0;
}

.admin-sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
    font-weight: 700;
    font-size: 1rem;
}

.admin-nav a {
    display: block;
    padding: 10px 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: background 0.1s;
}

.admin-nav a:hover,
.admin-nav a.active { background: var(--bg); color: var(--text); }

.admin-main {
    flex: 1;
    padding: 32px 40px;
    overflow-x: auto;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.admin-header h1 { font-size: 1.4rem; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.admin-table th,
.admin-table td {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    background: var(--bg);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.admin-table tr:last-child td { border-bottom: none; }

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.pending { background: #fef3c7; color: #92400e; }
.status-badge.approved { background: #d1fae5; color: #065f46; }
.status-badge.rejected { background: #fee2e2; color: #991b1b; }

.admin-actions {
    display: flex;
    gap: 8px;
}

.admin-actions button,
.admin-actions a {
    font-size: 0.78rem;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: all 0.1s;
}

.admin-actions button:hover,
.admin-actions a:hover { background: var(--bg); }

.admin-actions .danger { color: #dc2626; border-color: #fecaca; }
.admin-actions .danger:hover { background: #fef2f2; }

/* --- Admin Editor --- */
.editor-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.editor-toolbar select,
.editor-toolbar input[type="text"] {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
}

.editor-toolbar input[type="text"] { min-width: 300px; }

.content-editor {
    width: 100%;
    min-height: 400px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.7;
    resize: vertical;
}

/* --- Notices --- */
.success-msg {
    background: #d1fae5;
    color: #065f46;
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.error-msg {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.3;
}

.empty-state p { font-size: 0.95rem; }

/* --- Message Reply --- */
.message-reply {
    margin-top: 14px;
    padding: 12px 16px;
    background: #fffef3;
    border-radius: 8px;
    border-left: 4px solid #c9940c;
    line-height: 1.8;
    box-shadow: 0 1px 4px rgba(180,140,20,0.08);
}

.reply-badge {
    color: #c9940c;
    font-weight: 700;
    font-size: 0.95rem;
    margin-right: 4px;
}

.reply-text {
    font-weight: 700;
    color: #1f2937;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.95rem;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 28px;
}

.pagination a,
.pagination span {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.pagination a:hover { background: var(--bg); }
.pagination .current { background: var(--text); color: #fff; border-color: var(--text); }

/* --- Responsive --- */
@media (max-width: 768px) {
    .entry-cards {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .home-container { padding: 48px 16px 32px; }
    .site-title { font-size: 1.6rem; }
    .home-header { margin-bottom: 40px; }

    .essay-item {
        flex-direction: column;
        gap: 4px;
    }

    .essay-item-meta { margin-left: 0; }

    .page-container { padding: 32px 16px; }

    .admin-layout { flex-direction: column; }
    .admin-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 12px 0;
    }
    .admin-sidebar-header { padding-bottom: 12px; }
    .admin-nav { display: flex; overflow-x: auto; }
    .admin-nav a { flex-shrink: 0; white-space: nowrap; }
    .admin-main { padding: 20px 16px; }

    .essay-article { padding: 24px; }

    .editor-toolbar input[type="text"] { min-width: auto; width: 100%; }

    .admin-table { display: block; overflow-x: auto; }
}
