/* =====================================================================
   WEBGIS SEBARAN & KERAWANAN TBC KABUPATEN LUWU UTARA
   Stylesheet utama

   CATATAN: @import Google Fonts SENGAJA TIDAK dipakai di sini. @import
   bersifat render-blocking -- jika koneksi ke fonts.googleapis.com lambat
   atau terhambat jaringan, SELURUH file CSS ini ikut tertunda/gagal
   diterapkan (menyebabkan header/sidebar/peta tampil tidak bergaya sama
   sekali). Font memakai tumpukan font sistem yang selalu tersedia offline.
   ===================================================================== */

:root {
  /* color tokens - tema TBC (biru) */
  --color-primary: #1D63D8;
  --color-primary-dark: #123E85;
  --color-primary-light: #5B93E8;
  --color-accent: #D9A404;

  --risk-rendah: #2E9E5B;
  --risk-sedang: #E8A63A;
  --risk-tinggi: #D6412E;

  --color-paper: #F3F7FC;
  --color-surface: #FFFFFF;
  --color-ink: #1D2733;
  --color-muted: #62707E;
  --color-border: #D7E3F0;
  --color-border-soft: #E9F0F8;

  --font-display: 'Segoe UI', Roboto, Arial, sans-serif;
  --font-body: 'Segoe UI', Roboto, Arial, sans-serif;
  --font-mono: 'Consolas', 'Courier New', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 2px 8px rgba(29,99,216,0.08);
  --shadow-md: 0 8px 24px rgba(29,99,216,0.14);
  --sidebar-w: 252px;
  --topbar-h: 70px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  width: 100%;
  overflow-x: hidden;
  background: #FFFFFF;
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; margin: 0 0 .5em; color: var(--color-primary-dark); }
h1 { font-size: 2.1rem; letter-spacing: -0.01em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-accent); }
code, .mono { font-family: var(--font-mono); }
img { max-width: 100%; }

/* ---------------------------------------------------------------- */
/* App shell: sidebar + topbar + content                            */
/* ---------------------------------------------------------------- */
.app-shell { min-height: 100vh; overflow-x: hidden; }

.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  background-image: linear-gradient(100deg, var(--color-primary-dark), var(--color-primary) 70%);
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px 0 18px;
  z-index: 9999; /* PERBAIKAN: Dinaikkan agar selalu di atas peta */
  box-shadow: var(--shadow-md);
  gap: 16px;
}

.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; flex-shrink: 1; }
.topbar-right { display: flex; align-items: center; gap: 18px; flex-shrink: 0; }

.header-logos { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.header-logo {
  height: 40px; width: 40px; object-fit: contain; border-radius: 8px;
  background: #fff; padding: 3px; flex-shrink: 0;
}

.topbar .brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar .brand-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: rgba(255,255,255,0.14);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.topbar .brand-text { min-width: 0; }
.topbar .kicker { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; opacity: .78; }
.topbar .title { font-family: var(--font-display); font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw; }

/* Navigasi horizontal di header kanan atas (halaman publik) */
.topnav { display: flex; align-items: center; gap: 2px; }
.topnav-link {
  color: #fff !important; opacity: .82; font-size: 13.3px; font-weight: 600;
  padding: 8px 12px; border-radius: 7px; white-space: nowrap;
}
.topnav-link:hover { opacity: 1; background: rgba(255,255,255,0.12); }
.topnav-link.active { opacity: 1; background: rgba(255,255,255,0.2); box-shadow: var(--shadow-sm); }

/* Dropdown navigasi mobile (halaman publik, layar kecil) */
.mobile-nav {
  display: none; position: fixed; top: var(--topbar-h); left: 0; right: 0;
  background: #fff; flex-direction: column; padding: 8px;
  box-shadow: var(--shadow-md); z-index: 9997;
  transform: translateY(-8px); opacity: 0; pointer-events: none;
  transition: transform .15s ease, opacity .15s ease;
}
.mobile-nav.open { display: flex; transform: translateY(0); opacity: 1; pointer-events: auto; }
.mobile-nav-link {
  color: var(--color-ink) !important; font-size: 14.5px; font-weight: 600;
  padding: 12px 14px; border-radius: 8px;
}
.mobile-nav-link:hover { background: var(--color-border-soft); }
.mobile-nav-link.active { background: var(--color-primary); color: #fff !important; }

.menu-toggle {
  display: none;
  background: none; border: none; color: #fff; font-size: 22px;
  margin-right: 4px; cursor: pointer; padding: 4px 8px;
}

.btn-login-admin {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,0.14);
  color: #fff !important;
  padding: 8px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  border: 1px solid rgba(255,255,255,0.25);
  transition: background .15s;
}
.btn-login-admin:hover { background: rgba(255,255,255,0.24); }

.admin-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.12);
  padding: 6px 14px 6px 6px; border-radius: 30px;
  font-size: 13px; color: #fff;
}
.admin-pill .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--color-accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
}
.admin-pill a { color: #fff !important; opacity: .92; }
.admin-pill a:hover { opacity: 1; text-decoration: underline; }

/* Sidebar */
.sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: #F0F5FB;
  border-right: 1px solid var(--color-border-soft);
  overflow-y: auto;
  padding: 18px 0;
  z-index: 9998; /* PERBAIKAN: Dinaikkan agar di atas peta tapi di bawah topbar */
  transition: transform .2s ease;
}
.nav-section-title {
  font-family: var(--font-mono);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--color-muted); padding: 14px 18px 8px;
}
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 18px; margin: 0 8px; border-radius: 9px;
  color: var(--color-ink) !important; font-size: 14px; font-weight: 500;
}
.nav-link:hover { background: var(--color-border-soft); }
.nav-link.active {
  background: var(--color-primary);
  color: #fff !important;
  box-shadow: var(--shadow-sm);
}
.nav-link svg { flex-shrink: 0; }

/* Main content */
.main-content {
  padding-top: var(--topbar-h);
  min-height: 100vh;
  display: flex; flex-direction: column;
}
/* Halaman admin masih pakai sidebar kiri (sidebar_admin.php) */
.has-sidebar .main-content { margin-left: var(--sidebar-w); }
.content-pad { padding: 28px 32px; flex: 1; }
.content-pad.full-bleed { padding: 0; }

.site-footer {
  padding: 18px 32px; border-top: 1px solid var(--color-border-soft);
  font-size: 12.5px; color: var(--color-muted);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px;
}

@media (max-width: 900px) {
  .menu-toggle { display: inline-block; }
  .topnav { display: none; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-md); }
  .sidebar.open { transform: translateX(0); }
  .has-sidebar .main-content { margin-left: 0; }
  .topbar .title { max-width: 40vw; }
  .topbar .brand-text .kicker { display: none; }
  .content-pad.full-bleed { left: 0; }
  .header-logo { height: 30px; width: 30px; }
}

@media (max-width: 640px) {
  .topbar .brand-text { display: none; }
  .header-logos { gap: 6px; }
}

/* ---------------------------------------------------------------- */
/* Hero + cards                                                     */
/* ---------------------------------------------------------------- */
.hero {
  background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary));
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 40px 40px 34px;
  margin-bottom: 26px;
}
.eyebrow {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .1em;
  text-transform: uppercase; opacity: .85; margin-bottom: 10px;
}
.hero h1 { color: #fff; font-size: 1.9rem; margin-bottom: 14px; }
.hero .sub { max-width: 780px; opacity: .92; font-size: 15px; }
.hero-centered { display: flex; flex-direction: column; align-items: center; text-align: center; }
.hero-centered .sub { margin-left: auto; margin-right: auto; }
.hero-illustration { margin-bottom: 14px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.hero-centered .hero-cta { justify-content: center; }
.btn-hero-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; color: var(--color-primary-dark) !important;
  padding: 11px 20px; border-radius: 9px; font-size: 14px; font-weight: 700;
}
.btn-hero-primary:hover { background: #E4EDFB; }
.btn-hero-outline {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.1); color: #fff !important;
  padding: 11px 20px; border-radius: 9px; font-size: 14px; font-weight: 700;
  border: 1px solid rgba(255,255,255,0.45);
}
.btn-hero-outline:hover { background: rgba(255,255,255,0.2); }
.hero-stats { display: flex; flex-wrap: wrap; gap: 28px; margin-top: 26px; }
.hero-centered .hero-stats { justify-content: center; }
.hero-stats .stat .num { font-family: var(--font-display); font-size: 1.7rem; font-weight: 800; }
.hero-stats .stat .lbl { font-size: 12.5px; opacity: .82; margin-top: 2px; }

/* Quick links (beranda) */
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 980px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid-4 { grid-template-columns: 1fr; } }
.quick-link-card {
  display: flex; align-items: center; gap: 12px;
  color: var(--color-ink) !important; font-weight: 700; font-size: 14px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.quick-link-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.quick-link-card .icon {
  width: 38px; height: 38px; border-radius: 9px; flex-shrink: 0;
  background: #E4EDFB; color: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
}
.card.prose h3 { margin-bottom: 12px; }
.card.prose p { color: #4a3d3a; font-size: 14.5px; }

.page-head { margin-bottom: 22px; }
.page-head .lead { color: var(--color-muted); font-size: 14.5px; max-width: 760px; }

.grid { display: grid; gap: 18px; margin-bottom: 30px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 980px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.faskes-map-card { padding: 0; overflow: hidden; margin-bottom: 22px; position: relative !important; z-index: 1 !important; }
#leaflet-faskes { height: 300px; width: 100%; position: relative !important; z-index: 1 !important; } /* PERBAIKAN: relative & z-index */
@media (max-width: 640px) { #leaflet-faskes { height: 260px; } }

.param-card { display: flex; gap: 16px; align-items: flex-start; }
.param-card .icon {
  width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0;
  background: #E4EDFB; color: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
}
.param-card h3 { margin-bottom: 6px; font-size: 1.02rem; }
.param-card .muted { color: var(--color-muted); font-size: 13.5px; margin-bottom: 8px; }
.param-card a { font-size: 13px; font-weight: 600; }

.muted { color: var(--color-muted); }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-0 { margin-top: 0; }

/* ---------------------------------------------------------------- */
/* Summary cards (dashboard)                                        */
/* ---------------------------------------------------------------- */
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
@media (max-width: 980px) { .summary-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .summary-grid { grid-template-columns: 1fr; } }
.summary-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--color-primary);
}
.summary-card .lbl { font-size: 12px; color: var(--color-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.summary-card .num { font-family: var(--font-display); font-size: 1.9rem; font-weight: 800; color: var(--color-primary-dark); margin-top: 4px; }
.summary-card.risk-high { border-left-color: var(--risk-tinggi); }
.summary-card.risk-high .num { color: var(--risk-tinggi); }

/* ---------------------------------------------------------------- */
/* Tables                                                            */
/* ---------------------------------------------------------------- */
.table-wrap { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm); }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
  background: var(--color-paper); text-align: left; padding: 12px 16px;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--color-muted); border-bottom: 1px solid var(--color-border);
}
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--color-border-soft); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #F0F5FB; }
.actions { display: flex; gap: 8px; white-space: nowrap; }

.badge { display: inline-block; padding: 4px 11px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge-rendah  { background: #E4F5EA; color: var(--risk-rendah); }
.badge-sedang  { background: #FCF0DA; color: #A5741F; }
.badge-tinggi  { background: #FBE3DE; color: var(--risk-tinggi); }

.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px; border-radius: 8px; font-size: 13.5px; font-weight: 600; border: 1px solid transparent; cursor: pointer; }
.btn-primary { background: var(--color-primary); color: #fff !important; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-outline { background: #fff; border-color: var(--color-border); color: var(--color-ink) !important; }
.btn-outline:hover { background: var(--color-paper); }
.btn-danger { background: #FBE3DE; color: var(--risk-tinggi) !important; }
.btn-danger:hover { background: #f6cec5; }
.btn-sm { padding: 6px 13px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }

.alert { padding: 12px 16px; border-radius: 8px; font-size: 13.5px; margin-bottom: 18px; }
.alert-success { background: #E4F5EA; color: #1c6b3f; border: 1px solid #bfe5cf; }
.alert-error { background: #FBE3DE; color: #9c2c1c; border: 1px solid #f2beb1; }

/* ---------------------------------------------------------------- */
/* Forms                                                             */
/* ---------------------------------------------------------------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--color-ink); }
.form-control, select.form-control, textarea.form-control {
  width: 100%; padding: 10px 13px; border: 1px solid var(--color-border);
  border-radius: 8px; font-size: 14.5px; font-family: var(--font-body);
  background: #fff; color: var(--color-ink);
}
.form-control:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(29,99,216,.12); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
.form-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 26px 28px; max-width: 620px; box-shadow: var(--shadow-sm); }

/* ---------------------------------------------------------------- */
/* Login page                                                        */
/* ---------------------------------------------------------------- */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary));
  font-family: var(--font-body);
}
.login-card {
  background: #fff; width: 100%; max-width: 400px; border-radius: var(--radius-lg);
  padding: 34px 32px; box-shadow: 0 20px 60px rgba(0,0,0,.28);
}
.brand-row { display: flex; align-items: center; gap: 13px; margin-bottom: 22px; }
.brand-row .brand-icon {
  width: 44px; height: 44px; border-radius: 11px; background: #E4EDFB;
  color: var(--color-primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.back-link { display: inline-block; margin-top: 16px; font-size: 13px; color: var(--color-muted) !important; }
.back-link:hover { color: var(--color-primary) !important; }

/* ---------------------------------------------------------------- */
/* Map pages (Peta Sebaran / Peta Kerawanan)                         */
/* ---------------------------------------------------------------- */
.content-pad.full-bleed {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 5;
}
.has-sidebar .content-pad.full-bleed { left: var(--sidebar-w); }
.map-page-wrap { height: 100%; width: 100%; overflow: hidden; display: flex; align-items: stretch; }
.map-side {
  width: 320px; min-width: 320px; max-width: 320px; height: 100%;
  overflow-y: auto; padding: 18px 16px; background: #f8fafc;
  border-right: 1px solid var(--color-border-soft); box-sizing: border-box; flex-shrink: 0;
}
.map-area { flex: 1; min-width: 0; height: 100%; position: relative; overflow: hidden; }
#leaflet-map { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1 !important; } /* PERBAIKAN: z-index */
.leaflet-overlay-pane svg { overflow: visible !important; }

/* PERBAIKAN: Menurunkan z-index control zoom leaflet agar tidak tembus topbar/sidebar */
.leaflet-top,
.leaflet-bottom {
  z-index: 400 !important;
}

.legend-box {
  background: #fff; border: 1px solid #c8d2dc; border-radius: 6px;
  padding: 12px 14px; margin-bottom: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.07);
}
.legend-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .9px;
  color: var(--color-primary-dark); margin-bottom: 10px; border-bottom: 2px solid var(--color-primary-dark);
  padding-bottom: 5px;
}
.legend-row { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.legend-swatch { display: inline-block; width: 26px; height: 16px; border-radius: 2px; flex-shrink: 0; }

/* Tools Informasi (accordion) di sidebar peta: metodologi & pencegahan TBC */
.info-accordion {
  border: 1px solid #c8d2dc; border-radius: 6px; margin-bottom: 12px;
  background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.07); overflow: hidden;
}
.info-accordion summary {
  list-style: none; cursor: pointer; padding: 11px 14px;
  font-size: 12.5px; font-weight: 700; color: var(--color-primary-dark);
  display: flex; align-items: center; gap: 8px; user-select: none;
}
.info-accordion summary::-webkit-details-marker { display: none; }
.info-accordion summary .chev { margin-left: auto; transition: transform .15s ease; flex-shrink: 0; }
.info-accordion[open] summary .chev { transform: rotate(180deg); }
.info-accordion summary .ico {
  width: 20px; height: 20px; border-radius: 5px; flex-shrink: 0;
  background: #E4EDFB; color: var(--color-primary); display: flex; align-items: center; justify-content: center;
}
.info-accordion .info-body {
  padding: 0 14px 13px 42px; font-size: 12px; line-height: 1.7; color: #4a3d3a; border-top: 1px solid #eee;
}
.info-accordion .info-body p { margin: 8px 0; }
.info-accordion .info-body ul { margin: 6px 0 8px; padding-left: 18px; }
.info-accordion .info-body li { margin-bottom: 4px; }
.info-accordion .info-body strong { color: var(--color-primary-dark); }
.info-accordion .info-src {
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed #ddd;
  font-size: 10.5px; color: #8a7a77; font-style: italic;
}

.kec-label {
  background: transparent !important; border: none !important; padding: 0 !important;
  font-family: 'Segoe UI', Arial, sans-serif !important; font-size: 12px !important; font-weight: 700 !important;
  color: #fff !important;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000, 0 1px 3px rgba(0,0,0,.65) !important;
  box-shadow: none !important; white-space: nowrap !important; pointer-events: none !important;
}
.kec-label::before { display: none !important; }

/* Titik Fasilitas Kesehatan (Puskesmas & Rumah Sakit) di peta Fasilitas Kesehatan */
.faskes-icon { background: transparent; border: none; }
.faskes-icon-inner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center;
}
.faskes-icon-inner.faskes-icon-puskesmas {
  background: #1E6FD9;
  box-shadow: 0 0 0 1px #1E6FD9, 0 1px 4px rgba(0,0,0,.35);
}
.faskes-icon-inner.faskes-icon-rs {
  background: #E53935;
  box-shadow: 0 0 0 1px #E53935, 0 1px 4px rgba(0,0,0,.35);
}

@media print {
  .topbar, .sidebar, .site-footer, .no-print { display: none !important; }
  .main-content { margin-left: 0 !important; padding-top: 0 !important; }
}