/* ===== CSS Variables ===== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #0f172a;
    --accent: #f59e0b;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 40px -10px rgba(0,0,0,0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --font-mono: "SF Mono", "Fira Code", "Consolas", monospace;
    --navbar-bg: rgba(255,255,255,0.85);
    --hero-bg: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 50%, #fef2f2 100%);
    --footer-bg: linear-gradient(135deg, #0b1121 0%, #1a1a2e 100%);
    --placeholder-bg: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    --placeholder-color: #94a3b8;
    --code-bg: #f1f5f9;
    --code-color: #e11d48;
    --pre-bg: #0f172a;
    --pre-color: #e2e8f0;
    --input-bg: #fff;
}

[data-theme="dark"] {
    --primary: #60a5fa;
    --primary-dark: #3b82f6;
    --primary-light: #1e3a5f;
    --secondary: #e2e8f0;
    --bg: #0b1121;
    --bg-card: #131c31;
    --text: #e2e8f0;
    --text-light: #94a3b8;
    --text-muted: #64748b;
    --border: #1e293b;
    --border-light: #1a2332;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.5);
    --shadow-xl: 0 20px 40px -10px rgba(0,0,0,0.6);
    --navbar-bg: rgba(11,17,33,0.9);
    --hero-bg: linear-gradient(135deg, #0b1121 0%, #131c31 50%, #1a1a2e 100%);
    --footer-bg: linear-gradient(135deg, #060a14 0%, #0f1525 100%);
    --placeholder-bg: linear-gradient(135deg, #1a2332, #1e293b);
    --placeholder-color: #475569;
    --code-bg: #1e293b;
    --code-color: #f472b6;
    --pre-bg: #060a14;
    --pre-color: #94a3b8;
    --input-bg: #1a2332;
}

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

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.main-content { flex: 1; }

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

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

/* ===== Container ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ===== Navbar ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--navbar-bg);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--border);
    height: 64px;
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.nav-logo {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--secondary);
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.nav-logo:hover { opacity: 0.85; color: transparent; }

.nav-menu {
    display: flex;
    align-items: center;
    list-style: none;
    gap: 4px;
}

.nav-menu > li { position: relative; }

.nav-menu > li > a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.nav-menu > li > a:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.search-form {
    display: flex;
    align-items: center;
    background: var(--border-light);
    border-radius: 999px;
    padding: 2px;
    border: 1px solid transparent;
    transition: var(--transition);
}
.search-form:focus-within {
    border-color: var(--primary);
    background: var(--input-bg);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.search-form input {
    border: none;
    background: transparent;
    padding: 6px 12px;
    font-size: 0.85rem;
    outline: none;
    width: 140px;
    color: var(--text);
}
.search-form button {
    background: none;
    border: none;
    padding: 6px 12px;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
}
.search-form button:hover { color: var(--primary); }

/* Dropdown */
.nav-dropdown:hover .dropdown-menu { opacity: 1; pointer-events: auto; transform: translateY(4px); }

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    list-style: none;
    padding: 8px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: var(--transition);
    z-index: 100;
    border: 1px solid var(--border);
}
.dropdown-menu li a {
    display: block;
    padding: 8px 12px;
    color: var(--text);
    font-size: 0.88rem;
    border-radius: 6px;
    transition: var(--transition);
}
.dropdown-menu li a:hover { background: var(--primary-light); color: var(--primary); }

/* Nav Toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}
.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: var(--transition);
}

/* ===== Hero Section ===== */
.hero {
    padding: 120px 0 60px;
    background: var(--hero-bg);
    text-align: center;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(37,99,235,0.04) 0%, transparent 50%),
                radial-gradient(circle at 70% 50%, rgba(124,58,237,0.04) 0%, transparent 50%);
    pointer-events: none;
}
.hero-content { position: relative; }
.hero h1 {
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    letter-spacing: -1px;
}
.hero p {
    font-size: 1.15rem;
    color: var(--text-light);
    max-width: 500px;
    margin: 0 auto;
}

/* ===== Page Header ===== */
.page-header {
    padding: 100px 0 40px;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    text-align: center;
    border-bottom: 1px solid var(--border);
}
.page-header h1 { font-size: 2rem; font-weight: 700; margin-bottom: 6px; }
.page-header p { color: var(--text-light); }
.post-count { display: inline-block; margin-top: 8px; font-size: 0.85rem; color: var(--text-muted); }

/* ===== Posts Card Grid ===== */
.posts-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 32px 0;
}

.post-entry {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}
.post-entry:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
    border-color: var(--primary);
}

.post-entry-img {
    display: block;
    width: 100%;
    height: 170px;
    overflow: hidden;
}
.post-entry-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.post-entry:hover .post-entry-img img { transform: scale(1.05); }

.post-entry-img-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 170px;
    background: var(--placeholder-bg);
    color: var(--placeholder-color);
    font-size: 1.8rem;
}

.post-entry-body {
    padding: 16px 18px;
}

.post-entry-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.post-entry-meta .post-category {
    display: inline-block;
    padding: 1px 10px;
    background: var(--primary-light);
    color: var(--primary) !important;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    transition: var(--transition);
}
.post-entry-meta .post-category:hover { background: var(--primary); color: #fff !important; }

.post-entry-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 6px;
}
.post-entry-title a { color: var(--secondary); }
.post-entry-title a:hover { color: var(--primary); }

.post-entry-excerpt {
    font-size: 0.84rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-entry-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
}
.post-entry-footer i { margin-right: 3px; }
.post-entry-footer .read-more {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.82rem;
    margin-left: auto;
}
.post-entry-footer .read-more i { transition: transform 0.2s; }
.post-entry-footer .read-more:hover i { transform: translateX(3px); }

/* ===== Pagination ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 40px 0 60px;
}
.page-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 500;
    background: var(--bg-card);
    transition: var(--transition);
}
.page-link:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}
.page-link.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ===== Single Post ===== */
.single-post {
    padding: 100px 0 60px;
    max-width: 780px;
}

.post-header { text-align: center; margin-bottom: 40px; }
.post-header .post-category { margin-bottom: 16px; }
.post-header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 16px;
    color: var(--secondary);
}
.post-header .post-meta {
    justify-content: center;
    flex-wrap: wrap;
    font-size: 0.85rem;
}
.post-header .post-meta span { display: inline-flex; align-items: center; gap: 4px; }

.post-featured-image {
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 36px;
    box-shadow: var(--shadow-md);
}
.post-featured-image img { width: 100%; }

.post-content {
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--text);
}
.post-content h1, .post-content h2, .post-content h3 {
    margin: 32px 0 16px;
    color: var(--secondary);
    font-weight: 700;
    line-height: 1.3;
}
.post-content h1 { font-size: 1.8rem; }
.post-content h2 { font-size: 1.5rem; }
.post-content h3 { font-size: 1.25rem; }
.post-content p { margin-bottom: 16px; }
.post-content ul, .post-content ol { margin-bottom: 16px; padding-left: 24px; }
.post-content li { margin-bottom: 6px; }
.post-content a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.post-content a:hover { color: var(--primary-dark); }
.post-content strong { font-weight: 700; color: var(--secondary); }
.post-content code {
    background: var(--code-bg);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.88em;
    color: var(--code-color);
}
.post-content pre { background: var(--pre-bg); color: var(--pre-color); padding: 20px; border-radius: var(--radius); overflow-x: auto; margin-bottom: 20px; font-size: 0.88rem; line-height: 1.6; }
.post-content pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
.post-content img { border-radius: var(--radius-sm); margin: 24px 0; box-shadow: var(--shadow-md); }
.post-content blockquote {
    border-left: 4px solid var(--primary);
    padding: 12px 20px;
    margin: 20px 0;
    background: var(--primary-light);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-light);
    font-style: italic;
}

/* ===== Post Disclaimer & Download ===== */
.post-disclaimer {
    margin-top: 28px;
    padding: 14px 18px;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: #92400e;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.6;
}
[data-theme="dark"] .post-disclaimer {
    background: #1a1508;
    border-color: #3d2e0e;
    color: #d4a73a;
}
.post-disclaimer i { flex-shrink: 0; margin-top: 3px; }

.post-download { margin-top: 16px; }

/* ===== Featured Image Sizing ===== */
.post-featured-image {
    margin: 28px 0;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.post-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    font-size: 0.88rem;
    color: var(--text-light);
}
.tag {
    display: inline-block;
    padding: 4px 12px;
    background: #f1f5f9;
    color: var(--text-light) !important;
    border-radius: 999px;
    font-size: 0.82rem;
    transition: var(--transition);
}
.tag:hover { background: var(--primary-light); color: var(--primary) !important; }

/* Post Nav */
.post-nav {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
.post-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
    color: var(--text);
    max-width: 48%;
}
.post-nav a:hover { border-color: var(--primary); color: var(--primary); box-shadow: var(--shadow-md); }
.post-nav a span { font-size: 0.88rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-nav-prev { text-align: left; }
.post-nav-next { text-align: right; }
.post-nav-prev i, .post-nav-next i { flex-shrink: 0; }

/* ===== Comments ===== */
.comments-section { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--border); }
.comments-section h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: 24px; }
.comments-section h2 i { margin-right: 8px; }

.comment {
    display: flex;
    gap: 14px;
    margin-bottom: 20px;
}
.comment-avatar { flex-shrink: 0; }
.comment-avatar i { font-size: 2rem; color: var(--text-muted); }
.comment-body { flex: 1; }
.comment-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.comment-meta strong { font-size: 0.9rem; }
.comment-meta span { font-size: 0.8rem; color: var(--text-muted); }
.comment-body p { font-size: 0.92rem; line-height: 1.6; color: var(--text-light); margin-bottom: 8px; }
.reply-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.82rem;
    cursor: pointer;
    transition: var(--transition);
    padding: 2px 8px;
    border-radius: 4px;
}
.reply-btn:hover { color: var(--primary); background: var(--primary-light); }

.replies {
    margin-left: 24px;
    margin-top: 16px;
    padding-left: 16px;
    border-left: 2px solid var(--border);
}

.no-comments { text-align: center; padding: 32px; color: var(--text-muted); font-size: 0.95rem; }

.comment-form {
    margin-top: 32px;
    padding: 28px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.comment-form h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 20px; }
.comment-form h3 i { margin-right: 6px; }

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

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}
.required { color: #ef4444; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.93rem;
    font-family: var(--font);
    background: var(--input-bg);
    color: var(--text);
    transition: var(--transition);
    outline: none;
}
input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
textarea { resize: vertical; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none !important;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-secondary { background: var(--border-light); color: var(--text); }
.btn-secondary:hover { background: var(--border); }
.btn-block { width: 100%; justify-content: center; }
.btn-small {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.82rem;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}
.btn-small:hover { border-color: var(--primary); color: var(--primary); }
.btn-edit:hover { border-color: #f59e0b; color: #f59e0b; }
.btn-delete:hover { border-color: #ef4444; color: #ef4444; }
.btn-view:hover { border-color: #10b981; color: #10b981; }

/* ===== Admin Layout ===== */
.admin-layout {
    display: flex;
    min-height: calc(100vh - 64px);
    padding-top: 64px;
}

.admin-sidebar {
    width: 240px;
    background: var(--secondary);
    color: #fff;
    padding: 28px 20px;
    position: fixed;
    top: 64px;
    left: 0;
    bottom: 0;
    overflow-y: auto;
}
.admin-sidebar h2 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 24px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 8px;
}
.admin-sidebar ul { list-style: none; }
.admin-sidebar ul li { margin-bottom: 2px; }
.admin-sidebar ul li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: rgba(255,255,255,0.7);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    transition: var(--transition);
}
.admin-sidebar ul li a:hover { background: rgba(255,255,255,0.1); color: #fff; }
.admin-sidebar ul li a.active { background: rgba(255,255,255,0.15); color: #fff; font-weight: 600; }

.admin-main {
    flex: 1;
    margin-left: 240px;
    padding: 32px;
    min-height: 100vh;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}
.admin-header h1 { font-size: 1.6rem; font-weight: 700; }
.admin-header p { color: var(--text-light); font-size: 0.9rem; }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    font-size: 1.3rem;
}
.stat-info { display: flex; flex-direction: column; }
.stat-num { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stat-lbl { font-size: 0.82rem; color: var(--text-light); }

/* Admin Grid */
.admin-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}
.admin-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.admin-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.admin-card h3:not(.admin-card-header h3) { margin-bottom: 16px; }

/* Tables */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.admin-table th, .admin-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border-light); }
.admin-table th { font-weight: 600; color: var(--text-light); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.5px; }
.admin-table tr:hover td { background: #f8fafc; }
.admin-table-full { width: 100%; }
.action-cell { white-space: nowrap; display: flex; gap: 6px; }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}
.badge-published { background: #dcfce7; color: #16a34a; }
.badge-draft { background: #fef3c7; color: #d97706; }
.badge-approved { background: #dcfce7; color: #16a34a; }
.badge-pending { background: #fef3c7; color: #d97706; }
.badge-rejected { background: #fee2e2; color: #dc2626; }

/* Alerts */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.alert-success { background: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }

/* ===== About Page ===== */
.about-page { padding: 48px 0; max-width: 800px; }
.about-card {
    text-align: center;
    padding: 48px 32px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    margin-bottom: 32px;
}
.about-avatar i { font-size: 5rem; color: var(--primary-light); margin-bottom: 16px; }
.about-card h2 { font-size: 1.6rem; font-weight: 700; margin-bottom: 16px; }
.about-card p { color: var(--text-light); line-height: 1.8; margin-bottom: 12px; max-width: 600px; margin-left: auto; margin-right: auto; }
.about-social {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
}
.about-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--border-light);
    color: var(--text-light);
    font-size: 1.2rem;
    transition: var(--transition);
}
.about-social a:hover { background: var(--primary); color: #fff; transform: translateY(-3px); }

.about-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
}
.stat-item {
    text-align: center;
    padding: 24px 32px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    min-width: 120px;
}
.stat-number { display: block; font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 0.85rem; color: var(--text-light); margin-top: 4px; }

/* ===== Search ===== */
.search-large {
    display: flex;
    max-width: 500px;
    margin: 32px auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.search-large input {
    flex: 1;
    border: none;
    padding: 14px 18px;
    font-size: 1rem;
    outline: none;
}
.search-large button {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0 24px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
}
.search-large button:hover { background: var(--primary-dark); }

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-light);
}
.empty-state i { font-size: 3rem; color: var(--text-muted); margin-bottom: 16px; display: block; }
.empty-state h2 { font-size: 1.3rem; margin-bottom: 8px; color: var(--text); }

/* ===== Post Form (Admin) ===== */
.post-form { max-width: 900px; }
.post-form hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.post-form h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 16px; }

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    background: var(--border-light);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.editor-toolbar button {
    padding: 6px 12px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
    font-family: var(--font);
}
.editor-toolbar button:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

#content { border-radius: 0 0 var(--radius-sm) var(--radius-sm); font-family: var(--font-mono); font-size: 0.88rem; line-height: 1.6; }

.form-actions { display: flex; gap: 12px; margin-top: 24px; }

.tag-checkboxes { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--border-light);
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
    user-select: none;
}
.tag-checkbox:hover { background: var(--primary-light); }
.tag-checkbox input[type="checkbox"] { accent-color: var(--primary); }
.tag-checkbox:has(input:checked) { background: var(--primary-light); border: 1px solid var(--primary); }

/* ===== Scroll to Top ===== */
.scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: var(--transition);
    z-index: 99;
}
.scroll-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.scroll-top:hover { background: var(--primary-dark); transform: translateY(-3px); box-shadow: var(--shadow-lg); }

/* ===== Footer ===== */
.footer {
    background: var(--footer-bg);
    color: rgba(255,255,255,0.7);
    padding: 56px 0 0;
    position: relative;
    overflow: hidden;
}
.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #7c3aed, #ec4899);
}
.footer-container {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    padding-bottom: 40px;
}
.footer-col:first-child { max-width: 300px; }
.footer-col h3 {
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    opacity: 0.8;
}
.footer-col p { font-size: 0.88rem; line-height: 1.8; opacity: 0.6; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul li a {
    color: rgba(255,255,255,0.5);
    font-size: 0.88rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.footer-col ul li a:hover { color: #fff; transform: translateX(4px); }
.footer-col ul li a::before { content: '›'; font-size: 1.1rem; }

.footer-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.footer-tags .tag {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.5) !important;
    font-size: 0.78rem;
}
.footer-tags .tag:hover { background: var(--primary); color: #fff !important; }

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 20px 0;
    text-align: center;
}
.footer-bottom p { font-size: 0.82rem; opacity: 0.35; letter-spacing: 0.3px; }

/* ===== Reading Progress Bar ===== */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #7c3aed);
    z-index: 1001;
    width: 0;
    transition: width 0.1s linear;
}

/* ===== Navbar Logo Image ===== */
.nav-logo-img { height: 32px; width: auto; display: block; }
.nav-logo { display: flex; align-items: center; gap: 8px; }

/* ===== Navbar Shrink ===== */
.navbar.scrolled { height: 56px; box-shadow: var(--shadow-md); }

/* ===== Scroll Reveal Animation ===== */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Hero Title Typewriter ===== */
.hero-title {
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid var(--primary);
    animation: typing 1.5s steps(20) forwards, blink-caret 0.75s step-end 3;
    width: 0;
    display: inline-block;
}
@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}
@keyframes blink-caret {
    50% { border-color: transparent }
}

/* ===== Hero Floating Particles ===== */
.hero-particles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.hero-particle {
    position: absolute;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0.15;
    animation: float-particle linear infinite;
}
@keyframes float-particle {
    0% { transform: translateY(100%) scale(0); opacity: 0; }
    20% { opacity: 0.2; }
    80% { opacity: 0.15; }
    100% { transform: translateY(-100vh) scale(1); opacity: 0; }
}

/* ===== Code Copy Button ===== */
.code-block-wrap {
    position: relative;
    margin-bottom: 20px;
}
.code-block-wrap pre { margin-bottom: 0; }
.code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    opacity: 0;
    font-family: var(--font);
}
.code-block-wrap:hover .code-copy-btn { opacity: 1; }
.code-copy-btn:hover { background: rgba(255,255,255,0.2); color: #fff; }
.code-copy-btn.copied { background: #16a34a; color: #fff; border-color: #16a34a; }

/* ===== Lightbox ===== */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0,0,0,0.9);
    justify-content: center;
    align-items: center;
    padding: 40px;
    cursor: zoom-out;
}
.lightbox.active { display: flex; }
.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}
.lightbox.active .lightbox-content { transform: scale(1); }
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 2.2rem;
    color: #fff;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    line-height: 1;
}
.lightbox-close:hover { opacity: 1; }
.lightbox-trigger { cursor: zoom-in; transition: var(--transition); }
.lightbox-trigger:hover { opacity: 0.9; }

/* ===== Toast Notification ===== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 0.88rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 360px;
}
.toast.show { transform: translateX(0); }
.toast-success { background: #16a34a; }
.toast-error { background: #dc2626; }
.toast-info { background: var(--primary); }

/* ===== Stat Counter Animation ===== */
.stat-number { opacity: 0; }
.stat-number.animated { animation: countFadeIn 0.6s ease forwards; }
@keyframes countFadeIn {
    to { opacity: 1; }
}

/* ===== Live Comment Preview ===== */
.comment-preview {
    padding: 16px;
    background: var(--border-light);
    border-radius: var(--radius-sm);
    margin-top: 8px;
    font-size: 0.88rem;
    color: var(--text-light);
    display: none;
    border: 1px dashed var(--border);
}
.comment-preview.show { display: block; }
.comment-preview strong { font-size: 0.82rem; color: var(--text); }

/* ===== Smooth Image Loading ===== */
.post-entry-img img, .post-featured-image img {
    background: var(--border-light);
}
.post-entry-img img.loaded, .post-featured-image img.loaded {
    background: transparent;
}

/* ===== Login Page ===== */
.login-page {
    background: var(--hero-bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
}
.login-header {
    text-align: center;
    margin-bottom: 32px;
}
.login-header i { font-size: 2.5rem; color: var(--primary); margin-bottom: 12px; }
.login-header h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; }
.login-header p { font-size: 0.9rem; color: var(--text-light); }
.login-form .form-group { margin-bottom: 20px; }
.login-form label { display: flex; align-items: center; gap: 6px; }
.login-footer { text-align: center; margin-top: 20px; }
.login-footer a { font-size: 0.88rem; color: var(--text-light); display: inline-flex; align-items: center; gap: 6px; }
.login-footer a:hover { color: var(--primary); }

/* ===== Theme Toggle ===== */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: var(--border-light);
    color: var(--text);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
}
.theme-toggle:hover { background: var(--primary-light); color: var(--primary); }

/* ===== Content With Sidebar ===== */
.content-with-sidebar {
    display: flex;
    gap: 28px;
    align-items: flex-start;
}
.content-main { flex: 1; min-width: 0; }
.content-sidebar {
    flex: 0 0 260px;
    width: 260px;
    position: sticky;
    top: 88px;
}

.sidebar-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}
.sidebar-card h3 {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Tag Cloud */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.tag-cloud-item {
    display: inline-block;
    padding: 3px 10px;
    background: var(--border-light);
    color: var(--text-light) !important;
    border-radius: 999px;
    font-weight: 500;
    transition: var(--transition);
    line-height: 1.4;
}
.tag-cloud-item:hover { background: var(--primary); color: #fff !important; transform: translateY(-1px); }

/* Sidebar Categories */
.sidebar-cats { list-style: none; }
.sidebar-cats li { margin-bottom: 2px; }
.sidebar-cats li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.88rem;
    color: var(--text);
    transition: var(--transition);
}
.sidebar-cats li a:hover { background: var(--border-light); color: var(--primary); }
.sidebar-cats li a span {
    font-size: 0.78rem;
    color: var(--text-muted);
    background: var(--border-light);
    padding: 1px 8px;
    border-radius: 999px;
}

/* Sidebar Quote */
.sidebar-quote blockquote {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text);
    font-style: italic;
    margin-bottom: 8px;
    quotes: none;
}
.sidebar-quote blockquote::before { content: '\201C'; font-size: 1.5rem; color: var(--primary); margin-right: 4px; }
.sidebar-quote blockquote::after { content: '\201D'; font-size: 1.5rem; color: var(--primary); margin-left: 4px; }
.sidebar-quote cite {
    font-size: 0.82rem;
    color: var(--text-muted);
    display: block;
    text-align: right;
}
.sidebar-quote cite::before { content: '—— '; }

/* ===== Responsive ===== */
@media (max-width: 968px) {
    .admin-sidebar { width: 200px; }
    .admin-main { margin-left: 200px; }
    .admin-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .nav-toggle { display: flex; }
    .nav-menu {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--bg-card);
        backdrop-filter: blur(16px);
        flex-direction: column;
        padding: 16px;
        border-bottom: 1px solid var(--border);
        display: none;
    }
    .nav-menu.active { display: flex; }
    .dropdown-menu {
        position: static;
        opacity: 1;
        pointer-events: auto;
        transform: none;
        box-shadow: none;
        border: none;
        padding: 0 0 0 16px;
        display: none;
    }
    .nav-dropdown.open .dropdown-menu { display: block; }
    .search-form { width: 100%; }
    .search-form input { width: 100%; }

    .hero h1 { font-size: 2rem; }
    .hero { padding: 100px 0 40px; }

    .content-with-sidebar { flex-direction: column; }
    .content-sidebar { flex: none; width: 100%; position: static; }

    .posts-list { grid-template-columns: 1fr; padding: 24px 0; gap: 14px; }

    .post-entry-body { padding: 14px 16px; }
    .post-entry-title { font-size: 1rem; }
    .post-entry-img { height: 180px; }

    .single-post { padding: 80px 16px 40px; }
    .post-header h1 { font-size: 1.6rem; }
    .post-content { font-size: 1rem; }

    .form-row { grid-template-columns: 1fr; }

    .admin-layout { flex-direction: column; }
    .admin-sidebar { position: relative; top: 0; width: 100%; padding: 16px 20px; }
    .admin-sidebar ul { display: flex; flex-wrap: wrap; gap: 4px; }
    .admin-sidebar ul li a { padding: 8px 12px; font-size: 0.82rem; }
    .admin-main { margin-left: 0; padding: 20px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    .about-stats { flex-direction: column; align-items: center; gap: 16px; }

    .post-nav { flex-direction: column; }
    .post-nav a { max-width: 100%; }

    .footer-container { grid-template-columns: 1fr 1fr; gap: 24px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .footer-container { grid-template-columns: 1fr; gap: 20px; }
    .hero h1 { font-size: 1.6rem; }
    .posts-list { grid-template-columns: 1fr; padding: 16px 0; gap: 12px; }
    .post-entry-img { height: 150px; }
    .post-entry-body { padding: 12px 14px; }
    .post-entry-title { font-size: 0.95rem; }
    .post-entry-excerpt { font-size: 0.82rem; }
}
