:root {
    --bg: #f4f5f7;
    --card-bg: #ffffff;
    --text: #232323;
    --muted: #737373;
    --border: #e6e6ea;
    --primary: #2b93ff;
    --primary-dark: #1b7ce0;
    --like: #ff4d6d;
    --header-bg: #1b1c22;
    --header-text: #ffffff;
    --radius: 12px;
}

* { 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.55;
}

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

/* Header */
.site-header {
    background: var(--header-bg);
    color: var(--header-text);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 6px rgba(0,0,0,.15);
}
.site-header-inner {
    max-width: 680px;
    margin: 0 auto;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.site-header .brand {
    color: #fff;
    font-weight: 800;
    font-size: 20px;
    letter-spacing: -0.5px;
}
.site-header .brand:hover { text-decoration: none; }
.site-nav { display: flex; gap: 14px; align-items: center; }
.site-nav a { color: #d6d6e0; font-size: 14px; }
.site-nav a:hover { color: #fff; text-decoration: none; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 9px 18px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-ghost { background: transparent; border: 1px solid rgba(255,255,255,.3); color: inherit; }
.btn-ghost.back-link { display: inline-block; margin: 24px auto; border-color: var(--border); color: var(--text); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-danger { background: #e6435a; color: #fff; }

/* Main / Feed */
.site-main {
    max-width: 680px;
    margin: 24px auto 60px;
    padding: 0 16px;
}

.feed { display: flex; flex-direction: column; gap: 20px; }

.post-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.post-link-wrap { display: block; color: inherit; padding: 20px 20px 6px; }
.post-link-wrap:hover { text-decoration: none; }
.post-title { margin: 0 0 10px; font-size: 20px; font-weight: 800; color: var(--text); }
.post-excerpt { color: var(--text); font-size: 15px; white-space: pre-line; }
.post-media { margin: 0 -20px 10px; }
.post-media img, .post-media video { width: 100%; display: block; max-height: 520px; object-fit: cover; }
.video-embed { position: relative; padding-bottom: 56.25%; height: 0; margin: 0 -20px 10px; overflow: hidden; }
.video-embed iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }

.post-meta {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 20px; font-size: 12.5px; color: var(--muted);
}
.post-meta-left { display: flex; align-items: center; gap: 6px; }
.post-author { font-weight: 600; color: #4a4a52; }
.post-date-lg .post-author { color: #4a4a52; }
.dot { opacity: .6; }
.post-type-tag {
    background: var(--bg); padding: 2px 10px; border-radius: 999px; font-weight: 600;
}

/* ===== Action bar (like / comment / share) ===== */
.post-actions {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 16px; border-top: 1px solid var(--border); margin-top: 14px;
}
.post-actions-lg { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 20px 0; padding: 14px 0; gap: 10px; }

.action-btn {
    display: inline-flex; align-items: center; gap: 7px;
    background: var(--bg); border: 1px solid transparent; cursor: pointer;
    padding: 9px 16px; border-radius: 999px; color: #55555c; font-size: 13.5px; font-weight: 700;
    transition: background .15s ease, color .15s ease, border-color .15s ease, transform .1s ease;
}
.action-btn:hover { background: #eceef2; border-color: var(--border); text-decoration: none; color: #2a2a2e; }
.action-btn:active { transform: scale(0.96); }
.action-btn .icon { display: inline-flex; line-height: 0; }
.action-btn .icon svg { display: block; }
.action-btn .count { min-width: 8px; text-align: left; }

/* Like button: outline heart by default, filled red heart when liked */
.like-btn .icon-filled { display: none; }
.like-btn.liked { background: #ffe3e9; color: var(--like); }
.like-btn.liked:hover { background: #ffd3dd; color: var(--like); }
.like-btn.liked .icon-outline { display: none; }
.like-btn.liked .icon-filled { display: inline-flex; color: var(--like); }
.like-btn.pulse { animation: pulse .35s ease; }
@keyframes pulse { 0% { transform: scale(1);} 40% { transform: scale(1.18);} 100% { transform: scale(1);} }

/* Comment button */
.post-actions a.action-btn { color: #55555c; }

/* Share button + dropdown menu */
.share-wrap { position: relative; }
.share-btn.share-active { background: #e3f0ff; color: var(--primary-dark); }
.share-menu {
    display: none; position: absolute; bottom: 46px; left: 0;
    background: #fff; border: 1px solid var(--border); border-radius: 12px;
    box-shadow: 0 10px 30px rgba(20,20,30,.14); min-width: 190px; z-index: 10; overflow: hidden;
    padding: 6px;
}
.share-menu.open { display: block; animation: pop-in .12s ease; }
@keyframes pop-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.share-option {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 12px; font-size: 14px; color: var(--text); border-radius: 8px; font-weight: 600;
}
.share-option:hover { background: var(--bg); text-decoration: none; }

.pagination {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 24px; font-size: 14px; color: var(--muted);
}

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

/* Post detail */
.post-detail { background: var(--card-bg); border-radius: var(--radius); border: 1px solid var(--border); padding: 24px; margin-bottom: 20px; }
.post-title-lg { font-size: 28px; font-weight: 800; margin: 0 0 6px; }
.post-date-lg { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.post-detail .post-media { margin: 0 -24px 16px; }
.post-detail .video-embed { margin: 0 -24px 16px; }
.post-content { font-size: 16px; white-space: pre-line; }

/* Comments */
.comments-section { background: var(--card-bg); border-radius: var(--radius); border: 1px solid var(--border); padding: 24px; }
.comments-section h3 { margin-top: 0; }
.comment-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.comment-form input, .comment-form textarea, .auth-form input, .admin-form input, .admin-form textarea, .admin-form select {
    padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; width: 100%;
}
.comment-list { display: flex; flex-direction: column; gap: 14px; }
.comment-item { border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.comment-item:last-child { border-bottom: none; }
.comment-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.comment-date { font-size: 12px; color: var(--muted); }
.comment-body { font-size: 14.5px; }

.muted { color: var(--muted); }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert-success { background: #e6f9ee; color: #16794a; }
.alert-error { background: #fdeaec; color: #c22a3f; }
.alert-info { background: #eaf3ff; color: #1b5faa; }

/* Auth pages */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--header-bg); }
.auth-box { background: #fff; padding: 36px; border-radius: var(--radius); width: 100%; max-width: 380px; }
.auth-box .brand { text-align: center; display: block; margin-bottom: 4px; font-size: 24px; font-weight: 800; color: var(--text); }
.auth-form, .admin-form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.auth-form label, .admin-form label { font-size: 13px; font-weight: 600; color: var(--text); display: flex; flex-direction: column; gap: 6px; }
.auth-form .btn, .admin-form .btn { margin-top: 6px; }

.site-footer { text-align: center; color: var(--muted); font-size: 13px; padding: 30px 16px; }

@media (max-width: 480px) {
    .post-title-lg { font-size: 22px; }
    .site-main { margin-top: 12px; }
}
