/* Advoke CV — Editor Undo/Redo Controls */

.editor-history {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

.editor-history__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--transition-colors);
  position: relative;
}

.editor-history__btn:hover:not(:disabled) {
  background-color: var(--color-accent-tint);
  color: var(--color-text);
}

.editor-history__btn:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: 2px;
}

.editor-history__btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.editor-history__btn svg {
  width: 16px;
  height: 16px;
}

.editor-history__btn--filled {
  background-color: var(--white);
  border-color: var(--color-border);
}

.editor-history__btn--filled:hover:not(:disabled) {
  border-color: var(--color-accent);
}

.editor-history__stack {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px;
  background-color: var(--white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.editor-history__stack .editor-history__btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
}

.editor-history__stack .editor-history__btn svg {
  width: 14px;
  height: 14px;
}

.editor-history__divider {
  width: 1px;
  height: 20px;
  background-color: var(--color-border);
  margin-inline: var(--space-1);
  flex-shrink: 0;
}

.editor-history__indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-2xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-muted);
  white-space: nowrap;
  padding-inline: var(--space-1);
}

.editor-history__indicator-dot {
  width: 5px;
  height: 5px;
  border-radius: var(--radius-full);
  background-color: var(--color-accent);
  flex-shrink: 0;
}

.editor-history__popover {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 240px;
  max-width: 320px;
  max-height: 320px;
  overflow-y: auto;
  background-color: var(--white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--space-2);
  z-index: var(--z-dropdown);
  display: none;
}

.editor-history__popover[data-open="true"] {
  display: block;
}

.editor-history__popover-title {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-2xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  color: var(--color-text-muted);
  margin: 0;
}

.editor-history__popover-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.editor-history__popover-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
  min-height: 32px;
  padding: var(--space-1-5) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: var(--transition-colors);
}

.editor-history__popover-item:hover {
  background-color: var(--color-accent-tint);
  color: var(--color-text);
}

.editor-history__popover-item.is-current {
  background-color: var(--color-accent-soft);
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
}

.editor-history__popover-item-time {
  font-size: var(--text-2xs);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.editor-history__popover-item-action {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 767px) {
  .editor-history__indicator {
    display: none;
  }
  .editor-history__btn {
    width: 32px;
    height: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .editor-history__btn,
  .editor-history__popover-item {
    transition: none;
  }
}