/* ==========================================================================
   SECTION IURAN RUMAH (LAYOUT UTAMA & DESKTOP)
   ========================================================================== */

.iuran-rumah-section {
    background: #050505;
    padding: 6.5rem 4rem;
    /* Di layar HP padding ini otomatis mengecil lewat media query */
}

.iuran-rumah-inner {
    max-width: 1200px;
    margin: 0 auto;
}


/* ==========================================================================
   SUMMARY CARDS
   ========================================================================== */

.ir-summary-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.ir-summary-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1.25rem 1.2rem;
    box-sizing: border-box;
}

.ir-summary-val {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    word-wrap: break-word;
    /* Mencegah nominal uang yang panjang jebol keluar kartu */
}

.ir-summary-lbl {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.75rem;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

.ir-summary-sub {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.85rem;
    margin-top: 0.35rem;
}


/* ==========================================================================
   FILTER BAR
   ========================================================================== */

.ir-filter-bar {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr auto;
    margin-bottom: 1.5rem;
    align-items: center;
}

.ir-filter-bar input,
.ir-filter-bar select {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    border-radius: 12px;
    padding: 0.9rem 1rem;
    font-size: 0.95rem;
    width: 100%;
    box-sizing: border-box;
}

.ir-filter-bar input:focus,
.ir-filter-bar select:focus {
    border-color: var(--gold);
    outline: none;
}


/* ==========================================================================
   RESPONSIVE TABLE SYSTEM (ANTI-BOCOR)
   ========================================================================== */

.ir-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Scroll halus di iOS/Safari */
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 1.5rem;
}

.ir-table-head,
.ir-table-row {
    display: grid;
    gap: 1rem;
    grid-template-columns: 100px 2fr 160px 120px 100px;
    /* Struktur grid yang konsisten */
    align-items: center;
    padding: 1rem;
    min-width: 680px;
    /* Mengunci lebar minimum tabel agar struktur grid tidak hancur di HP */
}

.ir-table-head {
    background: rgba(201, 168, 76, 0.06);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    font-weight: 600;
}

.ir-table-row {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: background 0.2s;
}

.ir-table-row:last-child {
    border-bottom: none;
}

.ir-table-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.ir-table-head>span,
.ir-table-row>span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Memotong teks berlebih dengan sisa titik-titik (...) */
}


/* ==========================================================================
   BADGES & ACTIONS
   ========================================================================== */

.ir-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.ir-status.lunas {
    color: #2ecc71;
    background: rgba(46, 204, 113, 0.14);
}

.ir-status.cicil {
    color: #C9A84C;
    background: rgba(201, 168, 76, 0.14);
}

.ir-status.belum {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.12);
}

.ir-actions {
    display: flex;
    gap: 0.6rem;
}

.ir-actions .ir-edit-btn,
.ir-actions .ir-del-btn {
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    padding: 0.45rem 0.6rem;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
}

.ir-actions .ir-edit-btn:hover,
.ir-actions .ir-del-btn:hover {
    background: rgba(201, 168, 76, 0.12);
    border-color: rgba(201, 168, 76, 0.3);
}


/* ==========================================================================
   MODAL SYSTEM
   ========================================================================== */

.ir-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.ir-modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.ir-modal-box {
    background: #111;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 20px;
    width: 100%;
    max-width: 420px;
    padding: 2rem;
    box-sizing: border-box;
}

.ir-modal-title {
    font-size: 1.45rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
}

.ir-modal-box label {
    display: block;
    margin-top: 1rem;
    margin-bottom: 0.4rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
}

.ir-modal-box input,
.ir-modal-box select {
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    outline: none;
    box-sizing: border-box;
}

.ir-modal-box input:focus,
.ir-modal-box select:focus {
    border-color: rgba(201, 168, 76, 0.5);
}

.ir-modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}


/* ==========================================================================
   MEDIA QUERIES (BREAKPOINTS RESPONSIVE)
   ========================================================================== */


/* --- TABLET (Max 900px) --- */

@media (max-width: 900px) {
    .iuran-rumah-section {
        padding: 4rem 2rem;
    }
    .ir-summary-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }
}


/* --- HP / MOBILE (Max 650px) --- */

@media (max-width: 650px) {
    .iuran-rumah-section {
        padding: 2.5rem 1rem;
    }
    /* 1. Filter Bar & Summary Card jadi Full Width */
    .ir-filter-bar {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .ir-summary-row {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    .ir-summary-val {
        font-size: 1.4rem;
    }
    /* 2. Transformasi Tabel Menjadi Sistem Kartu Vertikal (Semua Data Kelihatan) */
    .ir-table-wrap {
        border: none;
        /* Hapus border pembungkus luar */
        overflow-x: visible;
        /* Tidak perlu scrollbar lagi */
    }
    /* Sembunyikan header tabel asli karena tidak cocok untuk mode kartu */
    .ir-table-head {
        display: none;
    }
    /* Ubah baris tabel menjadi satu kotak kartu utuh */
    .ir-table-row {
        display: flex;
        flex-direction: column;
        /* Susun data dari atas ke bawah */
        align-items: flex-start;
        gap: 0.6rem;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 14px;
        padding: 1.2rem;
        margin-bottom: 1rem;
        min-width: unset;
        /* Reset kuncian lebar desktop */
    }
    .ir-table-row:last-child {
        margin-bottom: 0;
    }
    /* Atur ulang tiap data (span) di dalam kartu */
    .ir-table-row>span {
        padding: 0;
        border-right: none;
        white-space: normal;
        /* Biar teks panjang otomatis turun ke bawah, ga kepotong */
        text-overflow: unset;
        width: 100%;
        display: flex;
        justify-content: space-between;
        /* Membuat format Label (Kiri) : Nilai (Kanan) */
        font-size: 0.88rem;
    }
    /* Trik CSS: Menambahkan label penanda otomatis di sebelah kiri tiap data */
    .ir-table-row>span:nth-child(1)::before {
        content: "No. Rumah";
        color: rgba(255, 255, 255, 0.4);
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    .ir-table-row>span:nth-child(2)::before {
        content: "Nama Kepala KK";
        color: rgba(255, 255, 255, 0.4);
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    .ir-table-row>span:nth-child(3)::before {
        content: "Pembayaran";
        color: rgba(255, 255, 255, 0.4);
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    .ir-table-row>span:nth-child(4)::before {
        content: "Status";
        color: rgba(255, 255, 255, 0.4);
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    /* Khusus untuk kolom aksi edit/hapus */
    .ir-table-row>.ir-actions {
        width: 100%;
        margin-top: 0.6rem;
        padding-top: 0.8rem;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        justify-content: flex-end;
        /* Tombol aksi mepet ke kanan */
    }
    /* Sesuaikan ukuran badge status di dalam kartu */
    .ir-status {
        padding: 0.25rem 0.65rem;
        font-size: 0.72rem;
    }
}