/* =============================================
   Main Styles - Clean Light Theme
   ============================================= */

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    background: var(--background);
    color: var(--text-primary);
    animation: pageLoad 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes pageLoad {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(24px) scale(0.99); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes blurIn {
    from { opacity: 0; filter: blur(8px); }
    to { opacity: 1; filter: blur(0); }
}

.animate-fadeInUp { animation: slideUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) both; }
.animate-fadeIn { animation: fadeIn 0.35s ease both; }

.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1), transform 0.5s cubic-bezier(0.22, 1, 0.36, 1); }
.reveal.active { opacity: 1; transform: translateY(0); }

/* Global smooth transitions for all interactive elements */
a, button, input, select, textarea, .card, .nav-link, .post-card, .user-card, .section-tab, .page-link, .donor-item, .alert {
    transition-property: color, background-color, border-color, box-shadow, transform, opacity, filter;
    transition-duration: 0.25s;
    transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Button press effect */
.btn:active { transform: scale(0.97); transition-duration: 0.08s; }

/* Smooth hover lift for cards */
.card { transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease, border-color 0.25s ease; }
.card:hover { transform: translateY(-2px); }

/* Post card hover */
.post-card { transition: background 0.2s ease, border-color 0.2s ease, border-left-color 0.3s ease; }

/* User card hover */
.user-card { transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.2s ease, box-shadow 0.3s ease; }
.user-card:hover { transform: translateY(-3px); }

/* ===== Navbar ===== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    transition: background 0.3s ease, border-color 0.3s ease;
}
.navbar-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    gap: 16px;
}
.navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 800;
    font-size: 1rem;
    flex-shrink: 0;
}
.navbar-brand:hover { opacity: 0.8; }
.logo-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.85rem;
}
.nav-desktop {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
}
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.2s ease, background 0.2s ease;
    position: relative;
}
.nav-link:hover { color: var(--primary); background: var(--primary-50); }
.nav-link.active { color: var(--primary); font-weight: 600; }
.nav-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.nav-search {
    position: relative;
    display: flex;
    align-items: center;
}
.nav-search input {
    width: 190px;
    padding: 6px 10px 6px 30px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    color: var(--text-primary);
    background: var(--surface-alt);
    outline: none;
    transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.2s ease, background 0.2s ease, box-shadow 0.3s ease;
}
.nav-search input::placeholder { color: var(--text-muted); }
.nav-search input:focus { width: 220px; border-color: var(--primary); background: var(--surface); }
.nav-search i { position: absolute; left: 10px; color: var(--text-muted); font-size: 0.78rem; pointer-events: none; }

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 10px 4px 4px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.82rem;
    transition: background var(--transition);
}
.user-chip:hover { background: var(--border); }
.user-chip img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }

.nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background var(--transition), color var(--transition);
}
.nav-btn-primary { background: var(--primary); color: #fff; }
.nav-btn-primary:hover { background: var(--primary-dark); }
.nav-btn-outline { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.nav-btn-outline:hover { color: var(--text-primary); border-color: var(--border-strong); background: var(--surface-alt); }

.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.95rem;
    cursor: pointer;
    background: transparent;
}
.nav-toggle:hover { background: var(--surface-alt); }

.navbar-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    padding: 10px 16px 16px;
    flex-direction: column;
    gap: 4px;
}
.navbar-menu.show { display: flex; }
.navbar-menu .nav-link { width: 100%; border-radius: var(--radius-sm); padding: 10px 14px; }
.navbar-menu .nav-search { width: 100%; margin: 6px 0; }
.navbar-menu .nav-search input { width: 100%; }
.navbar-menu .nav-search input:focus { width: 100%; }
.navbar-menu .nav-btn { width: 100%; justify-content: center; padding: 10px; }

.theme-toggle-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}
.theme-toggle-btn:hover { border-color: var(--border-strong); color: var(--text-primary); }

/* ===== Main content ===== */
.main-content {
    max-width: 1120px;
    margin: 0 auto;
    padding: 16px 20px 40px;
}

/* ===== Cards ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-header h2, .card-header h3 { font-size: 0.95rem; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.card-body { padding: 16px 18px; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}
.btn:hover { opacity: 0.9; }
.btn:active { opacity: 0.8; }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--surface-alt); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--color-error); color: #fff; }
.btn-danger:hover { background: #e04848; }
.btn-success { background: var(--accent); color: #fff; }
.btn-success:hover { background: #00a35e; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-alt); color: var(--text-primary); }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 600; color: var(--text-primary); font-size: 0.85rem; }
.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--surface);
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.3s ease, background 0.2s ease;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-input:focus, .form-textarea:focus, .form-select:focus { border-color: var(--primary); }
.form-textarea { resize: vertical; min-height: 100px; line-height: 1.6; }
.form-hint { margin-top: 4px; font-size: 0.75rem; color: var(--text-muted); }
.form-select option { background: var(--surface); color: var(--text-primary); }

/* ===== Post list ===== */
.post-list { display: flex; flex-direction: column; }
.post-card {
    position: relative;
    display: block;
    text-decoration: none;
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    padding: 14px 18px;
}
.post-card:last-child { border-bottom: none; }
.post-card:hover { background: var(--surface-alt); }
.post-card-inner { display: flex; align-items: flex-start; gap: 12px; }
.post-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--surface-alt); }
.post-body { flex: 1; min-width: 0; }
.post-title { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); line-height: 1.4; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-card:hover .post-title { color: var(--primary); }
.post-preview { color: var(--text-secondary); font-size: 0.82rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 8px; }
.post-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; font-size: 0.75rem; color: var(--text-muted); }
.post-meta-item { display: inline-flex; align-items: center; gap: 4px; }
.post-author-name { color: var(--text-secondary); text-decoration: none; font-weight: 500; transition: color var(--transition); }
.post-author-name:hover { color: var(--primary); }
.post-stats { display: inline-flex; align-items: center; gap: 10px; margin-left: auto; }
.post-stat { display: inline-flex; align-items: center; gap: 3px; }

/* ===== Role badges ===== */
.role-badge { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border-radius: 4px; font-size: 0.65rem; font-weight: 700; }
.role-super-admin { background: #fff3e0; color: #e67700; }
.role-admin { background: #e8f5e9; color: #2e7d32; }
.role-user { background: var(--surface-alt); color: var(--text-muted); }
.custom-title { color: var(--secondary); font-weight: 600; font-size: 0.75rem; }

/* ===== Search ===== */
.search-container { margin-bottom: 16px; }
.search-glass {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 4px 4px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    flex-wrap: nowrap;
}
.search-input-wrap { flex: 1; position: relative; min-width: 0; }
.search-input-wrap i { position: absolute; left: 0; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 0.8rem; pointer-events: none; }
.search-input-wrap .search-input { padding-left: 0; border: none; background: transparent; width: 100%; font-size: 0.88rem; }
.search-input-wrap .search-input:focus { box-shadow: none; background: transparent; border: none; }
.search-select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-alt);
    font-size: 0.8rem;
    color: var(--text-secondary);
    outline: none;
    appearance: none;
    cursor: pointer;
    flex-shrink: 0;
}
.search-select:focus { border-color: var(--primary); }
.search-btn { border-radius: var(--radius-pill); padding: 7px 18px; flex-shrink: 0; font-size: 0.82rem; }

/* ===== Section tabs ===== */
.section-tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: nowrap; overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 4px; }
.section-tab {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 500;
    transition: all 0.2s ease;
}
.section-tab:hover { color: var(--primary); background: var(--primary-50); }
.section-tab.active { color: var(--primary); font-weight: 700; background: var(--primary-50); }
.section-tab i { font-size: 0.76rem; }
.section-main-badge { font-size: 0.6rem; background: var(--primary-100); color: var(--primary); padding: 1px 4px; border-radius: 3px; margin-left: 2px; }

/* 帖子卡片上的分区标签 */
.post-section-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-50);
    border: 1px solid var(--primary-100);
    padding: 1px 7px;
    border-radius: 999px;
    white-space: nowrap;
}
.post-section-tag i { font-size: 0.62rem; }

/* ===== User cards ===== */
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.user-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    text-align: center;
    text-decoration: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.user-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.user-card-avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; margin-bottom: 8px; background: var(--surface-alt); }
.user-card-name { font-weight: 600; color: var(--text-primary); font-size: 0.88rem; }
.user-card-bio { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* ===== Empty state ===== */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state i { font-size: 36px; margin-bottom: 10px; color: var(--border); }
.empty-state p { font-size: 0.9rem; margin-bottom: 12px; }

/* ===== Alerts ===== */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
    animation: slideDown 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.alert-error { background: #fef0f0; color: var(--color-error); border-color: #fde2e2; }
.alert-success { background: #f0f9eb; color: var(--accent); border-color: #e1f3d8; }
.alert-info { background: #ecf5ff; color: var(--color-info); border-color: #d9ecff; }

/* ===== Pagination ===== */
.pagination { display: flex; justify-content: center; gap: 4px; margin-top: 20px; flex-wrap: wrap; }
.page-link {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    background: var(--surface);
    transition: all var(--transition);
}
.page-link:hover { color: var(--primary); border-color: var(--primary); }
.page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 28px 20px;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.footer p { margin-bottom: 6px; }
.footer-links { display: inline-flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.footer-links a { color: var(--text-muted); text-decoration: none; transition: color var(--transition); }
.footer-links a:hover { color: var(--primary); }

/* ===== Skeleton ===== */
.skeleton {
    background: linear-gradient(90deg, var(--surface-alt) 25%, var(--border-light) 50%, var(--surface-alt) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite linear;
    border-radius: var(--radius-md);
    color: transparent !important;
    pointer-events: none;
    user-select: none;
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.skeleton-list { display: flex; flex-direction: column; gap: 0; }
.skeleton-card { height: 80px; border-bottom: 1px solid var(--border-light); }

/* ===== Disclaimer ===== */
.disclaimer {
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--surface-alt);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--primary);
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===== Banner ===== */
.banner-bar {
    overflow: hidden;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.banner-track {
    display: inline-flex;
    align-items: center;
    gap: 40px;
    padding: 6px 0;
    animation: banner-scroll 40s linear infinite;
}
@keyframes banner-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.banner-bar:hover .banner-track { animation-play-state: paused; }
.banner-item { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--text-secondary); }
.banner-tag { display: inline-block; padding: 1px 5px; border: 1px solid; border-radius: 3px; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.5px; }
.banner-cyan .banner-tag { border-color: var(--primary); color: var(--primary); }
.banner-pink .banner-tag { border-color: #e77c8e; color: #e77c8e; }
.banner-yellow .banner-tag { border-color: #e6a23c; color: #e6a23c; }
.banner-green .banner-tag { border-color: var(--accent); color: var(--accent); }
.banner-purple .banner-tag { border-color: #8b5cf6; color: #8b5cf6; }

/* ===== Guest banner ===== */
.guest-banner {
    background: #fffbe6;
    color: #8c6e1d;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.84rem;
    font-weight: 500;
    border: 1px solid #ffe7a0;
}
.guest-banner i { color: #e6a23c; }
.guest-banner .guest-countdown { font-weight: 700; color: #e6a23c; }
.guest-banner a {
    color: #fff;
    background: var(--primary);
    padding: 4px 12px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 600;
}
.guest-banner a:hover { background: var(--primary-dark); }

/* ===== Markdown ===== */
.markdown-body { color: var(--text-primary); line-height: 1.75; word-wrap: break-word; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 { margin: 18px 0 10px; font-weight: 700; }
.markdown-body h1 { font-size: 1.4rem; }
.markdown-body h2 { font-size: 1.2rem; }
.markdown-body h3 { font-size: 1.05rem; }
.markdown-body p { margin-bottom: 10px; }
.markdown-body pre { background: #f6f8fa; color: var(--text-primary); padding: 12px; border-radius: var(--radius-md); overflow-x: auto; font-size: 0.84rem; margin: 12px 0; border: 1px solid var(--border); }
.markdown-body code { background: var(--surface-alt); color: var(--color-error); padding: 2px 5px; border-radius: 4px; font-family: Consolas, monospace; font-size: 0.84em; }
.markdown-body pre code { background: transparent; color: inherit; padding: 0; }
.markdown-body img { max-width: 100%; height: auto; border-radius: var(--radius-md); margin: 8px 0; }
.markdown-body blockquote { border-left: 3px solid var(--primary); background: var(--primary-50); padding: 8px 12px; margin: 12px 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-secondary); }
.markdown-body ul, .markdown-body ol { margin: 8px 0 8px 20px; }
.markdown-body table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.markdown-body th { background: var(--surface-alt); font-weight: 700; }

/* ===== Donor ===== */
.donor-item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border-light); font-size: 0.82rem; color: var(--text-secondary); transition: color var(--transition); }
.donor-item:last-child { border-bottom: none; }
.donor-item:hover { color: var(--primary); }
.donor-item a { color: inherit; }
.donor-item a:hover { color: var(--primary); }
.donor-icon { width: 24px; height: 24px; background: linear-gradient(135deg, #ff9f43, #ff6b35); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 10px; flex-shrink: 0; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .nav-desktop { display: none; }
    .nav-right .nav-search, .nav-right .user-chip { display: none; }
    .nav-toggle { display: flex; }
    .navbar-menu .nav-desktop { display: flex; flex-direction: column; width: 100%; }
    .main-content { padding: 14px 16px 32px; }
}
@media (max-width: 768px) {
    .navbar-inner { height: 52px; padding: 0 14px; }
    .card-header { padding: 12px 14px; }
    .card-body { padding: 12px 14px; }
    .post-card { padding: 12px 14px; }
    .post-avatar { width: 32px; height: 32px; }
    .post-title { font-size: 0.92rem; }
    .search-glass { border-radius: var(--radius-lg); }
    .footer { padding: 20px 16px; }
}
@media (max-width: 480px) {
    .post-meta { gap: 8px; }
    .post-stats { width: 100%; margin-left: 0; margin-top: 6px; }
    .user-grid { grid-template-columns: repeat(2, 1fr); }
}
