.popover-wrap {
  position: relative;
  display: inline-block;
}

.popover {
  position: absolute;
  top: calc(100% + 12px);

  min-width: 380px;
  max-width: 480px;
  padding: 16px 18px;
  border-radius: 12px;

  background: rgba(47, 27, 86, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(10px);

  /* Enhanced shadow for better depth */
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 8px 16px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset;

  backdrop-filter: none; /* remove glass */
  z-index: 20;

  left: 50%; /* anchor to center of trigger */
  transform: translateX(-50%); /* pull back half width */

  /* Smooth entrance animation */
  animation: popover-enter 0.15s ease-out;
}

@keyframes popover-enter {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-8px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

.popover-trigger {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

/* The caret */
.popover::before {
  content: "";
  position: absolute;
  top: -8px; /* moves caret above the popover */
  left: 50%;
  transform: translateX(-50%);

  width: 0;
  height: 0;

  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid rgba(47, 27, 86, 0.95); /* match background */
}

/* optional: border outline on the caret */
.popover::after {
  content: "";
  position: absolute;
  top: -9px; /* slightly above to appear like border */
  left: 50%;
  transform: translateX(-50%);

  width: 0;
  height: 0;

  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 9px solid rgba(255, 255, 255, 0.22);
  opacity: 0.7; /* light border look */
  z-index: -1;
}

/* Popover content structure */
.popover-header {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.popover-body {
  font-size: 14px;
  line-height: 1.5;
  color: #e3dbf4;
}

.popover-section {
  margin-bottom: 16px;
}

.popover-section:last-child {
  margin-bottom: 0;
}

.popover-highlight {
  background: rgba(181, 108, 255, 0.08);
  padding: 6px 10px;
  border-radius: 6px;
  margin: 4px 0 12px 0;
  font-size: 13px;
}

.popover-code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 13px;
  color: #f0f0f0;
}

.popover-warning {
  background: rgba(255, 156, 85, 0.1);
  border: 1px solid rgba(255, 156, 85, 0.3);
  padding: 8px 12px;
  border-radius: 8px;
  margin: 8px 0;
}

.popover-warning .popover-warning-icon {
  color: #ff9c55;
  font-weight: bold;
  margin-right: 6px;
}
