* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

.grid-container {
  display: grid;
  height: 100vh;
  width: 100vw;
  grid-template-columns: 220px 1fr 280px;
  grid-template-rows: auto 1fr;
  grid-template-areas: 
    'header header header'
    'left main right';
}

.header {
  grid-area: header;
  background-color: midnightblue;
  font-size: 25px;
  color: white;
  font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
  overflow: hidden;
} 

.left {
  grid-area: left;
  overflow: auto;
  max-height: 100%;
}

.toc {
  grid-area: left;
  width: 100%;
  height: 100%;
  padding: 10px;
  border-right: 1px solid #ccc;
  background-color: #f8f9fa;
  overflow-y: auto;
  box-sizing: border-box;
}

#layerList li ul {
    margin-top: 5px;
    padding-left: 20px;
}

#layerList li {
    margin-bottom: 6px;
}


.main {
  grid-area: main;
  border: 5px solid grey;
  overflow: auto;
  height: 100%;
}
/* Map container */
#mapContainer {
  grid-area: main;
  position: relative;
  width: 100%;
  height: 100%;
}

#map {
  flex: 1;
  height: 100%;
  width: 100%;
  position: relative;
  overflow: visible;
  z-index: 0;
}

#form {
  width: 19vw;
  height: 100vh;
  background-color: whitesmoke;
  font-size: 14px;
}

#form h1 {
  color: #0f2027;
  text-align: center;
  font-size: 18px;
}

#form .btn-success {
  padding: 5px;
  margin-top: 10px;
  width: 80px;
  color: white;
  background-color: #0099ff;
  border: none;
  border-radius: 4px;
  font-size: 20px;
}

.ol-tooltip {
  position: absolute;
  background: white;
  border: 1px solid #cccccc;
  padding: 3px 6px;
  border-radius: 4px;
  white-space: nowrap;
  font-size: 12px;
}
.ol-tooltip-measure {
  opacity: 0.7;
  font-weight: bold;
}
.ol-tooltip-static {
  background-color: #ffcc33;
  border: 1px solid white;
  color: black;
}


.mousePosition{
    position: absolute;
    bottom: 8px;
    right: 10px;
    border: 1px solid rgba(100,100,100,0.4);
    border-radius: 6px;
    padding: 4px 10px;
    background-color: rgba(255,255,255,0.85);
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #222;
    white-space: nowrap;
    z-index: 500;
    pointer-events: none;
}

/* Popup Overlay Container */
.ol-popup {
  position: absolute;
  background-color: rgba(255, 255, 255, 0.95);
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  border: 1px solid #ccc;
  min-width: 350px;
  max-width: 60vw;
  max-height: 60vh;
  overflow-y: auto;
  font-family: Arial, sans-serif;
  font-size: 13px;
  color: #333;
  z-index: 1000;
  display: none; /* Hide initially */
}

/* Popup header */
.ol-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  border-bottom: 1px solid #ccc;
  padding-bottom: 5px;
}

/* Drag handle */
.drag-handle {
  flex-grow: 1;
  flex-shrink: 1;
  max-width: calc(100% - 50px); /* Prevent overlap with close button */
  background: linear-gradient(to bottom, #e6f0fa, #d6e4f5); /* Subtle gradient for 3D */
  color: #999999;
  font-weight: bold;
  font-size: 14px;
  padding: 6px 10px;
  cursor: grab;
  border-radius: 4px;
  box-shadow: 
    2px 2px 6px rgba(0, 0, 0, 0.3),
    -1px -1px 3px rgba(255, 255, 255, 0.7);
  transition: box-shadow 0.2s ease, background 0.2s ease;
}
.drag-handle:hover {
  background: linear-gradient(to bottom, #d6e4f5, #c6d4e5);
  box-shadow: 
    inset 2px 2px 4px rgba(0, 0, 0, 0.25),
    inset -1px -1px 3px rgba(255, 255, 255, 0.6);
}
.drag-handle:active {
  cursor: grabbing;
  box-shadow: 
    inset 2px 2px 5px rgba(0, 0, 0, 0.35),
    inset -1px -1px 3px rgba(255, 255, 255, 0.5);
}


/* Close button */
.ol-popup-closer {
  flex-shrink: 0;
  z-index: 1; /* Ensure on top */
  text-decoration: none;
  font-size: 14px;
  color: #999999;
  background: linear-gradient(to bottom, #e6f0fa, #d6e4f5); /* Subtle gradient for 3D */
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 
    2px 2px 6px rgba(0, 0, 0, 0.3),
    -1px -1px 3px rgba(255, 255, 255, 0.7);
  transition: box-shadow 0.2s ease, background 0.2s ease;
}
.ol-popup-closer:hover {
  background: linear-gradient(to bottom, #d6e4f5, #c6d4e5);
  color: #666666;
  box-shadow: 
    inset 2px 2px 4px rgba(0, 0, 0, 0.25),
    inset -1px -1px 3px rgba(255, 255, 255, 0.6);
}
.ol-popup-closer:active {
  box-shadow: 
    inset 2px 2px 5px rgba(0, 0, 0, 0.35),
    inset -1px -1px 3px rgba(255, 255, 255, 0.5);
}

/* Layer select label */
#popup-content label {
  font-weight: bold;
  margin-bottom: 4px;
  display: inline-block;
}

/* Layer select and attributes */
#popup-content select {
  width: 100%;
  padding: 4px 6px;
  font-size: 12px;
  margin-top: 5px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}
#popup-content #featureAttributes {
  margin-top: 10px;
  max-height: 200px;
  overflow-y: auto;
  font-size: 12px;
}
#popup-content #featureAttributes table {
  width: 100%;
  border-collapse: collapse;
}
#popup-content #featureAttributes td {
  padding: 4px;
  border-bottom: 1px solid #eee;
}

/* Feature Info button image */
.myButton img {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1);
  vertical-align: middle;
}


#layerSelect {
  width: 100%;
  padding: 4px 6px;
  font-size: 12px;
  margin-top: 5px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}

/* Attributes Table */
#featureAttributes table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
  font-size: 11.5px;
}

#featureAttributes table tr td {
  padding: 2px 4px;
  vertical-align: top;
}

#featureAttributes table tr td:first-child {
  font-weight: 600;
  width: 35%;
  color: #222;
}

#featureAttributes table tr td:last-child {
  color: #444;
}




  .mapButtonContainer {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 6px;
  }

/* Mobile-only toolbar that holds the tool buttons above the map; hidden on desktop */
.mobile-toolbar {
  display: none;
}

.myButton {
  background-color: rgba(22, 85, 167, 0.6); /* Original blue */
  height: 25px; /* Match button size */
  width: 25px;
  border-radius: 2px;
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 
    3px 3px 6px rgba(0, 0, 0, 0.4), /* Stronger raised shadow */
    -2px -2px 3px rgba(255, 255, 255, 0.8); /* Brighter highlight */
  transition: box-shadow 0.2s ease, background-color 0.2s ease;
}

/* PNG image styling */
.myButton img {
  width: 18px; /* Smaller to show shadow */
  height: 18px;
  object-fit: contain; /* Preserve aspect ratio */
  filter: brightness(0) invert(1); /* Keep white icon */
}

/* Hover effect: Inset shadow */
.myButton:hover {
  background-color: rgb(0, 60, 136, 1); /* Original darker blue */
  box-shadow: 
    inset 3px 3px 6px rgba(0, 0, 0, 0.4),
    inset -2px -2px 3px rgba(255, 255, 255, 0.6);
}

/* Clicked state: Green with inset shadow */
.myButton.clicked {
  background-color: rgba(22, 170, 35, 0.8); /* Original green */
  box-shadow: 
    inset 3px 3px 6px rgba(0, 0, 0, 0.4),
    inset -2px -2px 3px rgba(255, 255, 255, 0.6);
}

/* Clicked hover: Darker green */
.myButton.clicked:hover {
  background-color: rgba(22, 170, 35, 1);
  box-shadow: 
    inset 3px 3px 6px rgba(0, 0, 0, 0.4),
    inset -2px -2px 3px rgba(255, 255, 255, 0.6);
}


/* Button container: Unchanged */
.myButtonDiv {
  justify-content: center;
  align-items: center;
  display: flex;
}

   .ol-dragBox{
    border: 2px dashed grey;
    background-color: rgba(200,200,200,0.6);
  }

 
  /*query panel both*/
  .attQueryDiv {
    position: absolute;
  top: 10px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1); /* 30% transparency */
  border: 2px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  display: none; /* Hidden by default */
  min-width: 200px;
  max-width: 300px;
  font-size: 12px;
  line-height: 1.4;
    }

   .attQueryDiv label{
    color: black;
    font-size: 12px;
    margin: 10px 10px 0px 10px;
  }

  #spatialLayerSelect.form-control {
  font-size: 12px !important;
  padding: 4px 10px !important;
  height: 25px !important;
  line-height: 1.2 !important;
  width: 100%;
  border-radius: 6px;
  align-items: center;
  }

  #aggSpatialLayerSelect.form-control {
  font-size: 12px !important;
  padding: 4px 10px !important;
  height: 25px !important;
  line-height: 1.2 !important;
  width: 100%;
  border-radius: 6px;
  align-items: center;
  }

  #attrLayerSelect.form-control {
  font-size: 12px !important;
  padding: 4px 10px !important;
  height: 25px !important;
  line-height: 1.2 !important;
  width: 100%;
  border-radius: 6px;
  align-items: center;
  }

.form-control {
       width: 100%;
       padding: 5px;
       margin-top: 5px;
     }

.btn {
       padding: 5px 10px;
       margin-top: 10px;
     }

   #attrFieldSelect.form-control {
  font-size: 12px !important;
  padding: 4px 10px !important;
  height: 25px !important;
  line-height: 1.2 !important;
  width: 100%;
  border-radius: 6px;
  align-items: center;
  }

 .attQueryDiv select{
  font-size: 12px !important;
  padding: 4px 10px !important;
  height: 25px !important;
  line-height: 1.2 !important;
  width: 100%;
  border-radius: 6px;
  align-items: center;
  }

  .attQueryDiv input{
  font-size: 12px !important;
  padding: 4px 10px !important;
  height: 25px !important;
  line-height: 1.2 !important;
  width: 100%;
  border-radius: 6px;
  align-items: center;
  }

  #fieldValueSelect.form-control {
  font-size: 12px !important;
  padding: 4px 10px !important;
  height: 25px !important;
  line-height: 1.2 !important;
  width: 100%;
  border-radius: 6px;
  align-items: center;
  }

  #aggFieldValueSelect.form-control {
  font-size: 12px !important;
  padding: 4px 10px !important;
  height: 25px !important;
  line-height: 1.2 !important;
  width: 100%;
  border-radius: 6px;
  align-items: center;
  }

  #secondLayerSelect.form-control {
  font-size: 12px !important;
  padding: 4px 10px !important;
  height: 25px !important;
  line-height: 1.2 !important;
  width: 100%;
  border-radius: 6px;
  align-items: center;
  }

   #aggSecondLayerSelect.form-control {
  font-size: 12px !important;
  padding: 4px 10px !important;
  height: 25px !important;
  line-height: 1.2 !important;
  width: 100%;
  border-radius: 6px;
  align-items: center;
  }

  #aggGroupFieldSelect.form-control {
  font-size: 12px !important;
  padding: 4px 10px !important;
  height: 25px !important;
  line-height: 1.2 !important;
  width: 100%;
  border-radius: 6px;
  align-items: center;
  }

   #aggTypeSelect.form-control {
  font-size: 12px !important;
  padding: 4px 10px !important;
  height: 25px !important;
  line-height: 1.2 !important;
  width: 100%;
  border-radius: 6px;
  align-items: center;
  }


  .attQueryDiv label:nth-child(1){
    margin: 10px;
    font-size: 12px;
  }
  /* Style for the radio button */
#myRadioButton {
  transform: scale(0.8);               /* Slightly smaller */
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  accent-color: #007bff;               /* Blue color for modern browsers */
  appearance: auto;                    /* Fallback in case it's overridden */
  margin: 2px;                         /* Reduce spacing */
  height: 30px;
  line-height: 1.2;
  padding: 4px 8px;
  }

/* Hover and active effects for subtle 3D illusion */
#myRadioButton:hover {
  box-shadow: 0 1px 4px rgba(0, 123, 255, 0.6);
}

#myRadioButton:active {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
  transform: scale(0.75);
}


 
  #attQryTable {
    font-size: 12px;
}

  .attQryRun {
  color: white;
  background-color: green;
  border-radius: 3px;
  border: 1px solid darkgreen;
  height: 35px;
  width: 50px;
  margin: 10px;
  }

  /*Attr Query Result*/
 .attListDiv {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: white;
    border-top: 2px solid #999;
    max-height: 200px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.3);
    display: none;
    overflow: hidden;
    font-size: 12px;
    
}

.attListHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(to right, #d0eaff, #b8e0ff);
    border-bottom: 1px solid #ccc;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.featureCountContainer {
  display: flex;
  gap: 8px;
  margin-left: auto;
  margin-right: 10px;
  align-items: center;
}

.featureBox {
  padding: 2px 6px;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  color: white;
  background: rgba(255,255,255,0.15);
}

.totalBox {
  background: rgba(100,160,255,0.3);
}

.selectedBox {
  background: rgba(100,220,120,0.3);
}

.attListCloser {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px; /* Adjust for visual balance */
    font-weight: bold;
    border: 1px solid #ccc;
    border-radius: 6px; /* Use 50% for circular button */
    background: #003366;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}

.attListCloser:hover {
    background: #e1e1e1;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.attQueryCloserBtn {

  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px; /* Adjust for visual balance */
  font-weight: bold;
  border: 1px solid #ccc;
  border-radius: 6px; /* Use 50% for circular button */
  background: #003366;
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.attQueryCloserBtn:hover {
  background: #005599;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

#runAttrQueryBtn {
  margin-top: 10px;
  width: 100%;
  height: 25px;
  line-height: 25px; /* Match height */
  background-color: #007bff;
  color: white;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  padding: 0;
}

#runAttrQueryBtn:hover {
  background-color: #0056b3;
}

#runAttrQueryBtn:active {
  background-color: #004494;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.attListContent {
    flex: 1 1 auto;
    overflow-y: auto;
}

.attListContent table {
    width: 100%;
    border-collapse: collapse;
}

.attListContent th,
.attListContent td {
    border: 1px solid #ccc;
    padding: 4px 8px;
    text-align: left;
    vertical-align: top;
}

.attQueryDivSpatial {
  position: absolute;
  top: 10px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1); /* 30% transparency */
  border: 2px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  display: none; /* Hidden by default */
  min-width: 200px;
  max-width: 300px;
  font-size: 12px;
  line-height: 1.4;
  }
    

  #headerDiv{
    position:sticky;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: midnightblue;
    z-index: 1001;
    height: 35px;
    width: 100%;
    border-radius: 6px;
    flex-shrink: 0;
   }

  #headerDiv label{
  color: white;
  font-weight: bold;
  font-size: 14px;
  }
#headerDivAgg{
    position:sticky;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: midnightblue;
    z-index: 1001;
    height: 35px;
    width: 100%;
    border-radius: 6px;
    flex-shrink: 0;
   }

 #headerDivAgg label{
  color: white;
  font-weight: bold;
  font-size: 14px;
  }

.closeBtn {

  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px; /* Adjust for visual balance */
  font-weight: bold;
  border: 1px solid #ccc;
  border-radius: 6px; /* Use 50% for circular button */
  background: #003366;
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.closeBtn:hover {
  background: #005599;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}
.attQueryCloserBtn {

  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px; /* Adjust for visual balance */
  font-weight: bold;
  border: 1px solid #ccc;
  border-radius: 6px; /* Use 50% for circular button */
  background: #003366;
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.attQueryCloserBtn:hover {
  background: #005599;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}


/* Scrollable content for both panels */
.scrollableContent, #attQueryContent, #attQueryContentAgg {
  max-height: calc(600px - 35px); /* Max panel height minus header height */
  overflow-y: auto;
  padding: 10px;
  box-sizing: border-box;
}


.scrollableContent label{
  display:block;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight:bold;
}

#layerSelect.form-control {
  font-size: 12px !important;
  padding: 4px 10px !important;
  height: 25px !important;
  line-height: 1.2 !important;
  width: 100%;
  border-radius: 6px;
  align-items: center;
  }
  #fieldSelect.form-control {
  font-size: 12px !important;
  padding: 4px 10px !important;
  height: 25px !important;
  line-height: 1.2 !important;
  width: 100%;
  border-radius: 6px;
  align-items: center;
  }

   #aggFieldSelect.form-control {
  font-size: 12px !important;
  padding: 4px 10px !important;
  height: 25px !important;
  line-height: 1.2 !important;
  width: 100%;
  border-radius: 6px;
  align-items: center;
  }

  #selectOperator.form-control {
  font-size: 12px !important;
  padding: 4px 10px !important;
  height: 25px !important;
  line-height: 1.2 !important;
  width: 100%;
  border-radius: 6px;
  align-items: center;
  }

  #aggSelectOperator.form-control {
  font-size: 12px !important;
  padding: 4px 10px !important;
  height: 25px !important;
  line-height: 1.2 !important;
  width: 100%;
  border-radius: 6px;
  align-items: center;
  }

  .radio-group {
  display: flex;
  flex-direction: row;
  gap: 4px;           /* smaller gap between options */
  font-weight: bold;
  margin-top: 10px;
  font-family: sans-serif;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 6px;           /* space between radio and label text */
  font-weight: normal; /* or keep bold if you want */
  font-size: 13px;    /* smaller font size if needed */
  line-height: 1.2;   /* tighter line height */
  height: auto;       /* remove any fixed height */
  margin: 0;
  padding: 0;
}


   #fieldValue.form-control {
  font-size: 12px !important;
  padding: 4px 10px !important;
  height: 25px !important;
  line-height: 1.2 !important;
  width: 100%;
  border-radius: 6px;
  align-items: center;
  }



#queryBtn {
  margin-top: 10px;
  width: 100%;
  height: 25px;
  line-height: 25px; /* Match height */
  background-color: #007bff;
  color: white;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  padding: 0;
}

#queryBtn:hover {
  background-color: #0056b3;
}

#queryBtn:active {
  background-color: #004494;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

#aggQueryBtn {
  margin-top: 10px;
  width: 100%;
  height: 25px;
  line-height: 25px; /* Match height */
  background-color: #007bff;
  color: white;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  padding: 0;
}

#aggQueryBtn:hover {
  background-color: #0056b3;
}

#aggQueryBtn:active {
  background-color: #004494;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

#clearSelectedBtn {
  margin-top: 10px;
  width: 100%;
  height: 25px;
  line-height: 25px; /* Match height */
  background-color: #dc3545;    /* Bootstrap 'danger' red */
  color: white;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  padding: 0;
}

#clearSelectedBtn:hover {
  background-color: #c82333;
}

#clearSelectedBtn:active {
  background-color: #bd2130;
  transform: scale(0.97);
}

#aggClearSelectedBtn {
  margin-top: 10px;
  width: 100%;
  height: 25px;
  line-height: 25px; /* Match height */
  background-color: #dc3545;    /* Bootstrap 'danger' red */
  color: white;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  padding: 0;
}

#aggClearSelectedBtn:hover {
  background-color: #c82333;
}

#aggClearSelectedBtn:active {
  background-color: #bd2130;
  transform: scale(0.97);
}

.attListDivSpatial {
    grid-area: main;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    z-index: 1000; 
    background:white;
    display: flex;
    flex-direction: column;
    padding: 8px;
    border-top: 2px solid #999;
    /* max-height: 6.5em; approx 2 rows depending on line-height */
    /* overflow:hidden; */
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.3);
    /* display: none; */
    /* box-sizing: border-box; */
    }

  .attListContentSpatial {
  max-height: 250px; /* adjust as needed */
  overflow: hidden;
  border: 1px solid #ccc;
}

.scrollWrapper {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 260px;
  width: 100%;
  /* Always show horizontal scrollbar so users know table is scrollable */
  scrollbar-width: thin;
}
.scrollWrapper::-webkit-scrollbar { height: 8px; width: 8px; }
.scrollWrapper::-webkit-scrollbar-track { background: #f0f0f0; }
.scrollWrapper::-webkit-scrollbar-thumb { background: #aaa; border-radius: 4px; }

/* Bottom tab body: no extra scroll — let scrollWrapper handle it */
.bottom-tab-body {
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.bottom-tab-body .attListContent {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

  /* Error message */
.error-message {
  color: red;
  font-size: 12px;
  margin-top: 5px;
}

.resultTable {
  font-size: 10px;
  width: 100%;
  border-collapse: collapse;
}

.resultTable th, .resultTable td {
border: 1px solid #ccc;
padding: 5px;
}

.resultTable th {
  position: sticky;
  background-color: #f0f0f0;
}

/* Responsive adjustments */
@media only screen and (max-width: 768px) {
  .grid-container {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "header"
      "main";
  }
}

.expand-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 24px;
  height: 24px;
  cursor: pointer;
  background-color: #e6f0fa;
  color: #999999;
  box-shadow: 
    2px 2px 4px rgba(0, 0, 0, 0.2),
    -1px -1px 2px rgba(255, 255, 255, 0.6);
  border-radius: 4px;
  margin-right: 6px;
  font-size: 20px;
  font-weight: bold;
  user-select: none;
  transition: box-shadow 0.2s ease, background-color 0.2s ease;
}

.expand-btn::before {
  content: "+";
}

.expand-btn.expanded::before {
  content: "-";
}

.expand-btn:hover {
  background-color: #d6e4f5;
  box-shadow: 
    inset 2px 2px 4px rgba(0, 0, 0, 0.25),
    inset -1px -1px 2px rgba(255, 255, 255, 0.5);
}

/* Shared styling for query divs */
.query-div {
  position: absolute;
  top: 10px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1); /* 30% transparency */
  border: 2px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  display: none; /* Hidden by default */
  min-width: 200px;
  max-width: 300px;
  font-size: 12px;
  line-height: 1.4;
}


/* Specific styling for attListDivAggSpatial */
#attListDivAggSpatial {
  top: 430px; /* Stacks below attQueryDivAggSpatial (350px height + 10px gap) */
  width: 400px;
  height: 400px;
  overflow-y: auto; /* Enable scrolling for long content */
}

/* Specific styling for overlayResultDiv */
#overlayResultDiv {
  bottom: 10px; /* Anchor to bottom to ensure visibility */
  Left: 40px;
  width: 400px;
  height: 500px;
  display: none; /* Initially hidden, toggled to flex in JavaScript */
  flex-direction: column;
  overflow-y: auto;
  z-index: 1001; /* Higher than other panels */
  background-color: white;
  
}
/* Styling for overlay result content */
.overlay-result-content {
  flex: 1;
  padding: 10px;
  bottom: 10px; /* Anchor to bottom to ensure visibility */
}
/* ============================================================
   RIGHT PANEL – Feature Info + Aggregate results
   ============================================================ */
.right-panel {
  grid-area: right;
  display: none;
  flex-direction: column;
  background: #f4f6f9;
  border-left: 2px solid #c8d0db;
  overflow: hidden;
  min-width: 0;
}


.right-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  position: relative;
}

.right-panel-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #bbb;
  font-size: 12px;
  text-align: center;
  padding: 20px;
  gap: 12px;
}
.right-panel-placeholder p { margin: 0; line-height: 1.5; }

/* Individual result sections inside right panel */
.right-result-section {
  border-bottom: 1px solid #dde;
  font-size: 12px;
}
.right-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px;
  background: #e8edf5;
  border-bottom: 1px solid #d0d8e8;
  font-weight: bold;
  font-size: 12px;
  color: #1a3060;
}
.right-section-closer {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: #666;
  padding: 0;
  line-height: 1;
}
.right-section-closer:hover { color: #c00; }
.right-section-body {
  padding: 8px 10px;
  overflow-x: auto;
}
#featureInfoContent table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
#featureInfoContent td {
  padding: 3px 6px;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}
#featureInfoContent td:first-child {
  font-weight: bold;
  color: #1a3060;
  white-space: nowrap;
  width: 40%;
}

/* ============================================================
   BOTTOM RESULT PANEL – Attr query + Spatial query results
   ============================================================ */
.bottom-result-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 38%;
  background: white;
  border-top: 2px solid #2a4a8a;
  z-index: 900;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -3px 12px rgba(0,0,0,0.18);
  overflow: hidden;
}

.bottom-tab {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.bottom-tab-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: midnightblue;
  color: white;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.bottom-tab-title {
  font-weight: bold;
  font-size: 13px;
  font-family: 'Gill Sans', Calibri, sans-serif;
  flex-shrink: 0;
}
.bottom-tab-header .featureCountContainer {
  display: flex;
  gap: 8px;
  flex: 1;
}
.tab-closer {
  background: none;
  border: none;
  color: rgba(255,255,255,0.75);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  margin-left: auto;
}
.tab-closer:hover { color: white; }

.bottom-tab-body {
  flex: 1;
  overflow: auto;
}
.bottom-tab-body .attListContent,
.bottom-tab-body #attListContent,
.bottom-tab-body #attListContentSpatial {
  width: 100%;
}

/* ============================================================
   RESULT SECTION (aggregate / overlay – in right panel)
   ============================================================ */
.result-section-title {
  font-weight: bold;
  font-size: 12px;
  margin-bottom: 6px;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================================
   EDIT TOOL PALETTE (side panel, not popup)
   ============================================================ */
#editToolPanel {
  position: relative;
  top: auto;
  left: auto;
  width: 100%;
  background: white;
  border: none;
  border-bottom: 2px solid #2a4a8a;
  border-radius: 0;
  box-shadow: none;
  z-index: auto;
  display: none;
  font-family: Arial, sans-serif;
  font-size: 12px;
  overflow: hidden;
}

#editToolPanel .edit-panel-header {
  background: midnightblue;
  color: white;
  padding: 8px 12px;
  font-weight: bold;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#editToolPanel .edit-panel-header button {
  background: none;
  border: none;
  color: white;
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.edit-section {
  border-bottom: 1px solid #e0e4ec;
}

.edit-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  background: #f0f4fa;
  user-select: none;
  font-weight: bold;
  font-size: 12px;
  color: #1a3060;
}

.edit-section-header:hover { background: #e4ecf8; }

.edit-section-header .section-toggle {
  font-size: 14px;
  font-weight: bold;
  color: #5a7ab8;
}

.edit-section-body {
  padding: 10px 12px;
  display: none;
  background: white;
}
.edit-section-body.open { display: block; }

.edit-section-body label {
  display: block;
  font-weight: bold;
  margin-bottom: 4px;
  margin-top: 8px;
  color: #222;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.edit-section-body label:first-child { margin-top: 0; }

.edit-section-body select,
.edit-section-body input[type="file"] {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 12px;
  box-sizing: border-box;
}

.edit-radio-group {
  display: flex;
  gap: 16px;
  margin: 6px 0;
}
.edit-radio-group label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: normal !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  cursor: pointer;
  font-size: 12px;
  margin: 0 !important;
}

.edit-action-btn {
  width: 100%;
  padding: 7px;
  margin-top: 10px;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-delete { background: #dc3545; color: white; }
.btn-delete:hover { background: #b02030; }
.btn-delete:disabled { background: #e8a0a8; cursor: not-allowed; }

.btn-append { background: #28a745; color: white; }
.btn-append:hover { background: #1e7a35; }
.btn-append:disabled { background: #8ecf9e; cursor: not-allowed; }

.btn-transfer { background: #0066cc; color: white; }
.btn-transfer:hover { background: #004c99; }
.btn-transfer:disabled { background: #80b3e8; cursor: not-allowed; }

.edit-confirm-banner {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 4px;
  padding: 8px 10px;
  margin-top: 8px;
  font-size: 11px;
  color: #555;
  display: none;
}
.edit-confirm-banner.visible { display: block; }
.edit-confirm-banner .confirm-btns {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.edit-confirm-banner .confirm-btns button {
  flex: 1;
  padding: 4px;
  border: none;
  border-radius: 3px;
  font-size: 11px;
  cursor: pointer;
  font-weight: bold;
}
.btn-confirm-yes { background: #dc3545; color: white; }
.btn-confirm-no  { background: #6c757d; color: white; }

/* ============================================================
   RIGHT PANEL TOOL INPUT SECTIONS
   ============================================================ */
.right-tool-panel {
  border-bottom: 2px solid #c8d0db;
  background: white;
  font-size: 12px;
  overflow-y: auto;
}
.right-tool-panel .headerDiv,
.right-tool-panel .scrollableContent,
.right-tool-panel > div {
  /* Remove any absolute positioning inherited from old float-over-map styles */
  position: relative !important;
  top: auto !important; left: auto !important;
  right: auto !important; bottom: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  box-shadow: none !important;
  border: none !important;
  border-radius: 0 !important;
}
/* Result sections inside right panel - reset old sizing */
#rightPanelBody .attListDiv {
  position: relative !important;
  top: auto !important; left: auto !important;
  right: auto !important; bottom: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  max-height: 280px;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid #dde;
  overflow: hidden;
}
#rightPanelBody .attListDiv .bottom-tab-body {
  flex: 1;
  overflow-y: auto;
}

/* ============================================================
   OVERRIDE: tool panels inside right panel body
   (reset absolute positioning from legacy .attQueryDiv classes)
   ============================================================ */
#rightPanelBody #attQueryDiv,
#rightPanelBody #attQueryDivSpatial,
#rightPanelBody #attQueryDivAggSpatial,
#rightPanelBody #interactiveSelectDiv,
#rightPanelBody #downloadShpPanel {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  left: auto !important;
  bottom: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-shadow: none !important;
  border: none !important;
  border-bottom: 1px solid #dde !important;
  border-radius: 0 !important;
  background: white !important;
  z-index: auto !important;
  overflow-y: auto;
  max-height: 55vh;
}
#rightPanelBody .scrollableContent {
  max-height: none !important;
  overflow: visible !important;
}
#rightPanelBody .headerDiv {
  position: relative !important;
  background: #1a3060 !important;
  color: white !important;
  padding: 8px 12px !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
}
#rightPanelBody .headerDiv label {
  color: white !important;
  font-weight: bold !important;
  margin: 0 !important;
  font-size: 13px !important;
}
#rightPanelBody .headerDiv .closeBtn,
#rightPanelBody .headerDiv .attQueryCloserBtn {
  background: none !important;
  border: none !important;
  color: white !important;
  font-size: 16px !important;
  cursor: pointer !important;
}
#rightPanelBody label {
  display: block;
  margin: 8px 12px 2px;
  font-size: 12px;
  color: #333;
}
#rightPanelBody .form-control {
  margin: 2px 12px;
  width: calc(100% - 24px) !important;
  font-size: 12px;
}
#rightPanelBody .btn {
  margin: 6px 12px;
  width: calc(100% - 24px);
  font-size: 12px;
}
#rightPanelBody .radio-group {
  margin: 6px 12px;
}

/* ── Result table row click highlight ── */
.resultTable tbody tr { transition: background 0.1s; }
.resultTable tbody tr:hover { background: #dceeff; cursor: pointer; }
.resultTable tbody tr.row-selected {
  background: repeating-linear-gradient(
    45deg,
    transparent 0px,
    transparent 4px,
    #ffff00 4px,
    #ffff00 6px,
    transparent 6px,
    transparent 10px
  ) !important;
  outline: 2px solid #ffff00;
}
.resultTable tbody tr.row-selected td { color: #333; font-weight: bold; }

/* ============================================================
   NEW RESPONSIVE LAYOUT — app-shell, resizable panels, mobile
   ============================================================ */

/* Reset old grid on body */
body { margin: 0; padding: 0; overflow: hidden; }

/* ── App shell: full viewport, column flex ── */
.app-shell {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ── Header ── */
.app-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 12px;
  background-color: midnightblue;
  color: white;
  font-size: 20px;
  font-family: 'Gill Sans', Calibri, sans-serif;
  z-index: 100;
}
.app-header img { height: 38px; }

/* ── Body row: TOC | handle | Center | handle | Right ── */
.app-body {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  min-height: 0;
}

/* ── TOC panel ── */
.panel-toc {
  flex: 0 0 220px;
  min-width: 80px;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f8f9fa;
  border-right: 1px solid #ccc;
}
.panel-toc .toc {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 10px;
  box-sizing: border-box;
  border-right: none;
}

/* ── Centre column: Map (flex top) + handle + Bottom table ── */
.panel-center {
  flex: 1;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* Map fills available space */
.panel-map {
  flex: 1;
  min-height: 100px;
  position: relative;
  overflow: hidden;
}
.panel-map #map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ── Bottom attribute table panel ── */
.panel-bottom {
  flex: 0 0 220px;
  min-height: 60px;
  max-height: 60vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: white;
  border-top: 2px solid #2a4a8a;
  box-shadow: 0 -3px 12px rgba(0,0,0,0.18);
}
.panel-bottom .bottom-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}
.panel-bottom .bottom-tab-body {
  flex: 1;
  overflow: auto;
}

/* ── Right panel ── */
.panel-right {
  flex: 0 0 280px;
  min-width: 80px;
  max-width: 480px;
  display: none;        /* shown by JS when a tool activates */
  flex-direction: column;
  background: #f4f6f9;
  border-left: 2px solid #c8d0db;
  overflow: hidden;
}
.panel-right.visible { display: flex; }
.panel-right .right-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  position: relative;
}

/* ── Vertical resize handle (between panels horizontally) ── */
.resize-handle {
  flex: 0 0 5px;
  background: #d0d8e0;
  cursor: col-resize;
  transition: background 0.15s;
  z-index: 50;
  position: relative;
}
.resize-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3px;
  height: 32px;
  background: #9ab;
  border-radius: 2px;
  opacity: 0.6;
}
.resize-handle:hover, .resize-handle:active { background: #2a6aad; }

/* ── Horizontal resize handle (between map and bottom table) ── */
.resize-handle-h {
  flex: 0 0 5px;
  background: #d0d8e0;
  cursor: row-resize;
  transition: background 0.15s;
  z-index: 50;
  position: relative;
  display: none;  /* shown when bottom panel is visible */
}
.resize-handle-h.visible { display: block; }
.resize-handle-h::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  height: 3px;
  width: 32px;
  background: #9ab;
  border-radius: 2px;
  opacity: 0.6;
}
.resize-handle-h:hover, .resize-handle-h:active { background: #2a6aad; }

/* ── Keep .grid-container working for any legacy refs ── */
.grid-container {
  display: contents;
}

/* ============================================================
   MOBILE LAYOUT  (≤ 768px)
   Stack order: header → toc → tools (right panel) → map → results
   ============================================================ */
@media (max-width: 768px) {
  body { overflow: auto; }

  .app-shell {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .app-header {
    font-size: 15px;
    height: 44px;
    position: sticky;
    top: 0;
    z-index: 200;
  }

  .app-body {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  /* TOC — full width, collapsible height */
  .panel-toc {
    flex: none;
    width: 100% !important;
    max-width: 100%;
    max-height: 220px;
    overflow-y: auto;
    border-right: none;
    border-bottom: 2px solid #ccc;
  }

  /* Right panel (tools) — full width, below TOC */
  .panel-right,
  .panel-right.visible {
    display: flex;
    flex: none;
    width: 100% !important;
    max-width: 100%;
    min-width: 0;
    max-height: 360px;
    overflow-y: auto;
    border-left: none;
    border-bottom: 2px solid #c8d0db;
    order: 2;
  }

  /* Map — full width, fixed height */
  .panel-center {
    flex: none;
    width: 100% !important;
    order: 3;
  }
  .panel-map {
    height: 55vw;
    min-height: 220px;
    max-height: 60vh;
    position: relative;
  }

  /* Bottom results — full width, below map */
  .panel-bottom {
    flex: none;
    max-height: 50vh;
    width: 100%;
    order: 4;
  }

  /* Hide resize handles on mobile — no drag needed */
  .resize-handle,
  .resize-handle-h {
    display: none !important;
  }

  /* Make buttons and text larger for touch */
  .edit-action-btn,
  .panel-run-btn,
  .panel-clear-btn {
    min-height: 38px;
    font-size: 13px !important;
  }

  /* Popup fits screen */
  .ol-popup {
    max-width: 90vw;
  }

  /* Tool buttons are relocated (by index.html) out of the map overlay into
     #mobileToolbar, a horizontal bar that sits directly above the map. This
     declutters the short mobile map and keeps every tool reachable. */
  .mobile-toolbar {
    display: flex;
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    background: #eef2f8;
    border-bottom: 2px solid #c8d0db;
    /* first child of .panel-center => renders above the map */
  }

  /* Lay the OpenLayers button container out as a wrapping horizontal bar
     (roughly two rows on a phone) instead of an absolutely-positioned column. */
  .mobile-toolbar .mapButtonContainer {
    position: static;
    top: auto;
    left: auto;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-content: flex-start;
    max-height: none;
    gap: 10px;
  }

  /* Slightly larger, easier-to-tap buttons */
  .myButton {
    width: 32px;
    height: 32px;
  }
  .myButton img {
    width: 22px;
    height: 22px;
  }
}

@media (max-width: 480px) {
  .app-header { font-size: 13px; height: 40px; }
  .app-header img { height: 30px; }
  .panel-map { height: 65vw; }
}

/* ============================================================
   STARTUP ROLE LOGIN MODAL
   ============================================================ */
#roleLoginOverlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 60, 0.55);
  backdrop-filter: blur(3px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.role-login-box {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
  overflow: hidden;
  animation: roleFadeIn 0.25s ease;
}
@keyframes roleFadeIn {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.role-login-header {
  background: midnightblue;
  color: #fff;
  padding: 14px 18px;
  font-size: 17px;
  font-family: 'Gill Sans', Calibri, sans-serif;
  display: flex;
  align-items: center;
}
.role-login-body { padding: 18px; }
.role-login-prompt {
  text-align: center;
  color: #555;
  font-size: 13px;
  margin: 0 0 14px;
}
.role-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  margin-bottom: 10px;
  border: 1.5px solid #d8dee8;
  border-radius: 8px;
  background: #f8faff;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.role-btn:hover { border-color: #1a85ff; background: #eef5ff; transform: translateY(-1px); }
.role-btn:active { transform: translateY(0); }
.role-ico { font-size: 24px; flex-shrink: 0; }
.role-txt { display: flex; flex-direction: column; line-height: 1.3; }
.role-txt b { font-size: 14px; color: #1a3060; }
.role-txt small { font-size: 11px; color: #888; }
.role-cred-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
}
.role-back { background: #e0e4ec; color: #444; }
.role-back:hover { background: #d0d6e0; }
.role-go { background: linear-gradient(to bottom, #1a85ff, #0060cc); color: #fff; }
.role-go:hover { background: linear-gradient(to bottom, #1a90ff, #0070dd); }

@media (max-width: 480px) {
  .role-login-box { max-width: 100%; }
  .role-login-header { font-size: 15px; }
}

/* ============================================================
   HEADER USER BADGE + LOGOUT
   ============================================================ */
.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  padding-right: 4px;
}
.header-role-badge {
  font-size: 12px;
  font-weight: bold;
  color: #fff;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 14px;
  padding: 4px 12px;
  white-space: nowrap;
}
.header-logout-btn {
  font-size: 12px;
  font-weight: bold;
  color: #fff;
  background: linear-gradient(to bottom, #c0392b, #962d22);
  border: 1px solid #7a2419;
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.2);
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}
.header-logout-btn:hover { background: linear-gradient(to bottom, #d04434, #a83228); }
.header-logout-btn:active { transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(0,0,0,0.3); }

@media (max-width: 768px) {
  .header-role-badge { font-size: 10px; padding: 3px 8px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
  .header-logout-btn { font-size: 11px; padding: 4px 8px; }
}
@media (max-width: 480px) {
  .header-role-badge {
    /* hide the username text on very small screens, keep just the role */
    max-width: 70px;
  }
}
