:root{
  --bg: #f4f7fb;
  --surface: #ffffff;
  --text: #0b1220;
  --muted: #5b6b83;
  --border: #e6ebf4;

  --primary: #0b5ed7;
  --primary-2: #094fb5;
  --soft: #eef4ff;

  --shadow: 0 12px 34px rgba(15, 23, 42, 0.08);
  --shadow2: 0 10px 22px rgba(15, 23, 42, 0.06);
  --radius: 14px;
}

*{ box-sizing: border-box; }
html, body { height: 100%; }

body{
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  letter-spacing: -0.2px;
}

.hidden{ display:none !important; }
.muted{ color: var(--muted); }

/* =========================
   Topbar
   ========================= */
.topbar{
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 18px;

  display: grid;
  grid-template-columns: auto 1fr auto; /* FIX: logo | nav | actions */
  align-items: center;
  gap: 12px;
}

.brand{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 280px;
}

.logo{
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.brand-name{
  font-weight: 900;
  font-size: 16px;
  line-height: 1.1;
}

.brand-sub{
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
}

.nav{
  display:flex;
  justify-content:center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-link{
  text-decoration:none;
  color: #16243b;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
}

.nav-link:hover{
  background: #f2f6ff;
  border-color: #e4ecff;
}

.nav-link.active{
  background: var(--soft);
  border-color: #d6e6ff;
  color: #0b3ea8;
}

.top-actions{
  display:flex;
  justify-content:flex-end;
  align-items: center;
  gap: 10px;
  justify-self: end; /* FIX: benar-benar nempel kanan grid */
}

/* =========================
   Layout
   ========================= */
.layout{
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: calc(100vh - 74px);
}

/* =========================
   Sidebar
   ========================= */
.sidebar{
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px;
  overflow:auto;
}

.sidebar-head{
  padding: 10px 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fbfdff;
  box-shadow: var(--shadow2);
  margin-bottom: 12px;
}

.sidebar-title{
  font-weight: 900;
  font-size: 13.5px;
}

.sidebar-sub{
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 4px;
}

.sidebar-section{ margin-bottom: 12px; }

.info-card{
  background: #fbfcff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: 0 8px 18px rgba(15,23,42,0.05);
}

.info-top{
  display:flex;
  align-items:center;
  gap: 10px;
  margin-bottom: 6px;
}

.info-dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.dot-veg{ background: #22c55e; }
.dot-cagar{ background: #f59e0b; }
.dot-lereng{ background: #60a5fa; }

.info-card h4{
  margin: 0;
  font-size: 13px;
  font-weight: 900;
}

.info-card ul{
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.info-card li{ margin: 6px 0; font-size: 12.5px; }

.mini-note{
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  padding: 12px;
  font-size: 12.5px;
  color: #7c2d12;
}

/* =========================
   Main
   ========================= */
.main{
  padding: 16px;
  overflow: auto;
}
.view{ width: 100%; }

/* =========================
   Hero
   ========================= */
.hero{
  position: relative;
  border-radius: calc(var(--radius) + 8px);
  overflow:hidden;
  box-shadow: var(--shadow);
  min-height: 390px;
  background:
    radial-gradient(1200px 520px at 20% 20%, rgba(11,94,215,0.35), transparent 60%),
    radial-gradient(900px 420px at 80% 30%, rgba(16,185,129,0.22), transparent 55%),
    linear-gradient(135deg, #071226 0%, #0b2a5c 48%, #0b5ed7 100%);
}

.hero-overlay{
  position:absolute; inset:0;
  background: url("assets/hero.jpg") center/cover no-repeat;
  opacity: 0.12;
}

.hero-content{
  position: relative;
  padding: 30px;
  color: white;
}

.hero-kicker{
  display:inline-block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.2px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  margin-bottom: 12px;
}

.hero-content h1{
  margin: 0 0 10px;
  font-size: 30px;
  letter-spacing: -0.6px;
}

.accent{ color: #dbeafe; }

.hero-lead{
  margin: 0 0 16px;
  max-width: 820px;
  color: rgba(255,255,255,0.88);
  line-height: 1.55;
}

.hero-actions{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.hero-badges{
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 12px;
  margin-top: 18px;
}

.badge{
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 16px;
  padding: 12px 14px;
  backdrop-filter: blur(10px);
}

.badge-title{
  font-weight: 900;
  font-size: 13px;
}

.badge-text{
  font-size: 12.5px;
  color: rgba(255,255,255,0.84);
  margin-top: 6px;
  line-height: 1.45;
}

.badge-meta{
  margin-top: 10px;
  font-size: 11.5px;
  color: rgba(255,255,255,0.72);
  font-weight: 700;
  border-top: 1px solid rgba(255,255,255,0.16);
  padding-top: 10px;
}

/* =========================
   Sections
   ========================= */
.content-block{ margin-top: 14px; }
.section-head h2, .section-head h3{ margin: 0; }
.section-head p{ margin: 8px 0 0; line-height: 1.6; }

.grid-2{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
  margin-top: 12px;
}

/* =========================
   Cards & Panels
   ========================= */
.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 10px 20px rgba(15,23,42,0.05);
}

.card h3{ margin: 0 0 8px; font-weight: 900; }
.card p{ margin: 0; color: #2b3b55; line-height: 1.6; }

.callout{
  margin-top: 12px;
  border-radius: var(--radius);
  border: 1px solid #d6e6ff;
  background: var(--soft);
  padding: 12px 14px;
}

.callout-title{ font-weight: 900; }
.callout-text{ color: #294067; margin-top: 4px; line-height: 1.5; }

.panel{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 8px);
  box-shadow: var(--shadow);
  padding: 18px;
  max-width: 560px;
}

.panel-wide{
  max-width: 980px;
}

.panel-head h2{ margin: 0 0 6px; font-weight: 900; }
.panel-head p{ margin: 0; }

.static-extra{
  margin-top: 12px;
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
}

/* =========================
   Buttons (FIX: tidak melar)
   ========================= */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 800;

  cursor: pointer;
  white-space: nowrap;
  width: fit-content;

  transition: transform .06s ease, background .2s ease, border-color .2s ease;
}

.btn:active{ transform: translateY(1px); }

.btn.primary{ background: var(--primary); color: white; }
.btn.primary:hover{ background: var(--primary-2); }

.btn.secondary{
  background: rgba(255,255,255,0.16);
  color: white;
  border-color: rgba(255,255,255,0.28);
}
.btn.secondary:hover{ background: rgba(255,255,255,0.22); }

.btn.ghost{
  background: #f6f8fe;
  border-color: #e6ebf4;
  color: #16243b;
}
.btn.ghost:hover{ background: #eef3ff; }

/* =========================
   Form
   ========================= */
.form{ margin-top: 10px; }

.field{ display:block; margin-bottom: 12px; }

.field span{
  display:block;
  font-size: 12.5px;
  font-weight: 900;
  margin-bottom: 6px;
}

.field input{
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  outline: none;
  background: white;
}

.field input:focus{
  border-color: #b6d4fe;
  box-shadow: 0 0 0 4px rgba(11,94,215,0.12);
}

.form-actions{ display:flex; gap: 10px; margin-top: 6px; }

.hint{
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--muted);
}

code{
  background: #0b1220;
  color: #e2e8f0;
  padding: 2px 6px;
  border-radius: 8px;
}

/* =========================
   Dashboard
   ========================= */
.page-head h2{ margin: 0 0 6px; font-weight: 900; }

.stats{
  margin-top: 12px;
  display:grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 10px;
}

.stat-card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow2);
}

.stat-label{ font-size: 12px; color: var(--muted); font-weight: 900; }
.stat-value{ font-size: 22px; font-weight: 900; margin-top: 8px; }
.stat-note{ font-size: 12px; color: var(--muted); margin-top: 6px; }

.dataset{ margin-top: 14px; }

.dataset-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 12px;
  margin-top: 12px;
}

/* Dataset card: 1/4 title white, 3/4 image */
.dataset-card{
  padding: 0;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 8px);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow2);
  cursor: pointer;
  text-align: left;
  transition: transform .12s ease, box-shadow .12s ease;
}

.dataset-card:hover{
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(15,23,42,0.10);
}

.dataset-title{
  background: white;
  padding: 12px 14px;
  font-weight: 900;
  border-bottom: 1px solid var(--border);
}

.dataset-media{
  height: 180px;
  background-size: cover;
  background-position: center;
}

.bg-veg{
  background-image:
    linear-gradient(135deg, rgba(34,197,94,0.28), rgba(11,94,215,0.16)),
    url("assets/hero.jpg");
}

.bg-cagar{
  background-image:
    linear-gradient(135deg, rgba(245,158,11,0.26), rgba(2,132,199,0.16)),
    url("assets/hero.jpg");
}

.bg-lereng{
  background-image:
    linear-gradient(135deg, rgba(96,165,250,0.26), rgba(30,64,175,0.16)),
    url("assets/hero.jpg");
}

.dataset-footer{ margin-top: 12px; }

/* =========================
   Footer
   ========================= */
.footer{
  margin-top: 16px;
  padding: 10px 4px;
  display:flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
  border-top: 1px solid rgba(230,235,244,0.9);
}

/* =========================
   Responsive
   ========================= */
@media (max-width: 1100px){
  .layout{ grid-template-columns: 340px 1fr; }
  .stats{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 900px){
  .topbar{ grid-template-columns: 1fr; }
  .nav{ justify-content:flex-start; }
  .layout{ grid-template-columns: 1fr; }
  .sidebar{ order: 2; border-right: none; border-top: 1px solid var(--border); }
  .hero-badges{ grid-template-columns: 1fr; }
  .grid-2{ grid-template-columns: 1fr; }
  .dataset-grid{ grid-template-columns: 1fr; }
  .static-extra{ grid-template-columns: 1fr; }
}

.single{
  min-height: calc(100vh - 74px);
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 18px;
}
.login-message{
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #9f1239;
}
/* =========================================
   TAMBAHAN: Preview gambar di card Dashboard
   (gambar di folder assets)
   ========================================= */

.bg-tanah-lama{
  background-image: url("assets/gname.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.bg-tanah-baru{
  background-image: url("assets/qname.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* =========================
   WebGIS Page (Leaflet) - mengikuti gaya dashboard
   ========================= */
.map-wrap{
  padding: 16px;
  overflow: hidden; /* biar rapi */
}

.map-shell{
  height: calc(100vh - 74px - 32px); /* 74px topbar, 32px padding main */
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 8px);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow2);
}

#map{
  width: 100%;
  height: 100%;
}

/* Legenda item untuk sidebar WebGIS (kalau mau tampil rapi) */
.legend-grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}

.legend-item{
  display:flex;
  align-items:center;
  gap: 10px;
  font-size: 12.5px;
  color: #2b3b55;
}

.swatch{
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.12);
  background: var(--sw, #ddd);
}
