/* =============================================================================
   DIFABEL TOOLS — panel aksesibilitas website publik (BEDESA PRO)
   Dimuat dari includes/footer.php. Logika: assets/js/difabel.js
   ============================================================================= */
#bpDifabel { --dfb-merah: #e5202e; --dfb-merah-tua: #b91c1c; font-family: inherit; }
#bpDifabel *, #bpDifabel *::before, #bpDifabel *::after { box-sizing: border-box; }

/* ---- Tombol pemicu (ikon difabel) ---- */
.dfb-pemicu {
    position: fixed; right: 14px; top: 64%; transform: translateY(-50%); z-index: 1000010;
    display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; cursor: pointer;
}
.dfb-ikon {
    width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
    background: var(--dfb-merah); color: #fff; font-size: 1.65rem;
    display: flex; align-items: center; justify-content: center;
    border: 3px solid #fff; box-shadow: 0 6px 18px rgba(229,32,46,.45), 0 0 0 0 rgba(229,32,46,.5);
    transition: transform .2s ease, background .2s ease; animation: dfbDenyut 2.6s ease-out 3;
}
.dfb-pemicu:hover .dfb-ikon, .dfb-pemicu:focus-visible .dfb-ikon { transform: scale(1.07); background: var(--dfb-merah-tua); }
.dfb-pemicu:focus-visible { outline: none; }
.dfb-pemicu:focus-visible .dfb-ikon { box-shadow: 0 0 0 4px #fde047, 0 6px 18px rgba(229,32,46,.45); }
.dfb-label {
    order: -1; background: var(--dfb-merah); color: #fff; font-weight: 800; font-size: .95rem; line-height: 1.05;
    text-align: center; padding: 7px 14px; border-radius: 6px; box-shadow: 0 6px 16px rgba(0,0,0,.18);
    opacity: 0; transform: translateX(8px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; white-space: nowrap;
}
.dfb-pemicu:hover .dfb-label, .dfb-pemicu:focus-visible .dfb-label, #bpDifabel.dfb-sapa .dfb-label { opacity: 1; transform: none; }
#bpDifabel.dfb-buka .dfb-pemicu { right: 300px; }
#bpDifabel.dfb-buka .dfb-label { display: none; }
@keyframes dfbDenyut { 0% { box-shadow: 0 6px 18px rgba(229,32,46,.45), 0 0 0 0 rgba(229,32,46,.5); } 70% { box-shadow: 0 6px 18px rgba(229,32,46,.45), 0 0 0 16px rgba(229,32,46,0); } 100% { box-shadow: 0 6px 18px rgba(229,32,46,.45), 0 0 0 0 rgba(229,32,46,0); } }

/* ---- Panel ---- */
.dfb-panel {
    position: fixed; right: 0; top: 50%; z-index: 1000020; width: 280px; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow-y: auto;
    background: #3f4247; border-radius: 14px 0 0 14px; padding: 8px 0 8px 8px;
    box-shadow: -10px 10px 30px rgba(0,0,0,.28);
    transform: translate(105%, -50%); visibility: hidden; transition: transform .28s ease, visibility .28s;
}
#bpDifabel.dfb-buka .dfb-panel { transform: translate(0, -50%); visibility: visible; }
.dfb-kepala { display: flex; align-items: center; justify-content: space-between; color: #fff; padding: 4px 10px 10px 6px; }
.dfb-kepala b { font-size: .95rem; display: flex; align-items: center; gap: 8px; }
.dfb-tutup { width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.dfb-tutup:hover, .dfb-tutup:focus-visible { background: rgba(255,255,255,.28); outline: none; }
.dfb-daftar { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.dfb-item {
    width: 100%; display: flex; align-items: center; gap: 12px; padding: 4px; border: 0; cursor: pointer; text-align: left;
    background: #ececec; border-radius: 6px 0 0 6px; color: #1f2937; font-weight: 800; font-size: .98rem; transition: background .15s;
}
.dfb-item:hover { background: #fff; }
.dfb-item:focus-visible { outline: 3px solid #fde047; outline-offset: -3px; }
.dfb-item .dfb-k { width: 58px; height: 52px; border-radius: 5px; flex-shrink: 0; background: var(--dfb-merah); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.15rem; font-weight: 900; }
.dfb-item[aria-pressed="true"] { background: #fff4f4; box-shadow: inset 4px 0 0 var(--dfb-merah); }
.dfb-item[aria-pressed="true"] .dfb-k { background: #15803d; }
.dfb-item .dfb-n { flex: 1; }
.dfb-item .dfb-s { font-size: .7rem; font-weight: 700; color: #64748b; margin-right: 10px; }
.dfb-lvl { display: block; font-size: .72rem; font-weight: 600; color: #94a3b8; padding: 2px 10px 0 6px; }

@media (max-width: 575.98px) {
    .dfb-pemicu { right: 8px; top: 52%; }
    .dfb-ikon { width: 46px; height: 46px; font-size: 1.45rem; }
    .dfb-panel { width: min(280px, 86vw); }
    #bpDifabel.dfb-buka .dfb-pemicu { opacity: 0; pointer-events: none; }
    .dfb-item .dfb-k { width: 50px; height: 46px; }
}
@media (prefers-reduced-motion: reduce) { .dfb-ikon { animation: none; } .dfb-panel, .dfb-label { transition: none; } }

/* =============================================================================
   EFEK PADA HALAMAN (kelas pada <html>)
   ============================================================================= */
/* Kontras tinggi: latar hitam, teks kuning, tautan cyan */
html.dfb-kontras body *:not(#bpDifabel):not(#bpDifabel *):not(img):not(video):not(svg):not(svg *):not(iframe):not(canvas) {
    background-color: #000 !important; background-image: none !important; color: #fff200 !important;
    border-color: #fff200 !important; text-shadow: none !important; box-shadow: none !important;
}
html.dfb-kontras body { background: #000 !important; }
html.dfb-kontras body a:not(#bpDifabel *), html.dfb-kontras body a:not(#bpDifabel *) * { color: #00e5ff !important; text-decoration: underline !important; }
html.dfb-kontras body button:not(#bpDifabel *), html.dfb-kontras body .btn:not(#bpDifabel *) { border: 2px solid #fff200 !important; }

/* Mode gelap: balik warna halaman, kembalikan foto/video/peta ke warna asli */
html.dfb-gelap { filter: invert(1) hue-rotate(180deg); background: #fff; }
html.dfb-gelap img, html.dfb-gelap video, html.dfb-gelap iframe, html.dfb-gelap canvas, html.dfb-gelap picture,
html.dfb-gelap .leaflet-tile-pane, html.dfb-gelap [style*="background-image"],
html.dfb-gelap #bpDifabel .dfb-pemicu, html.dfb-gelap #bpDifabel .dfb-panel {
    filter: invert(1) hue-rotate(180deg);
}
html.dfb-gelap #bpDifabel img { filter: none; }

/* Stabilo: sorot teks yang ditunjuk/difokus seperti stabilo */
html.dfb-stabilo body :is(p, li, h1, h2, h3, h4, h5, h6, td, th, dt, dd, blockquote, figcaption, label, a, .card-title, .card-text):not(#bpDifabel *):hover,
html.dfb-stabilo body :is(p, li, h1, h2, h3, h4, h5, h6, td, th, a, label):not(#bpDifabel *):focus-within,
html.dfb-stabilo body .dfb-tersorot {
    background-color: #fff176 !important; color: #111 !important; outline: 2px solid #fbc02d; outline-offset: 1px; border-radius: 3px;
    -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* Garis panduan membaca */
.dfb-garis {
    position: fixed; left: 0; right: 0; height: 12px; margin-top: -6px; z-index: 1000005; pointer-events: none; display: none;
    background: rgba(229,32,46,.16); border-top: 3px solid #e5202e; border-bottom: 3px solid #e5202e;
}
html.dfb-panduan .dfb-garis { display: block; }
