/* ========================================
   GENERAL STYLES
   ======================================== */
html,
body {
  padding: 0;
  margin: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
}

/* ========================================
   HEADER / BANNER
   ======================================== */
.header {
  position: absolute;
  top: 0;
  width: 100%;
  height: 60px;
  z-index: 100;
}

.banner-container {
  padding: 0px;
  margin: 0 auto;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.banner {
  display: flex;
  flex-direction: row;
  flex-grow: 4;
  background-color: #407cc9;
  margin: 0px;
  width: 100%;
  height: 60px;
  padding-top: 0px;
  overflow: hidden;
  text-align: center;
  vertical-align: middle;
  color: white;
  font-weight: bold;
  font-size: 25px;
  align-items: center;
  justify-content: space-between;
}

.banner-left {
  display: flex;
  align-items: center;
  padding-left: 15px;
  flex-shrink: 0;
}

.banner-logo {
  height: 50px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
}

.name-content {
  background-color: #407cc9;
  margin: 0;
  padding: 10px;
  overflow: hidden;
  text-align: center;
  color: white;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
}

.banner-right {
  display: flex;
  align-items: center;
  padding-right: 15px;
  flex-shrink: 0;
}

.help-link {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: #ee7622;
  color: white;
  text-decoration: none;
  padding: 8px 15px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: bold;
  transition: background-color 0.2s ease;
}

.help-link:hover {
  background-color: #d66a1e;
}

.help-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background-color: white;
  color: #ee7622;
  border-radius: 50%;
  font-size: 14px;
  font-weight: bold;
}

.help-text {
  display: inline;
}

.title-text {
  font-size: 45px;
  line-height: 1.2;
}

/* ========================================
   MAP VIEW
   ======================================== */
#viewDiv {
  position: absolute;
  right: 0;
  left: 0;
  top: 60px;
  bottom: 0;
  margin: 0;
}

/* ========================================
   LAYER PANEL
   ======================================== */
#layer-panel {
  position: absolute;
  top: 75px;
  right: 15px;
  z-index: 50;
}

/* ========================================
   PRINT WIDGET
   ======================================== */
#print-panel {
  position: absolute;
  top: 190px;
  right: 15px;
  z-index: 50;
  background: #ee7622;
  border-radius: 8px;
  padding: 10px;
  min-width: 80px;
  max-width: 320px;
  max-height: calc(100vh - 250px);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Custom scrollbar for print panel */
#print-panel::-webkit-scrollbar {
  width: 8px;
}

#print-panel::-webkit-scrollbar-track {
  background: #ffffe6;
  border-radius: 4px;
}

#print-panel::-webkit-scrollbar-thumb {
  background: #407cc9;
  border-radius: 4px;
}

#print-panel::-webkit-scrollbar-thumb:hover {
  background: #3569a8;
}

.print-container-header h4 {
  margin: 0 0 8px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid white;
  font-size: 14px;
  color: white;
}

#print-container {
  display: flex;
  justify-content: center;
}

#print-container .esri-expand {
  background-color: transparent;
  box-shadow: none;
}

#print-container .esri-expand__container {
  background-color: #ffffe6;
  border: solid 2px #ee7622;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#print-container .esri-print {
  background-color: #ffffe6;
  border-radius: 8px;
}

#print-container .esri-print__header-title {
  background-color: #407cc9;
  color: white;
}

#print-container .esri-print__layout-tab-list,
#print-container .esri-print__export-panel {
  background-color: #ffffe6;
}

.layer-container {
  color: white;
  background-color: #ee7622;
  padding: 10px;
  min-width: 150px;
  border-radius: 8px;
  opacity: 0.95;
}

.layer-container h3 {
  margin: 0 0 10px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid white;
  font-size: 14px;
}

.layer-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 5px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.layer-toggle:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.layer-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #407cc9;
  cursor: pointer;
}

.layer-toggle span {
  color: white;
  font-size: 14px;
}

/* ========================================
   WIDGET CONTAINERS
   ======================================== */
.widget-container {
  position: absolute;
  z-index: 50;
}

/* ========================================
   EDITOR WIDGET
   ======================================== */
#editor-container {
  position: absolute;
  top: 75px;
  left: 15px;
  max-width: 320px;
  max-height: calc(100% - 100px);
  overflow: auto;
  background: #ffffe6;
  border-radius: 8px;
  border: solid 2px #ee7622;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* ========================================
   COLOR PICKER PANEL
   ======================================== */
#color-picker-panel {
  position: absolute;
  top: 75px;
  left: 340px;
  background: #ffffe6;
  border-radius: 8px;
  border: solid 2px #ee7622;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  padding: 10px;
  z-index: 50;
}

#color-picker-panel h4 {
  margin: 0 0 10px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #ee7622;
  font-size: 14px;
  color: #333;
}

#color-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.color-btn {
  width: 32px;
  height: 32px;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.color-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.color-btn.active {
  border-color: #ee7622;
  box-shadow: 0 0 8px rgba(238, 118, 34, 0.6);
}

/* ========================================
   TEXT TOOL PANEL
   ======================================== */
#text-tool-panel {
  position: absolute;
  top: 200px;
  left: 15px;
  background: #ffffe6;
  border-radius: 8px;
  border: solid 2px #ee7622;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  padding: 10px;
  z-index: 49;
  width: 200px;
}

#text-tool-panel h4 {
  margin: 0 0 10px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #ee7622;
  font-size: 14px;
  color: #333;
}

#textInput {
  width: 100%;
  padding: 8px;
  border: 1px solid #ee7622;
  border-radius: 4px;
  font-size: 14px;
  margin-bottom: 10px;
  box-sizing: border-box;
  background-color: #fff;
}

#textInput:focus {
  outline: none;
  border-color: #407cc9;
  box-shadow: 0 0 5px rgba(64, 124, 201, 0.5);
}

.text-tool-btn {
  width: 100%;
  padding: 8px 12px;
  background-color: #407cc9;
  color: white;
  border: solid 1px white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.text-tool-btn:hover {
  background-color: #3569a8;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
}

.text-tool-btn.active {
  background-color: #ee7622;
  box-shadow: 0 0 10px rgba(238, 118, 34, 0.5);
}

.text-tool-btn span {
  font-size: 16px;
  font-weight: bold;
}

/* Editor widget styling overrides */
#editor-container .esri-editor {
  border-radius: 8px;
  background-color: #ffffe6;
}

#editor-container .esri-editor__title {
  background-color: #407cc9;
  color: white;
}

#editor-container .esri-editor__scroller {
  max-height: 400px;
  background-color: #ffffe6;
}

#editor-container .esri-editor__content {
  background-color: #ffffe6;
}

#editor-container .esri-editor__panel-content {
  background-color: #ffffe6;
}

#editor-container .esri-feature-form {
  background-color: #ffffe6;
}

#editor-container .esri-feature-templates {
  background-color: #ffffe6;
}

#editor-container .esri-item-list {
  background-color: #ffffe6;
}

#editor-container .esri-item-list__list-item {
  background-color: #ffffe6;
  border-bottom: 1px solid #ee7622;
}

#editor-container .esri-item-list__list-item:hover {
  background-color: #f5f5d6;
}

#editor-container .esri-item-list__list-item--selected {
  background-color: #f0f0c0;
  border-left: 3px solid #ee7622;
}

/* ========================================
   MEASUREMENT WIDGET
   ======================================== */
#measurement-panel {
  position: absolute;
  bottom: 30px;
  right: 15px;
  z-index: 99;
  background: #ffffe6;
  border-radius: 8px;
  border: solid 2px #ee7622;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  padding: 10px;
}

#measurement-panel.minimized #measurement-content {
  display: none;
}

#measurement-panel.minimized {
  padding: 8px 10px;
}

.measurement-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid #ee7622;
}

#measurement-panel.minimized .measurement-header {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.measurement-header h4 {
  margin: 0;
  font-size: 14px;
  color: #333;
}

.minimize-btn {
  width: 24px;
  height: 24px;
  background-color: #407cc9;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.minimize-btn:hover {
  background-color: #3569a8;
}

#measurement-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.measurement-btn {
  flex: 1;
  padding: 8px 10px;
  background-color: #407cc9;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: bold;
  transition: all 0.2s ease;
}

.measurement-btn:hover {
  background-color: #3569a8;
}

.measurement-btn.active {
  background-color: #ee7622;
}

#measurementDiv {
  min-height: 20px;
}

/* ========================================
   ESRI WIDGET OVERRIDES
   ======================================== */
.esri-widget--button {
  font-size: 14px;
  background-color: #ee7622;
  color: #fff;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  overflow: hidden;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-flow: row nowrap;
  justify-content: center;
  align-items: center;
  transition: background-color 125ms ease-in-out;
  border: solid white 1px !important;
}

.esri-widget--button:hover {
  background-color: #407cc9;
}

.esri-zoom,
.esri-widget--button {
  border: solid white 1px !important;
}

.esri-input {
  background-color: #ffffe6;
  border: 1px solid #ee7622;
  color: #00827a;
  font-family: inherit;
  font-size: 14px;
}

.esri-widget__table tr td,
.esri-widget__table tr th {
  padding: 0.5em 0.7em;
  word-break: break-word;
  vertical-align: top;
  font-weight: 400;
  background-color: #ffffe6;
}

.esri-widget__table tr td {
  width: 50%;
  background-color: #ffffe6;
}

/* Attribution styling */
.esri-attribution {
  background: rgba(255, 255, 230, 0.9);
}

/* ========================================
   POPUP STYLING
   ======================================== */
.esri-popup__main-container {
  pointer-events: auto;
  position: relative;
  z-index: 1;
  width: 100px;
  max-height: 1000px;
  background-color: #ffffe6;
  display: flex;
  flex-flow: column nowrap;
  padding: 0px;
  justify-content: center !important;
}

.esri-popup__header-title {
  color: #333;
  background-color: #d6d6b0;
  display: block;
  margin: auto !important;
  justify-content: center !important;
  font-size: smaller;
  font-weight: bold;
}

.esri-popup__header-container {
  background-color: #ee7622;
  padding: 1px !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
  margin: auto !important;
  flex: 1;
  cursor: pointer;
}

.esri-popup__content {
  display: flex;
  flex-flow: column nowrap;
  flex: 1 1 auto;
  border: solid 1px black;
  margin: 10px;
  overflow-y: auto !important;
  line-height: normal;
  background-color: #fff !important;
  padding: 10px !important;
}

.esri-popup__button:hover {
  color: rgb(175, 29, 29);
  background-color: #ee7622;
}

.esri-view-width-xlarge .esri-popup__main-container,
.esri-view-width-large .esri-popup__main-container,
.esri-view-width-medium .esri-popup__main-container {
  pointer-events: auto;
  position: relative;
  overflow-y: visible !important;
  width: 100%;
  border: 1px solid black;
  max-height: 400px !important;
  max-width: 340px !important;
  background-color: #ffffe6;
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */
#editor-container::-webkit-scrollbar {
  width: 8px;
}

#editor-container::-webkit-scrollbar-track {
  background: #ffffe6;
  border-radius: 4px;
}

#editor-container::-webkit-scrollbar-thumb {
  background: #ee7622;
  border-radius: 4px;
}

#editor-container::-webkit-scrollbar-thumb:hover {
  background: #407cc9;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */
@media screen and (min-width: 320px) {
  .title-text {
    font-size: 18px;
  }
}

@media screen and (min-width: 600px) {
  .title-text {
    font-size: 28px;
  }
}

@media screen and (min-width: 1024px) {
  .title-text {
    font-size: 45px;
  }
}

@media (max-width: 768px) {
  .title-text {
    font-size: 28px;
  }

  .banner-logo {
    height: 40px;
    max-width: 140px;
  }

  .help-link {
    padding: 6px 12px;
    font-size: 12px;
  }

  .help-icon {
    width: 18px;
    height: 18px;
    font-size: 12px;
  }

  #editor-container {
    max-width: 280px;
    left: 10px;
    top: 70px;
  }

  #color-picker-panel {
    left: 10px;
    top: auto;
    bottom: 180px;
  }

  #text-tool-panel {
    left: 10px;
    top: 200px;
    width: 180px;
  }

  #layer-panel {
    right: 10px;
    top: 70px;
  }

  #print-panel {
    right: 10px;
    top: 180px;
  }

  #measurement-panel {
    right: 10px;
    bottom: 20px;
  }
}

@media (max-width: 480px) {
  .header {
    height: 50px;
  }

  .banner {
    height: 50px;
  }

  .title-text {
    font-size: 18px;
  }

  .banner-left {
    padding-left: 8px;
  }

  .banner-logo {
    height: 35px;
    max-width: 100px;
  }

  .banner-right {
    padding-right: 8px;
  }

  .help-link {
    padding: 5px 8px;
    font-size: 11px;
    gap: 4px;
  }

  .help-text {
    display: none;
  }

  .help-icon {
    width: 20px;
    height: 20px;
    font-size: 12px;
  }

  #viewDiv {
    top: 50px;
  }

  #editor-container {
    max-width: 250px;
    top: 60px;
  }

  #color-picker-panel {
    left: 10px;
    top: auto;
    bottom: 170px;
  }

  #color-options {
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
  }

  .color-btn {
    width: 28px;
    height: 28px;
  }

  #layer-panel {
    top: 60px;
  }

  #print-panel {
    top: 170px;
  }

  #measurement-panel {
    right: 10px;
    bottom: 20px;
  }
}
