/* AfroLex Connect — autocomplete on third-party sites */

.afrolex-connect-wrap {
  margin-bottom: 1rem;
}

.afrolex-connect-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #3d4452;
  margin-bottom: 6px;
}

.afrolex-connect-input-wrap,
.afrolex-connect-ac-anchor {
  position: relative;
}

.afrolex-connect-field,
input[data-afrolex],
.afrolex-field {
  width: 100%;
  max-width: 100%;
}

.afrolex-connect-field.afrolex-recognized,
input[data-afrolex].afrolex-recognized {
  /* optional subtle hint */
}

/* Mirror overlay — per-word lexicon marks on plain inputs/textareas */
.afrolex-connect-field-stack {
  position: relative;
  display: block;
  width: 100%;
}

.afrolex-connect-field-mirror {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  border: 1.5px solid transparent;
  border-radius: inherit;
  box-sizing: border-box;
  color: transparent;
}

.afrolex-connect-field-stack > input,
.afrolex-connect-field-stack > textarea {
  position: relative;
  z-index: 1;
  color: var(--al-text, #111827) !important;
  -webkit-text-fill-color: currentColor;
  caret-color: var(--al-text, #111827);
  background: transparent !important;
}

/* Legacy class — stack marker only; text stays visible on the field */
.afrolex-connect-field-stack > input.afrolex-connect-field-overlay,
.afrolex-connect-field-stack > textarea.afrolex-connect-field-overlay {
  color: var(--al-text, #111827) !important;
  -webkit-text-fill-color: currentColor;
  caret-color: var(--al-text, #111827);
}

.afrolex-connect-field-mirror .afrolex-mark-ok {
  /* valid — no extra styling */
}

.afrolex-connect-field-mirror .afrolex-mark-warn {
  background: rgba(252, 232, 230, 0.7);
  border-radius: 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  color: transparent;
}

/* Contenteditable AfroLex fields — per-word spellcheck via spans */
.afrolex-connect-ce-stack {
  position: relative;
}

.afrolex-connect-sync-input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.afrolex-connect-ce {
  outline: none;
  min-height: 1em;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.afrolex-connect-ce-single {
  white-space: pre;
  overflow-x: auto;
}

.afrolex-connect-ce:empty::before {
  content: attr(data-placeholder);
  color: #9ca3af;
  pointer-events: none;
}

.afrolex-connect-ce .afrolex-mark-warn {
  background: rgba(252, 232, 230, 0.85);
  border-radius: 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  cursor: pointer;
}

.afrolex-connect-ce .afrolex-lexicon-ok {
  /* Valid lexicon word — spellcheck suppressed on span */
}

.afrolex-connect-hint {
  position: fixed;
  z-index: 2147483647;
  background: #fff;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
  padding: 0;
  pointer-events: auto;
}

.afrolex-connect-hint-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  color: #0d1117;
  white-space: nowrap;
}

.afrolex-connect-hint-btn:hover {
  background: #fce8e6;
}

.afrolex-connect-ac,
.afrolex-connect-ac-float,
#afrolex-connect-field-ac,
#afrolex-connect-float-ac {
  position: fixed;
  z-index: 2147483647;
  background: #fff;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
  max-height: 240px;
  overflow-y: auto;
  pointer-events: auto;
}

.afrolex-connect-ac-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  border-bottom: 1px solid #f1f3f4;
}

.afrolex-connect-ac-item:last-child {
  border-bottom: none;
}

.afrolex-connect-ac-item:hover,
.afrolex-connect-ac-item.is-active {
  background: #e6f4ea;
}

.afrolex-connect-ac-word {
  font-weight: 600;
  color: #0d1117;
}

.afrolex-connect-ac-meta {
  font-size: 0.75rem;
  color: #6b7385;
  margin-top: 2px;
}

.afrolex-connect-ac-empty {
  padding: 12px 14px;
  font-size: 0.85rem;
  color: #6b7385;
}
