/* Spell-check overlay — visible textarea, hidden measurement mirror, underline rects + popover. */

.flmvr-spellcheck-host {
  position: relative;
  display: block;
  flex: 1 1 0%;
  min-width: 0;
  align-self: stretch;
  text-align: left;
}

.flmvr-msg-composer-main .flmvr-spellcheck-host {
  flex: 1 1 0%;
  min-width: 0;
}

.flmvr-msg-prelude .flmvr-spellcheck-host {
  width: 100%;
}

.flmvr-spellcheck-host textarea.flmvr-msg-composer-input,
.flmvr-spellcheck-host textarea.flmvr-msg-prelude-message {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  display: block;
  position: relative;
  z-index: 3;
}

/* Hidden duplicate text for layout / getClientRects (no border — matches textarea content width) */
.flmvr-spellcheck-measure {
  box-sizing: border-box;
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
  position: absolute;
  z-index: 0;
  text-align: left;
}

/* Clips underlines to the visible textarea client area; pointer-events none pass-through except children */
.flmvr-spellcheck-clip {
  position: absolute;
  overflow: hidden;
  pointer-events: none;
  z-index: 4;
}

.flmvr-spellcheck-overlay-inner {
  position: relative;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Visible misspelling tick (thin bar — text-decoration does not paint on empty boxes).
 * pointer-events MUST stay `none` — the textarea owns clicks; the popover is opened
 * from the textarea's caret position, never by intercepting clicks here. Otherwise
 * clicking the bottom of an underlined word would steal cursor placement. */
.flmvr-spellcheck-underline {
  box-sizing: border-box;
  background: repeating-linear-gradient(
    90deg,
    #c62828,
    #c62828 2px,
    transparent 2px,
    transparent 4px
  );
  background-size: 4px 2px;
  background-position: 0 100%;
  background-repeat: repeat-x;
  opacity: 0.95;
  pointer-events: none;
}

@media print {
  .flmvr-spellcheck-underline,
  .flmvr-spellcheck-popover {
    display: none !important;
  }
}


.flmvr-spellcheck-mark {
  text-decoration-line: underline;
  text-decoration-style: wavy;
  text-decoration-color: #c62828;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.flmvr-spellcheck-popover {
  min-width: 160px;
  max-width: min(320px, 90vw);
  padding: 6px 0;
  border-radius: 8px;
  border: 1px solid #d6d8de;
  background: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  font-size: 14px;
  line-height: 1.35;
}

.flmvr-spellcheck-popover:focus-visible {
  outline: 2px solid #0b57d0;
  outline-offset: 2px;
}

.flmvr-spellcheck-popover-title {
  padding: 4px 10px 6px;
  font-weight: 600;
  color: #333;
  border-bottom: 1px solid #eee;
}

.flmvr-spellcheck-popover-empty {
  padding: 6px 10px;
  color: #666;
  font-style: italic;
}

button.flmvr-spellcheck-suggestion {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #1a4b8c;
  font: inherit;
}

button.flmvr-spellcheck-suggestion:hover,
button.flmvr-spellcheck-suggestion:focus {
  background: #f0f4fa;
  outline: none;
}

button.flmvr-spellcheck-suggestion:focus-visible {
  background: #e6eef8;
  outline: 2px solid #6699cc;
  outline-offset: -2px;
}

button.flmvr-spellcheck-addword {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 6px 10px;
  border: 0;
  border-top: 1px solid #eee;
  background: #fafafa;
  cursor: pointer;
  color: #555;
  font-size: 12px;
}

button.flmvr-spellcheck-addword:hover {
  background: #f0f0f0;
}

button.flmvr-spellcheck-addword:focus-visible {
  outline: 2px solid #6699cc;
  outline-offset: -2px;
}
