/* ==========================================================
   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;
}

body.dashboard-edit-mode .dashboard-editable-item:hover {
  outline: 1px dashed #174a6c;
  background: rgba(23, 74, 108, 0.06);
}

body.dashboard-edit-mode .dashboard-edit-selected {
  outline: 2px solid #2d7ff9;
  outline-offset: 2px;
  background: rgba(45, 127, 249, 0.08);
}

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

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;
}
