/* =========================================
   1. ROOT VARIABLES
   ========================================= */
:root {
    --bg-surface: #ffffff;
    --bg-main: #f8f9fa;
    --border: #e0e0e0;
    --radius-sm: 8px;
    --text-main: #333333;
    --text-muted: #777777;
    --accent: #ff961e;
    --accent-rgb: 255, 150, 30;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* =========================================
   2. GLOBAL & CONTAINER BERITA
   ========================================= */
.berita {
    width: 90%;
    max-width: 1200px;
    min-height: 100vh;
    margin: 0 auto;
    padding-top: 80px;
    padding-bottom: 80px;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', sans-serif;
}

.berita-header {
    text-align: center;
    margin-bottom: 50px;
    margin-top: 20px;
}

.berita-header h1 {
    font-size: clamp(2rem, 5vw, 2.8rem);
    color: #1a1a1a;
    margin-bottom: 10px;
    line-height: 1.2;
}

.berita-header p {
    color: #555;
    font-size: 1.1rem;
}

/* =========================================
   3. FILTER BAR & SEARCH (RESPONSIF BARU)
   ========================================= */
.berita-controls {
    width: 100%;
    margin-bottom: 40px;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    background: var(--bg-surface);
    padding: 15px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.search-box {
    flex: 1 1 300px;
    min-width: 250px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 15px;
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    height: 48px;
    padding: 0 15px 0 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: all 0.3s ease;
    background: var(--bg-surface);
    box-sizing: border-box;
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.1);
}

.filter-controls {
    display: flex;
    gap: 15px;
    flex: 0 1 auto;
    justify-content: flex-end;
}

.custom-select {
    position: relative;
    min-width: 170px;
}

.selectedBox {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    height: 48px;
    padding: 0 20px;
    color: var(--text-main);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    user-select: none;
    box-sizing: border-box;
}

.selectedBox:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.1);
}

.selectedBox i {
    transition: transform 0.3s;
    color: var(--text-muted);
    margin-left: 10px;
}

.selectOptions {
    position: absolute;
    background-color: var(--bg-surface);
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    z-index: 99;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: none;
}

.selectOptions div {
    padding: 12px 20px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
}

.selectOptions div:hover {
    background-color: var(--bg-main);
    color: var(--accent);
    padding-left: 25px;
}

.selectOptions div.active {
    background-color: rgba(var(--accent-rgb), 0.1);
    color: var(--accent);
    font-weight: 700;
}

/* =========================================
   4. GRID & CARD BERITA
   ========================================= */
.berita-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    width: 100%;
}

.berita-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    text-decoration: none;
}

.berita-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.berita-img-container {
    width: 100%;
    height: 220px;
    overflow: hidden;
}

.berita-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.berita-content {
    padding: 25px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.berita-tanggal,
.berita-author {
    font-size: 0.85rem;
    color: #888;
    font-weight: 500;
}

.berita-judul {
    font-size: 1.3rem;
    margin: 15px 0 12px 0;
    color: #222;
    line-height: 1.4;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
    width: 100%;
}

.berita-excerpt {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 25px;
    line-height: 1.6;
    flex-grow: 1;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
    width: 100%;
}

.berita-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #8b0000;
    text-decoration: none;
    transition: color 0.3s ease, gap 0.3s ease;
    width: max-content;
}

.berita-link:hover {
    color: #5a0000;
    gap: 12px;
}

.berita-not-found {
    text-align: center;
    padding: 80px 20px;
    width: 100%;
}

.berita-not-found h3 {
    font-size: 1.5rem;
    color: #8b0000;
    margin-bottom: 15px;
}

/* =========================================
   5. DETAIL BERITA
   ========================================= */
.berita-detail-container {
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    padding: 50px;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
}

.btn-kembali {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #555;
    text-decoration: none;
    margin-bottom: 30px;
    font-weight: 500;
    transition: color 0.3s;
}

.btn-kembali:hover {
    color: #8b0000;
}

.berita-detail-header {
    margin-bottom: 30px;
}

.berita-detail-header h1 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    margin: 15px 0;
    line-height: 1.3;
    color: #111;
}

.berita-detail-hero img {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 40px;
    max-height: 450px;
    object-fit: cover;
}

.berita-detail-body {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
}

.berita-detail-body p {
    margin-bottom: 20px;
}

.berita-detail-body h3 {
    margin: 35px 0 15px;
    color: #222;
    font-size: 1.5rem;
}

.berita-detail-body ul {
    margin-bottom: 25px;
    padding-left: 20px;
}

.berita-detail-body li {
    margin-bottom: 10px;
}

/* =========================================
   6. PAGINATION
   ========================================= */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 50px;
    flex-wrap: wrap;
    width: 100%;
}

.page-link,
.pagination-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 42px;
    height: 42px;
    background: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
}

.page-link:hover:not(.active):not(.pagination-active) {
    background: var(--bg-main);
    color: var(--accent);
    border-color: var(--accent);
}

.page-link.active,
.pagination-active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    pointer-events: none;
    box-shadow: 0 4px 10px rgba(var(--accent-rgb), 0.3);
}

/* =========================================
   TAMBAHAN UNTUK FITUR SHARE
   ========================================= */
.berita-actions {
    display: flex;
    justify-content: space-between;
    /* Membuat tombol kembali di kiri, share di kanan */
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.btn-share {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.btn-share:hover {
    background-color: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(var(--accent-rgb), 0.2);
}

/* Penyesuaian tombol kembali agar konsisten dengan margin baru */
.btn-kembali {
    margin-bottom: 0 !important;
    /* Meng-override margin inline di HTML */
}

/* =========================================
   8. HALAMAN ERROR 404 (NOT FOUND)
   ========================================= */
.page-404 {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-surface);
    border-radius: 16px;
    box-shadow: var(--shadow);
    max-width: 600px;
    margin: 40px auto;
}

.page-404 h1 {
    font-size: 6rem;
    color: #8b0000;
    margin: 0 0 10px 0;
    line-height: 1;
    font-weight: 800;
}

.page-404 h2 {
    font-size: 1.8rem;
    color: var(--text-main);
    margin-bottom: 15px;
}

.page-404 p {
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 1.1rem;
    line-height: 1.6;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--accent);
    color: #ffffff;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: #e68619;
    /* sedikit lebih gelap dari --accent */
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(var(--accent-rgb), 0.3);
    color: #ffffff;
}

/* =========================================
   PEMBERSIHAN INLINE STYLE BERITA DETAIL
   ========================================= */
.berita-detail-header h1 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    margin: 10px 0;
}

.berita-tanggal {
    color: #888;
    font-size: 0.9rem;
}

.berita-author {
    color: #777;
    font-size: 0.9rem;
}

.berita-detail-hero img {
    width: 100%;
    border-radius: 15px;
    max-height: 450px;
    object-fit: cover;
    margin-bottom: 30px;
}

/* =========================================
   7. MEDIA QUERIES (CONSOLIDATED)
   ========================================= */
@media (max-width: 800px) {
    .berita {
        padding-top: 60px;
    }

    /* Responsive Filter Bar */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        flex: none;
        width: 100%;
    }

    .filter-controls {
        width: 100%;
        justify-content: space-between;
        display: grid;
        grid-template-columns: 1fr;
        /* Full width dropdown if only 1 */
    }

    .custom-select {
        min-width: unset;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .berita-detail-container {
        padding: 30px 20px;
        border-radius: 12px;
    }
}

@media (max-width: 600px) {
    .berita-grid {
        grid-template-columns: 1fr;
        /* 1 kolom di HP */
    }

    /* Responsive Pagination */
    .page-link,
    .pagination-btn {
        width: 38px;
        height: 38px;
        font-size: 14px;
    }

    .pagination {
        gap: 5px;
    }
}