/* Tooltip Container */
.tooltipContainer {
  position: relative;
  display: inline-block;
}

/* Tooltip Base */
.tooltip {
  position: absolute;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.95);
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease,
    transform 0.2s ease;
  pointer-events: none;
  background-color: var(--vscode-editorHoverWidget-background);
  border: 1px solid var(--vscode-editorHoverWidget-border);
  border-radius: 6px;
  box-shadow: var(--vscode-widget-shadow);
  font-size: var(--vscode-editor-font-size, 12px);
  font-family: var(
    --vscode-editor-font-family,
    "Segoe UI",
    system-ui,
    sans-serif
  );
  line-height: 1.4;
  white-space: nowrap;
}

/* Tooltip Visible State */
.tooltip--visible {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

/* Tooltip Content */
.tooltipContent {
  padding: 8px 12px;
  color: var(--vscode-editorHoverWidget-foreground);
  word-wrap: break-word;
  white-space: normal;
}

/* Tooltip Arrow */
.tooltipArrow {
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
}

/* Position: Top */
.tooltip--top {
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  margin-bottom: 8px;
}

.tooltip--top.tooltip--visible {
  transform: translateX(-50%) scale(1);
}

.tooltip--top .tooltipArrow {
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px 6px 0 6px;
  border-color: var(--vscode-editorHoverWidget-border) transparent transparent
    transparent;
}

.tooltip--top .tooltipArrow::after {
  content: "";
  position: absolute;
  top: -7px;
  left: -5px;
  border-width: 5px 5px 0 5px;
  border-style: solid;
  border-color: var(--vscode-editorHoverWidget-background) transparent
    transparent transparent;
}

/* Position: Bottom */
.tooltip--bottom {
  top: 100%;
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  margin-top: 8px;
}

.tooltip--bottom.tooltip--visible {
  transform: translateX(-50%) scale(1);
}

.tooltip--bottom .tooltipArrow {
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 0 6px 6px 6px;
  border-color: transparent transparent var(--vscode-editorHoverWidget-border)
    transparent;
}

.tooltip--bottom .tooltipArrow::after {
  content: "";
  position: absolute;
  bottom: -7px;
  left: -5px;
  border-width: 0 5px 5px 5px;
  border-style: solid;
  border-color: transparent transparent
    var(--vscode-editorHoverWidget-background) transparent;
}

/* Position: Left */
.tooltip--left {
  right: 100%;
  top: 50%;
  transform: translateY(-50%) scale(0.95);
  margin-right: 8px;
}

.tooltip--left.tooltip--visible {
  transform: translateY(-50%) scale(1);
}

.tooltip--left .tooltipArrow {
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  border-width: 6px 0 6px 6px;
  border-color: transparent transparent transparent
    var(--vscode-editorHoverWidget-border);
}

.tooltip--left .tooltipArrow::after {
  content: "";
  position: absolute;
  left: -7px;
  top: -5px;
  border-width: 5px 0 5px 5px;
  border-style: solid;
  border-color: transparent transparent transparent
    var(--vscode-editorHoverWidget-background);
}

/* Position: Right */
.tooltip--right {
  left: 100%;
  top: 50%;
  transform: translateY(-50%) scale(0.95);
  margin-left: 8px;
}

.tooltip--right.tooltip--visible {
  transform: translateY(-50%) scale(1);
}

.tooltip--right .tooltipArrow {
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border-width: 6px 6px 6px 0;
  border-color: transparent var(--vscode-editorHoverWidget-border) transparent
    transparent;
}

.tooltip--right .tooltipArrow::after {
  content: "";
  position: absolute;
  right: -7px;
  top: -5px;
  border-width: 5px 5px 5px 0;
  border-style: solid;
  border-color: transparent var(--vscode-editorHoverWidget-background)
    transparent transparent;
}

/* Responsive behavior */
@media (max-width: 480px) {
  .tooltip {
    max-width: 200px !important;
    font-size: 11px;
  }

  .tooltipContent {
    padding: 6px 10px;
  }
}

/* Focus states for accessibility */
.tooltipContainer:focus-within .tooltip {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .tooltip {
    border-width: 2px;
    border-color: var(
      --vscode-contrastBorder,
      var(--vscode-editorHoverWidget-border)
    );
  }
}
