/* LexiSpeak feature-lock: locked-card badges + upgrade dialog. */

.lx-feature-locked {
  position: relative;
  cursor: pointer;
  /* Some card contents (e.g. .lx-config__preset-info, .lx-config__preset-duration)
     set their own z-index above 0, which would otherwise let them paint over
     the tooltip below despite its much higher z-index — isolate creates a
     fresh stacking context so the tooltip's z-index is only ever compared
     against this element's own descendants, where it always wins. */
  isolation: isolate;
}

/* Icon-only badge, absolutely positioned so a locked Start button/card
   keeps its original size — the required-plan copy lives in the tooltip
   (data-lx-tooltip below) and in aria-label, not inline text. */
.lx-feature-locked__badge {
  position: absolute;
  top: -0.4rem;
  right: -0.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 9999px;
  background: var(--color-warning, #f59e0b);
  color: #fff;
  pointer-events: none;
  z-index: 1;
}

.lx-feature-locked__badge i,
.lx-feature-locked__badge svg {
  width: 0.65rem;
  height: 0.65rem;
}

/* .lx-config__preset-item clips its own shine-sweep effect with
   overflow: hidden, which would also clip the corner tooltip below — locked
   cards need it visible outside the card edge instead. */
.lx-config__preset-item.lx-feature-locked {
  overflow: visible;
}

/* In-app cards (Quick Start presets/topics) use tooltip-only affordance —
   no badge icon — so the Start button keeps its original gradient look
   (see config.css .lx-config__preset-start) instead of a "disabled" gray
   state. Marketing/gate-page locks keep the badge. */
.lx-config__preset-item.lx-feature-locked .lx-feature-locked__badge {
  display: none;
}

/* Tooltip: shows the "Requires <plan> — upgrade to unlock" copy on
   hover/focus instead of inline text, so the original element's layout
   stays unchanged. */
.lx-feature-locked[data-lx-tooltip]::after {
  content: attr(data-lx-tooltip);
  position: absolute;
  bottom: calc(100% + 0.4rem);
  left: 50%;
  transform: translateX(-50%);
  max-width: 16rem;
  width: max-content;
  padding: 0.35rem 0.6rem;
  border-radius: 0.375rem;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  font-size: 0.7rem;
  line-height: 1.3;
  text-align: center;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 999;
}

.lx-feature-locked[data-lx-tooltip]:hover::after,
.lx-feature-locked[data-lx-tooltip]:focus-visible::after,
.lx-feature-locked[data-lx-tooltip]:focus-within::after {
  opacity: 1;
  visibility: visible;
}

/* ---------------------------------------------------------------------
   Upgrade dialog
--------------------------------------------------------------------- */

.lx-feature-lock-modal[hidden] {
  display: none;
}

.lx-feature-lock-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.lx-feature-lock-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.lx-feature-lock-modal__dialog {
  position: relative;
  width: 100%;
  max-width: 26rem;
  background: var(--color-background, #fff);
  color: var(--color-foreground, #111827);
  border-radius: 1rem;
  padding: 1.75rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  text-align: center;
}

.lx-feature-lock-modal__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  border: none;
  background: transparent;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  padding: 0.25rem;
  border-radius: 9999px;
}

.lx-feature-lock-modal__close:hover,
.lx-feature-lock-modal__close:focus-visible {
  opacity: 1;
}

.lx-feature-lock-modal__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  border-radius: 9999px;
  background: color-mix(in srgb, var(--color-primary, #6d28d9) 12%, transparent);
  color: var(--color-primary, #6d28d9);
}

.lx-feature-lock-modal__title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.lx-feature-lock-modal__description {
  font-size: 0.9rem;
  color: var(--color-muted-foreground-1, #6b7280);
  margin: 0 0 1rem;
}

.lx-feature-lock-modal__plan {
  font-size: 0.85rem;
  margin: 0 0 1.25rem;
}

.lx-feature-lock-modal__plan-label {
  font-weight: 600;
  margin-right: 0.25rem;
}

.lx-feature-lock-modal__actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lx-feature-lock-modal__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1rem;
  border-radius: 9999px;
  background: var(--color-primary, #6d28d9);
  color: var(--color-primary-foreground, #fff);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}

.lx-feature-lock-modal__cta:hover,
.lx-feature-lock-modal__cta:focus-visible {
  filter: brightness(1.05);
}

.lx-feature-lock-modal__dismiss {
  border: none;
  background: transparent;
  color: var(--color-muted-foreground-1, #6b7280);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.5rem;
}
