/* =========================================================
   ARISAN & IURAN PEMUDA — Tema 3 Warna
   1. Hijau Zamrud  (#0B6E4F) : warna utama / identitas pemuda
   2. Merah Marun   (#9E2A2B) : arisan perkawinan, bahaya, hapus
   3. Emas          (#E0A526) : aksen, penanda aktif, peringatan
   Semua warna Bootstrap dipetakan ke 3 warna ini agar konsisten.
   ========================================================= */
:root {
    --c1: #0B6E4F;  --c1-dark: #08513A;  --c1-soft: #E3F1EC;  --c1-rgb: 11, 110, 79;
    --c2: #9E2A2B;  --c2-dark: #7A1F20;  --c2-soft: #F7E6E6;  --c2-rgb: 158, 42, 43;
    --c3: #E0A526;  --c3-dark: #B8861A;  --c3-soft: #FCF3DE;  --c3-rgb: 224, 165, 38;

    --bg: #F5F6F4;
    --ink: #1F2A27;
    --muted: #6B7A75;
    --line: #E3E7E5;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(16, 40, 32, .06), 0 4px 14px rgba(16, 40, 32, .05);
    --sidebar-w: 256px;
    --topbar-h: 60px;

    /* --- Pemetaan warna Bootstrap ke 3 warna tema --- */
    --bs-body-bg: var(--bg);
    --bs-body-color: var(--ink);
    --bs-secondary-color: var(--muted);
    --bs-border-color: var(--line);
    --bs-border-radius: 8px;
    --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-body-font-size: .925rem;
    --bs-link-color: var(--c1);   --bs-link-color-rgb: var(--c1-rgb);
    --bs-link-hover-color: var(--c1-dark); --bs-link-hover-color-rgb: 8, 81, 58;

    --bs-primary: var(--c1);  --bs-primary-rgb: var(--c1-rgb);
    --bs-success: var(--c1);  --bs-success-rgb: var(--c1-rgb);
    --bs-info:    var(--c1);  --bs-info-rgb:    var(--c1-rgb);
    --bs-danger:  var(--c2);  --bs-danger-rgb:  var(--c2-rgb);
    --bs-warning: var(--c3);  --bs-warning-rgb: var(--c3-rgb);

    --bs-primary-bg-subtle: var(--c1-soft); --bs-primary-text-emphasis: var(--c1-dark); --bs-primary-border-subtle: #A9D3C4;
    --bs-success-bg-subtle: var(--c1-soft); --bs-success-text-emphasis: var(--c1-dark); --bs-success-border-subtle: #A9D3C4;
    --bs-info-bg-subtle:    var(--c1-soft); --bs-info-text-emphasis:    var(--c1-dark); --bs-info-border-subtle:    #A9D3C4;
    --bs-danger-bg-subtle:  var(--c2-soft); --bs-danger-text-emphasis:  var(--c2-dark); --bs-danger-border-subtle:  #E4B5B5;
    --bs-warning-bg-subtle: var(--c3-soft); --bs-warning-text-emphasis: #7A5A10;        --bs-warning-border-subtle: #EED59A;
}

html { scrollbar-gutter: stable; }          /* cegah layout "loncat" saat scrollbar muncul */
body { background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6 { font-weight: 650; letter-spacing: -.01em; }
.text-muted { color: var(--muted) !important; }
code { color: var(--c2); }
::selection { background: var(--c3-soft); }

/* Garis tiga warna (identitas) */
.tri-bar { height: 4px; background: linear-gradient(90deg, var(--c1) 0 33.3%, var(--c3) 33.3% 66.6%, var(--c2) 66.6% 100%); }

/* ===================== LAYOUT ===================== */
.app { display: flex; min-height: 100vh; }
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; padding: 1.25rem; }
@media (min-width: 992px) { .content { padding: 1.75rem 2rem; } }
.app-footer { padding: .9rem 2rem; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--line); background: #fff; }

/* ===================== SIDEBAR ===================== */
.sidebar {
    --bs-offcanvas-width: var(--sidebar-w);
    width: var(--sidebar-w); flex-shrink: 0;
    background: linear-gradient(180deg, var(--c1-dark) 0%, var(--c1) 100%) !important;
    color: #fff; display: flex; flex-direction: column;
}
@media (min-width: 992px) {
    .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 3px; }
.sidebar .brand { padding: 1.1rem 1rem; display: flex; gap: .75rem; align-items: center; border-bottom: 1px solid rgba(255,255,255,.12); }
.sidebar .logo {
    width: 42px; height: 42px; flex-shrink: 0; border-radius: 12px;
    background: var(--c3); color: var(--c1-dark); display: grid; place-items: center; font-size: 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.sidebar .brand-name { font-weight: 700; line-height: 1.15; font-size: .95rem; }
.sidebar .brand-org { font-size: .75rem; opacity: .7; line-height: 1.2; display: block; }
.sidebar .menu { padding: .5rem .6rem 1rem; }
.sidebar .nav-title {
    font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em;
    color: var(--c3); opacity: .9; padding: 1rem .75rem .35rem;
}
.sidebar .nav-link {
    position: relative; display: flex; align-items: center; gap: .65rem;
    color: rgba(255,255,255,.82); border-radius: 9px; padding: .55rem .75rem; margin-bottom: 2px;
    font-size: .9rem; transition: background .15s, color .15s;
}
.sidebar .nav-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar .nav-link.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.sidebar .nav-link.active::before {
    content: ""; position: absolute; left: -.6rem; top: 8px; bottom: 8px; width: 4px;
    border-radius: 0 4px 4px 0; background: var(--c3);
}
.sidebar .nav-link.active i { color: var(--c3); }
.sidebar .user-box { margin-top: auto; padding: .9rem 1rem; border-top: 1px solid rgba(255,255,255,.12); font-size: .82rem; }
.sidebar .user-box .avatar {
    width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.15);
    display: grid; place-items: center; font-weight: 700; flex-shrink: 0;
}
.sidebar .user-box a { color: rgba(255,255,255,.7); text-decoration: none; }
.sidebar .user-box a:hover { color: var(--c3); }

/* ===================== TOPBAR ===================== */
.topbar {
    position: sticky; top: 0; z-index: 1020; height: var(--topbar-h);
    background: rgba(255,255,255,.92); backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: .75rem; padding: 0 1.25rem;
}
@media (min-width: 992px) { .topbar { padding: 0 2rem; } }
.topbar .page-title { font-size: 1.1rem; font-weight: 650; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .btn-menu { border: 1px solid var(--line); background: #fff; width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; }
.topbar .date-chip {
    font-size: .78rem; color: var(--c1-dark); background: var(--c1-soft);
    padding: .3rem .65rem; border-radius: 999px; white-space: nowrap;
}

/* ===================== KARTU ===================== */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); background: #fff; }
.card.shadow-none { box-shadow: none !important; }
.card h6, .card-title { font-weight: 650; color: var(--ink); }
.card-footer { border-top-color: var(--line); }

/* Kartu statistik dengan garis warna di kiri */
.stat { position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c1); }
.stat.stat-c2::before { background: var(--c2); }
.stat.stat-c3::before { background: var(--c3); }
.stat .icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; flex-shrink: 0; }
.stat .label { font-size: .78rem; color: var(--muted); }
.stat .value { font-size: 1.2rem; font-weight: 700; margin: 0; white-space: nowrap; }
.icon-c1 { background: var(--c1-soft); color: var(--c1); }
.icon-c2 { background: var(--c2-soft); color: var(--c2); }
.icon-c3 { background: var(--c3-soft); color: var(--c3-dark); }

/* ===================== TOMBOL ===================== */
.btn { font-weight: 500; border-radius: 8px; }
.btn-sm { border-radius: 7px; }
.btn-brand, .btn-primary, .btn-success {
    --bs-btn-color: #fff; --bs-btn-bg: var(--c1); --bs-btn-border-color: var(--c1);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--c1-dark); --bs-btn-hover-border-color: var(--c1-dark);
    --bs-btn-active-bg: var(--c1-dark); --bs-btn-active-border-color: var(--c1-dark); --bs-btn-active-color: #fff;
    --bs-btn-disabled-bg: var(--c1); --bs-btn-disabled-border-color: var(--c1); --bs-btn-disabled-color: #fff;
    --bs-btn-focus-shadow-rgb: var(--c1-rgb);
}
.btn-danger {
    --bs-btn-color: #fff; --bs-btn-bg: var(--c2); --bs-btn-border-color: var(--c2);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--c2-dark); --bs-btn-hover-border-color: var(--c2-dark);
    --bs-btn-active-bg: var(--c2-dark); --bs-btn-active-border-color: var(--c2-dark); --bs-btn-focus-shadow-rgb: var(--c2-rgb);
}
.btn-warning, .btn-accent {
    --bs-btn-color: #3D2E08; --bs-btn-bg: var(--c3); --bs-btn-border-color: var(--c3);
    --bs-btn-hover-color: #3D2E08; --bs-btn-hover-bg: var(--c3-dark); --bs-btn-hover-border-color: var(--c3-dark);
    --bs-btn-active-bg: var(--c3-dark); --bs-btn-focus-shadow-rgb: var(--c3-rgb);
}
.btn-outline-primary, .btn-outline-success {
    --bs-btn-color: var(--c1); --bs-btn-border-color: #A9D3C4;
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--c1); --bs-btn-hover-border-color: var(--c1);
    --bs-btn-active-bg: var(--c1); --bs-btn-active-border-color: var(--c1); --bs-btn-active-color: #fff;
    --bs-btn-focus-shadow-rgb: var(--c1-rgb);
}
.btn-outline-danger {
    --bs-btn-color: var(--c2); --bs-btn-border-color: #E4B5B5;
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--c2); --bs-btn-hover-border-color: var(--c2);
    --bs-btn-active-bg: var(--c2); --bs-btn-active-border-color: var(--c2); --bs-btn-focus-shadow-rgb: var(--c2-rgb);
}
.btn-outline-secondary {
    --bs-btn-color: #44524D; --bs-btn-border-color: var(--line);
    --bs-btn-hover-color: var(--c1-dark); --bs-btn-hover-bg: var(--c1-soft); --bs-btn-hover-border-color: #A9D3C4;
    --bs-btn-active-bg: var(--c1-soft); --bs-btn-active-color: var(--c1-dark); --bs-btn-active-border-color: #A9D3C4;
}
.btn-light { --bs-btn-bg: #F1F3F2; --bs-btn-border-color: #F1F3F2; --bs-btn-hover-bg: #E6EAE8; --bs-btn-hover-border-color: #E6EAE8; }
.btn .spinner-border { width: .9rem; height: .9rem; border-width: .15em; }

/* Tombol pilihan bulan / centang */
.btn-check:checked + .btn-outline-secondary { background: var(--c1); border-color: var(--c1); color: #fff; }
.bulan-check .btn { width: 100%; }

/* ===================== FORM ===================== */
.form-label { font-weight: 550; font-size: .85rem; margin-bottom: .3rem; color: #33413C; }
.form-control, .form-select { border-color: #D6DCD9; border-radius: 8px; }
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: var(--c1); box-shadow: 0 0 0 .2rem rgba(var(--c1-rgb), .15);
}
.form-check-input:checked { background-color: var(--c1); border-color: var(--c1); }
.form-control:disabled, .form-select:disabled { background: #F1F3F2; }
.form-text { font-size: .78rem; }

/* ===================== TABEL ===================== */
.table { --bs-table-hover-bg: rgba(var(--c1-rgb), .04); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .6rem .7rem; border-bottom-color: var(--line); }
.table thead th, .table .table-light th {
    background: #F3F6F5 !important; color: #4A5A55; font-size: .74rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; border-bottom: 2px solid var(--line);
}
.table tfoot td, .table tfoot th { background: #FAFBFA; border-top: 2px solid var(--line); }
.table-responsive { border-radius: 10px; }
.table-sm > :not(caption) > * > * { padding: .4rem .55rem; }

/* Matriks iuran (anggota x bulan) */
.matriks td, .matriks th { text-align: center; vertical-align: middle; white-space: nowrap; font-size: .84rem; }
.matriks td.nama, .matriks th.nama { text-align: left; position: sticky; left: 0; background: #fff; z-index: 2; min-width: 170px; box-shadow: 1px 0 0 var(--line); }
.matriks thead th.nama { background: #F3F6F5 !important; }
.cell-lunas { color: var(--c1); font-size: 1.05rem; }
.cell-belum { color: var(--c2); opacity: .45; }

/* ===================== BADGE, ALERT, PROGRESS ===================== */
.badge { font-weight: 600; letter-spacing: .01em; padding: .38em .65em; border-radius: 6px; }
.badge.bg-warning { color: #3D2E08 !important; }
.badge.bg-light { color: var(--muted) !important; border: 1px solid var(--line); }
.alert { border-radius: 10px; border-width: 0 0 0 4px; }
.alert-success { border-left-color: var(--c1); }
.alert-danger  { border-left-color: var(--c2); }
.alert-warning { border-left-color: var(--c3); }
.alert-secondary, .alert-light { border-left-color: #C9D1CE; }
.alert-link { color: inherit; }
.progress { background: #EBEFED; border-radius: 999px; }
.progress-bar { border-radius: 999px; }

/* ===================== KHUSUS ARISAN ===================== */
.arisan-card { transition: border-color .15s, transform .15s; }
.arisan-card:hover { border-color: #E4B5B5; transform: translateY(-2px); }
.arisan-card .heart { color: var(--c2); }
.section-arisan { border-top: 3px solid var(--c2); }

/* ===================== HALAMAN LOGIN ===================== */
.login-wrap {
    min-height: 100vh; display: grid; place-items: center; padding: 1rem;
    background:
        radial-gradient(circle at 15% 20%, rgba(var(--c3-rgb), .25), transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(var(--c2-rgb), .30), transparent 45%),
        linear-gradient(135deg, var(--c1-dark), var(--c1));
}
.login-card { width: 100%; max-width: 390px; overflow: hidden; border: 0; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-card .logo { width: 64px; height: 64px; border-radius: 18px; background: var(--c1-soft); color: var(--c1); display: grid; place-items: center; font-size: 2rem; margin: 0 auto .75rem; }

/* ===================== RESPONSIF ===================== */
@media (max-width: 991.98px) {
    .sidebar { height: 100%; }
    .stat .value { font-size: 1.05rem; }
}
@media (max-width: 575.98px) {
    .content { padding: 1rem .75rem; }
    .topbar .date-chip { display: none; }
    .table > :not(caption) > * > * { padding: .5rem .5rem; }
}

/* Hormati pengguna yang mematikan animasi */
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.min-w-0 { min-width: 0; }

/* ===================== PENGUNCI KONSISTENSI =====================
   Memastikan tampilan sama walau versi/tema Bootstrap berbeda */
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--ink); }
.topbar .page-title { color: var(--c1-dark); }
.btn { background-image: none !important; text-shadow: none; box-shadow: none; }
.form-control, .form-select { background-color: #fff; color: var(--ink); }
.form-control::placeholder { color: #9AA6A2; }
.table > :not(caption) > * > * { background-color: transparent; box-shadow: none; }
.table-hover > tbody > tr:hover > * { background-color: rgba(var(--c1-rgb), .045); }
.offcanvas-backdrop.show { opacity: .45; }

/* Kartu statistik di layar HP: angka tidak boleh terpotong */
@media (max-width: 575.98px) {
    .stat { padding: .85rem !important; }
    .stat .icon { width: 34px; height: 34px; font-size: 1rem; border-radius: 9px; }
    .stat .d-flex { flex-direction: column; align-items: flex-start !important; gap: .5rem !important; }
    .stat .value { font-size: .98rem; white-space: normal; word-break: break-word; }
    .stat .label { font-size: .72rem; }
}
