/**
 * pdf-controls.css — chrome for the local PDF embed plugin.
 *
 * The iframe carries the browser's default PDF viewer. This file styles the
 * editor widget, click overlay, settings gear, resize handle, and popover.
 */

.cm-pdf-hidden {
  display: none;
}

.cm-pdf-figure {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 0.35em 0;
}

.cm-pdf-media {
  position: relative;
  display: block;
  max-width: 100%;
  line-height: 0;
}

.cm-pdf-frame {
  display: block;
  max-width: 100%;
  border: 1px solid var(--color-border, #d0d7de);
  border-radius: 6px;
  background: var(--color-surface, #fff);
}

.cm-pdf-open {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: transparent;
  cursor: zoom-in;
  z-index: 1;
}

.cm-pdf-open:focus-visible {
  outline: 2px solid var(--color-accent, #606c76);
  outline-offset: 2px;
  border-radius: 6px;
}

.cm-pdf-caption {
  padding: 0.35em 0 0;
  color: var(--color-text-muted, #6a737d);
  font-size: 0.85em;
  line-height: 1.4;
}

.cm-pdf-gear {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--color-border, #d0d7de);
  border-radius: var(--radius-sm, 6px);
  background: var(--color-surface, #fff);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  z-index: 3;
}

.cm-pdf-gear img {
  width: 15px;
  height: 15px;
  pointer-events: none;
}

.cm-pdf-figure:hover .cm-pdf-gear,
.cm-pdf-figure:focus-within .cm-pdf-gear,
.cm-pdf-gear.is-open {
  opacity: 1;
  pointer-events: auto;
}

.cm-pdf-gear:hover {
  background: var(--color-surface-hover, rgba(0, 0, 0, 0.06));
}

.cm-pdf-gear:focus-visible {
  outline: 2px solid var(--color-accent, #606c76);
  outline-offset: 1px;
}

.cm-pdf-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1px solid var(--color-accent, #606c76);
  border-radius: 2px;
  background: var(--color-surface, #fff);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  z-index: 3;
}

.cm-pdf-figure:hover .cm-pdf-handle,
.cm-pdf-figure:focus-within .cm-pdf-handle,
.cm-pdf-figure.is-resizing .cm-pdf-handle {
  opacity: 1;
  pointer-events: auto;
}

.cm-pdf-handle-se {
  right: -6px;
  bottom: -6px;
  cursor: nwse-resize;
}

.cm-pdf-resizing,
.cm-pdf-resizing * {
  user-select: none !important;
}

.cm-pdf-popover {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 300px;
  padding: 10px;
  white-space: normal;
}

.cm-pdf-popover-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cm-pdf-popover-label {
  display: block;
  flex: 0 0 76px;
  color: var(--color-text-muted, #6a737d);
  font-size: 0.75rem;
}

.cm-pdf-popover-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 28px;
  padding: 4px 7px;
  font-size: 0.78rem;
}

.cm-pdf-popover-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--color-border, #d0d7de);
}

.cm-pdf-popover-actions {
  display: flex;
  gap: 6px;
}

.cm-pdf-popover-btn {
  padding: 4px 9px;
  border: 1px solid var(--color-border, #d0d7de);
  border-radius: var(--radius-sm, 6px);
  background: var(--color-surface, #fff);
  color: var(--color-text, #1a1a1a);
  font: inherit;
  font-size: 0.78rem;
  line-height: 1.3;
  cursor: pointer;
}

.cm-pdf-popover-btn:hover {
  background: var(--color-surface-hover, rgba(0, 0, 0, 0.06));
}

.cm-pdf-popover-btn:focus-visible {
  outline: 2px solid var(--color-accent, #606c76);
  outline-offset: 1px;
}

.cm-pdf-popover .cm-fence-popover-footer {
  margin-top: 2px;
}
