/*---------- General Layout ----------*/

.measurement-layer-base {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0px;
  left: 0px;
  outline: none;
  font-size: 10pt;
}

.line-measurement,
.circle-measurement,
.text-annotation,
.measurement-svg {
  position: absolute;
  width: 100%;
  height: 100%;
}

/*---------- Colors ----------*/

.line-measurement .line,
.circle-measurement .circle,
.text-annotation .arrow-line {
  stroke: yellow;
}

.text-annotation .arrow-head {
  fill: yellow;
}

.measurement-text,
.text-annotation .text {
  color: yellow;
  background-color: rgba(0, 0, 0, 0.7);
}

.measurement-layer-base .text-anchor.button-showing .delete-button,
.measurement-layer-base .text-annotation.editable .delete-button {
  background-color: rgba(50, 45, 40, 0.9);
}

.measurement-layer-base .text-anchor.button-showing .delete-button:hover,
.measurement-layer-base .text-annotation.editable .delete-button:hover,
.measurement-layer-base .text-anchor .delete-button:focus {
  background-color: rgba(70, 60, 50, 0.9);
}

.measurement-layer-base .text-anchor.button-showing .delete-button-icon,
.measurement-layer-base .text-annotation.editable .delete-button-icon,
.measurement-layer-base .text-anchor .delete-button:focus .delete-button-icon {
  stroke: yellow;
}

/*---------- General Measurement & Text Styling ----------*/

.line-measurement .line,
.circle-measurement .circle,
.text-annotation .arrow-line {
  stroke-width: 2px;
  stroke-linecap: butt;
  fill: none;
}

.text-annotation .arrow-head {
  stroke: none;
}

.measurement-text {
  position: relative;
  padding: 1px 4px;
  white-space: pre;
  cursor: default;
  /* Use color transitions rather than opacity, which blurs text for some reason. */
  transition: color 0.3s, background-color 0.3s;
}

.measurement-layer-base.line-end-dragged
  .text-anchor.just-created
  .measurement-text,
.measurement-layer-base.circle-stroke-dragged
  .text-anchor.just-created
  .measurement-text {
  color: transparent;
  background-color: transparent;
}

.text-annotation .text {
  position: relative;
  padding: 1px 4px;
}

.line-measurement .grabber-group:hover .line,
.line-measurement.mid-hover .grabber-group .line,
.line-measurement .line.dragged,
.circle-measurement .grabber-group:hover .circle,
.circle-measurement .circle.dragged,
.text-annotation .arrow-line.hover,
.text-annotation .arrow-line.dragged {
  stroke-width: 3px;
}

.text-annotation .public-DraftEditor-content {
  /* Ensures the blinking cursor is always visible when the text is editable but empty. */
  min-width: 1px;
}

.text-annotation .public-DraftStyleDefault-block {
  white-space: pre;
  text-align: center;
}

.text-annotation.no-text .text-anchor {
  visibility: hidden;
}

.text-annotation.no-text.editable .text-anchor {
  visibility: visible;
}

/*---------- Grabbers ----------*/

.line-measurement .grabber,
.text-annotation .arrow-line-grabber {
  stroke: transparent;
  stroke-width: 11px;
  stroke-linecap: butt;
}

.line-measurement .grabber.start-grabber,
.line-measurement .grabber.end-grabber {
  stroke-linecap: square;
}

.circle-measurement .stroke-grabber {
  stroke: transparent;
  stroke-width: 11px;
  fill: none;
}

.circle-measurement .fill-grabber {
  fill: transparent;
  stroke: none;
}

.text-annotation .arrow-head-grabber {
  stroke: transparent;
  fill: transparent;
}

/*---------- Text Anchor & Delete Button ----------*/

.measurement-layer-base .text-anchor {
  /* Zero-size flexbox allows us to center text without using transforms,
  which can lead to sub-pixel positioning (blurry lines). */
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 0px;
  height: 0px;
}

.measurement-layer-base .text-box {
  position: relative;
  display: flex;
}

.measurement-layer-base .delete-button {
  position: absolute;
  right: -18px;
  background-color: transparent;
  border-radius: 0;
  border-style: none;
  outline: none;
  width: 18px;
  height: 100%;
  top: 0;
  margin: 0;
  padding: 0;
  transition: background-color 0.2s, border-color 0.2s;
}

.measurement-layer-base .delete-button-svg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 15px;
  height: 15px;
}

.measurement-layer-base.any-dragged .delete-button-svg,
.measurement-layer-base.any-mode-on .delete-button-svg {
  background-color: transparent;
  border-color: transparent;
}

.measurement-layer-base .delete-button-icon {
  stroke: transparent;
  stroke-width: 2px;
  stroke-linecap: square;
  fill: none;
  transition: stroke 0.2s;
}

.measurement-layer-base.any-dragged .delete-button-icon,
.measurement-layer-base.any-mode-on .delete-button-icon {
  stroke: transparent;
}

/*---------- Cursors ----------*/

.line-measurement .mid-grabber,
.circle-measurement .fill-grabber,
.text-annotation .arrow-line-grabber,
.measurement-layer-base.line-mid-dragged,
.measurement-layer-base.circle-fill-dragged,
.measurement-layer-base.arrow-line-dragged {
  cursor: move;
}

.line-measurement .start-grabber,
.line-measurement .end-grabber,
.circle-measurement .stroke-grabber,
.text-annotation .text,
.text-annotation .arrow-head-grabber,
.measurement-layer-base.line-start-dragged,
.measurement-layer-base.line-end-dragged,
.measurement-layer-base.circle-stroke-dragged,
.measurement-layer-base.arrow-head-dragged,
.measurement-layer-base.text-dragged,
.measurement-layer-base .delete-button {
  cursor: pointer;
}

.text-annotation.editable .text {
  cursor: text;
}

/*---------- Pointer Events & Drag ----------*/

.line-measurement,
.line-measurement .line,
.circle-measurement,
.circle-measurement .circle,
.text-annotation,
.text-annotation .arrow-line,
.measurement-svg {
  pointer-events: none;
}

.measurement-layer-base .grabber-group {
  pointer-events: painted;
}

.measurement-layer-base .text,
.measurement-layer-base .arrow-head-grabber,
.measurement-layer-base .arrow-line-grabber,
.measurement-layer-base .text-box,
.measurement-layer-base .text-anchor.button-showing .delete-button,
.measurement-layer-base .editable .delete-button,
.measurement-layer-base.any-dragged .grabber-group .start-grabber.dragged,
.measurement-layer-base.any-dragged .grabber-group .mid-grabber.dragged,
.measurement-layer-base.any-dragged .grabber-group .end-grabber.dragged,
.measurement-layer-base.any-dragged .grabber-group .fill-grabber.dragged,
.measurement-layer-base.any-dragged .grabber-group .stroke-grabber.dragged,
.measurement-layer-base.any-dragged .arrow-head-grabber.dragged,
.measurement-layer-base.any-dragged .arrow-line-grabber.dragged {
  pointer-events: auto;
}

.measurement-layer-base.any-dragged .grabber-group,
.measurement-layer-base.any-dragged .text,
.measurement-layer-base.any-dragged .arrow-head-grabber,
.measurement-layer-base.any-dragged .arrow-line-grabber,
.measurement-layer-base.any-dragged .text-box,
.measurement-layer-base.any-dragged .delete-button,
.measurement-layer-base.any-mode-on .grabber-group,
.measurement-layer-base.any-mode-on .text,
.measurement-layer-base.any-mode-on .arrow-head-grabber,
.measurement-layer-base.any-mode-on .arrow-line-grabber,
.measurement-layer-base.any-mode-on .text-box,
.measurement-layer-base .delete-button {
  pointer-events: none;
}
