/* ═══════════════════════════════════════════════
   EPC Filter Widget v2.0.0
   Style: Top-bar filter + results count + sort dropdown
   ═══════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ─── Reset ─── */
.epcf-wrap, .epcf-wrap *, .epcf-wrap *::before, .epcf-wrap *::after {
    box-sizing: border-box;
}
.epcf-wrap {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
}

/* ═══════════════════════════════════════════════
   SORT BAR
═══════════════════════════════════════════════ */
.epcf-sort-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid #e5e5e5;
    margin-bottom: 28px;
    gap: 12px;
    flex-wrap: wrap;
}
.epcf-sort-bar__count {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: #525252;
    line-height: 1;
    white-space: nowrap;
}
.epcf-sort-bar__right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.epcf-sort-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23525252' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    border: 1px solid #d4d4d4;
    border-radius: 4px;
    padding: 8px 36px 8px 12px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: #0a0a0a;
    cursor: pointer;
    min-width: 140px;
    transition: border-color 0.15s ease;
    line-height: 1.2;
}
.epcf-sort-select:focus { outline: none; border-color: #0a0a0a; }
.epcf-sort-select:hover { border-color: #a3a3a3; }

/* ═══════════════════════════════════════════════
   GRID AREA
═══════════════════════════════════════════════ */
.epcf-grid-area { flex: 1; min-width: 0; }
.epcf-grid-wrap { position: relative; }

.epcf-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}
.epcf-spinner {
    width: 28px;
    height: 28px;
    border: 2.5px solid #e5e5e5;
    border-top-color: #0a0a0a;
    border-radius: 50%;
    animation: epcf-spin 0.7s linear infinite;
}
@keyframes epcf-spin { to { transform: rotate(360deg); } }

.epcf-results { min-height: 200px; }

.epcf-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 20px;
    text-align: center;
    color: #a3a3a3;
    border: 1px dashed #e5e5e5;
}
.epcf-no-results svg { opacity: 0.4; }
.epcf-no-results p {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    margin: 0;
}

/* ═══════════════════════════════════════════════
   GRID — default 4 kolom, responsif ke bawah
═══════════════════════════════════════════════ */
.epcf-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* ═══════════════════════════════════════════════
   PAGINATION
═══════════════════════════════════════════════ */
.epcf-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 40px;
    flex-wrap: wrap;
}
.epcf-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #525252;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1;
    padding: 0;
}
.epcf-page-btn:hover { color: #0a0a0a; border-color: #d4d4d4; }
.epcf-page-btn.is-active { background: #0a0a0a; color: #fff; border-color: #0a0a0a; }
.epcf-page-btn--prev,
.epcf-page-btn--next { font-size: 16px; color: #0a0a0a; }
.epcf-page-btn[disabled] { opacity: 0.3; cursor: default; pointer-events: none; }
.epcf-page-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 13px;
    color: #a3a3a3;
    user-select: none;
}

/* ═══════════════════════════════════════════════
   FADE-IN
═══════════════════════════════════════════════ */
.epcf-results .epc-card { animation: epcf-fadein 0.2s ease both; }
@keyframes epcf-fadein {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════
   RESPONSIVE — override agresif untuk semua HP
═══════════════════════════════════════════════ */
@media (max-width: 1024px) and (min-width: 769px) {
    .epcf-grid,
    .epcf-results .epc-grid,
    .epcf-results .epcf-grid { grid-template-columns: repeat(3, 1fr) !important; }
}

@media (max-width: 768px) {
    /* Sort bar: 50% kiri untuk teks, 50% kanan untuk dropdown */
    .epcf-sort-bar {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: flex-start !important;
        padding: 10px 0 !important;
        margin-bottom: 16px !important;
        gap: 6px 0 !important;
    }
    .epcf-sort-bar__count {
        width: 50% !important;
        flex: 0 0 50% !important;
        font-size: 12px !important;
        line-height: 1.4 !important;
        white-space: normal !important;
        word-break: break-word !important;
        padding-right: 6px !important;
    }
    .epcf-sort-bar__right {
        width: 50% !important;
        flex: 0 0 50% !important;
        display: flex !important;
        justify-content: flex-end !important;
    }
    .epcf-sort-select {
        font-size: 12px !important;
        width: 100% !important;
        min-width: unset !important;
        max-width: 100% !important;
        padding: 6px 28px 6px 10px !important;
    }

    /* Grid 2 kolom di semua HP */
    .epcf-grid,
    .epcf-results .epc-grid,
    .epcf-results .epcf-grid,
    div.epcf-grid,
    div.epc-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .epcf-page-btn { width: 32px !important; height: 32px !important; font-size: 12px !important; }
}

/* HP mungil (320px ke bawah) — 1 kolom */
@media (max-width: 320px) {
    .epcf-grid,
    .epcf-results .epc-grid,
    .epcf-results .epcf-grid { grid-template-columns: 1fr !important; }
}
