/* ================= RESET & DASAR ================= */
body {
    font-family: var(--font-body);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    padding-top: 50px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--primary);
}

/* ================= MAIN CONTENT & CONTAINERS ================= */
.main-content {
    flex: 1;
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 20px;
    width: 100%;
}

.section-container {
    background: var(--bg-surface);
    border-radius: var(--radius);
    padding: 50px;
    margin-bottom: 40px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.section-header {
    text-align: center;
    margin-bottom: 40px;
}

.section-header h1 {
    font-size: 38px;
    font-weight: 800;
    margin-bottom: 15px;
    letter-spacing: -0.5px;
}

.section-header p {
    color: var(--text-muted);
    font-size: 17px;
    max-width: 750px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ================= FORM PENCARIAN & CUSTOM SELECT ================= */
.filter-form {
    display: flex;
    gap: 15px;
    background: var(--bg-surface);
    padding: 15px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    flex-wrap: wrap;
    align-items: center;
    /* Pastikan semua field sejajar lurus di Desktop */
}

/* Search Box */
.search-box {
    flex: 1;
    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%;
    padding: 12px 15px 12px 40px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 15px;
    outline: none;
    transition: all 0.3s ease;
    /* Beda warna sedikit agar terlihat seperti field input */
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

/* Custom Select Dropdown */
.custom-select {
    position: relative;
    width: 180px;
    font-family: var(--font-body);
}

.select-selected {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 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;
}

.select-selected:hover,
.custom-select.active .select-selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.select-selected i {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-muted);
    font-size: 14px;
}

.custom-select.active .select-selected i {
    transform: rotate(180deg);
    color: var(--accent);
}

.select-items {
    position: absolute;
    background-color: var(--bg-surface);
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 99;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.1);
    overflow: hidden;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.select-items.select-hide {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    pointer-events: none;
}

.select-items div {
    color: var(--text-main);
    padding: 12px 20px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
}

.select-items div:hover {
    background-color: var(--bg-main);
    color: var(--accent);
    padding-left: 25px;
}

.select-items div.same-as-selected {
    background-color: rgba(var(--accent-rgb), 0.2);
    color: var(--accent);
    font-weight: 700;
}

/* Tombol Cari */
.btn-search {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 12px;
    font-family: var(--font-heading);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    height: 100%;
    /* Menyesuaikan dengan tinggi input */
}

.btn-search:hover {
    background: var(--accent);
}

/* ================= ARTIKEL POST CARDS ================= */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

.post-card {
    background: var(--bg-surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: all 0.4s ease;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow);
}

.post-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
}

.card-cover {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.card-no-cover {
    width: 100%;
    height: 220px;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 50px;
    opacity: 0.5;
}

.card-body {
    padding: 30px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-meta {
    font-size: 13px;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-title {
    font-size: 21px;
    line-height: 1.4;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-excerpt {
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 25px;
    flex: 1;
}

.card-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    transition: color 0.3s;
}

.post-card:hover .card-footer {
    color: var(--accent);
}

.card-footer i {
    margin-left: 8px;
    transition: transform 0.3s;
}

.post-card:hover .card-footer i {
    transform: translateX(8px);
}

/* ================= PAGINATION ================= */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 50px;
    flex-wrap: wrap;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--bg-surface);
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.page-link:hover {
    background: var(--bg-main);
    color: var(--accent);
    border-color: var(--accent);
}

.page-link.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

/* ================= RESPONSIVE / TAMPILAN HP ================= */
@media (max-width: 768px) {
    .section-container {
        padding: 25px 15px;
        margin-bottom: 25px;
    }

    .post-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .section-header h1 {
        font-size: 24px;
        margin-bottom: 10px;
    }

    .section-header p {
        font-size: 14px;
        line-height: 1.5;
    }

    .card-body {
        padding: 20px 15px;
    }

    .card-title {
        font-size: 18px;
        margin-bottom: 8px;
    }

    .card-excerpt {
        font-size: 14px;
        margin-bottom: 15px;
    }

    .card-meta {
        font-size: 12px;
        margin-bottom: 10px;
    }

    /* Form Pencarian & Filter Mobile */
    .filter-form {
        flex-direction: column;
        padding: 12px;
        gap: 10px;
        align-items: stretch;
        /* Memaksa elemen penuh kiri ke kanan */
    }

    .search-box {
        min-width: 100%;
        width: 100%;
    }

    .search-box input {
        padding: 10px 12px 10px 35px;
        font-size: 14px;
    }

    .custom-select,
    .btn-search {
        width: 100%;
    }

    .select-selected {
        padding: 10px 15px;
        font-size: 14px;
    }
}

/* KHUSUS LAYAR EKSTRA KECIL (320px - 380px) */
@media (max-width: 380px) {
    .section-container {
        padding: 20px 12px;
    }

    .section-header h1 {
        font-size: 22px;
    }

    .pagination-container {
        gap: 4px;
        margin-top: 30px;
    }

    .page-link {
        width: 32px;
        height: 32px;
        font-size: 13px;
        border-radius: 6px;
    }
}