/* CMS Edit Controls - In-context editing for logged-in CMS users */

.cms-editable-section {
  position: relative !important;
  border: 2px dashed transparent !important;
  transition: border-color 0.2s ease;
  isolation: isolate;
}

.cms-editable-section:hover {
  border-color: rgba(37, 99, 235, 0.6) !important;
}

.cms-edit-overlay {
  position: absolute !important;
  top: 12px !important;
  right: 12px !important;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 9999 !important;
}

/* Only the very first editable section on the page needs extra space for the header */
main > .cms-editable-section:first-of-type .cms-edit-overlay {
  top: 120px !important;
}

.cms-editable-section:hover .cms-edit-overlay {
  opacity: 1;
  pointer-events: auto;
}

.cms-edit-controls {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  background: rgba(37, 99, 235, 0.95) !important;
  color: white !important;
  padding: 10px 14px !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1) !important;
  backdrop-filter: blur(8px) !important;
  white-space: nowrap !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
}

.cms-section-title {
  font-weight: 600 !important;
  letter-spacing: 0.01em !important;
  padding-right: 8px !important;
  border-right: 1px solid rgba(255, 255, 255, 0.3) !important;
}

.cms-edit-button {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 6px 12px !important;
  background: white !important;
  color: rgb(37, 99, 235) !important;
  border-radius: 6px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  transition: all 0.15s ease !important;
  line-height: 1 !important;
}

.cms-edit-button:hover {
  background: rgb(243, 244, 246) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
  color: rgb(37, 99, 235) !important;
  text-decoration: none !important;
}

.cms-edit-button::after {
  content: '→' !important;
  font-size: 14px !important;
  margin-left: 2px !important;
}

/* Sticky overlay state - needs to clear the fixed header + admin bar (~128px total) */
.cms-edit-overlay.cms-overlay-stuck {
  position: fixed !important;
  top: 140px !important;
  right: auto !important; /* Clear right so left positioning works correctly */
  z-index: 9999 !important;
}

/* Make sure edit controls work on dark backgrounds */
.cms-editable-section.dark-section:hover {
  outline-color: rgba(255, 255, 255, 0.5);
}

/* Ensure proper stacking for sections with their own positioning */
.cms-editable-section > section,
.cms-editable-section > div {
  position: relative;
}
