/* Gaya kustom di atas Bootstrap. Sumber tunggal: file ini (dimuat setelah app.css). */
:root {
    --kp-primary: #0d6efd;
    --kp-ink: #0f172a;
    --kp-muted: #475569;
    --kp-line: #e2e8f0;
    --kp-soft: #eef4ff;
    --kp-radius: .85rem;
    --kp-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 14px rgba(15, 23, 42, .05);
}

html { scroll-behavior: smooth; }
body { font-size: 1rem; color: var(--kp-ink); -webkit-font-smoothing: antialiased; }
a { text-underline-offset: .15em; }
a:focus-visible, button:focus-visible, input:focus-visible, .btn:focus-visible {
    outline: 3px solid rgba(13, 110, 253, .45);
    outline-offset: 2px;
}
.text-muted { color: var(--kp-muted) !important; }
h1, h2, h3 { letter-spacing: -.01em; }

/* Input >= 16px agar iOS tidak zoom otomatis */
.form-control, .form-control-lg, .btn { font-size: 1rem; }

/* Navbar */
.site-nav {
    position: sticky; top: 0; z-index: 1030;
    background: rgba(255, 255, 255, .92);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--kp-line);
}
.site-nav .navbar-brand { font-weight: 800; color: var(--kp-ink); letter-spacing: -.02em; }
.site-nav .navbar-brand .brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; margin-right: .5rem; border-radius: .55rem;
    background: var(--kp-primary); color: #fff; font-size: .95rem; vertical-align: middle;
}
.site-nav .nav-link { font-weight: 600; padding: .6rem .75rem; border-radius: .5rem; }
.site-nav .nav-link:hover { background: var(--kp-soft); }
.nav-search { min-width: 0; }
@media (min-width: 768px) { .nav-search { width: 20rem; } }
.nav-search .form-control { border-radius: 999px 0 0 999px; background: #f1f5f9; border-color: transparent; }
.nav-search .btn { border-radius: 0 999px 999px 0; }

/* Cards */
.card { border: 0; border-radius: var(--kp-radius); box-shadow: var(--kp-shadow); }
.card-body { padding: 1.25rem; }
@media (min-width: 768px) { .card-body { padding: 1.75rem; } }

/* Hero */
.hero {
    background: linear-gradient(180deg, var(--kp-soft) 0%, rgba(248, 250, 252, 0) 100%);
    border-radius: 1.25rem; padding: 1.5rem 1rem;
}
@media (min-width: 768px) { .hero { padding: 2.5rem 2rem; } }
.hero h1 { font-weight: 800; font-size: clamp(1.7rem, 4vw, 2.5rem); }
.hero .lead { color: var(--kp-muted); font-size: 1.05rem; }
.hero .input-group { box-shadow: var(--kp-shadow); border-radius: var(--kp-radius); }
.hero .form-control { border-color: var(--kp-line); border-radius: var(--kp-radius) 0 0 var(--kp-radius); }
.hero .btn { border-radius: 0 var(--kp-radius) var(--kp-radius) 0; padding-left: 1.5rem; padding-right: 1.5rem; }
.chip {
    display: inline-block; padding: .35rem .85rem; margin: 0 .25rem .5rem 0;
    background: #fff; border: 1px solid var(--kp-line); border-radius: 999px;
    color: var(--kp-ink); text-decoration: none; font-size: .9rem;
}
.chip:hover { border-color: var(--kp-primary); color: var(--kp-primary); }

/* Grid kartu provinsi */
.tile {
    position: relative;
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    min-height: 3.5rem; padding: .75rem 1rem; height: 100%;
    background: #fff; border: 1px solid var(--kp-line); border-radius: var(--kp-radius);
    color: var(--kp-ink); text-decoration: none; font-weight: 600;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.tile:hover { border-color: var(--kp-primary); box-shadow: var(--kp-shadow); color: var(--kp-primary); transform: translateY(-1px); }
.tile small { font-weight: 500; color: var(--kp-muted); white-space: nowrap; }

/* Daftar baris (kota / kecamatan / kelurahan) */
.row-list { display: grid; gap: .5rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .row-list { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .row-list { grid-template-columns: repeat(3, 1fr); } }
.row-item {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    min-height: 3.25rem; padding: .6rem 1rem;
    background: #fff; border: 1px solid var(--kp-line); border-radius: .7rem;
    color: var(--kp-ink); text-decoration: none; transition: border-color .15s, background .15s;
}
.row-item { position: relative; }
.row-item[hidden] { display: none; }
a.row-item:hover { border-color: var(--kp-primary); background: var(--kp-soft); }
.row-item .name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.row-item .meta { color: var(--kp-muted); font-size: .85rem; white-space: nowrap; text-align: right; }
.row-item .code { font-weight: 700; color: var(--kp-primary); background: var(--kp-soft); padding: .15rem .6rem; border-radius: 999px; text-decoration: none; }
.row-item .code:hover { background: var(--kp-primary); color: #fff; }
.row-item .code.empty { color: var(--kp-muted); background: #f1f5f9; }

/* Tabel (hasil pencarian & detail kode pos) */
.table { --bs-table-hover-bg: var(--kp-soft); }
.table > :not(caption) > * > * { padding: .8rem .75rem; }
.table thead th { background: #f8fafc; color: var(--kp-muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--kp-line); }
.table-bordered > :not(caption) > * { border-width: 0 0 1px; }
.table-bordered > :not(caption) > * > * { border-width: 0; }
.table tbody tr { border-bottom: 1px solid var(--kp-line); }
.table tbody tr:hover { background: var(--kp-soft); }

/* Filter & lain-lain */
.filter-box { position: relative; }
.filter-box .form-control { background: #f1f5f9; border-color: transparent; border-radius: .7rem; padding: .7rem 1rem; }
.filter-box .form-control:focus { background: #fff; border-color: var(--kp-primary); }
.page-intro { color: var(--kp-muted); }

.breadcrumb-header { position: relative; }
.breadcrumb-header .breadcrumb { -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent); mask-image: linear-gradient(90deg, #000 92%, transparent); }
.breadcrumb-item a { text-decoration: none; }
.breadcrumb-item a:hover { text-decoration: underline; }

.code-hero { background: var(--kp-soft) !important; border-radius: var(--kp-radius) !important; }
.code-hero .display-5 { letter-spacing: .04em; }
.min-w-0 { min-width: 0; }
.list-group-item { border-color: var(--kp-line); }

.back-to-top {
    position: fixed; right: 1rem; bottom: 1rem; z-index: 1020;
    width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%;
    background: var(--kp-primary); color: #fff; font-size: 1.25rem; line-height: 1;
    box-shadow: var(--kp-shadow); opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s;
}
.back-to-top.show { opacity: 1; visibility: visible; }

footer { margin-top: 2rem; border-top: 1px solid var(--kp-line); background: #fff; font-size: .9rem; }
footer .nav-link { color: var(--kp-muted); padding: .5rem .75rem; }
footer .nav-link:hover { color: var(--kp-primary); }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; }
}
