:root {
    --earth-900: #1a2e22;
    --earth-800: #23402e;
    --earth-700: #2d5237;
    --amber-500: #c8873a;
    --amber-400: #d9a35c;
    --cream: #f6f2ea;
    --ink: #1e2321;
    --muted: #6b7570;
    --border: #e2ddd0;
    --white: #ffffff;
    --radius: 10px;
}

* { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: 80px; /* agar anchor #provinsi tidak tertutup header sticky */
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--cream);
    color: var(--ink);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    /* Sticky footer: body jadi kolom flex setinggi minimal layar penuh, "main" mengisi sisa
       ruang kosong -- supaya footer selalu nempel di bawah layar walau kontennya sedikit
       (misal halaman hasil pencarian yang cuma 1 hasil), bukan "ketarik" ke tengah halaman. */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
main { flex: 1 0 auto; }

img, svg { max-width: 100%; }

a { color: inherit; text-decoration: none; }

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 clamp(20px, 5vw, 32px);
}

/* Halaman dengan class ini di <body> tidak dibatasi lebar 1180px - dipakai
   untuk template tertentu yang sengaja dibuat fullwidth. */
body.fullwidth-page .container {
    max-width: none;
}

/* Header */
header.site-header {
    background: var(--earth-900);
    color: var(--cream);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.brand {
    font-size: clamp(1.1rem, 3vw, 1.3rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}
.brand span { color: var(--amber-400); }
.site-header nav a {
    color: var(--cream);
    opacity: 0.85;
    font-size: 0.92rem;
    margin-left: 18px;
}
.site-header nav a:first-child { margin-left: 0; }
.site-header nav a:hover { opacity: 1; }

/* Hero */
.hero {
    background: linear-gradient(160deg, var(--earth-900) 0%, var(--earth-700) 100%);
    color: var(--cream);
    padding: clamp(32px, 6vw, 56px) 0 clamp(28px, 5vw, 44px);
    text-align: center;
}
.hero h1 {
    font-size: clamp(1.5rem, 4.5vw, 2.2rem);
    margin: 0 auto 10px;
    font-weight: 800;
    max-width: 700px;
    line-height: 1.25;
}
.hero p {
    color: #d9d3c4;
    max-width: 600px;
    margin: 0 auto 22px;
    font-size: clamp(0.9rem, 2vw, 1rem);
}
.hero-stats {
    display: flex;
    justify-content: center;
    gap: clamp(18px, 4vw, 28px);
    flex-wrap: wrap;
}
.hero-stats div { font-size: 0.85rem; color: #cdc7b8; }
.hero-stats strong { display: block; font-size: 1.4rem; color: var(--amber-400); }

/* Search box */
.search-box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 6px;
    display: flex;
    max-width: 480px;
    width: 100%;
    margin: 20px auto 0;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    text-align: left;
}
.search-box input {
    flex: 1;
    min-width: 0;
    border: none;
    padding: 12px 14px;
    font-size: 16px;
    border-radius: 8px;
    outline: none;
}
.search-box button {
    background: var(--amber-500);
    color: white;
    border: none;
    padding: 0 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}

/* Sections */
.section { padding: 42px 0; }
.section h2 {
    font-size: 1.4rem;
    margin: 0 0 6px;
}
.section .sub { color: var(--muted); margin: 0 0 24px; font-size: 0.94rem; }

#provinsi h2, #provinsi .sub {
    text-align: center;
}
#provinsi .sub {
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

/* Provinsi grid - jumlah kolom otomatis menyesuaikan lebar layar (bukan angka tetap) */
.provinsi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}
.provinsi-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    transition: all 0.15s ease;
}
.provinsi-card:hover {
    border-color: var(--amber-500);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}
.provinsi-card .name { font-weight: 700; font-size: 1rem; }
.provinsi-card .count { color: var(--muted); font-size: 0.82rem; margin-top: 4px; }

/* Listing cards */
.listing-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 14px;
}
.listing-card .top {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 10px;
    flex-wrap: wrap;
}
.listing-card .name { font-weight: 700; font-size: 1.05rem; margin: 0 0 4px; }
.listing-card .loc { color: var(--muted); font-size: 0.85rem; }
.badge-featured {
    background: var(--amber-500);
    color: white;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 20px;
    font-weight: 600;
    white-space: nowrap;
}
.listing-card .desc { margin: 10px 0; font-size: 0.92rem; color: #3a423d; }
.listing-card .layanan-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tag {
    background: var(--cream);
    border: 1px solid var(--border);
    font-size: 0.76rem;
    padding: 3px 9px;
    border-radius: 20px;
    color: var(--earth-800);
}
.contact-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Tombol mengambang WA & Telepon di beranda, tetap tampil saat scroll */
.floating-contact {
    position: fixed;
    right: 18px;
    bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 200;
}
.floating-contact a {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    transition: transform 0.15s ease;
}
.floating-contact a:hover { transform: scale(1.08); }
.floating-contact a.fab-wa { background: #25D366; }
.floating-contact a.fab-call { background: var(--amber-500); }
.floating-contact svg { width: 24px; height: 24px; }

@media (max-width: 600px) {
    .floating-contact { right: 12px; bottom: 12px; gap: 10px; }
    .floating-contact a { width: 48px; height: 48px; }
    .floating-contact svg { width: 21px; height: 21px; }
}

/* Pill kategori artikel di beranda */
.kategori-section {
    padding: 4px 0 14px;
    text-align: center;
}
.kategori-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}
.kategori-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--white);
    border: 1px solid var(--border);
    color: var(--earth-800);
    font-size: 0.88rem;
    font-weight: 600;
    padding: 9px 18px;
    border-radius: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: all 0.18s ease;
}
.kategori-pill:hover {
    background: var(--amber-500);
    border-color: var(--amber-500);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(200,135,58,0.28);
}
.kategori-pill .count {
    background: var(--cream);
    color: var(--earth-700);
    font-size: 0.74rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    transition: all 0.18s ease;
}
.kategori-pill:hover .count {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

.btn-wa, .btn-tel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 16px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    flex: 1 1 150px;
    transition: filter 0.15s ease;
}
.btn-wa:hover, .btn-tel:hover { filter: brightness(0.94); }

.btn-wa {
    background: #25D366;
    color: white;
}

.btn-tel {
    background: var(--amber-500, #c8873a);
    color: white;
}

/* SEO content block */
.seo-content {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    font-size: 0.94rem;
    color: #3a423d;
}
.seo-content.empty {
    color: var(--muted);
    font-style: italic;
}
.internal-link-provinsi {
    background: var(--cream);
    border-left: 3px solid var(--amber-500);
    padding: 10px 14px;
    border-radius: 4px;
    margin: 0 0 12px;
}
.internal-link-provinsi ul {
    margin: 6px 0 0;
    padding-left: 20px;
}
.internal-link-provinsi li { margin: 2px 0; }
.internal-link-provinsi a {
    color: var(--amber-500);
    text-decoration: underline;
    font-weight: 600;
}
.seo-content img {
    max-width: min(100%, 760px);
    height: auto;
    display: block;
    margin: 0 auto 16px;
    border-radius: var(--radius);
}

/* Area layanan (kota/kabupaten per provinsi) */
.wilayah-block {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-top: 20px;
}
.wilayah-block h2 {
    font-size: 1.15rem;
    margin: 0 0 8px;
}
.wilayah-intro {
    font-size: 0.92rem;
    color: #3a423d;
    margin: 0 0 14px;
}
.wilayah-list {
    list-style: none;
    padding: 0;
    margin: 0 0 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.wilayah-list li a {
    display: inline-block;
    background: var(--cream);
    border: 1px solid var(--border);
    color: var(--earth-800);
    font-size: 0.82rem;
    padding: 5px 12px;
    border-radius: 20px;
    text-decoration: none;
}
.wilayah-list li a:hover {
    border-color: var(--amber-500);
}
.wilayah-note {
    font-size: 0.85rem;
    color: var(--muted);
    margin: 0;
}

.faq-block {
    margin-top: 20px;
}
.faq-block h2 {
    font-size: 1.15rem;
    margin-bottom: 10px;
}
.faq-item {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 10px;
}
.faq-item h3 {
    font-size: 0.95rem;
    margin: 0 0 6px;
}
.faq-item p {
    font-size: 0.88rem;
    color: #3a423d;
    margin: 0;
}

/* Breadcrumb */
.breadcrumb {
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 16px;
}
.breadcrumb a { color: var(--earth-700); }

/* Footer */
footer.site-footer {
    background: var(--earth-900);
    color: #b9b3a3;
    padding: 28px 0;
    margin-top: 40px;
    font-size: 0.85rem;
    text-align: center;
}

.footer-sitemap {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 14px;
    margin-bottom: 18px;
    font-size: 0.78rem;
}

.footer-sitemap a {
    color: #b9b3a3;
    text-decoration: none;
}

.footer-sitemap a:hover {
    color: #fff;
    text-decoration: underline;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}

/* Admin */
.admin-shell { min-height: 100vh; background: var(--cream); }
.admin-topbar {
    background: var(--earth-900);
    color: white;
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.admin-topbar .container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px 16px; max-width: none; margin: 0; padding: 0 16px; }
.admin-topbar .container > div:last-child { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
.admin-topbar a.logout { color: #d9a35c; font-size: 0.85rem; }
.admin-layout {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    max-width: none;
    margin: 0;
    padding: 16px;
}
.admin-sidebar {
    flex: 0 0 190px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: sticky;
    top: 70px;
}
.admin-sidebar a {
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--text, #2a2a2a);
    text-decoration: none;
    font-size: 0.92rem;
}
.admin-sidebar a:hover { background: var(--white); }
.admin-sidebar a.active { background: var(--white); font-weight: 700; color: var(--amber-500); }
.admin-main { flex: 1; min-width: 0; }
@media (max-width: 700px) {
    .admin-layout { flex-direction: column; }
    .admin-sidebar { flex-direction: row; flex-wrap: wrap; position: static; width: 100%; }
}
.admin-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}
.form-row { margin-bottom: 14px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

/* Tabs (dipakai di form artikel: Artikel / Ide Cepat) */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tab-btn {
    background: none;
    border: none;
    padding: 10px 6px;
    margin-right: 20px;
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    font-family: inherit;
}
.tab-btn.active { color: var(--earth-800); border-bottom-color: var(--amber-500); }
.tab-panel[hidden] { display: none; }

/* Editor kaya (rich text) untuk Isi Artikel */
.rte-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    background: var(--cream);
}
.rte-toolbar button {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    color: var(--earth-800);
    line-height: 1.3;
}
.rte-toolbar button:hover { background: var(--amber-500); color: #fff; border-color: var(--amber-500); }
.rte-toolbar button:disabled { opacity: 0.4; cursor: not-allowed; }
.rte-toolbar button:disabled:hover { background: #fff; color: var(--earth-800); border-color: var(--border); }
.rte-toolbar .rte-sep { width: 1px; background: var(--border); margin: 4px 2px; }
.rte-toolbar .rte-mode-btn { margin-left: auto; font-weight: 700; }

.rte-editor {
    min-height: 480px;
    max-height: none;
    resize: vertical;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 14px;
    font-size: 0.95rem;
    line-height: 1.65;
    background: #fff;
    color: var(--ink);
}
.rte-editor:focus { outline: 2px solid var(--amber-400); outline-offset: -2px; }
.rte-editor img {
    max-width: 100%;
    display: inline-block;
    vertical-align: top;
    cursor: pointer;
    border-radius: 6px;
    margin: 4px;
}
.rte-editor img.rte-img-selected { outline: 2px solid var(--amber-500); outline-offset: 2px; }
.rte-editor.rte-dragover { outline: 2px dashed var(--amber-500); outline-offset: -6px; background: #fffaf2; }
.rte-img-resize-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--amber-500);
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: nwse-resize;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.rte-img-resize-handle-ne, .rte-img-resize-handle-sw { cursor: nesw-resize; }
.rte-alt-box {
    position: absolute;
    z-index: 1000;
    font-size: 0.78rem;
    padding: 5px 8px;
    border: 1px solid var(--amber-500);
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.rte-img-delete-btn {
    position: absolute;
    z-index: 1001;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: #c0392b;
    color: #fff;
    font-size: 15px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.rte-img-delete-btn:hover { background: #a5301f; }
.rte-editor a { color: var(--amber-500); text-decoration: underline; }
.rte-editor p { margin: 0 0 12px; }
.rte-html {
    width: 100%;
    min-height: 480px;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 14px;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.82rem;
    resize: vertical;
}
.form-row label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 5px; }
.form-row input, .form-row select, .form-row textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
}
.form-row textarea { min-height: 90px; resize: vertical; }
.btn {
    background: var(--earth-700);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
}
.btn.amber { background: var(--amber-500); }
.btn.danger { background: #b3453a; }
.btn.ghost { background: transparent; color: var(--earth-700); border: 1px solid var(--border); }

.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.admin-table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 0.88rem; }
table.admin-table th, table.admin-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table.admin-table th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; }
.row-actions a { margin-right: 10px; font-size: 0.85rem; color: var(--earth-700); }
.row-actions a.danger { color: #b3453a; }

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--earth-900);
}
.login-box {
    background: white;
    padding: 36px 32px;
    border-radius: var(--radius);
    width: 100%;
    max-width: 360px;
}
.login-box h1 { font-size: 1.2rem; margin: 0 0 20px; }
.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.86rem;
    margin-bottom: 14px;
}
.alert.error { background: #fce8e6; color: #a3352b; }
.alert.success { background: #e5f4ea; color: #1f7a44; }

/* Tablet */
@media (max-width: 900px) {
    .provinsi-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Mobile */
@media (max-width: 600px) {
    .provinsi-grid { grid-template-columns: repeat(2, 1fr); }
    .search-box { max-width: 100%; }
    .contact-buttons { flex-direction: column; }
    .btn-wa, .btn-tel { flex: 1 1 auto; width: 100%; }
    .listing-card .top { flex-direction: column; align-items: flex-start; }
    .admin-card { padding: 18px; }
    .form-row-2 { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
    .provinsi-grid { grid-template-columns: 1fr; }
}
