#layout-wrapper {
  display: flex;
  height: calc(100vh - 50px); /* Adjust if you have a navbar */
  margin-top: 0px; /* Adjust if you have a fixed navbar at top */
  background-color: #005fa3; /* biru gelap khas KKP */
  padding-bottom: 24px; /* Instead of margin on #map */
  padding-top: 8px; /* Instead of margin on #map */
  box-sizing: border-box; /* ✅ Make padding part of total height */
  /*overflow: hidden; /* ✅ Prevent scrollbars / clipping issues */*/
}
 
.sidebar-wrapper {
  background: #005fa3;
  color: white;
  z-index: 999;
  transition: width 0.5s ease-in-out;
  overflow: hidden;
}

 /* Sidebar styles */
.sidebar-wrapper.collapsed {
  width: 50px;
}

/* Expand on hover */
.sidebar-wrapper.collapsed:hover {
  width: 250px;
}

/* Icon menu */
.sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-menu li a {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  color: white;
  text-decoration: none;
  height: 40px; /* Fixed height for stability */
  line-height: 40px; /* Added */
}

.sidebar-menu li a:hover {
  background-color: #0071bc;
}

.sidebar-menu i {
  width: 24px;
  text-align: center;
  font-size: 18px;
  flex-shrink: 0; /* Prevent resizing */
  line-height: 1;
  display: inline-block; /* Added */
}

/* Always allocate label space — only fade in/out */
.menu-label {
  opacity: 1;
  margin-left: 10px;
  white-space: nowrap;
  transition: opacity 0.3s ease;
}

/* Hidden when collapsed */
.sidebar-wrapper.collapsed .menu-label {
  opacity: 0;
  pointer-events: none;
}

/* Shown on hover */
.sidebar-wrapper.collapsed:hover .menu-label {
  opacity: 1;
  pointer-events: auto;
}

/* Hide content when collapsed */
.sidebar-wrapper.collapsed .panel-title,
.sidebar-wrapper.collapsed .table,
.sidebar-wrapper.collapsed .panel-body {
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

/* Show content on hover */
.sidebar-wrapper.collapsed:hover .panel-title,
.sidebar-wrapper.collapsed:hover .table,
.sidebar-wrapper.collapsed:hover .panel-body {
  opacity: 1;
  pointer-events: auto;
}

/* Make the map take remaining space */
#map {
  flex: 1;
  border-radius: 16px; /* rounded corner */
  border: 8px solid white; /* white stroke */
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.25); /* subtle shadow */
  overflow: hidden; /* clip map tiles inside border */
  margin: 10px; /* optional spacing from edges */
}

/* Ensure navbar stays on top */
.navbar {
  z-index: 1000;
}

#intro-cover {
  position: absolute;
  top: 58px; /* match your navbar height */
  left: 50px; /* match your expanded sidebar width */
  right: 0;
  bottom: 0;
  z-index: 1001; /* ABOVE the map, but BELOW navbar and sidebar */
  background-color: rgba(0, 88, 158, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: left 0.5s ease-in-out, opacity 0.8s ease; /* ← this line for smooth move */
  flex: 1;
  border-radius: 16px; /* rounded corner */
  border: 8px solid white; /* white stroke */
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.25); /* subtle shadow */
  overflow: hidden; /* clip map tiles inside border */
  margin: 10px; /* optional spacing from edges */
}

#intro-cover.hidden {
  opacity: 0;
  pointer-events: none; /* hanya aktif saat visible */
}

body.sidebar-forced-expanded #intro-cover {
  left: 250px !important; /* match expanded sidebar width */
}

#intro-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#intro-cover.hidden {
  opacity: 0;
  pointer-events: none;
}

.gradient-overlay {
  position: absolute;
  /* ...existing positioning... */
  background-image:
    linear-gradient(to bottom, rgba(0,0,0,0.4), rgba(0,0,0,0.9)),
    url('../img/cover-tangsel.webp');
  background-size: cover;
  background-position: center;
}

.gradient-overlay img {
  visibility: hidden; /* hide the actual img tag, letting bg-image show */
}

.cover-text {
  position: absolute;
  bottom: 40px;
  left: 50px;
  right: 50px;
  display: flex;
  justify-content: space-between;
  color: white;
  z-index: 2;
  align-items: flex-end;
  font-family: sans-serif;
  flex-wrap: wrap;
}

.cover-text .left h1 {
  font-size: 32px;
  margin: 0;
  line-height: 1.4;
  text-shadow: 1px 1px 4px black;
}

.cover-text .right h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  margin-bottom: 10px;
  text-align: right;
  text-shadow: 1px 1px 4px black;
}


#intro-cover .bpn-logo img {
  visibility: visible !important;
  width: 100px;
  height: auto;
  position: relative;
  margin-bottom: 40px;
}

#intro-cover .bpn-logo {
  position: absolute;
  right: 0px;
  z-index: 2;
}

.sidebar-wrapper.force-expanded {
  width: 250px !important;
}

.sidebar-wrapper.force-expanded .menu-label,
.sidebar-wrapper.force-expanded .panel-title,
.sidebar-wrapper.force-expanded .table,
.sidebar-wrapper.force-expanded .panel-body {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-wrapper.force-expanded:hover {
  width: 250px !important; /* Lock it at expanded size even on hover */
}

/* Calculator Form */
.calculator-form {
  padding: 12px 12px;
  color: white;
  border-top: 1px solid #444;
  margin-left: 6px;
  margin-top: 12px;
  transition: opacity 0.3s ease, max-height 0.3s ease;
}

.calculator-form.hidden {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  pointer-events: none;
}

.sidebar-wrapper.collapsed:not(.force-expanded) .calculator-form {
  display: none; /* Fully hide in collapsed mode */
}

label[for="form-klb"] {
    margin-top: 12px;
    display: block; /* or inline-block */
}

label[for="form-kdh"] {
    margin-top: 12px;
    display: block; /* or inline-block */
}

label[for="form-kdb"] {
    margin-top: 12px;
    display: block; /* or inline-block */
}

#luas-lahan {
  margin-top: 6px;
  color: #000;
}

#form-klb {
  margin-top: 6px;
  color: #000;
}

#form-kdb{
  margin-top: 6px;
  color: #000;
}

#form-kdh {
  margin-top: 6px;
  color: #000;
}

.button-wrapper {
  text-align: center;
  margin-top: 16px;
}

.rounded-button {
  border-radius: 4px;
  padding: 8px 24px;
  font-weight: 600;
}

/* RESULT FORMULA */

.calculator-result {
  margin-top: 24px;
  padding: 16px;
  border-radius: 8px;
  background: #f8f9fa;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  max-width: 500px;
  margin-left: 18px;
  margin-right: 12px;
  margin-top: auto;
  text-align: left;
  animation: fadeIn 0.4s ease;
}

.calculator-result h5 {
  margin-bottom: 16px;
  text-align: center;
  font-weight: bold;
  color: #007bff;
}

.result-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #dee2e6;
}

.result-label {
  font-weight: 600;
  color: #333;
}

.result-value {
  font-weight: 600;
  color: #007bff;
}

.hidden {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reset-button {
  background-color: #f44336; /* Red tone */
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 8px 24px;
  font-weight: 600;
}

.reset-button:hover {
  background-color: #d32f2f;
}