html,
body {
  padding: 0;
  margin: 0;
  height: 100%;
  width: 100%;
  font-family: "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* --- Header Styles --- */
#appHeader {
  height: 60px;
  background-color: #222629;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 250px;
}
.header-right {
  width: 250px;
}

.header-center {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.logo-img {
  height: 40px;
  width: auto;
  display: block;
}
.company-name {
  font-size: 1rem;
  font-weight: 300;
  color: #f0f0f0;
  white-space: nowrap;
}
.header-center h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  white-space: nowrap;
}

/* --- Header Dropdown Menu --- */
.header-menu {
  position: relative;
  display: inline-block;
  margin-left: 20px;
}

.menu-btn {
  background-color: #0079c1;
  color: white;
  padding: 6px 12px;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.3s;
}

.menu-btn:hover {
  background-color: #005e96;
}

.menu-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: white;
  min-width: 280px;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  padding: 15px;
  border-radius: 4px;
  border: 1px solid #ddd;
  margin-top: 10px;
  text-align: left;
}

.header-menu:hover .menu-content {
  display: block;
}

.menu-group {
  margin-bottom: 12px;
}
.menu-group label {
  display: block;
  margin-bottom: 5px;
  color: #333;
  font-weight: bold;
  font-size: 0.85rem;
}
.menu-divider {
  border-bottom: 1px solid #eee;
  margin: 10px 0;
}
.menu-status {
  font-size: 0.8rem;
  color: #0079c1;
  font-style: italic;
  text-align: right;
}

.esri-select {
  width: 100%;
  padding: 6px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 0.9rem;
}

/* --- Layout --- */
#mainContainer {
  display: flex;
  flex: 1;
  overflow: hidden;
}

#sidePanel {
  width: 350px;
  background-color: #fff;
  border-right: 1px solid #ccc;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-sizing: border-box;
}

.panel-instruction {
  padding: 20px;
  color: #555;
  text-align: center;
}
#featureContent {
  padding-bottom: 20px;
}
.feature-item {
  padding: 15px;
}

/* Wrapper for measurement widget inside panel */
#measurePanelWrapper {
  padding: 10px;
  border-top: 1px solid #eee;
}

#viewDiv {
  flex: 1;
  padding: 0;
  margin: 0;
  position: relative;
}

/* --- Measurement Toolbar Styling --- */
#toolbarDiv {
  position: absolute;
  bottom: 30px;
  left: 15px;
  cursor: default;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  z-index: 99;
}

.esri-widget--button.active {
  background: #0079c1;
  color: #fff;
}

/* ... existing header styles ... */

.header-right {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center; /* Vertically center the button */
}

/* Help Button Styling */
.help-btn {
  text-decoration: none;
  color: white;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: rgba(0, 0, 0, 0.2);
}

.help-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.8);
  color: #fff;
}

/* Ensure Esri icon font size matches text */
.help-btn .esri-icon-question {
  font-size: 16px;
}

/* --- Mobile --- */
@media (max-width: 900px) {
  #appHeader {
    flex-direction: column;
    height: auto;
    padding: 10px;
    gap: 10px;
  }
  .header-left,
  .header-right {
    width: 100%;
    justify-content: center;
    flex-direction: column;
    text-align: center;
  }
  .header-center {
    flex-direction: column;
    gap: 10px;
  }

  /* Ensure help button is centered on mobile */
  .header-right {
    justify-content: center;
    margin-top: 5px;
  }
  .header-menu {
    margin-left: 0;
  }
  .company-name {
    display: none;
  }
  .header-center h1 {
    font-size: 1rem;
    white-space: normal;
  }
  .menu-content {
    left: 50%;
    transform: translateX(-50%);
    width: 90vw;
  }

  #mainContainer {
    flex-direction: column-reverse;
  }
  #sidePanel {
    width: 100%;
    height: 35%;
    z-index: 50;
  }
  #viewDiv {
    height: 65%;
  }

  #toolbarDiv {
    bottom: 25px;
    left: 10px;
  }

  .esri-ui-top-right .esri-expand__content {
    max-height: 50vh !important;
    overflow-y: auto !important;
  }
}
