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

:root {
    --bg:          #0d0f1a;
    --surface:     #151726;
    --surface2:    #1b1e31;
    --border:      #252840;
    --text:        #e8eaf0;
    --text-muted:  #7880a0;
    --accent:      #5b6df8;
    --accent-dim:  #3d4db5;
    --green:       #22c55e;
    --orange:      #f59e0b;
    --red:         #ef4444;
    --blue:        #3b82f6;
    --radius:      12px;
    --radius-sm:   8px;
    --shadow:      0 4px 24px rgba(0,0,0,.35);
}

html { scroll-behavior: smooth; }

body {
    background:  var(--bg);
    color:       var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size:   15px;
    line-height: 1.6;
    min-height:  100vh;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
img { max-width: 100%; border-radius: var(--radius-sm); }

/* ── Navbar ──────────────────────────────────────────────────────────────── */
.navbar {
    display:         flex;
    align-items:     center;
    gap:             1.5rem;
    padding:         0 1.5rem;
    height:          58px;
    background:      var(--surface);
    border-bottom:   1px solid var(--border);
    position:        sticky;
    top:             0;
    /* Navbar must sit above overlay (200) and drawer (300) so
       the hamburger button is always tappable */
    z-index:         400;
}

.logo {
    font-size:   1.3rem;
    font-weight: 700;
    color:       var(--accent);
    letter-spacing: -0.5px;
    flex-shrink: 0;
}

.nav-links { display: flex; gap: 0.25rem; }
.nav-link {
    padding:       6px 14px;
    border-radius: 6px;
    color:         var(--text-muted);
    font-size:     0.9rem;
    transition:    background 0.15s, color 0.15s;
}
.nav-link:hover,
.nav-link.active { background: var(--surface2); color: var(--text); }

.auth-area { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.user-greeting { color: var(--text-muted); font-size: 0.9rem; }

/* Logged-in user pill in navbar */
.nav-user { display: flex; align-items: center; gap: 0.5rem; }
.nav-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    flex-shrink: 0;
}
.nav-avatar-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    display:       inline-flex;
    align-items:   center;
    gap:           0.4rem;
    padding:       8px 18px;
    border-radius: var(--radius-sm);
    border:        none;
    font-size:     0.9rem;
    font-weight:   500;
    transition:    background 0.15s, transform 0.1s;
    background:    var(--surface2);
    color:         var(--text);
}
.btn:hover           { background: var(--border); transform: translateY(-1px); }
.btn-primary         { background: var(--accent); color: #fff; }
.btn-primary:hover   { background: var(--accent-dim); }
.btn-secondary       { background: var(--surface2); }
.btn-sm              { padding: 5px 12px; font-size: 0.82rem; }
.btn-outline         { background: transparent; border: 1px solid var(--border); }
.btn-outline:hover   { background: var(--surface2); }

/* ── Container ───────────────────────────────────────────────────────────── */
.container {
    max-width: 900px;
    margin:    0 auto;
    padding:   2rem 1.25rem 4rem;
}

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.5px; }
.subtitle { color: var(--text-muted); margin-top: 0.25rem; }

/* ── Search bar ──────────────────────────────────────────────────────────── */
.search-bar {
    display:       flex;
    gap:           0.5rem;
    margin-bottom: 1rem;
}
.search-bar input {
    flex:          1;
    padding:       10px 16px;
    border:        1px solid var(--border);
    border-radius: var(--radius-sm);
    background:    var(--surface2);
    color:         var(--text);
    font-size:     0.95rem;
    outline:       none;
    transition:    border-color 0.2s;
}
.search-bar input:focus { border-color: var(--accent); }
.btn-search { padding: 10px 22px; }

/* ── Filter section labels ───────────────────────────────────────────────── */
.filter-label {
    font-size:   0.75rem;
    font-weight: 600;
    color:       var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin:      0.75rem 0 0.4rem;
}

/* ── Country filter buttons ──────────────────────────────────────────────── */
.country-filters {
    display:       flex;
    flex-wrap:     wrap;
    gap:           0.5rem;
    margin-bottom: 0.5rem;
}
.country-filter {
    padding:       6px 14px;
    border-radius: 20px;
    border:        1px solid var(--border);
    background:    var(--surface2);
    color:         var(--text-muted);
    font-size:     0.85rem;
    transition:    all 0.15s;
}
.country-filter:hover  { border-color: var(--accent); color: var(--text); }
.country-filter.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Category filter buttons ─────────────────────────────────────────────── */
.category-filters {
    display:       flex;
    flex-wrap:     wrap;
    gap:           0.5rem;
    margin-bottom: 1.5rem;
}
.cat-filter {
    padding:       6px 16px;
    border-radius: 20px;
    border:        1px solid var(--border);
    background:    var(--surface2);
    color:         var(--text-muted);
    font-size:     0.85rem;
    transition:    all 0.15s;
}
.cat-filter:hover  { border-color: var(--accent); color: var(--text); }
.cat-filter.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Feed sections ───────────────────────────────────────────────────────── */
.feed-section { margin-bottom: 3rem; }
.section-heading {
    font-size:     1.3rem;
    font-weight:   700;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    display:       flex;
    align-items:   baseline;
    gap:           0.6rem;
    flex-wrap:     wrap;
}

.section-heading-sub {
    font-size:   0.78rem;
    font-weight: 400;
    color:       var(--text-muted);
    letter-spacing: 0.02em;
}

/* ── Posts grid ──────────────────────────────────────────────────────────── */
.posts-grid { display: flex; flex-direction: column; gap: 1.25rem; }

/* ── Trending rank badge ─────────────────────────────────────────────────── */
.trending-rank {
    font-size:   1.2rem;
    font-weight: 800;
    color:       var(--accent);
    margin-top:  0.25rem;
    line-height: 1;
}

/* ── Post card ───────────────────────────────────────────────────────────── */
.post-card {
    background:    var(--surface);
    border:        1px solid var(--border);
    border-radius: var(--radius);
    padding:       1.25rem;
    transition:    border-color 0.2s, box-shadow 0.2s;
}
.post-card:hover {
    border-color: var(--accent);
    box-shadow:   var(--shadow);
}

/* Card header row */
.post-header {
    display:         flex;
    align-items:     flex-start;
    justify-content: space-between;
    gap:             0.5rem;
    margin-bottom:   0.6rem;
    flex-wrap:       wrap;
}
.post-badges { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }

/* Status badges */
.badge {
    padding:       3px 10px;
    border-radius: 20px;
    font-size:     0.72rem;
    font-weight:   600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-ai       { background: rgba(91,109,248,.2); color: #8b9dff; border: 1px solid rgba(91,109,248,.3); }
.badge-verified { background: rgba(34,197,94,.15);  color: var(--green); border: 1px solid rgba(34,197,94,.3); }
.badge-review   { background: rgba(245,158,11,.15); color: var(--orange); border: 1px solid rgba(245,158,11,.3); }

/* Category mini-badges */
.cat-badge {
    padding:       3px 9px;
    border-radius: 20px;
    font-size:     0.72rem;
    font-weight:   600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
/* Existing categories */
.cat-tech        { background: rgba(59,130,246,.15);  color: #60a5fa; border: 1px solid rgba(59,130,246,.3); }
.cat-politics    { background: rgba(239,68,68,.12);   color: #f87171; border: 1px solid rgba(239,68,68,.3); }
.cat-science     { background: rgba(34,197,94,.12);   color: #4ade80; border: 1px solid rgba(34,197,94,.3); }
.cat-business    { background: rgba(245,158,11,.12);  color: #fbbf24; border: 1px solid rgba(245,158,11,.3); }
.cat-world       { background: rgba(168,85,247,.12);  color: #c084fc; border: 1px solid rgba(168,85,247,.3); }
.cat-health      { background: rgba(236,72,153,.12);  color: #f472b6; border: 1px solid rgba(236,72,153,.3); }
.cat-general     { background: rgba(148,163,184,.12); color: #94a3b8; border: 1px solid rgba(148,163,184,.3); }
/* New categories */
.cat-ai          { background: rgba(99,102,241,.15);  color: #a5b4fc; border: 1px solid rgba(99,102,241,.3); }
.cat-finance     { background: rgba(20,184,166,.12);  color: #2dd4bf; border: 1px solid rgba(20,184,166,.3); }
.cat-stockmarket { background: rgba(16,185,129,.12);  color: #34d399; border: 1px solid rgba(16,185,129,.3); }
.cat-sports      { background: rgba(251,113,133,.12); color: #fb7185; border: 1px solid rgba(251,113,133,.3); }
.cat-startups    { background: rgba(251,191,36,.12);  color: #fbbf24; border: 1px solid rgba(251,191,36,.3); }

/* Country badge */
.country-badge {
    padding:       3px 9px;
    border-radius: 20px;
    font-size:     0.72rem;
    font-weight:   600;
    background:    rgba(99,102,241,.12);
    color:         #a5b4fc;
    border:        1px solid rgba(99,102,241,.3);
}

/* Source trust badge */
.trust-badge {
    padding:       3px 9px;
    border-radius: 20px;
    font-size:     0.72rem;
    font-weight:   600;
}
.trust-high { background: rgba(34,197,94,.12); color: var(--green); border: 1px solid rgba(34,197,94,.3); }
.trust-mid  { background: rgba(245,158,11,.12); color: var(--orange); border: 1px solid rgba(245,158,11,.3); }
.trust-low  { background: rgba(239,68,68,.12); color: var(--red); border: 1px solid rgba(239,68,68,.3); }

.post-time { color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; }

/* Post title */
.post-title {
    font-size:     1.05rem;
    font-weight:   600;
    margin-bottom: 0.5rem;
    line-height:   1.4;
    color:         var(--text);
}

/* Post image — fixed height prevents stretching and keeps cards uniform */
.post-image {
    margin:        0.6rem 0;
    border-radius: 10px;
    overflow:      hidden;
    width:         100%;
    line-height:   0;
}
.post-image img {
    width:         100%;
    height:        240px;
    object-fit:    cover;
    border-radius: 10px;
    display:       block;
    background:    var(--surface2);
}

/* Post body */
.post-content { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.75rem; }

/* Meta row */
.post-meta {
    display:       flex;
    align-items:   center;
    justify-content: space-between;
    gap:           0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap:     wrap;
}
.post-author { color: var(--text-muted); font-size: 0.83rem; }

/* Score + trust badges */
.post-scores { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.credibility-score {
    padding:       3px 9px;
    border-radius: 20px;
    font-size:     0.75rem;
    font-weight:   700;
}
.score-high { background: rgba(34,197,94,.15); color: var(--green); border: 1px solid rgba(34,197,94,.3); }
.score-mid  { background: rgba(245,158,11,.15); color: var(--orange); border: 1px solid rgba(245,158,11,.3); }
.score-low  { background: rgba(239,68,68,.15); color: var(--red); border: 1px solid rgba(239,68,68,.3); }

/* Credibility explanation */
.credibility-explanation {
    font-size:     0.82rem;
    color:         var(--text-muted);
    font-style:    italic;
    border-left:   2px solid var(--border);
    padding-left:  0.75rem;
    margin:        0.5rem 0;
}

/* ── Community vote row ──────────────────────────────────────────────────── */
.vote-row {
    display:       flex;
    flex-wrap:     wrap;
    gap:           0.5rem;
    margin:        0.75rem 0;
}
.vote-btn {
    display:       inline-flex;
    align-items:   center;
    gap:           0.3rem;
    padding:       5px 12px;
    border-radius: 20px;
    border:        1px solid var(--border);
    background:    var(--surface2);
    color:         var(--text-muted);
    font-size:     0.8rem;
    font-weight:   500;
    transition:    all 0.15s;
}
.vote-btn span { font-weight: 700; }
.vote-btn:hover { border-color: var(--accent); color: var(--text); }

.vote-reliable.voted   { background: rgba(34,197,94,.15);  color: var(--green);  border-color: var(--green); }
.vote-misleading.voted { background: rgba(239,68,68,.15);  color: var(--red);    border-color: var(--red); }
.vote-unverified.voted { background: rgba(245,158,11,.15); color: var(--orange); border-color: var(--orange); }

/* ── Post actions (likes, views, source) ─────────────────────────────────── */
.post-actions {
    display:     flex;
    align-items: center;
    gap:         1rem;
    flex-wrap:   wrap;
}
.like-btn {
    display:     inline-flex;
    align-items: center;
    gap:         0.35rem;
    background:  none;
    border:      none;
    color:       var(--text-muted);
    font-size:   0.85rem;
    padding:     4px 0;
    transition:  color 0.15s;
}
.like-btn:hover { color: #f43f5e; }
.like-btn.liked { color: #f43f5e; }
.like-icon { font-size: 1rem; }
.view-count { color: var(--text-muted); font-size: 0.83rem; }
.source-link {
    color:      var(--accent);
    font-size:  0.83rem;
    margin-left: auto;
}
.source-link:hover { text-decoration: underline; }
.no-source { color: var(--text-muted); font-size: 0.83rem; margin-left: auto; }

/* ── States ──────────────────────────────────────────────────────────────── */
.loading     { color: var(--text-muted); padding: 2rem; text-align: center; }
.empty-state { color: var(--text-muted); padding: 2rem; text-align: center; }
.error-state { color: var(--red);        padding: 2rem; text-align: center; }

/* ── Auth pages ──────────────────────────────────────────────────────────── */
.auth-card {
    max-width:     420px;
    margin:        3rem auto;
    background:    var(--surface);
    border:        1px solid var(--border);
    border-radius: var(--radius);
    padding:       2rem;
}
.auth-card h2 { font-size: 1.5rem; margin-bottom: 1.5rem; }
.auth-link { text-align: center; margin-top: 1.25rem; color: var(--text-muted); font-size: 0.9rem; }
.auth-link a { color: var(--accent); }

/* ── Auth page (login / register) ───────────────────────────────────────── */
.auth-container {
    max-width:     420px;
    margin:        3rem auto;
    background:    var(--surface);
    border:        1px solid var(--border);
    border-radius: var(--radius);
    padding:       2rem;
}
.auth-container h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: 1.25rem; }
.auth-form  { margin-bottom: 0.75rem; }
.btn-full   { width: 100%; justify-content: center; }
.auth-switch { color: var(--text-muted); font-size: 0.87rem; margin-top: 0.75rem; text-align: center; }
.auth-switch a { color: var(--accent); }
.error-msg { color: var(--red); font-size: 0.85rem; padding: 0.5rem 0; }

/* Google OAuth button */
.btn-google {
    display:         flex;
    align-items:     center;
    justify-content: center;
    gap:             0.65rem;
    width:           100%;
    padding:         11px 18px;
    border-radius:   var(--radius-sm);
    border:          1px solid var(--border);
    background:      #fff;
    color:           #1f1f1f;
    font-size:       0.95rem;
    font-weight:     500;
    font-family:     inherit;
    cursor:          pointer;
    text-decoration: none;
    transition:      box-shadow 0.15s, transform 0.1s;
    margin-bottom:   1rem;
}
.btn-google:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
    transform:  translateY(-1px);
}
.google-icon { width: 20px; height: 20px; flex-shrink: 0; }

/* Divider "or" between Google and password form */
.auth-divider {
    display:     flex;
    align-items: center;
    gap:         0.75rem;
    margin:      1rem 0;
    color:       var(--text-muted);
    font-size:   0.82rem;
}
.auth-divider::before,
.auth-divider::after {
    content:    '';
    flex:       1;
    height:     1px;
    background: var(--border);
}

/* ── Form styles ─────────────────────────────────────────────────────────── */
.form-group  { margin-bottom: 1.1rem; }
.form-row    { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }
label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-muted); margin-bottom: 0.35rem; }
input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
    width:         100%;
    padding:       10px 14px;
    border:        1px solid var(--border);
    border-radius: var(--radius-sm);
    background:    var(--surface2);
    color:         var(--text);
    font-size:     0.95rem;
    font-family:   inherit;
    outline:       none;
    transition:    border-color 0.2s;
    appearance:    none;
    -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; line-height: 1.5; }
select option { background: var(--surface2); }
.field-hint { color: var(--text-muted); font-size: 0.78rem; margin-top: 0.3rem; display: block; }

/* Submit form */
.submit-form { max-width: 680px; }
.submit-buttons { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.25rem; }

/* Image preview */
.image-preview { margin-top: 0.75rem; }
.image-preview img { max-height: 200px; border-radius: var(--radius-sm); }
input[type="file"] {
    padding: 8px;
    font-size: 0.85rem;
    border: 1px dashed var(--border);
    background: var(--surface2);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
}

/* Result area */
.result-area  { margin-top: 1.5rem; }
.result-success,
.result-warning,
.result-error {
    padding:       1.25rem 1.5rem;
    border-radius: var(--radius);
    font-size:     0.9rem;
    line-height:   1.7;
}
.result-success { background: rgba(34,197,94,.08);  border: 1px solid rgba(34,197,94,.3);  color: #86efac; }
.result-warning { background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.3); color: #fde68a; }
.result-error   { background: rgba(239,68,68,.08);  border: 1px solid rgba(239,68,68,.3);  color: #fca5a5; }
.result-explanation { font-style: italic; margin-top: 0.4rem; }
.red-flags { margin-top: 0.75rem; }
.red-flags ul { margin-left: 1.2rem; margin-top: 0.35rem; }

/* ── Profile page ────────────────────────────────────────────────────────── */
.profile-header {
    display:       flex;
    align-items:   center;
    gap:           1.5rem;
    margin-bottom: 2rem;
}
.profile-avatar {
    width:          72px;
    height:         72px;
    border-radius:  50%;
    background:     var(--accent);
    display:        flex;
    align-items:    center;
    justify-content: center;
    font-size:      2rem;
    font-weight:    700;
    flex-shrink:    0;
}
.profile-info h1  { font-size: 1.5rem; }
.profile-email    { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.15rem; }
.profile-joined   { color: var(--text-muted); font-size: 0.8rem; }

.profile-stats {
    display:       flex;
    gap:           1rem;
    margin-bottom: 2rem;
}
.stat-card {
    flex:          1;
    background:    var(--surface);
    border:        1px solid var(--border);
    border-radius: var(--radius);
    padding:       1.25rem;
    text-align:    center;
}
.stat-value { font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat-label { color: var(--text-muted); font-size: 0.83rem; margin-top: 0.25rem; }
.section-title { font-size: 1.2rem; font-weight: 600; margin-bottom: 1rem; }

/* ── Admin panel ─────────────────────────────────────────────────────────── */
.admin-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.tab-btn {
    padding:       8px 20px;
    border-radius: var(--radius-sm);
    border:        1px solid var(--border);
    background:    var(--surface2);
    color:         var(--text-muted);
    font-size:     0.9rem;
    transition:    all 0.15s;
}
.tab-btn:hover  { color: var(--text); border-color: var(--accent); }
.tab-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.admin-card {
    background:    var(--surface);
    border:        1px solid var(--border);
    border-radius: var(--radius);
    padding:       1rem 1.25rem;
    margin-bottom: 0.75rem;
}
.admin-card h3 { font-size: 1rem; margin-bottom: 0.4rem; }
.admin-meta    { color: var(--text-muted); font-size: 0.82rem; margin-bottom: 0.75rem; }
.admin-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.btn-approve { background: rgba(34,197,94,.15);  color: var(--green); border: 1px solid rgba(34,197,94,.3); }
.btn-reject  { background: rgba(245,158,11,.15); color: var(--orange); border: 1px solid rgba(245,158,11,.3); }
.btn-delete  { background: rgba(239,68,68,.12);  color: var(--red);   border: 1px solid rgba(239,68,68,.3); }
.btn-approve:hover { background: rgba(34,197,94,.3); }
.btn-reject:hover  { background: rgba(245,158,11,.3); }
.btn-delete:hover  { background: rgba(239,68,68,.25); }

.admin-make-admin {
    margin-top:    2rem;
    padding:       1.25rem;
    background:    var(--surface);
    border:        1px solid var(--border);
    border-radius: var(--radius);
}
.admin-make-admin h3 { margin-bottom: 0.75rem; }

/* ── Personalized feed heading ───────────────────────────────────────────── */
#feedHeading {
    transition: color .25s;
}
#feedHeading[title]:not([title=""]) {
    /* "Recommended for You" heading — glow with accent colour */
    color: var(--accent);
    cursor: help;
}

/* ── Post title link (card) ──────────────────────────────────────────────── */
.post-title-link {
    color: inherit;
    text-decoration: none;
}
.post-title-link:hover { color: var(--accent); }
.post-image-link { display: block; }

/* ── Article Detail Page ─────────────────────────────────────────────────── */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    transition: opacity .15s;
}
.back-link:hover { opacity: .75; }

/*
 * Article detail card — centred content, generous desktop padding.
 * On mobile the side padding shrinks so the full viewport width is usable.
 */
.article-detail {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem 2.5rem;
    margin-bottom: 2rem;
    /* Widen the article to use more of the container */
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}

.article-badges { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }

.article-title {
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.article-scores {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

/*
 * Article hero image — bleeds to the full width of the card by using
 * negative margins to cancel the parent's horizontal padding.
 * Keeps the rounded corners only on the top (matching the card top).
 */
.article-image {
    width: calc(100% + 5rem);   /* 2.5rem padding × 2 sides */
    margin-left: -2.5rem;
    margin-right: -2.5rem;
    max-height: 460px;
    overflow: hidden;
    border-radius: 0;
    margin-bottom: 1.75rem;
}
.article-image img {
    width: 100%;
    height: 460px;
    object-fit: cover;
    display: block;
}

.article-body {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text);
    margin-bottom: 2rem;
    white-space: pre-line;
}

/* ── TruthLens AI Analysis ───────────────────────────────────────────────── */
.analysis-box {
    border-radius: var(--radius-sm);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.75rem;
    border-left: 4px solid transparent;
}
.analysis-high  { background: rgba(34,197,94,.08);  border-color: var(--green); }
.analysis-mid   { background: rgba(59,130,246,.08); border-color: var(--blue); }
.analysis-warn  { background: rgba(245,158,11,.08); border-color: var(--orange); }
.analysis-low   { background: rgba(239,68,68,.08);  border-color: var(--red); }

.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.analysis-logo  { font-weight: 700; font-size: 1rem; }
.analysis-score { font-weight: 700; font-size: 1rem; padding: 0.2rem 0.65rem; border-radius: 20px; }

.analysis-tier {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.analysis-explanation { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.75rem; }

.analysis-signals, .analysis-concerns { margin-top: 0.75rem; }
.analysis-signals strong, .analysis-concerns strong { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.analysis-signal, .analysis-concern { font-size: 0.9rem; margin: 0.2rem 0; }
.signal-icon  { color: var(--green);  font-weight: 700; margin-right: 0.35rem; }
.concern-icon { color: var(--orange); font-weight: 700; margin-right: 0.35rem; }

/* ── Claim Verification ──────────────────────────────────────────────────── */
.claims-section {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.75rem;
    background: var(--surface2);
}
.claims-loading {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.claims-spinner {
    display: inline-block;
    animation: spin 1.5s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.claims-header {
    margin-bottom: 0.9rem;
}
.claims-logo {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
}

.claims-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.claim-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.8rem 1rem;
}
.claim-text {
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 0.45rem;
    font-style: italic;
}

/* Status badges */
.claim-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
}
.claim-confirmed  { background: rgba(34,197,94,.15);  color: var(--green);   border: 1px solid rgba(34,197,94,.3); }
.claim-partial    { background: rgba(59,130,246,.15); color: #60a5fa;        border: 1px solid rgba(59,130,246,.3); }
.claim-unverified { background: rgba(120,128,160,.15); color: var(--text-muted); border: 1px solid var(--border); }

/* ── Article actions ─────────────────────────────────────────────────────── */
.article-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.btn-source {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background .15s;
}
.btn-source:hover { background: var(--border); }

/* ── Article vote section ────────────────────────────────────────────────── */
.article-votes    { margin-bottom: 1rem; }
.votes-heading    { font-size: 1rem; font-weight: 600; margin-bottom: 0.75rem; color: var(--text-muted); }

/* ── Comments ────────────────────────────────────────────────────────────── */
.comments-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem 2rem;
}
.comments-heading { font-size: 1.25rem; font-weight: 700; margin-bottom: 1.25rem; }

.comments-list { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }

.comment {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1.1rem;
}
.comment-meta  { display: flex; gap: 0.75rem; align-items: baseline; margin-bottom: 0.35rem; }
.comment-author { font-weight: 600; font-size: 0.9rem; color: var(--accent); }
.comment-time   { font-size: 0.8rem; color: var(--text-muted); }
.comment-text   { font-size: 0.9rem; line-height: 1.6; color: var(--text); white-space: pre-line; }

.comment-input-row {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.comment-input-row textarea {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    transition: border-color .15s;
}
.comment-input-row textarea:focus { outline: none; border-color: var(--accent); }
.comment-input-row .btn { align-self: flex-end; }

.comment-login-prompt {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 0.75rem 0;
}
.comment-login-prompt a { color: var(--accent); }

.comment-error {
    color: var(--red);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── Danger button (delete) ──────────────────────────────────────────────── */
.btn-danger       { background: rgba(239,68,68,.15); color: var(--red); border: 1px solid rgba(239,68,68,.3); }
.btn-danger:hover { background: rgba(239,68,68,.3);  color: #fff; }

/* ── Owner action buttons (Edit / Delete / View) ─────────────────────────── */
/* Shown below user-owned post cards on article detail and profile pages      */
.owner-actions {
    display:     flex;
    gap:         0.5rem;
    flex-wrap:   wrap;
    margin:      0.75rem 0 0.25rem;
}

/* Wrapper used on profile page so owner-actions sit under each card ─────── */
.profile-card-wrapper { display: flex; flex-direction: column; }
.profile-card-wrapper .post-card { flex: 1; }
.profile-card-wrapper .owner-actions {
    background:    var(--surface);
    border:        1px solid var(--border);
    border-top:    none;
    border-radius: 0 0 var(--radius) var(--radius);
    padding:       0.6rem 1rem;
    margin:        0;
}

/*
 * Share section — flex row that wraps cleanly on mobile.
 * Buttons have comfortable tap targets (min 44px height) and gap between them.
 * The label reads "Share this article" and sits above the buttons on narrow screens.
 */
.share-section {
    display:       flex;
    align-items:   center;
    flex-wrap:     wrap;
    gap:           0.65rem 0.75rem;   /* row-gap col-gap */
    margin:        1.5rem 0;
    padding:       1rem 1.25rem;
    background:    var(--surface2);
    border:        1px solid var(--border);
    border-radius: var(--radius-sm);
}

.share-label {
    font-size:      0.8rem;
    font-weight:    600;
    color:          var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    /* Takes a full row on very narrow screens so buttons can fill the row below */
    flex-basis:     100%;
    margin-bottom:  0.1rem;
}

/*
 * Share buttons — larger padding for easy tapping on mobile.
 * Each button is at least 40px tall.
 */
.share-btn {
    display:         inline-flex;
    align-items:     center;
    gap:             0.4rem;
    padding:         9px 18px;
    border-radius:   22px;
    font-size:       0.88rem;
    font-weight:     500;
    border:          1px solid var(--border);
    background:      var(--surface);
    color:           var(--text-muted);
    cursor:          pointer;
    text-decoration: none;
    transition:      background 0.15s, color 0.15s, border-color 0.15s;
    white-space:     nowrap;
    min-height:      40px;
}
.share-btn:hover { background: var(--surface2); color: var(--text); border-color: var(--accent); }

/* X (Twitter) — dark */
.share-x { background: #000; color: #fff; border-color: #333; }
.share-x:hover { background: #222; color: #fff; }

/* Facebook — blue */
.share-fb { background: #1877f2; color: #fff; border-color: #1877f2; }
.share-fb:hover { background: #145dbf; color: #fff; }

/* Copy link */
.share-copy { font-family: inherit; }

.copy-confirm {
    font-size:  0.82rem;
    color:      var(--green);
    font-weight: 600;
}

/* ── Hamburger button (hidden on desktop) ────────────────────────────────── */
.hamburger {
    display:        none;
    flex-direction: column;
    justify-content: center;
    gap:            5px;
    width:          36px;
    height:         36px;
    padding:        6px;
    margin-left:    0.5rem;
    background:     transparent;
    border:         none;
    border-radius:  var(--radius-sm);
    cursor:         pointer;
    flex-shrink:    0;
}
.hamburger span {
    display:       block;
    width:         100%;
    height:        2px;
    background:    var(--text);
    border-radius: 2px;
    transition:    all 0.25s;
}
.hamburger:hover { background: var(--surface2); }

/* ── Mobile nav overlay (darkens background when drawer is open) ─────────── */
/* pointer-events: none when closed so the overlay NEVER blocks taps/clicks  */
.nav-overlay {
    position:       fixed;
    inset:          0;
    background:     rgba(0,0,0,.55);
    z-index:        200;
    opacity:        0;
    pointer-events: none;           /* invisible → no touch/click interception */
    transition:     opacity 0.25s;
}
.nav-overlay.open {
    opacity:        1;
    pointer-events: auto;           /* visible → tapping overlay closes drawer */
}

/* ── Mobile slide-in nav drawer ──────────────────────────────────────────── */
/* pointer-events: none when off-screen so translateX(-100%) elements don't  */
/* intercept touch events in mobile WebKit                                   */
.nav-drawer {
    position:       fixed;
    top:            0;
    left:           0;
    width:          min(280px, 85vw);
    height:         100dvh;
    background:     var(--surface);
    border-right:   1px solid var(--border);
    z-index:        300;
    display:        flex;
    flex-direction: column;
    transform:      translateX(-100%);
    transition:     transform 0.28s cubic-bezier(.4,0,.2,1);
    overflow-y:     auto;
    pointer-events: none;           /* off-screen → no touch interception */
}
.nav-drawer.open {
    transform:      translateX(0);
    pointer-events: auto;           /* on-screen → interactive */
}

.drawer-header {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    padding:         1rem 1.25rem;
    border-bottom:   1px solid var(--border);
    flex-shrink:     0;
}
.drawer-close {
    background: transparent;
    border:     none;
    color:      var(--text-muted);
    font-size:  1.1rem;
    padding:    4px 8px;
    border-radius: 6px;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}
.drawer-close:hover { background: var(--surface2); color: var(--text); }

.drawer-links {
    display:   flex;
    flex-direction: column;
    padding:   0.75rem 0;
    flex:      1;
}
.drawer-link {
    display:       flex;
    align-items:   center;
    gap:           0.6rem;
    padding:       0.8rem 1.25rem;
    font-size:     1rem;
    color:         var(--text-muted);
    border-left:   3px solid transparent;
    transition:    background 0.15s, color 0.15s, border-color 0.15s;
}
.drawer-link:hover,
.drawer-link.active {
    background:    var(--surface2);
    color:         var(--text);
    border-left-color: var(--accent);
}

.drawer-footer {
    padding:       1rem 1.25rem;
    border-top:    1px solid var(--border);
    flex-shrink:   0;
    display:       flex;
    flex-direction: column;
    gap:           0.5rem;
}
.drawer-user {
    display:     flex;
    align-items: center;
    gap:         0.6rem;
    padding:     0.4rem 0 0.6rem;
    font-size:   0.95rem;
    color:       var(--text-muted);
}
.drawer-logout { width: 100%; justify-content: center; }
.btn-full      { width: 100%; justify-content: center; text-align: center; }

/* ── Avatar dropdown ──────────────────────────────────────────────────────── */
.avatar-wrap {
    position:   relative;
    flex-shrink: 0;
}
.avatar-btn {
    display:     flex;
    align-items: center;
    gap:         0.4rem;
    background:  transparent;
    border:      none;
    padding:     3px 6px 3px 3px;
    border-radius: 20px;
    cursor:      pointer;
    transition:  background 0.15s;
}
.avatar-btn:hover { background: var(--surface2); }
.avatar-chevron {
    width:       10px;
    height:      auto;
    color:       var(--text-muted);
    flex-shrink: 0;
    transition:  transform 0.2s;
}
.avatar-btn[aria-expanded="true"] .avatar-chevron { transform: rotate(180deg); }

.avatar-dropdown {
    display:       none;
    position:      absolute;
    top:           calc(100% + 6px);
    right:         0;
    min-width:     160px;
    background:    var(--surface);
    border:        1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow:    var(--shadow);
    z-index:       150;
    overflow:      hidden;
    animation:     dropdownIn 0.15s ease;
}
.avatar-dropdown.open { display: block; }

@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
    display:    flex;
    align-items: center;
    gap:        0.5rem;
    width:      100%;
    padding:    0.65rem 1rem;
    font-size:  0.9rem;
    color:      var(--text-muted);
    background: transparent;
    border:     none;
    text-align: left;
    transition: background 0.12s, color 0.12s;
    cursor:     pointer;
}
.dropdown-item:hover { background: var(--surface2); color: var(--text); }
.dropdown-item-btn { font-family: inherit; }

/* ── Responsive — tablet ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .container { padding: 1.5rem 1rem 3rem; }

    /* Hide desktop nav links and show hamburger */
    .nav-links  { display: none; }
    .hamburger  { display: flex; }

    /* Keep auth area visible but compact — just Login/Register or avatar */
    .auth-area  { margin-left: auto; }

    /* Cards: full width images, tighter padding */
    .post-card  { padding: 1rem; }
    .post-image img { width: 100%; height: auto; max-height: 220px; object-fit: cover; }

    /* Page header */
    .page-header h1 { font-size: 1.5rem; }

    /* Vote row wraps on small screens */
    .vote-row   { flex-wrap: wrap; gap: 0.4rem; }
    .vote-btn   { flex: 1 1 auto; min-width: 100px; font-size: 0.78rem; padding: 5px 8px; }

    /* Filters scroll horizontally rather than wrap */
    .country-filters,
    .category-filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }

    .form-row       { flex-direction: column; gap: 0; }
    .profile-header { flex-direction: column; text-align: center; }
    .profile-stats  { flex-direction: column; }
    .submit-buttons { flex-direction: column; }

    /* Article page — narrower side padding, recalculate hero bleed */
    .article-detail {
        padding: 1.5rem;
    }
    .article-image {
        width: calc(100% + 3rem);   /* 1.5rem × 2 */
        margin-left: -1.5rem;
        margin-right: -1.5rem;
    }
    .article-image img { height: 320px; }
    .article-title { font-size: 1.45rem; }

    /* Share buttons fill a full row on narrow tablets */
    .share-section { padding: 0.85rem 1rem; }
}

/* ── Responsive — phone ──────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .navbar   { padding: 0 0.9rem; height: 52px; }
    .logo     { font-size: 1.1rem; }
    .container { padding: 1rem 0.75rem 3rem; }

    .post-card { padding: 0.85rem; }
    .post-title { font-size: 0.97rem; }
    .post-content { font-size: 0.87rem; }

    .badge, .cat-badge, .country-badge, .trust-badge { font-size: 0.68rem; padding: 2px 7px; }

    .post-actions { gap: 0.6rem; flex-wrap: wrap; }
    .search-bar   { gap: 0.4rem; }
    .search-bar input { font-size: 0.88rem; padding: 9px 12px; }

    /* Auth buttons side-by-side in navbar stay compact */
    .auth-area .btn { padding: 4px 10px; font-size: 0.78rem; }

    /* Article page — minimal side padding, full-bleed hero image */
    .article-detail {
        padding: 1rem 1rem;
        border-radius: var(--radius-sm);
    }
    .article-image {
        width: calc(100% + 2rem);   /* 1rem × 2 */
        margin-left: -1rem;
        margin-right: -1rem;
    }
    .article-image img { height: 220px; }
    .article-title { font-size: 1.25rem; }

    /* Share section — label always on its own line, buttons fill width */
    .share-section {
        padding: 0.75rem 0.85rem;
        gap: 0.5rem 0.5rem;
    }
    .share-btn {
        flex: 1 1 auto;
        justify-content: center;
        padding: 9px 12px;
        font-size: 0.83rem;
    }
}


/* ══════════════════════════════════════════════════════════════════════════════
   ADMIN ANALYTICS DASHBOARD
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Page nav (Moderation / Analytics tabs) ─────────────────────────────── */
.analytics-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.75rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
}
.analytics-tab-link {
    padding: 0.45rem 1rem;
    border-radius: 8px 8px 0 0;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color .2s, background .2s;
}
.analytics-tab-link:hover { color: var(--text); background: rgba(255,255,255,.04); }
.analytics-tab-link.active { color: var(--accent); font-weight: 600; border-bottom: 2px solid var(--accent); }

/* ── Stats grid ─────────────────────────────────────────────────────────── */
.analytics-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}
.analytics-stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.2rem 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    transition: transform .2s;
}
.analytics-stat-card:hover { transform: translateY(-2px); }
.analytics-stat-icon  { font-size: 1.6rem; line-height: 1; }
.analytics-stat-value { font-size: 1.75rem; font-weight: 700; color: var(--text); }
.analytics-stat-label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }

/* ── Charts row ─────────────────────────────────────────────────────────── */
.analytics-charts-row {
    margin-bottom: 1.75rem;
}
.analytics-chart-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem 1.5rem;
}

/* ── Tables grid ────────────────────────────────────────────────────────── */
.analytics-tables-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(440px, 1fr));
    gap: 1.25rem;
}
.analytics-table-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem 1.5rem;
    overflow: hidden;
}
.analytics-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 1rem;
    color: var(--text);
}

/* ── Data tables ────────────────────────────────────────────────────────── */
.analytics-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.analytics-table thead th {
    text-align: left;
    padding: 0.4rem 0.6rem;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
}
.analytics-table tbody tr:hover { background: rgba(255,255,255,.03); }
.analytics-table tbody td {
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid rgba(255,255,255,.04);
    vertical-align: middle;
    color: var(--text);
}
.analytics-table tbody tr:last-child td { border-bottom: none; }
.analytics-rank   { color: var(--text-muted); font-size: 0.8rem; width: 28px; }
.analytics-num    { font-weight: 600; text-align: right; width: 70px; }
.analytics-source { color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; }
.analytics-post-link { color: var(--accent); text-decoration: none; }
.analytics-post-link:hover { text-decoration: underline; }
.analytics-loading-cell { text-align: center; color: var(--text-muted); padding: 1.5rem; }
.analytics-empty  { text-align: center; color: var(--text-muted); padding: 1.5rem; font-size: 0.875rem; }
.analytics-loading { text-align: center; color: var(--text-muted); padding: 2rem; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .analytics-stats-grid   { grid-template-columns: repeat(2, 1fr); }
    .analytics-tables-row   { grid-template-columns: 1fr; }
    .analytics-stat-value   { font-size: 1.35rem; }
    .analytics-table        { font-size: 0.8rem; }
}
