html,
      body {
        margin: 0;
        padding: 0;
        height: 100%;
        font-family: Arial, sans-serif;
        font-weight: bold;
        overflow: hidden;
      }
      #map {
        height: calc(100vh - 90px); /* Full height minus header and footer */
        width: 100%;
        position: relative;
      }

      /* --- Buttons Container --- */
      #top-buttons {
        /* position: absolute; */
        top: 20px;
        left: 10px;
        right: 10px;
        padding: 20px;
        z-index: 1100;
        /* margin-top: 10px; */
        display: flex;
        justify-content: space-between;
        pointer-events: auto;
        gap: 15px;
      }
      button.map-btn {
        padding: 8px 16px;
        font-weight: bold;
        font-size: 14px;
        border: none;
        border-radius: 5px;
        background-color: #007bff;
        color: white;
        cursor: pointer;
        box-shadow: 0 0 8px rgba(0, 123, 255, 0.8);
        user-select: none;
        transition: background-color 0.3s ease;
      }
      button.map-btn:hover {
        background-color: #0056b3;
      }
      /* Center button special */
      #info-btn {
        flex: 1;
        max-width: 120px;
        margin: 0 auto;
        text-align: center;
      }

      /* --- Search Panel --- */
      #search-container {
          position: absolute !important;
          top: 70px !important;
          left: 20px !important;
          bottom: auto !important; /* Prevents stretching */
          right: auto !important;
          width: 340px;
          background: white;
          padding: 20px;
          border-radius: 8px;
          box-shadow: 0 4px 20px rgba(0,0,0,0.25);
          z-index: 1050;
          display: none;
      }
      #search-container label {
          font-size: 13px;
          color: #666;
          margin-bottom: 4px;
          display: block;
          width: 100%;
      }
      #search-container select, 
      #search-container input {
          width: 100% !important; /* Force full width */
          height: 38px;           /* Standard Bootstrap height */
          margin-bottom: 12px;
          border: 1px solid #ced4da;
          border-radius: 4px;
          padding: 6px 12px;
          box-sizing: border-box; /* Ensures padding doesn't break width */
      }
      #search-container button#search-btn {
        width: 100%;
        padding: 8px;
        margin-top: 5px;
        background: #28a745;
        border-radius: 4px;
        border: none;
        color: white;
        font-weight: bold;
        cursor: pointer;
        box-shadow: 0 0 8px rgba(40, 167, 69, 0.8);
      }
      #search-container button#search-btn:hover {
        background: #1e7e34;
      }
      /* Autocomplete dropdown */
      #autocomplete-list {
        position: absolute;
        top: 150px;
        left: 10px;
        width: 320px;
        max-height: 150px;
        overflow-y: auto;
        background: white;
        border: 1px solid #ccc;
        z-index: 910;
        display: none;
        font-size: 14px;
        cursor: pointer;
      }
      #autocomplete-list div {
        padding: 6px 10px;
        border-bottom: 1px solid #eee;
      }
      #autocomplete-list div:hover {
        background-color: #007bff;
        color: white;
      }

      /* --- Legend Panel --- */
      #legend-container {
          position: absolute !important;
          bottom: 110px !important; /* Anchored above the toggle button */
          right: 20px !important;
          top: auto !important;    /* FORCE remove top positioning */
          left: auto !important;
          width: 240px;
          max-height: 400px;
          background: rgba(255, 255, 255, 0.95);
          backdrop-filter: blur(4px); /* Modern blur effect */
          border-radius: 8px;
          border: 1px solid rgba(0,0,0,0.1);
          padding: 15px;
          box-shadow: 0 8px 32px rgba(0,0,0,0.15);
          z-index: 1050;
          display: none;
          overflow-y: auto;
      }
      #legend-container h4 {
        margin-top: 0;
        margin-bottom: 10px;
        font-weight: 700;
        font-size: 16px;
        text-align: center;
      }
      #legend-container p {
        margin: 5px 0 2px 0;
        font-weight: 600;
        font-size: 14px;
      }
      #legend-container img {
        vertical-align: middle;
        margin-bottom: 8px;
        border: 1px solid #ccc;
      }
      .legend-header {
          border-bottom: 1px solid #eee;
          padding-bottom: 8px;
          margin-bottom: 10px;
          font-weight: bold;
          color: #0056b3;
          display: flex;
          justify-content: space-between;
          align-items: center;
      }

      /* --- Popup Styling --- */
      #popup {
        position: absolute;
        bottom: 60px;
        left: 10px;
        max-width: 320px;
        max-height: 220px;
        overflow-y: auto;
        background: white;
        border-radius: 6px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
        padding: 10px;
        font-family: Arial, sans-serif;
        font-size: 14px;
        border: 1px solid #888;
        z-index: 1200;
        display: none;
        user-select: none;
      }
      #popup table {
        border-collapse: collapse;
        width: 100%;
      }
      #popup th,
      #popup td {
        border: 1px solid #ccc;
        padding: 5px 8px;
        text-align: left;
      }
      #popup th {
        background: #eee;
      }
      #popup-close {
        position: absolute;
        top: 3px;
        right: 6px;
        font-size: 18px;
        color: #666;
        font-weight: bold;
        cursor: pointer;
        user-select: none;
      }

      /* --- Header --- */
      #page-header {
        padding: 8px 20px;
        background: linear-gradient(90deg, #007bff, #0056b3);
        color: white;
        display: flex; /* use flexbox */
        align-items: center; /* vertically center items */
        justify-content: space-between; /* title left, login right */
        font-size: 18px;
        font-weight: bold;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
        z-index: 1200;
      }

      #page-header h1 {
        margin: 0;
        font-size: 20px;
      }

      /* --- Login Button --- */
      #login-btn {
        padding: 6px 14px;
        font-size: 14px;
        font-weight: bold;
        border: none;
        border-radius: 4px;
        background: #ffc107;
        color: #333;
        cursor: pointer;
        box-shadow: 0 0 6px rgba(0, 0, 0, 0.2);
        transition: background 0.3s;
      }

      #login-btn:hover {
        background: #e0a800;
      }

      /* --- Login Modal CSS --- */
      #login-modal {
        display: none;
        position: fixed;
        z-index: 1300; 
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        overflow: auto;
        background-color: rgba(0, 0, 0, 0.5); 
      }

      #login-modal-content {
        background-color: #fff;
        margin: 10% auto;
        padding: 20px 30px;
        border-radius: 8px;
        width: 300px;
        position: relative;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
        font-family: Arial, sans-serif;
      }

      #login-modal-content h2 {
        text-align: center;
        margin-bottom: 20px;
      }

      #login-modal-content label {
        display: block;
        margin-top: 10px;
        font-weight: bold;
      }

      #login-modal-content input {
        width: 93.7%;
        padding: 8px;
        margin-top: 5px;
        border-radius: 4px;
        border: 1px solid #ccc;
      }

      #login-modal-content button {
        width: 100%;
        padding: 10px;
        margin-top: 15px;
        background-color: #007bff;
        color: #fff;
        border: none;
        font-weight: bold;
        border-radius: 4px;
        cursor: pointer;
      }

      #login-modal-content button:hover {
        background-color: #0056b3;
      }

      #login-close {
        position: absolute;
        top: 8px;
        right: 12px;
        font-size: 20px;
        font-weight: bold;
        cursor: pointer;
      }

  /* --- Popup Styling --- */
  html, body, #popup {
    /* strong fallback stack for Nepali + Latin */
    font-family: "Noto Sans Devanagari", "Nirmala UI", "Mangal", "Kalimati",
                 "DejaVu Sans", system-ui, -apple-system, Arial, sans-serif;
  }
  /* make images inside the popup fit nicely */
  #popup img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: .25rem 0;
  }
  #popup {
    position: absolute;
    bottom: 20%;
    left: 10px;
    max-width: 320px;
    max-height: 220px;
    overflow-y: auto;
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    padding: 10px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    border: 1px solid #888;
    z-index: 1200;
    display: none;
    user-select: none;
  }
  #popup table {
    border-collapse: collapse;
    width: 100%;
  }
  #popup th, #popup td {
    border: 1px solid #ccc;
    padding: 5px 8px;
    text-align: left;
  }
  #popup th {
    background: #eee;
  }
  #popup-close {
    position: absolute;
    top: 3px;
    right: 6px;
    font-size: 18px;
    color: #666;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
  }  

  
  /* Image viewer modal (fullscreen) */
  #image-viewer-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 10000;
  }

  #image-viewer-modal img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
  }

  #image-viewer-modal .close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 30px;
    cursor: pointer;
  }

  /* --- Bootstrap Tax Details Modal --- */

#taxDetailsModal .modal-dialog {
  max-width: 80%;                 /* Wider modal but not full width */
  margin: 0 auto;                 /* Center horizontally */
  height: 100%;                   /* Take full viewport height */
  display: flex;                  /* Use flex to center vertically */
  align-items: center;            /* Vertical centering */
}

#taxDetailsModal .modal-content {
  width: 100%;                    /* Use entire dialog width */
  border-radius: 8px;
}

#taxDetailsModal .modal-header {
  background-color: #f8f9fa;
}

#taxDetailsModal .modal-title {
  font-weight: bold;
}

#taxDetailsModal .modal-body {
  max-height: 70vh;               /* Scroll inside body if content is tall */
  overflow-y: auto;
}

#taxDetailsModal .modal-footer {
  text-align: center;
}

.modal { display: none; }
.modal.show { display: block; }

#map-context-menu {
  display: none;
  position: absolute;
  z-index: 3000;
  min-width: 180px;
  background: white;
  border: 1px solid #ccc;
  box-shadow: 2px 2px 10px rgba(0,0,0,0.2);
  border-radius: 4px;
}
.menu-item {
  padding: 10px 15px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid #eee;
}
.menu-item:hover { background-color: #f1f1f1; color: #007bff; }
.menu-item.disabled { color: #ccc; cursor: not-allowed; }


/* --- Floating Buttons Layout --- */
.floating-map-btn {
  position: absolute;
  z-index: 1000;
  width: 42px;
  height: 42px;
  border-radius: 8px; /* Square with slight roundness looks more professional */
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.2);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #333;
}

.floating-map-btn:hover { background: #f8f9fa; color: #007bff; }

.search-toggle { top: 20px; left: 20px; }
.legend-toggle { bottom: 60px; right: 20px; } /* Above footer */


/* --- Modern Footer --- */
#map-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(5px);
  border-top: 1px solid #dee2e6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  z-index: 1100;
  color: #555;
}

#map-footer a {
  color: #007bff;
  text-decoration: none;
  font-weight: bold;
  margin-left: 5px;
}

#map-footer a:hover {
  text-decoration: underline;
}
