* {
    box-sizing: border-box;
    font-family: 'Segoe UI', sans-serif;
}

/* ===== ROOT ===== */
:root {
    --bg: #f5f6fa;
    --text: #111;
    --muted: #555;
    --card: #ffffff;
    --primary: #b80000;
}

/* ===== BODY ===== */
html, body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
}

/* ===== DARK MODE ===== */
body.dark {
    --bg: #0f172a;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --card: #1e293b;
}

/* ===== GLOBAL ===== */
a {
    text-decoration: none;
    color: inherit;
}

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

/* ================= HEADER ================= */
.top-header {
    background: var(--primary);
    padding: 14px 0;
    color: #fff;
}

.header-flex {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: bold;
}

.logo img {
    height: 48px; /* FIX: 100px terlalu besar */
}

/* SEARCH */
.search-box {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.search-box input {
    width: 360px;
    padding: 10px 16px;
    border-radius: 999px;
    border: none;
    outline: none;
}

/* THEME TOGGLE */
#themeToggle {
    background: #fff;
    border: none;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
}

/* ================= NAVBAR ================= */
.navbar {
    position: sticky;
    top: 0;
    z-index: 999;
    background: var(--card);
    border-bottom: 1px solid rgba(0,0,0,.1);
}

.navbar .container {
    display: flex;
    gap: 20px;
    overflow-x: auto;
}

.navbar a {
    padding: 14px 0;
    font-weight: 600;
    color: #444;
    white-space: nowrap;
}

.navbar a:hover,
.navbar a.active {
    color: var(--primary);
    border-bottom: 3px solid var(--primary);
}

/* DARK NAVBAR */
body.dark .navbar {
    background: #020617;
}

body.dark .navbar a {
    color: #cbd5f5;
}

/* ================= LAYOUT ================= */
.layout-3col {
    display: grid;
    grid-template-columns: 1fr 3fr 1fr;
    gap: 30px;
    margin-top: 30px;
}

/* ================= CARDS ================= */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 25px;
}

.card {
    background: var(--card);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,.08);
    transition: .3s;
}

.card:hover {
    transform: translateY(-5px);
}

.thumb {
    height: 200px;
    position: relative;
    overflow: hidden;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* CATEGORY BADGE */
.badge {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(184,0,0,.85);
    color: #fff;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 999px;
    z-index: 2;
}

/* cegah badge liar */
body > .badge {
    display: none;
}

.card-body {
    padding: 16px;
}

.card-body h2 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--text);
}

.card-body p {
    font-size: 14px;
    color: var(--muted);
}

/* ================= SIDEBAR ================= */
.sidebar .widget {
    background: var(--card);
    padding: 18px;
    border-radius: 14px;
    box-shadow: 0 10px 25px rgba(0,0,0,.08);
}

.widget h3 {
    margin-bottom: 12px;
    font-size: 16px;
    color: var(--text);
}

.widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.widget li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(0,0,0,.08);
}

body.dark .widget li {
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.widget li:last-child {
    border-bottom: none;
}

.widget a:hover {
    color: var(--primary);
}

/* ================= PAGINATION ================= */
.pagination {
    display: flex;
    gap: 8px;
    margin: 30px 0;
    justify-content: center;
    flex-wrap: wrap;
}

.pagination a {
    padding: 8px 14px;
    border-radius: 6px;
    background: #e5e7eb;
    color: #111;
    font-weight: 600;
}

.pagination a.active {
    background: var(--primary);
    color: #fff;
}

/* DARK PAGINATION */
body.dark .pagination a {
    background: #1e293b;
    color: #e5e7eb;
}

body.dark .pagination a.active {
    background: var(--primary);
    color: #ffffff;
}

/* ================= FOOTER ================= */
.footer {
    margin-top: auto;
    padding: 20px;
    text-align: center;
    background: #020617;
    color: #9ca3af;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 900px) {
    .layout-3col {
        grid-template-columns: 1fr;
    }

    .sidebar.left {
        order: 2;
    }

    .main-content {
        order: 1;
    }

    .sidebar.right {
        order: 3;
    }

    .header-flex {
        flex-direction: column;
    }

    .search-box {
        position: static;
        transform: none;
        width: 100%;
        display: flex;
        justify-content: center;
    }

    .search-box input {
        width: 100%;
        max-width: 360px;
    }
}

@media (max-width: 600px) {
    .articles-grid {
        grid-template-columns: 1fr;
    }

    .thumb {
        height: 220px;
    }

    .card-body h2 {
        font-size: 15px;
    }
}
