/* ============================================
   BLOG CÁ NHÂN - STYLE CHÍNH
   Theme: Navy tối làm chủ đạo, chuyển được sang sáng
============================================ */

:root {
    --bg: #f7f8fb;
    --surface: #ffffff;
    --text: #1b2333;
    --text-muted: #5b6577;
    --border: #e4e7ee;
    --accent: #3457d5;
    --accent-soft: #e8edfd;
    --radius: 14px;
    --shadow: 0 4px 20px rgba(20, 25, 40, 0.06);
    --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;
}

[data-theme="dark"] {
    --bg: #0b0f19;
    --surface: #131a29;
    --text: #e7ebf5;
    --text-muted: #8b93a7;
    --border: #232c40;
    --accent: #5b7cfa;
    --accent-soft: #1b2440;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.7;
    transition: background .25s ease, color .25s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    max-width: 880px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ---------- Header ---------- */
.site-header {
    border-bottom: 1px solid var(--border);
    padding: 22px 0;
    position: sticky;
    top: 0;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(10px);
    z-index: 10;
}
.site-header .row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand {
    font-weight: 800;
    font-size: 1.3rem;
    letter-spacing: -0.02em;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.brand span { color: var(--accent); font-family: var(--font-mono); }
.brand:hover { text-decoration: none; }

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

.theme-toggle {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    width: 38px; height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
}
.theme-toggle:hover { border-color: var(--accent); }

.admin-link {
    font-size: 0.85rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 7px 14px;
    border-radius: 20px;
}
.admin-link:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }

/* ---------- Hero ---------- */
.hero {
    padding: 56px 0 30px;
    text-align: center;
}
.hero h1 {
    font-size: 2.4rem;
    margin: 0 0 10px;
    letter-spacing: -0.03em;
}
.hero p { color: var(--text-muted); margin: 0; font-size: 1.05rem; }

/* ---------- Search ---------- */
.search-box {
    max-width: 480px;
    margin: 26px auto 0;
    position: relative;
}
.search-box input {
    width: 100%;
    padding: 13px 18px 13px 42px;
    border-radius: 30px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
}
.search-box input:focus { border-color: var(--accent); }
.search-box::before {
    content: "⌕";
    position: absolute;
    left: 18px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* ---------- Post list ---------- */
.post-grid { padding: 30px 0 60px; display: flex; flex-direction: column; gap: 22px; }

.post-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform .18s ease, box-shadow .18s ease;
    display: flex;
    gap: 20px;
}
.post-card:hover { transform: translateY(-3px); }

.post-card .thumb {
    flex: 0 0 220px;
    background: var(--accent-soft);
}
.post-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; min-height: 160px; }
.post-card .thumb.empty {
    display: flex; align-items: center; justify-content: center;
    color: var(--accent); font-family: var(--font-mono); font-size: 1.6rem;
    min-height: 160px;
}

.post-card .body { padding: 20px 20px 20px 0; flex: 1; min-width: 0; }
.post-card .meta { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 8px; font-family: var(--font-mono); }
.post-card h2 { margin: 0 0 10px; font-size: 1.3rem; line-height: 1.35; }
.post-card h2 a { color: var(--text); }
.post-card h2 a:hover { color: var(--accent); text-decoration: none; }
.post-card p { color: var(--text-muted); margin: 0; font-size: 0.95rem; }
.post-card .read-more { display: inline-block; margin-top: 10px; font-size: 0.85rem; font-weight: 600; }

@media (max-width: 640px) {
    .post-card { flex-direction: column; }
    .post-card .thumb { flex: none; }
    .post-card .body { padding: 16px; }
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

/* ---------- Pagination ---------- */
.pagination { display: flex; justify-content: center; gap: 8px; padding-bottom: 60px; }
.pagination a, .pagination span {
    min-width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.9rem;
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pagination .current { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination .disabled { opacity: 0.35; pointer-events: none; }

/* ---------- Single post ---------- */
.post-header { padding: 50px 0 20px; }
.post-header .meta { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.85rem; margin-bottom: 14px; }
.post-header h1 { font-size: 2.2rem; line-height: 1.3; margin: 0 0 6px; letter-spacing: -0.02em; }
.post-cover { margin: 20px 0 10px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.post-cover img { width: 100%; max-height: 460px; object-fit: cover; display: block; }

.post-content { padding: 20px 0 60px; font-size: 1.08rem; }
.post-content img { max-width: 100%; border-radius: 10px; }
.post-content h2, .post-content h3 { margin-top: 1.6em; }
.post-content p { margin: 1.1em 0; }
.post-content blockquote {
    border-left: 3px solid var(--accent);
    margin: 1.4em 0; padding: 4px 20px;
    color: var(--text-muted); font-style: italic;
}
.post-content pre {
    background: var(--accent-soft); padding: 16px; border-radius: 10px; overflow-x: auto;
    font-family: var(--font-mono); font-size: 0.9rem;
}

.back-link { display: inline-block; margin-bottom: 6px; font-size: 0.9rem; color: var(--text-muted); }
.back-link:hover { color: var(--accent); text-decoration: none; }

.post-footer {
    border-top: 1px solid var(--border);
    padding: 26px 0 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 26px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.site-footer .heart { color: #e0507a; }

/* ---------- Flash messages ---------- */
.flash {
    max-width: 880px;
    margin: 18px auto 0;
    padding: 13px 18px;
    border-radius: 10px;
    font-size: 0.92rem;
}
.flash.success { background: #e5f8ed; color: #1c7c3f; border: 1px solid #b7ecc9; }
.flash.error { background: #fdeceb; color: #c0392b; border: 1px solid #f6c6c1; }
[data-theme="dark"] .flash.success { background: #123322; color: #7fe3a4; border-color: #1e4d31; }
[data-theme="dark"] .flash.error { background: #3a1c1c; color: #ff8a80; border-color: #5c2626; }
