html, body {
  margin: 0;
  padding: 0;
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  font-family: Arial, sans-serif;
}

#controls-panel {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 280px; /* This width will now include padding and border */
  background: linear-gradient(
  to right,
  rgba(255, 255, 255, 0.6),
  rgba(255, 255, 255, 0.4)
);
  border-right: 2px solid rgba(200, 200, 200, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 1000;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
}

#controls-panel.collapsed {
  transform: translateX(-100%);
  opacity: 0;
  /* The panel is slid offscreen — make sure it can't intercept clicks
     near the left edge of the map while collapsed. */
  pointer-events: none;
}

#toggle-panel {
  position: absolute;
  top: 10px;
  left: 10px; /* move to visible area */
  z-index: 1100; /* above the panel */
  width: 35px;
  height: 35px;
  background: #444;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

#toggle-panel:hover {
  background: #666;
}

#toggle-panel i {
  pointer-events: none;
}

#controls-panel::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 30%; /* Ensures image only takes up the bottom 30% */
  background: linear-gradient(to top, rgba(244, 244, 244, 1) 0%, rgba(244, 244, 244, 0.7) 50%, transparent 100%);
  background-size: contain; /* Ensures the image fits without distortion */
  background-position: center bottom; /* Anchors image to the bottom */
  background-repeat: no-repeat; /* Prevents tiling */
  z-index: 1;
  pointer-events: none;
}

.map {
  flex: 1;
  height: 100vh;
}

.controls {
  margin-bottom: 8px;
  position: relative;
  flex-shrink: 0;
}

.controls label[for="city-input"],
.controls label {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
  display: block;
}

.city-input {
  width: 100%;
  margin-bottom: 8px;
  padding: 6px 8px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  box-sizing: border-box;
}

.autocomplete-suggestions {
  display: none; /* hidden by default */
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  max-height: 150px;
  overflow-y: auto;
  position: absolute;
  width: calc(100% - 2px);
  z-index: 1000;
  backdrop-filter: blur(4px);
}

/* Show it only when there's content */
.autocomplete-suggestions.visible {
  display: block;
}

.autocomplete-suggestion {
  padding: 5px;
  cursor: pointer;
}

.autocomplete-suggestion:hover,
.autocomplete-suggestion.highlighted {
  background: #f0f0f0;
}

.city-list {
  margin-top: 6px;
  margin-bottom: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.city-list::-webkit-scrollbar {
  width: 5px;
}

.city-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 4px;
}

.city-list::-webkit-scrollbar-thumb {
  background: rgba(0, 51, 102, 0.2);
  border-radius: 4px;
}

.city-list::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 51, 102, 0.4);
}

.panel-export-section {
  margin-top: auto;
  margin-left: -10px;
  margin-right: -10px;
  margin-bottom: -10px;
  padding: 10px;
  border-top: 1px solid rgba(0, 51, 102, 0.14);
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.35), rgba(240, 245, 255, 0.55));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 -3px 10px rgba(0, 0, 0, 0.03);
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

#export-map {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  margin-bottom: 0;
  padding: 8px 12px;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  border: 1px solid #1e40af;
  border-radius: 7px;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  box-sizing: border-box;
}

#export-map:hover {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  border-color: #1d4ed8;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

#export-map:active {
  background: linear-gradient(180deg, #1d4ed8 0%, #1e40af 100%);
  transform: translateY(0);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

#export-map:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

#export-map i {
  font-size: 13px;
  color: #ffffff;
  opacity: 0.95;
}

.city-item {
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.9);
  padding: 4px 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.city-item span {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-style-select {
  width: 100%;
  padding: 5px;
  margin-bottom: 10px;
  box-sizing: border-box;
}

.color-picker {
  width: 100%;
  margin-bottom: 10px;
}

.icon-select {
  width: 100%;
  padding: 5px;
  margin-bottom: 10px;
  box-sizing: border-box;
}

.fa-marker {
  font-size: 24px;
  color: blue;
}

.windows7-button {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 7px 12px;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #003366;
  background: linear-gradient(to bottom right, rgba(255, 255, 255, 0.4), rgba(240, 240, 255, 0.2));
  border: 1px solid rgba(0, 102, 204, 0.3);
  border-radius: 7px;
  backdrop-filter: blur(6px);
  background-clip: padding-box;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 1px 3px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.windows7-button:hover {
  background: linear-gradient(to bottom right, rgba(255, 255, 255, 0.5), rgba(230, 230, 255, 0.3));
  border-color: rgba(0, 102, 204, 0.5);
  color: #002244;
}

.windows7-button:active {
  transform: scale(0.98);
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.15);
}

/* City item control buttons */
.city-item button {
  margin-left: 3px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  color: #003366;
  padding: 2px 5px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.city-item button:hover {
  background: rgba(255, 255, 255, 0.5);
  border-color: rgba(0, 0, 0, 0.2);
}


.city-item button:active {
  background: linear-gradient(to bottom, #3c7be5 0%, #0c4fbf 100%);
  border-color: #0c4fbf;
  box-shadow: inset 0px 1px 2px rgba(0, 0, 0, 0.3);
}

.city-marker {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  color: #333;
  text-align: center;
}

#show-labels {
  margin-bottom: 10px;
}

#show-labels label {
  display: flex;
  align-items: center;
  font-size: 14px;
}

#show-labels input {
  margin-right: 5px;
}

#show-labels-container {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

#show-labels-container label {
  display: flex;
  align-items: center;
  width: 100%;
  font-size: 14px;
}

#show-labels-container input[type="checkbox"] {
  margin-right: 8px;
}

.collapsible {
  background-color: #4c8bf5;
  color: white;
  cursor: pointer;
  padding: 10px;
  border: none;
  text-align: left;
  outline: none;
  font-size: 15px;
  border-radius: 5px;
  margin-bottom: 5px;
  width: 100%;
  box-sizing: border-box;
  transition: background-color 0.3s ease;
}

.collapsible:after {
  content: '\25BC';
  float: right;
  transition: transform 0.3s ease;
}

.collapsible.active:after {
  content: '\25B2';
  transform: rotate(180deg);
}

.collapsible:hover {
  background-color: #3a6fd8;
}

.content {
  display: none;
  padding: 10px;
  background-color: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 5px;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 10px;
  transition: max-height 0.3s ease-out, padding 0.3s ease-out;
  overflow: hidden;
  font-size: 14px;
}

.collapsible.active + .content {
  display: block;
  max-height: 500px;
}

#advanced-settings-container {
  margin-top: auto;
}

#advanced-settings-container .form-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  font-size: 14px;
}

#advanced-settings-container .form-row label {
  margin-right: 10px;
  white-space: nowrap;
}

#advanced-settings-container .form-row input[type="checkbox"] {
  margin-left: 5px;
}

#advanced-settings-container .form-row input,
#advanced-settings-container .form-row select,
#advanced-settings-container label,
#advanced-settings-container input,
#advanced-settings-container select {
  font-size: 14px;
}

#settings-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  z-index: 999;
}

#settings-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #ffffff;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
  z-index: 1000;
  display: none;
  max-width: 420px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-sizing: border-box;
}

/* Header & Map Title */
.header-container {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 10px;
}

.header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
}

.header-top-row h1,
.map-title-row h1 {
  font-size: 19px;
  font-weight: 700;
  margin: 0;
  color: #0f2b48;
  letter-spacing: -0.02em;
}

.current-map-title {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 5px 9px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(0, 51, 102, 0.2);
  border-radius: 7px;
  color: #0f2b48;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  user-select: none;
}

.current-map-title:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 102, 204, 0.4);
  color: #001f3f;
  box-shadow: 0 2px 5px rgba(0, 51, 102, 0.1);
}

.current-map-title:active {
  transform: scale(0.99);
}

.map-name-icon {
  font-size: 12px;
  color: #2563eb;
  opacity: 0.9;
  flex-shrink: 0;
}

#current-map-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: #0f2b48;
}

.map-name-edit-hint {
  font-size: 11px;
  color: #64748b;
  opacity: 0.5;
  transition: opacity 0.2s ease, transform 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
  margin-left: 2px;
}

.current-map-title:hover .map-name-edit-hint {
  opacity: 0.95;
  color: #2563eb;
  transform: scale(1.1);
}

.current-map-title.editing,
.current-map-title:has(.map-name-input) {
  padding: 0;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.current-map-title.editing .map-name-icon,
.current-map-title.editing .map-name-edit-hint,
.current-map-title:has(.map-name-input) .map-name-icon,
.current-map-title:has(.map-name-input) .map-name-edit-hint {
  display: none;
}

.map-name-input {
  width: 100%;
  box-sizing: border-box;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: #0f2b48;
  padding: 5px 8px;
  background: #ffffff;
  border: 1.5px solid #2563eb;
  border-radius: 6px;
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.unsaved-indicator {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e65100;
  box-shadow: 0 0 0 2px rgba(230, 81, 0, 0.25);
  margin-left: 2px;
  flex-shrink: 0;
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.25);
    opacity: 0.8;
  }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

/* Icon buttons in header */
.icon-button {
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(0, 102, 204, 0.15);
  border-radius: 5px;
  padding: 4px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  box-sizing: border-box;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(0, 102, 204, 0.35);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.icon-button:active {
  transform: translateY(0);
}

.icon-button i {
  font-size: 12px;
  color: #003366;
  opacity: 0.85;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.icon-button:hover i {
  color: #001122;
  opacity: 1;
}

/* Open Map / My Maps Dialog */
#maps-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  z-index: 999;
}

#maps-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #ffffff;
  padding: 24px 26px;
  border-radius: 14px;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
  z-index: 1000;
  display: none;
  max-width: 780px;
  width: 94%;
  max-height: 85vh;
  overflow-y: auto;
  box-sizing: border-box;
  font-family: 'Segoe UI', Arial, sans-serif;
}

.maps-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.maps-dialog-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dialog-title-icon {
  font-size: 20px;
  color: #2563eb;
}

.maps-dialog-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  border: none;
  padding: 0;
}

.dialog-close-icon {
  background: transparent;
  border: none;
  color: #64748b;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s ease;
}

.dialog-close-icon:hover {
  background: #f1f5f9;
  color: #0f172a;
}

#maps-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 54vh;
  overflow-y: auto;
  padding-right: 4px;
}

#maps-list::-webkit-scrollbar {
  width: 6px;
}

#maps-list::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}

#maps-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

#maps-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.map-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  transition: all 0.2s ease;
  flex-wrap: wrap;
}

.map-row:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.04);
}

.map-row.is-current {
  border-color: #93c5fd;
  background: #f0f7ff;
}

.map-row-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 220px;
  flex: 1 1 230px;
}

.map-row-thumbnail {
  width: 80px;
  height: 54px;
  object-fit: cover;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  flex: 0 0 auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.map-row-details {
  min-width: 0;
  flex: 1;
}

.map-row-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.map-row-title-row .map-name-input {
  font-size: 13.5px;
  font-weight: 600;
  padding: 3px 8px;
  border: 1.5px solid #2563eb;
  border-radius: 6px;
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  width: 100%;
  box-sizing: border-box;
}

.map-row-name {
  display: block;
  font-weight: 700;
  font-size: 14.5px;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.map-row-current-badge {
  display: inline-block;
  padding: 1.5px 6px;
  font-size: 10px;
  font-weight: 700;
  color: #1d4ed8;
  background: #dbeafe;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.map-row-meta {
  color: #64748b;
  font-size: 12.5px;
  white-space: nowrap;
  line-height: 1.3;
}

.map-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
  flex: 0 1 auto;
}

.map-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-sizing: border-box;
  text-decoration: none;
  line-height: 1.2;
}

.map-action-btn i {
  font-size: 11px;
}

.map-action-open {
  background: #2563eb;
  color: #ffffff;
  border: 1px solid #1d4ed8;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.map-action-open:hover {
  background: #1d4ed8;
  border-color: #1e40af;
  box-shadow: 0 2px 5px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.map-action-rename,
.map-action-duplicate,
.map-action-export {
  background: #f8fafc;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.map-action-rename:hover,
.map-action-duplicate:hover,
.map-action-export:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.map-action-saveas {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.map-action-saveas:hover {
  background: #dcfce7;
  color: #14532d;
  border-color: #86efac;
  transform: translateY(-1px);
}

.map-action-delete {
  background: #ffffff;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.map-action-delete:hover {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fca5a5;
  transform: translateY(-1px);
}

.map-action-btn:active {
  transform: translateY(0);
}

.maps-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 16px;
  text-align: center;
  color: #64748b;
}

.maps-empty-icon {
  font-size: 36px;
  color: #94a3b8;
  margin-bottom: 10px;
}

.maps-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 4px;
}

.maps-empty-subtitle {
  font-size: 13px;
  color: #64748b;
  max-width: 320px;
}

.maps-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #e2e8f0;
  flex-wrap: wrap;
}

.maps-dialog-footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dialog-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-sizing: border-box;
  line-height: 1.3;
}

.dialog-btn i {
  font-size: 12px;
}

.dialog-btn-primary {
  background: #2563eb;
  color: #ffffff;
  border: 1px solid #1d4ed8;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.dialog-btn-primary:hover {
  background: #1d4ed8;
  border-color: #1e40af;
  box-shadow: 0 2px 5px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.dialog-btn-secondary {
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.dialog-btn-secondary:hover {
  background: #f8fafc;
  color: #0f172a;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.dialog-btn-ghost {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.dialog-btn-ghost:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.dialog-btn:active {
  transform: translateY(0);
}

#settings-dialog h3 {
  margin-top: 0;
  font-size: 20px;
  color: #003366;
  border-bottom: 1px solid #ccc;
  padding-bottom: 10px;
  margin-bottom: 20px;
}

#settings-dialog .settings-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 18px;
}

#settings-dialog .settings-tab {
  flex: 1;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: #64748b;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

#settings-dialog .settings-tab:hover {
  color: #334155;
}

#settings-dialog .settings-tab.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

#settings-dialog .settings-tab-panel {
  display: none;
}

#settings-dialog .settings-tab-panel.active {
  display: block;
}

#settings-dialog label {
  display: block;
  margin-bottom: 4px;
  color: #222;
  font-size: 14px;
  font-weight: 500;
}

#settings-dialog input[type="color"],
#settings-dialog input[type="number"],
#settings-dialog select {
  width: 100%;
  padding: 6px 10px;
  font-size: 14px;
  margin-bottom: 12px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #f9f9f9;
  box-sizing: border-box;
}

#settings-dialog input[type="checkbox"] {
  margin-right: 6px;
}

#settings-dialog .form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

#settings-dialog .form-row label {
  margin: 0;
  flex: 1;
}

#settings-dialog .form-row input[type="checkbox"] {
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .map-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .map-row-thumbnail {
    width: 100%;
    height: 110px;
  }

  .map-row-details {
    width: 100%;
  }

  .map-row-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
  }

  .maps-dialog-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .maps-dialog-footer-left {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
  }

  .dialog-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Ensure context menu appears above all map elements */
#sticker-context-menu {
  position: fixed;
  background: white;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 9999; /* Ensure it's above everything */
  min-width: 160px;
  display: none;
  flex-direction: column;
}

#sticker-context-menu button {
  background: none;
  border: none;
  padding: 8px 16px;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  color: #333;
}

#sticker-context-menu button:hover {
  background-color: #f0f0f0;
}

#sticker-context-menu button:not(:last-child) {
  border-bottom: 1px solid #eee;
}

#sticker-selection {
  z-index: 10000 !important;
}

.ol-overlaycontainer-stopevent {
  z-index: auto !important;
}

#panel-collapse {
  margin-left: 8px;
  order: -1; /* Move to the left of other buttons */
}

#panel-expand {
  display: flex; /* ADD this (or block) */
  align-items: center; /* ADD if using flex */
  justify-content: center; /* ADD if using flex */
  position: fixed;
  left: 280px; /* Set initial position based on expanded state */
  top: 75%;
  width: 30px;
  height: 60px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-left: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  z-index: 1000; 
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1);
  transition: left 0.3s ease, background 0.3s ease, box-shadow 0.3s ease; 
}

#panel-expand:hover {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.15);
}

#panel-expand i {
  font-size: 16px;
  color: #003366;
}

.hidden {
  display: none !important;
}

/* Account modal — reuses the maps-dialog header/overlay look */
.icon-button.is-signed-in {
  border-color: rgba(22, 101, 52, 0.35);
  background: rgba(220, 252, 231, 0.6);
}

.icon-button.is-signed-in i {
  color: #166534;
  opacity: 1;
}

#account-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  z-index: 999;
}

#account-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #ffffff;
  padding: 24px 26px;
  border-radius: 14px;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
  z-index: 1000;
  display: none;
  max-width: 340px;
  width: 92%;
  box-sizing: border-box;
  font-family: 'Segoe UI', Arial, sans-serif;
}

.account-modal-blurb {
  margin: 0 0 16px;
  font-size: 13px;
  color: #64748b;
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  margin-bottom: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
}

.form-input {
  width: 100%;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #f8fafc;
  box-sizing: border-box;
}

.form-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  background: #ffffff;
}

.auth-error {
  margin-bottom: 12px;
  padding: 8px 10px;
  font-size: 12.5px;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
}

.account-submit-btn {
  width: 100%;
}

.auth-switch {
  margin-top: 14px;
  text-align: center;
  font-size: 12.5px;
  color: #64748b;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  margin-left: 4px;
  color: #2563eb;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
}

#agent-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  z-index: 998;
}

@media (min-width: 769px) {
  #agent-dialog-overlay {
    display: none !important;
  }
}

#agent-dialog {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 290px;
  background: linear-gradient(
    to left,
    rgba(255, 255, 255, 0.6),
    rgba(255, 255, 255, 0.4)
  );
  border-left: 2px solid rgba(200, 200, 200, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 10px;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
  z-index: 1000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: Arial, sans-serif;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.icon-button.is-active,
#open-agent.is-active {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 102, 204, 0.5);
  box-shadow: 0 0 6px rgba(0, 102, 204, 0.25);
}

.icon-button.is-active i,
#open-agent.is-active i {
  color: #003366;
}

/* Agent Header */
.agent-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(200, 200, 200, 0.7);
  flex-shrink: 0;
}

.agent-header-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.agent-icon-badge {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(0, 102, 204, 0.2);
  color: #003366;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

.agent-header-title-group {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.agent-header-title-group h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #0f2b48;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.agent-status-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #15803d;
}

/* A crisp solid core (thin light ring for definition against the glass
   panel's variable backdrop) plus a separate expanding-and-fading ::after
   ring for the "pulse" — the dot itself never scales or blurs, which is
   what made the old single-element, box-shadow-blur version look fuzzy. */
.agent-status-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.9);
  display: inline-block;
}

.agent-status-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #16a34a;
  animation: agentPulseRing 2s infinite ease-out;
}

@keyframes agentPulseRing {
  0% { transform: scale(1); opacity: 0.55; }
  100% { transform: scale(2.4); opacity: 0; }
}

.agent-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.agent-header-btn {
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(0, 102, 204, 0.15);
  border-radius: 5px;
  padding: 4px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  box-sizing: border-box;
  color: #003366;
  font-size: 12px;
}

.agent-header-btn:hover {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(0, 102, 204, 0.35);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
  color: #001122;
}

.dialog-close-icon.agent-close-btn {
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(0, 102, 204, 0.15);
  border-radius: 5px;
  padding: 4px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  box-sizing: border-box;
  color: #003366;
  font-size: 12px;
}

.dialog-close-icon.agent-close-btn:hover {
  background: rgba(255, 230, 230, 0.75);
  border-color: rgba(204, 0, 0, 0.35);
  color: #990000;
  transform: translateY(-1px);
}

/* Agent Messages Area */
.agent-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 8px 0;
  scroll-behavior: smooth;
  box-sizing: border-box;
}

.agent-messages::-webkit-scrollbar {
  width: 4px;
}

.agent-messages::-webkit-scrollbar-track {
  background: transparent;
}

.agent-messages::-webkit-scrollbar-thumb {
  background: rgba(160, 160, 160, 0.5);
  border-radius: 4px;
}

/* Welcome Screen & Suggestions */
.agent-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px 4px 6px;
  animation: agentFadeIn 0.25s ease;
}

@keyframes agentFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.agent-welcome-avatar {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 102, 204, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #2563eb;
  margin-bottom: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.agent-welcome-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f2b48;
  margin: 0 0 4px;
}

.agent-welcome-subtitle {
  font-size: 12px;
  color: #ffffff;
  line-height: 1.4;
  margin: 0 0 12px;
}

.agent-suggestions-label {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #ffffff;
  margin-bottom: 6px;
}

.agent-suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.agent-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 6px 9px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(0, 51, 102, 0.2);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #0f2b48;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
  font-family: inherit;
}

.agent-chip:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 102, 204, 0.4);
  color: #001f3f;
  box-shadow: 0 2px 5px rgba(0, 51, 102, 0.1);
  transform: translateY(-1px);
}

.agent-chip:active {
  transform: scale(0.99);
}

.agent-chip i {
  font-size: 11px;
  color: #2563eb;
  flex-shrink: 0;
}

/* Chat Message Bubbles */
.agent-message-row {
  display: flex;
  gap: 6px;
  max-width: 95%;
  animation: agentMsgIn 0.2s ease-out;
}

@keyframes agentMsgIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.agent-message-row-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.agent-message-row-assistant {
  align-self: flex-start;
}

.agent-msg-avatar {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 102, 204, 0.25);
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
  margin-top: 2px;
}

.agent-message-content {
  display: flex;
  flex-direction: column;
}

.agent-message {
  padding: 7px 11px;
  font-size: 12.5px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.agent-message-user {
  align-self: flex-end;
  background: #2563eb;
  color: #ffffff;
  border-radius: 7px;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.25);
}

.agent-message-assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.85);
  color: #0f2b48;
  border: 1px solid rgba(0, 51, 102, 0.18);
  border-radius: 7px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.agent-action-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.agent-action-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(236, 253, 245, 0.9);
  color: #059669;
  border: 1px solid rgba(167, 243, 208, 0.8);
}

.agent-action-badge i {
  font-size: 9px;
}

/* Typing Indicator */
.agent-typing-row {
  display: flex;
  gap: 6px;
  align-self: flex-start;
  align-items: center;
  animation: agentMsgIn 0.2s ease-out;
}

.agent-typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 51, 102, 0.18);
  padding: 8px 12px;
  border-radius: 7px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.agent-typing-bubble span {
  width: 5px;
  height: 5px;
  background: #94a3b8;
  border-radius: 50%;
  display: inline-block;
  animation: agentTypingBounce 1.4s infinite ease-in-out both;
}

.agent-typing-bubble span:nth-child(1) {
  animation-delay: -0.32s;
}
.agent-typing-bubble span:nth-child(2) {
  animation-delay: -0.16s;
}
.agent-typing-bubble span:nth-child(3) {
  animation-delay: 0s;
}

@keyframes agentTypingBounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
    background: #2563eb;
  }
}

/* Agent Footer & Input Bar */
.agent-footer {
  padding-top: 8px;
  border-top: 1px solid rgba(200, 200, 200, 0.7);
  flex-shrink: 0;
}

.agent-input-container {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(0, 51, 102, 0.2);
  border-radius: 6px;
  padding: 2px 3px 2px 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.agent-input-container:focus-within {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 102, 204, 0.5);
  box-shadow: 0 0 5px rgba(0, 102, 204, 0.2);
}

.agent-input-field {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 12.5px;
  color: #0f2b48;
  padding: 5px 0;
  font-family: inherit;
  min-width: 0;
}

.agent-input-field::placeholder {
  color: #64748b;
  font-size: 12px;
}

.agent-send-btn {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  background: #2563eb;
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.agent-send-btn:hover:not(:disabled) {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.agent-send-btn:active:not(:disabled) {
  transform: translateY(0);
}

.agent-send-btn:disabled {
  background: #cbd5e1;
  color: #94a3b8;
  cursor: not-allowed;
  transform: none;
}

.agent-hints {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 5px;
  padding: 0 2px;
  font-size: 10.5px;
  color: #64748b;
}

.agent-hints span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.agent-hints strong {
  color: #0f2b48;
}

@media (max-width: 600px) {
  #agent-dialog {
    width: 100%;
    border-left: none;
  }
}

.account-status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.account-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #dbeafe;
  color: #1d4ed8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.account-status-text {
  min-width: 0;
}

.account-username {
  font-weight: 700;
  font-size: 14.5px;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-tagline {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}
