/* ========== CSS Variables & Themes ========== */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f7fa;
    --bg-tertiary: #eef1f6;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: #eff6ff;
    --accent-glow: rgba(37,99,235,0.15);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -1px rgba(0,0,0,0.03);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.07), 0 4px 10px -4px rgba(0,0,0,0.03);
    --shadow-xl: 0 20px 40px -10px rgba(0,0,0,0.08);
    --shadow-blue: 0 4px 20px rgba(37,99,235,0.15);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --max-width: 1200px;
    --header-height: 64px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --gradient: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
    --gradient-warm: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    --gradient-cool: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #1a2332;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --border-light: #1e293b;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-light: #1e3a5f;
    --accent-glow: rgba(59,130,246,0.12);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.4);
    --shadow-xl: 0 20px 40px rgba(0,0,0,0.5);
    --shadow-blue: 0 4px 20px rgba(59,130,246,0.2);
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
    0%   { background-position: -200% center; }
    100% { background-position: 200% center; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
    50%      { box-shadow: 0 0 0 12px transparent; }
}

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

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.7;
    transition: background var(--transition), color var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; }

#app, main { flex: 1; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

/* ========== Header ========== */
.site-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky; top: 0; z-index: 100;
    backdrop-filter: blur(12px);
    transition: background var(--transition), border-color var(--transition);
}

.header-inner {
    max-width: var(--max-width); margin: 0 auto; padding: 0 24px;
    height: var(--header-height); display: flex; align-items: center; justify-content: space-between;
}

.site-branding { display: flex; align-items: center; gap: 12px; }
.site-logo { font-size: 1.6rem; font-weight: 800; color: var(--text-primary); letter-spacing: -0.5px; }
.site-logo span { color: var(--accent); }

.header-nav { display: flex; align-items: center; gap: 8px; }
.header-nav a {
    padding: 8px 16px; border-radius: var(--radius-sm); color: var(--text-secondary);
    font-size: 0.9rem; font-weight: 500; transition: all 0.2s;
}
.header-nav a:hover, .header-nav a.active { color: var(--accent); background: var(--accent-light); }

.header-actions { display: flex; align-items: center; gap: 10px; }

#authArea { display: flex; align-items: center; gap: 8px; }

/* ========== Buttons ========== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; border: none; border-radius: var(--radius-sm);
    font-size: 0.9rem; font-weight: 500; cursor: pointer;
    transition: all 0.2s; text-decoration: none;
    white-space: nowrap;
}

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

.btn-outline { background: transparent; border: 2px solid var(--border-color); color: var(--text-primary); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-tertiary); color: var(--text-primary); }

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

.btn-sm { padding: 6px 12px; font-size: 0.82rem; border-radius: 4px; }
.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius-md); }

.btn-icon {
    width: 40px; height: 40px; padding: 0; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-tertiary); border: none; cursor: pointer;
    color: var(--text-secondary); font-size: 1.1rem; transition: all 0.2s;
}
.btn-icon:hover { background: var(--accent-light); color: var(--accent); }

/* Theme Toggle */
.theme-toggle {
    width: 40px; height: 40px; border-radius: 50%; border: none;
    background: var(--bg-tertiary); color: var(--text-secondary);
    cursor: pointer; font-size: 1.2rem; transition: all 0.3s;
    display: flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { background: var(--accent-light); color: var(--accent); transform: rotate(30deg); }

/* ========== Hero ========== */
.hero {
    background: var(--gradient); padding: 80px 0; text-align: center;
    position: relative; overflow: hidden;
}
.hero::before {
    content: ''; position: absolute; top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    animation: heroGlow 8s ease-in-out infinite;
}
.hero-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4); z-index: 0;
}
.hero-title, .hero-desc, .hero-search { position: relative; z-index: 1; }
@keyframes heroGlow {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(5%, 3%); }
}

.hero-title {
    font-size: 2.8rem; font-weight: 800; color: #fff;
    margin-bottom: 16px; position: relative; letter-spacing: -1px;
}
.hero-desc {
    font-size: 1.15rem; color: rgba(255,255,255,0.85);
    max-width: 600px; margin: 0 auto 32px; position: relative;
}
.hero-search {
    position: relative; max-width: 500px; margin: 0 auto;
    display: flex; gap: 10px;
}
.hero-search input {
    flex: 1; padding: 14px 20px; border: none; border-radius: 50px;
    font-size: 1rem; outline: none; box-shadow: var(--shadow-lg);
}
.hero-search button {
    padding: 14px 28px; border: none; border-radius: 50px;
    background: var(--text-primary); color: var(--bg-primary);
    font-size: 1rem; font-weight: 600; cursor: pointer;
    transition: all 0.2s;
}
.hero-search button:hover { transform: translateY(-2px); box-shadow: var(--shadow-xl); }

/* ========== Main Content Layout ========== */
.main-layout {
    max-width: var(--max-width); margin: 0 auto; padding: 40px 24px;
    display: grid; grid-template-columns: 1fr 300px; gap: 32px;
}
@media (max-width: 900px) {
    .main-layout { grid-template-columns: 1fr; }
}

/* ========== Post Cards ========== */
.posts-grid {
    display: grid; gap: 28px;
}

.post-card {
    background: var(--bg-primary); border-radius: var(--radius-lg);
    overflow: hidden; box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1); cursor: pointer;
    display: grid; grid-template-columns: 300px 1fr;
}
.post-card:hover {
    transform: translateY(-4px); box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.post-card-image {
    width: 100%; height: 100%; min-height: 220px; object-fit: cover;
    background: var(--gradient-cool);
}
.post-card-image.placeholder {
    display: flex; align-items: center; justify-content: center;
    font-size: 3rem; color: rgba(255,255,255,0.5);
    min-height: 220px;
}

.post-card-body {
    padding: 28px 32px; display: flex; flex-direction: column; justify-content: center;
}

.post-card-category {
    display: inline-block; padding: 4px 12px; border-radius: 20px;
    font-size: 0.75rem; font-weight: 600; margin-bottom: 14px;
    background: var(--accent-light); color: var(--accent);
    letter-spacing: 0.3px; width: fit-content;
}

.post-card-title {
    font-size: 1.3rem; font-weight: 700; margin-bottom: 10px;
    color: var(--text-primary); line-height: 1.45;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    letter-spacing: -0.2px;
}

.post-card-excerpt {
    color: var(--text-secondary); font-size: 0.92rem; line-height: 1.7;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    margin-bottom: 20px;
}

.post-card-meta {
    display: flex; align-items: center; gap: 18px;
    font-size: 0.82rem; color: var(--text-muted);
    padding-top: 18px; border-top: 1px solid var(--border-light);
    margin-top: auto;
}
.post-card-meta span { display: flex; align-items: center; gap: 5px; }

.pinned-badge {
    background: var(--warning); color: #fff; font-size: 0.68rem;
    padding: 2px 8px; border-radius: 10px; font-weight: 600; margin-left: 8px;
    vertical-align: middle; letter-spacing: 0.3px;
}

/* ========== Sidebar ========== */
.sidebar { display: flex; flex-direction: column; gap: 24px; }

.sidebar-widget {
    background: var(--bg-primary); border-radius: var(--radius-lg);
    padding: 24px; border: 1px solid var(--border-color);
}

.widget-title {
    font-size: 1rem; font-weight: 700; margin-bottom: 16px;
    padding-bottom: 12px; border-bottom: 2px solid var(--accent);
    color: var(--text-primary);
}

.category-list, .tag-list { list-style: none; }
.category-list li { margin-bottom: 4px; }
.category-list a {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px; border-radius: var(--radius-sm);
    color: var(--text-secondary); font-size: 0.9rem; transition: all 0.2s;
}
.category-list a:hover { background: var(--accent-light); color: var(--accent); }
.category-count { font-size: 0.8rem; color: var(--text-muted); background: var(--bg-tertiary); padding: 2px 8px; border-radius: 10px; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-item {
    padding: 5px 12px; border-radius: 20px; font-size: 0.8rem;
    background: var(--bg-tertiary); color: var(--text-secondary);
    transition: all 0.2s;
}
.tag-item:hover { background: var(--accent); color: #fff; }

/* ========== Pagination ========== */
.pagination {
    display: flex; justify-content: center; align-items: center; gap: 6px;
    margin-top: 40px; padding: 20px 0;
}
.pagination button {
    width: 40px; height: 40px; border-radius: var(--radius-sm); border: 1px solid var(--border-color);
    background: var(--bg-primary); color: var(--text-primary); cursor: pointer;
    font-size: 0.9rem; transition: all 0.2s;
}
.pagination button:hover:not(:disabled) { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ========== Single Post ========== */
.post-detail {
    max-width: 760px; margin: 0 auto; padding: 48px 24px;
}
.post-detail-header {
    margin-bottom: 36px;
    text-align: center;
}
.post-detail-category {
    display: inline-block; padding: 4px 14px; border-radius: 20px;
    font-size: 0.78rem; font-weight: 600; background: var(--accent-light); color: var(--accent);
    margin-bottom: 18px; letter-spacing: 0.3px;
}
.post-detail-title {
    font-size: 2.5rem; font-weight: 800; line-height: 1.25; margin-bottom: 18px;
    letter-spacing: -0.8px; color: var(--text-primary);
}
.post-detail-meta {
    display: flex; align-items: center; justify-content: center; gap: 20px; flex-wrap: wrap;
    font-size: 0.88rem; color: var(--text-muted);
}
.post-detail-meta span { display: flex; align-items: center; gap: 5px; }

.post-detail-cover {
    width: 100%; border-radius: var(--radius-lg); margin-bottom: 40px;
    max-height: 480px; object-fit: cover; box-shadow: var(--shadow-md);
}

/* --- Article Body Typography --- */
.post-detail-content {
    font-size: 1.1rem; line-height: 1.9; color: var(--text-primary);
    letter-spacing: 0.1px;
}

/* First paragraph drop cap */
.post-detail-content > p:first-of-type::first-letter {
    font-size: 3.4rem; font-weight: 800; float: left;
    line-height: 0.85; margin-right: 10px; margin-top: 6px;
    color: var(--accent);
}

.post-detail-content h1 { font-size: 2rem; font-weight: 800; margin: 2em 0 0.6em; letter-spacing: -0.5px; }
.post-detail-content h2 {
    font-size: 1.55rem; font-weight: 700; margin: 2em 0 0.7em;
    padding-bottom: 10px; border-bottom: 2px solid var(--border-color);
    letter-spacing: -0.3px;
}
.post-detail-content h3 { font-size: 1.25rem; font-weight: 700; margin: 1.6em 0 0.5em; letter-spacing: -0.2px; }
.post-detail-content h4 { font-size: 1.1rem; font-weight: 700; margin: 1.4em 0 0.4em; }

.post-detail-content p { margin-bottom: 1.2em; }
.post-detail-content strong { color: var(--text-primary); font-weight: 700; }
.post-detail-content a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.post-detail-content a:hover { color: var(--accent-hover); }

.post-detail-content img {
    border-radius: var(--radius-md); margin: 24px 0; max-width: 100%;
    box-shadow: var(--shadow-md);
}

/* Inline code */
.post-detail-content code {
    background: var(--bg-tertiary); color: #e11d48; padding: 2px 7px; border-radius: 4px;
    font-size: 0.88em; font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
    font-weight: 500;
}

/* Code block */
.post-detail-content pre {
    background: #1a1a2e; color: #e2e8f0; padding: 22px 26px;
    border-radius: var(--radius-md); overflow-x: auto; margin: 22px 0;
    font-size: 0.88rem; line-height: 1.7; position: relative;
    box-shadow: var(--shadow-md); border: 1px solid rgba(255,255,255,0.05);
}
.post-detail-content pre code {
    background: none; color: inherit; padding: 0; font-size: inherit;
    font-weight: 400; border-radius: 0;
}

/* Blockquote */
.post-detail-content blockquote {
    border-left: 4px solid var(--accent); padding: 18px 24px; margin: 28px 0;
    background: var(--accent-light); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary); font-style: italic;
}
.post-detail-content blockquote p:last-child { margin-bottom: 0; }

/* Lists */
.post-detail-content ul, .post-detail-content ol {
    margin: 16px 0; padding-left: 28px;
}
.post-detail-content li { margin-bottom: 8px; line-height: 1.8; }
.post-detail-content li::marker { color: var(--accent); }

/* Horizontal rule */
.post-detail-content hr {
    border: none; border-top: 1px solid var(--border-color); margin: 36px 0;
}

/* Tables */
.post-detail-content table {
    width: 100%; border-collapse: collapse; margin: 22px 0; font-size: 0.92rem;
    border-radius: var(--radius-sm); overflow: hidden;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border-color);
}
.post-detail-content thead {
    background: var(--bg-tertiary);
}
.post-detail-content th {
    text-align: left; padding: 14px 18px; font-weight: 700; font-size: 0.82rem;
    color: var(--text-secondary); letter-spacing: 0.5px; text-transform: uppercase;
    border-bottom: 2px solid var(--border-color);
}
.post-detail-content td {
    padding: 12px 18px; border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}
.post-detail-content tr:last-child td { border-bottom: none; }
.post-detail-content tbody tr:hover { background: var(--bg-secondary); }

/* Tags section */
.post-tags {
    display: flex; flex-wrap: wrap; gap: 8px; margin: 36px 0 0;
    padding-top: 28px; border-top: 1px solid var(--border-color);
}
.post-tags .tag-item {
    padding: 6px 14px; border-radius: 20px; font-size: 0.82rem;
    background: var(--bg-tertiary); color: var(--text-secondary);
    transition: all 0.2s;
}
.post-tags .tag-item:hover { background: var(--accent); color: #fff; }

/* Prev/Next nav */
.post-nav {
    display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
    margin-top: 56px; padding-top: 28px; border-top: 2px solid var(--border-color);
}
.post-nav-item {
    padding: 20px 22px; border-radius: var(--radius-md); background: var(--bg-primary);
    border: 1px solid var(--border-color); transition: all 0.25s;
    text-decoration: none;
}
.post-nav-item:hover {
    border-color: var(--accent); box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.post-nav-label { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 6px; letter-spacing: 0.3px; text-transform: uppercase; }
.post-nav-title { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); line-height: 1.4; }

/* ========== Comments ========== */
.comments-section {
    max-width: 760px; margin: 56px auto 64px; padding: 0 24px;
}
.comments-title {
    font-size: 1.25rem; font-weight: 700; margin-bottom: 28px;
    padding-bottom: 14px; border-bottom: 2px solid var(--border-color);
    color: var(--text-primary); display: flex; align-items: center; gap: 8px;
}

/* Comment form */
.comment-form {
    margin-bottom: 36px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
    background: var(--bg-primary); padding: 24px;
    border-radius: var(--radius-lg); border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}
.comment-form textarea {
    grid-column: 1 / -1; padding: 14px 18px; border: 1px solid var(--border-color);
    border-radius: var(--radius-md); font-size: 0.92rem; background: var(--bg-secondary);
    color: var(--text-primary); outline: none; transition: all 0.2s; font-family: inherit;
    min-height: 110px; resize: vertical;
}
.comment-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); background: var(--bg-primary); }
.comment-form input { grid-column: span 1; }
.comment-form input {
    padding: 12px 16px; border: 1px solid var(--border-color); border-radius: var(--radius-md);
    font-size: 0.9rem; background: var(--bg-secondary); color: var(--text-primary);
    outline: none; transition: all 0.2s; font-family: inherit;
}
.comment-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); background: var(--bg-primary); }
.comment-form button {
    grid-column: 1 / -1; justify-self: start; padding: 12px 28px;
}
.comment-form button.btn-primary { box-shadow: 0 2px 8px rgba(37,99,235,0.3); }
.comment-form button.btn-primary:hover { box-shadow: 0 4px 14px rgba(37,99,235,0.4); transform: translateY(-1px); }

/* Individual comment */
.comment-item {
    padding: 20px 0; border-bottom: 1px solid var(--border-light);
}
.comment-item:last-child { border-bottom: none; }

.comment-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }

.comment-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 0.88rem;
    background: var(--gradient); flex-shrink: 0;
}

.comment-author { font-weight: 600; font-size: 0.92rem; color: var(--text-primary); }
.comment-time { font-size: 0.78rem; color: var(--text-muted); margin-left: 8px; }
.comment-location {
    font-size: 0.72rem; color: var(--text-muted); margin-left: 8px;
    padding: 2px 8px; background: var(--bg-tertiary); border-radius: 10px;
}

.comment-content {
    font-size: 0.92rem; color: var(--text-secondary); line-height: 1.7;
    padding-left: 52px;
}

/* Reply */
.comment-reply {
    margin-left: 52px; margin-top: 10px;
    padding: 14px 18px; background: var(--bg-secondary);
    border-radius: var(--radius-md); border-left: 3px solid var(--accent);
}
.comment-reply .comment-content { padding-left: 0; }

/* ========== Auth Pages ========== */
.auth-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--bg-secondary); padding: 24px;
}
.auth-card {
    background: var(--bg-primary); border-radius: var(--radius-xl);
    padding: 48px 40px; width: 100%; max-width: 440px;
    box-shadow: var(--shadow-xl); border: 1px solid var(--border-color);
}
.auth-card h1 { font-size: 1.8rem; font-weight: 800; text-align: center; margin-bottom: 8px; }
.auth-card p { text-align: center; color: var(--text-secondary); margin-bottom: 32px; font-size: 0.9rem; }

.form-group { margin-bottom: 20px; }
.form-group label {
    display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.9rem;
    color: var(--text-primary);
}
.form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 12px 16px; border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); font-size: 0.95rem; background: var(--bg-primary);
    color: var(--text-primary); outline: none; transition: border-color 0.2s; font-family: inherit;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

.form-error { color: var(--danger); font-size: 0.85rem; margin-top: 4px; display: none; }
.form-error.show { display: block; }

.auth-footer { text-align: center; margin-top: 24px; font-size: 0.9rem; color: var(--text-secondary); }

/* ========== Footer ========== */
.site-footer {
    background: var(--bg-primary); border-top: 1px solid var(--border-color);
    padding: 32px 0; text-align: center; font-size: 0.85rem;
    color: var(--text-muted);
}

/* ========== User Menu Dropdown ========== */
.user-menu { position: relative; }
.user-menu-btn {
    display: flex; align-items: center; gap: 8px; padding: 6px 12px;
    border-radius: var(--radius-sm); border: none; background: var(--bg-tertiary);
    cursor: pointer; color: var(--text-primary); font-weight: 500; font-size: 0.9rem;
}
.user-menu-avatar {
    width: 30px; height: 30px; border-radius: 50%; background: var(--gradient);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 0.8rem; font-weight: 700;
}
.user-dropdown {
    position: absolute; top: 100%; right: 0; margin-top: 8px;
    background: var(--bg-primary); border-radius: var(--radius-md);
    border: 1px solid var(--border-color); box-shadow: var(--shadow-lg);
    min-width: 180px; overflow: hidden; display: none;
}
.user-dropdown.show { display: block; }
.user-dropdown a {
    display: block; padding: 12px 16px; font-size: 0.9rem; color: var(--text-secondary);
    transition: all 0.2s;
}
.user-dropdown a:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.user-dropdown hr { border: none; border-top: 1px solid var(--border-light); }

/* Author Badge */
.author-badge {
    display: inline-block; padding: 1px 8px; border-radius: 10px;
    font-size: 0.7rem; font-weight: 600;
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    color: #fff; margin-left: 6px; vertical-align: middle;
}

/* ========== Toast / Notifications ========== */
.toast-container {
    position: fixed; top: 24px; right: 24px; z-index: 9999;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    padding: 14px 20px; border-radius: var(--radius-sm); font-size: 0.9rem;
    color: #fff; box-shadow: var(--shadow-lg); animation: slideIn 0.3s ease;
    display: flex; align-items: center; gap: 8px; min-width: 280px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--accent); }
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ========== User Center ========== */
.user-center {
    max-width: 1000px; margin: 40px auto; padding: 0 24px;
    display: grid; grid-template-columns: 240px 1fr; gap: 32px;
    min-height: 60vh;
}

.user-center-sidebar {
    background: var(--bg-primary); border-radius: var(--radius-lg);
    border: 1px solid var(--border-color); padding: 24px;
    height: fit-content; position: sticky; top: 80px;
}

.user-avatar-section {
    text-align: center; padding-bottom: 20px; border-bottom: 1px solid var(--border-light); margin-bottom: 16px;
}
.user-avatar-large {
    width: 72px; height: 72px; border-radius: 50%; background: var(--gradient);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.8rem; font-weight: 700;
    margin: 0 auto 12px;
}
.user-avatar-section h3 { font-size: 1.1rem; margin-bottom: 4px; }
.user-avatar-section p { font-size: 0.85rem; color: var(--text-muted); }

.user-center-nav { display: flex; flex-direction: column; gap: 2px; }
.uc-nav-item {
    display: block; padding: 10px 12px; border-radius: var(--radius-sm);
    font-size: 0.9rem; color: var(--text-secondary); transition: all 0.2s;
}
.uc-nav-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.uc-nav-item.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }

.user-center-content { }
.user-center-content h2 { font-size: 1.3rem; margin-bottom: 20px; }

.uc-card {
    background: var(--bg-primary); border-radius: var(--radius-lg);
    padding: 24px; border: 1px solid var(--border-color);
}

/* ========== Write Article Page ========== */
.write-page {
    max-width: 900px; margin: 40px auto; padding: 0 24px;
}

.write-container h1 {
    font-size: 1.8rem; font-weight: 800; margin-bottom: 8px;
}

.write-subtitle {
    color: var(--text-muted); font-size: 0.9rem; margin-bottom: 32px;
}

.write-form {
    background: var(--bg-primary); border-radius: var(--radius-lg);
    padding: 32px; border: 1px solid var(--border-color);
}

.write-form .form-row {
    display: grid; grid-template-columns: 1fr; gap: 16px;
    margin-bottom: 0;
}

.write-form .form-group { margin-bottom: 20px; }
.write-form .form-group label {
    display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.9rem;
    color: var(--text-primary);
}
.write-form .form-group input,
.write-form .form-group select,
.write-form .form-group textarea {
    width: 100%; padding: 12px 16px; border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); font-size: 0.95rem; background: var(--bg-primary);
    color: var(--text-primary); outline: none; transition: border-color 0.2s; font-family: inherit;
}
.write-form .form-group input:focus,
.write-form .form-group textarea:focus,
.write-form .form-group select:focus {
    border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light);
}

.write-editor-toolbar {
    display: flex; gap: 4px; padding: 8px 12px;
    background: var(--bg-tertiary); border: 1px solid var(--border-color);
    border-bottom: none; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    flex-wrap: wrap;
}
.write-editor-toolbar button {
    width: 32px; height: 32px; border: none; border-radius: 4px;
    background: transparent; color: var(--text-secondary);
    cursor: pointer; font-size: 0.85rem; display: flex;
    align-items: center; justify-content: center; transition: all 0.2s;
}
.write-editor-toolbar button:hover { background: var(--accent-light); color: var(--accent); }

.write-editor-content {
    min-height: 400px; padding: 16px; border: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm); outline: none;
    font-size: 1rem; line-height: 1.8; color: var(--text-primary);
    background: var(--bg-primary);
}
.write-editor-content:focus { border-color: var(--accent); }
.write-editor-content h2 { font-size: 1.4rem; margin: 1em 0 0.5em; }
.write-editor-content h3 { font-size: 1.2rem; margin: 1em 0 0.5em; }
.write-editor-content p { margin-bottom: 0.8em; }
.write-editor-content img { max-width: 100%; border-radius: var(--radius-md); }
.write-editor-content blockquote {
    border-left: 4px solid var(--accent); padding: 8px 16px;
    margin: 12px 0; background: var(--bg-tertiary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.write-editor-content pre {
    background: #1e1e2e; color: #cdd6f4; padding: 16px;
    border-radius: var(--radius-md); overflow-x: auto;
}

.tag-input-wrapper {
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
    padding: 8px 12px; border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); background: var(--bg-primary);
}
.tag-input-wrapper:focus-within { border-color: var(--accent); }
.tag-input-wrapper input {
    border: none !important; outline: none; flex: 1; min-width: 120px;
    padding: 4px !important; box-shadow: none !important;
    background: transparent !important;
}
.tag-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 16px;
    background: var(--accent-light); color: var(--accent);
    font-size: 0.82rem; font-weight: 500;
}
.tag-chip button {
    border: none; background: none; color: var(--accent);
    cursor: pointer; font-size: 1rem; padding: 0; line-height: 1;
}

.upload-area {
    border: 2px dashed var(--border-color); border-radius: var(--radius-md);
    padding: 24px; text-align: center; cursor: pointer;
    transition: all 0.2s; color: var(--text-muted); font-size: 0.9rem;
}
.upload-area:hover { border-color: var(--accent); color: var(--accent); }

/* ========== Cool Effects ========== */

/* Custom scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--text-muted); border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* Glass morphism on cards */
.post-card, .sidebar-widget, .auth-card, .uc-card, .write-form {
    backdrop-filter: blur(2px);
}

/* Header glass effect */
.site-header {
    background: rgba(255,255,255,0.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
}
[data-theme="dark"] .site-header {
    background: rgba(15,23,42,0.85);
}

/* Logo gradient text */
.site-logo {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.site-logo span { -webkit-text-fill-color: var(--accent); }

/* Animated hero gradient */
.hero {
    background: var(--gradient);
    background-size: 200% 200%;
    animation: heroShift 6s ease infinite;
}
@keyframes heroShift {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

/* Glowing ring on hero search button */
.hero-search button {
    background: var(--bg-primary); color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    animation: pulseGlow 2.5s infinite;
}
.hero-search button:hover {
    background: var(--accent); color: #fff;
    animation: none;
}

/* Post cards fade-in cascade */
.posts-grid .post-card {
    animation: fadeInUp 0.5s ease both;
}
.posts-grid .post-card:nth-child(1) { animation-delay: 0.05s; }
.posts-grid .post-card:nth-child(2) { animation-delay: 0.1s; }
.posts-grid .post-card:nth-child(3) { animation-delay: 0.15s; }
.posts-grid .post-card:nth-child(4) { animation-delay: 0.2s; }
.posts-grid .post-card:nth-child(5) { animation-delay: 0.25s; }

/* Shimmer effect on card image hover */
.post-card-image {
    position: relative;
}
.post-card:hover .post-card-image::after {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(105deg,
        transparent 40%,
        rgba(255,255,255,0.15) 45%,
        rgba(255,255,255,0.25) 50%,
        rgba(255,255,255,0.15) 55%,
        transparent 60%
    );
    background-size: 200% 100%;
    animation: shimmer 0.8s ease-in-out;
}

/* Button glow on hover */
.btn-primary:hover {
    box-shadow: var(--shadow-blue);
    transform: translateY(-1px);
}

/* Smooth hover glow on cards */
.post-card:hover {
    box-shadow: var(--shadow-lg), var(--shadow-blue);
}

/* Floating sidebar widgets */
.sidebar-widget {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.sidebar-widget:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* Nav link underline effect */
.header-nav a {
    position: relative;
}
.header-nav a::after {
    content: ''; position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
    width: 0; height: 2px; background: var(--accent); border-radius: 2px;
    transition: width 0.25s ease;
}
.header-nav a:hover::after,
.header-nav a.active::after { width: 60%; }

/* Post detail fade in */
.post-detail {
    animation: fadeInUp 0.6s ease both;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .hero-title { font-size: 1.8rem; }
    .hero { padding: 50px 0; }
    .header-nav { display: none; }
    .post-card { grid-template-columns: 1fr; }
    .post-card-image { height: 200px; min-height: auto; }
    .post-card-body { padding: 18px 20px 22px; }
    .post-detail-title { font-size: 1.8rem; }
    .auth-card { padding: 32px 24px; }
    .comment-form { grid-template-columns: 1fr; }
    .comment-form input { grid-column: 1 / -1; }
    .post-nav { grid-template-columns: 1fr; }
    .user-center { grid-template-columns: 1fr; }
    .user-center-sidebar { position: static; }
}

/* ========== Utilities ========== */
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.loading {
    text-align: center; padding: 40px; color: var(--text-muted); font-size: 0.95rem;
}
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state-icon { font-size: 3rem; margin-bottom: 16px; }

/* ========== Upload Progress Bar ========== */
.upload-progress-bar { display: none; }
.upload-progress-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 10000;
    display: flex; align-items: center; justify-content: center;
}
.upload-progress-card {
    background: var(--bg-primary); border-radius: var(--radius-lg);
    padding: 36px 48px; box-shadow: var(--shadow-xl);
    text-align: center; min-width: 320px;
}
.upload-progress-title {
    font-size: 1rem; font-weight: 600; margin-bottom: 20px;
    color: var(--text-primary);
}
.upload-progress-track {
    width: 100%; height: 8px; background: var(--bg-tertiary);
    border-radius: 10px; overflow: hidden; margin-bottom: 12px;
}
.upload-progress-fill {
    height: 100%; width: 0%; background: var(--gradient);
    border-radius: 10px; transition: width 0.3s ease;
}
.upload-progress-text {
    font-size: 1.4rem; font-weight: 700; color: var(--accent);
}

/* ========== Video Background ========== */
.video-bg {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover; z-index: 0; pointer-events: none;
}
.hero { position: relative; overflow: hidden; }

/* Login page with background */
.auth-page-video-bg {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover; z-index: 0; pointer-events: none;
}
