:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --text: #1f2937;
    --muted: #6b7280;
    --bg: #f9fafb;
    --card: #ffffff;
    --border: #e5e7eb;
    --danger: #dc2626;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
}
.logo {
    font-size: 1.4rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--text);
}
.logo span { color: var(--primary); }
nav a {
    margin-left: 18px;
    text-decoration: none;
    color: var(--muted);
    font-weight: 500;
}
nav a:hover { color: var(--primary); }

/* Hero / search */
.hero {
    text-align: center;
    padding: 48px 0 24px;
}
.hero h1 { margin-bottom: 4px; }
.hero p { color: var(--muted); margin-top: 0; }
#searchBox {
    width: 100%;
    max-width: 420px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 1rem;
    margin-top: 16px;
}
#searchBox:focus {
    outline: none;
    border-color: var(--primary);
}

/* Post grid */
.post-grid {
    display: grid;
    gap: 20px;
    padding: 24px 0 60px;
}
.post-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: box-shadow 0.15s ease;
}
.post-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.06); }
.post-card h2 { margin: 0 0 6px; }
.post-card h2 a { color: var(--text); text-decoration: none; }
.post-card h2 a:hover { color: var(--primary); }
.meta { color: var(--muted); font-size: 0.9rem; margin: 4px 0 12px; }
.read-more {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* Single post */
.single-post { padding: 32px 0 16px; }
.single-post h1 { margin-bottom: 4px; }
.post-content { margin: 24px 0; font-size: 1.05rem; }
.post-content img { max-width: 100%; border-radius: var(--radius); }

#likeBtn, .btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
#likeBtn:hover, .btn:hover { background: var(--primary-dark); }
#likeBtn.liked { background: #16a34a; }
.admin-actions { margin-top: 16px; display: flex; gap: 10px; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }

/* Comments */
.comments { padding: 32px 0 60px; border-top: 1px solid var(--border); margin-top: 24px; }
.comment-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 500px;
    margin: 16px 0 28px;
}
.comment-form input, .comment-form textarea {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
}
.comment-form button {
    align-self: flex-start;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 999px;
    cursor: pointer;
}
.comment-list { list-style: none; padding: 0; }
.comment-list li {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 12px;
}
.comment-list .meta { margin: 2px 0 8px; font-size: 0.82rem; }

/* Forms (login / post form) */
.auth-form, .post-form {
    max-width: 560px;
    margin: 40px auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
}
.auth-form label, .post-form label {
    display: block;
    margin: 14px 0 6px;
    font-weight: 600;
    font-size: 0.9rem;
}
.auth-form input, .post-form input, .post-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
}
.auth-form button, .post-form button {
    margin-top: 20px;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
}
.auth-form button:hover, .post-form button:hover { background: var(--primary-dark); }
.error { color: var(--danger); font-weight: 600; }
.hint { color: var(--muted); font-size: 0.85rem; margin-top: 10px; }

/* Admin dashboard */
.dashboard { padding: 32px 0 60px; }
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.admin-table th, .admin-table td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
}
.admin-table th { background: #f3f4f6; }
.admin-table a { color: var(--primary); text-decoration: none; margin-right: 6px; }

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

@media (max-width: 600px) {
    .header-inner { flex-direction: column; gap: 10px; }
    .dashboard-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .admin-table { display: block; overflow-x: auto; }
}
