/* ==========================================================
   Edit Dashboard - button, slide-down menu and edit mode
   ========================================================== */

.edit-dashboard-wrap {
  position: relative;
  display: inline-block;
}

.edit-dashboard-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #174a6c;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.edit-dashboard-open-btn:hover {
  background: #0f3552;
}

.edit-dashboard-open-btn .edit-dashboard-caret {
  display: inline-block;
  transition: transform 0.25s ease;
  font-size: 0.8em;
}

.edit-dashboard-open-btn[aria-expanded="true"] .edit-dashboard-caret {
  transform: rotate(180deg);
}

/* Slide-down menu */
.edit-dashboard-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1200;
  min-width: 260px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
  padding: 8px;

  /* closed: slides up and fades out */
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  visibility: hidden;
  transition:
    max-height 0.28s ease,
    opacity 0.2s ease,
    transform 0.28s ease,
    visibility 0s linear 0.28s;
}

.edit-dashboard-menu.is-open {
  max-height: 420px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
  transition:
    max-height 0.28s ease,
    opacity 0.2s ease,
    transform 0.28s ease,
    visibility 0s linear 0s;
}

.edit-dashboard-menu-title {
  padding: 8px 12px 10px 12px;
  font-size: 0.82em;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7b8794;
}

.edit-dashboard-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 0.98em;
  font-weight: 600;
  color: #1f2d3d;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.edit-dashboard-menu button:hover,
.edit-dashboard-menu button:focus-visible {
  background: #eef4fa;
  outline: none;
}

.edit-dashboard-menu button .edit-dashboard-menu-icon {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #e3edf6;
  font-size: 0.9em;
}

/* ---------- Edit mode ---------- */

#dashboardEditToolbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: #10283b;
  color: #fff;
  padding: 12px 18px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
  font-size: 0.95em;
}

#dashboardEditToolbar strong {
  font-size: 1em;
  letter-spacing: 0.02em;
}

#dashboardEditToolbar .dashboard-edit-hint {
  color: #b8cfe2;
  font-size: 0.88em;
}

#dashboardEditToolbar select,
#dashboardEditToolbar button {
  border: none;
  border-radius: 7px;
  padding: 8px 14px;
  font-size: 0.92em;
  font-weight: 600;
  cursor: pointer;
}

#dashboardEditToolbar select {
  background: #1d3d57;
  color: #fff;
}

#dashboardEditToolbar .dashboard-edit-spacer {
  margin-left: auto;
}

#dashboardEditToolbar button[data-action="save"] {
  background: #2f9e5c;
  color: #fff;
}

#dashboardEditToolbar button[data-action="reset"] {
  background: #6b7c8c;
  color: #fff;
}

#dashboardEditToolbar button[data-action="exit"] {
  background: #d9534f;
  color: #fff;
}

body.dashboard-edit-mode {
  padding-bottom: 74px;
}

body.dashboard-edit-mode .dashboard-editable-item {
  outline: 1px dashed rgba(23, 74, 108, 0.35);
  outline-offset: 2px;
  cursor: move;
}

/* Highlighting is done with outlines and rings only. Never repaint the
   element's own background - a dark button with white text would turn
   pale and its caption would disappear. */

body.dashboard-edit-mode .dashboard-editable-item:hover {
  outline: 1px dashed #174a6c;
}

body.dashboard-edit-mode .dashboard-edit-selected {
  outline: 2px solid #2d7ff9;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(45, 127, 249, 0.28);
}

body.dashboard-edit-mode [contenteditable="true"] {
  outline: 2px solid #2f9e5c;
  outline-offset: 2px;
  cursor: text;
}

body.dashboard-edit-dragging {
  user-select: none;
}

/* The section being edited is highlighted */
body.dashboard-edit-mode .tab-section.dashboard-edit-target {
  box-shadow: 0 0 0 3px rgba(45, 127, 249, 0.35);
  border-radius: 14px;
}

.dashboard-edit-floating-controls {
  position: absolute;
  z-index: 2100;
  display: flex;
  gap: 6px;
  background: #10283b;
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.dashboard-edit-floating-controls button {
  background: #1d3d57;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.82em;
  font-weight: 600;
  cursor: pointer;
}

.dashboard-edit-floating-controls button:hover {
  background: #2d7ff9;
}

/* ==========================================================
   Map editing (map-editor.js) - only visible in edit mode
   ========================================================== */

.map-edit-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px 0;
  padding: 10px 12px;
  background: #10283b;
  border-radius: 10px;
  color: #fff;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 0.9em;
}

.map-edit-bar .map-edit-search {
  flex: 1 1 220px;
  min-width: 160px;
  border: none;
  border-radius: 7px;
  padding: 8px 11px;
  font-size: 0.95em;
  font-family: inherit;
  color: #1f2d3d;
}

.map-edit-bar button {
  border: none;
  border-radius: 7px;
  padding: 8px 13px;
  font-size: 0.9em;
  font-weight: 600;
  color: #fff;
  background: #1d3d57;
  cursor: pointer;
}

.map-edit-bar button:hover {
  background: #2d7ff9;
}

.map-edit-bar button[data-act="reset"] {
  background: #6b7c8c;
}

.map-edit-bar .map-edit-status {
  flex: 1 1 100%;
  color: #b8cfe2;
  font-size: 0.85em;
}

.contact-map.map-edit-active {
  outline: 2px solid #2d7ff9;
  outline-offset: 3px;
}

.map-edit-popup label {
  display: block;
  margin-top: 6px;
  font-size: 0.75em;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #64748b;
}

.map-edit-popup input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d8e0e8;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.92em;
  font-family: inherit;
  color: #1f2d3d;
}

.map-edit-popup-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.map-edit-popup-actions button {
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.82em;
  font-weight: 600;
  color: #fff;
  background: #174a6c;
  cursor: pointer;
}

.map-edit-popup-actions button[data-act="delete"] {
  background: #d9534f;
}

.map-edit-popup-hint {
  margin-top: 8px;
  color: #8a97a5;
  font-size: 0.78em;
}

/* ---------- colour palette ---------- */

.dashboard-edit-palette {
  position: absolute;
  z-index: 2100;
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: #10283b;
  border-radius: 10px;
  padding: 9px 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.34);
}

.dashboard-edit-palette[hidden] {
  display: none;
}

.dashboard-edit-palette-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dashboard-edit-palette-row > span {
  width: 34px;
  color: #b8cfe2;
  font-size: 0.76em;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dashboard-edit-swatch {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
}

.dashboard-edit-swatch:hover {
  outline: 2px solid #2d7ff9;
  outline-offset: 1px;
}

.dashboard-edit-palette input[type="color"] {
  width: 26px;
  height: 20px;
  margin-left: 3px;
  border: none;
  border-radius: 4px;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.dashboard-edit-palette-actions {
  justify-content: flex-end;
  gap: 6px;
  margin-top: 1px;
}

.dashboard-edit-palette-actions button {
  border: none;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.8em;
  font-weight: 600;
  color: #fff;
  background: #1d3d57;
  cursor: pointer;
}

.dashboard-edit-palette-actions button[data-action="clear-colour"] {
  background: #6b7c8c;
}

/* ---------- moving the control bar ---------- */

.dashboard-edit-floating-controls {
  align-items: center;
}

.dashboard-edit-drag {
  flex: 0 0 auto;
  padding: 0 6px 0 2px;
  color: #7ea3c4;
  font-size: 1.05em;
  line-height: 1;
  cursor: grab;
  user-select: none;
}

.dashboard-edit-drag:active {
  cursor: grabbing;
}

.dashboard-edit-floating-controls button[data-action="unpin"] {
  background: #34506b;
  padding: 5px 8px;
}
