/* ===== Basic ===== */
:root {
  --twoslash-error-color: #d45656;
  --twoslash-error-bg: #d4565620;
  --twoslash-tag-color: #3772cf;
  --twoslash-tag-bg: #3772cf20;
  --twoslash-tag-warn-color: #c37d0d;
  --twoslash-tag-warn-bg: #c37d0d20;
  --twoslash-tag-annotate-color: #1ba673;
  --twoslash-tag-annotate-bg: #1ba67320;
}

.twoslash-query-presisted .twoslash-popup-container,
.twoslash-completion-list {
  user-select: none;
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  transform: translateY(16px);
  width: 20rem;
  flex-direction: column;
  white-space: normal;
  box-shadow:
    0 4px 6px -1px rgb(0 0 0 / 0.1),
    0 2px 4px -2px rgb(0 0 0 / 0.1);
  border-width: 1px;
  border-radius: 6px;
  padding: 8px;
  z-index: 8;

  @apply text-fd-popover-foreground bg-fd-popover;
}

.twoslash-query-presisted .twoslash-popup-container:hover,
.twoslash-completion-list:hover {
  user-select: auto;
}

.twoslash-popup-arrow {
  position: absolute;
  top: -4px;
  left: 1em;
  transform: rotate(-45deg);
  pointer-events: none;
  width: 6px;
  height: 6px;
  border-top-width: 1px;
  border-right-width: 1px;

  @apply bg-fd-popover;
}

.twoslash-popup-docs-tag {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.twoslash-popup-docs-tag-name {
  font-weight: 600;
}

.twoslash-popup-code {
  font-size: 14px;
  display: block !important;
}

.twoslash-popup-code .line {
  padding-left: 0 !important;
}

.twoslash-popup-docs,
.twoslash-popup-docs-tags {
  font-size: 14px !important;
  line-height: 20px !important;
  margin-top: 8px !important;

  @apply text-fd-muted-foreground;
}

/* ===== Hover Info ===== */
.twoslash:hover .twoslash-hover {
  border-color: currentColor;
}

.twoslash .twoslash-hover {
  position: relative;
  transition: border 300ms;
  border-bottom: 1px dotted;
  border-color: transparent;
}

/* ===== Error Line ===== */
.twoslash .twoslash-error-line {
  position: relative;
  background-color: var(--twoslash-error-bg);
  border-left: 3px solid var(--twoslash-error-color);
  color: var(--twoslash-error-color);
  padding: 6px 12px;
  margin: 0.2em 0;
}

.twoslash .twoslash-error {
  text-decoration: wavy underline var(--twoslash-error-color);
  padding-bottom: 2px;
}

/* ===== Completeions ===== */
.twoslash .twoslash-completion-cursor {
  position: relative;
}

.twoslash-completion-list::before {
  width: 1px;
  position: absolute;
  top: -1.2em;
  height: 1em;
  left: -1px;
  content: ' ';
  @apply bg-fd-foreground;
}

.twoslash-completion-list li {
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  gap: 0.5rem;
}

.twoslash-completion-list li span.twoslash-completions-unmatched {
  @apply text-fd-muted-foreground;
}

.twoslash-completion-list .deprecated {
  text-decoration: line-through;
  opacity: 0.5;
}

/* Icons */
.twoslash-completion-list .twoslash-completions-icon {
  width: 1em;
  flex: none;
  @apply text-fd-muted-foreground;
}

/* Custom Tags */
.twoslash .twoslash-tag-line {
  position: relative;
  background-color: var(--twoslash-tag-bg);
  border-left: 3px solid var(--twoslash-tag-color);
  color: var(--twoslash-tag-color);
  padding: 6px 10px;
  margin: 0.2em 0;
  display: flex;
  align-items: center;
  gap: 0.3em;
}

.twoslash .twoslash-tag-line .twoslash-tag-icon {
  width: 1.1em;
  color: inherit;
}

.twoslash .twoslash-tag-line.twoslash-tag-error-line {
  background-color: var(--twoslash-error-bg);
  border-left: 3px solid var(--twoslash-error-color);
  color: var(--twoslash-error-color);
}

.twoslash .twoslash-tag-line.twoslash-tag-warn-line {
  background-color: var(--twoslash-tag-warn-bg);
  border-left: 3px solid var(--twoslash-tag-warn-color);
  color: var(--twoslash-tag-warn-color);
}

.twoslash .twoslash-tag-line.twoslash-tag-annotate-line {
  background-color: var(--twoslash-tag-annotate-bg);
  border-left: 3px solid var(--twoslash-tag-annotate-color);
  color: var(--twoslash-tag-annotate-color);
}

/* Respect people's wishes to not have animations */
@media (prefers-reduced-motion: reduce) {
  .twoslash * {
    transition: none !important;
  }
}

.fd-twoslash-popover {
  @apply z-50 min-w-[220px] max-w-[380px] max-h-[400px] overflow-auto rounded-lg border bg-fd-popover p-2 text-sm text-fd-popover-foreground shadow-md data-[state=closed]:animate-fd-popover-out data-[state=open]:animate-fd-popover-in focus-visible:outline-none;
}
