/*
 * Shared feedback-pane composition.
 * Viewer-specific styles supply the palette and base panel geometry.
 */

#panel {
  width: clamp(320px, 28vw, 380px);
}

#panel > .feedback-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.feedback-scope {
  min-width: 0;
  flex: 1;
  padding: 5px 26px 5px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background-color: transparent;
  color: var(--vc-text, var(--vg-text));
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.feedback-scope:hover,
.feedback-scope:focus-visible {
  border-color: var(--vc-border, var(--vg-border));
  background-color: var(--vc-accent-soft, var(--vg-accent-soft));
}

.feedback-scope:focus-visible {
  outline: 2px solid var(--vc-accent, var(--vg-accent));
  outline-offset: 1px;
}

#panel > .feedback-panel-header .add-menu {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 0;
  border: 0;
  font-weight: 400;
}

#panel > .feedback-panel-header .add-menu > summary {
  font-weight: 400;
  white-space: nowrap;
}

#panel > .feedback-panel-header .add-menu-panel {
  top: calc(100% + 6px);
  inset-inline-start: auto;
  inset-inline-end: 0;
  min-width: 210px;
}

.note {
  cursor: pointer;
  overflow: visible;
  padding: 0;
  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.note:hover,
.note:focus-visible,
.note.is-focused {
  border-color: var(--vc-accent, var(--vg-accent));
  box-shadow: 0 0 0 1px var(--vc-accent, var(--vg-accent));
}

.note:hover > .note-footer,
.note:focus-visible > .note-footer,
.note.is-focused > .note-footer {
  background: transparent;
}

.note > .note-header {
  display: block;
  min-width: 0;
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--vc-border, var(--vg-border));
}

.note-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.note-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--vc-text, var(--vg-text));
  font-family: inherit;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-details {
  display: grid;
  gap: 7px;
  margin-top: 9px;
  padding: 9px;
  border-radius: 7px;
  background: var(--vc-accent-soft, var(--vg-accent-soft));
}

.note-details-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-width: 0;
}

.note-details-label {
  color: var(--vc-muted, var(--vg-muted));
  font-size: 10px;
  font-weight: 600;
  line-height: 1.45;
  text-transform: uppercase;
}

.note-details a,
.note-details code {
  min-width: 0;
  color: var(--vc-text, var(--vg-text));
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.note-details a {
  text-underline-offset: 2px;
}

.note-body {
  padding: 11px 10px 12px;
}

.note-body .note-text {
  margin: 0;
}

.note > .note-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 8px;
  border-top: 1px solid var(--vc-border, var(--vg-border));
  background: color-mix(
    in oklab,
    var(--vc-accent-soft, var(--vg-accent-soft)) 48%,
    transparent
  );
}

.note-badges {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.note-badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 6px;
  border: 1px solid var(--vc-border, var(--vg-border));
  border-radius: 999px;
  color: var(--vc-muted, var(--vg-muted));
  font-size: 9px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.note-badge.note-unanchored {
  background: var(--vc-accent-soft, var(--vg-accent-soft));
}

.note-badge.note-archived {
  border-color: var(--vc-accent, var(--vg-accent));
  color: var(--vc-text, var(--vg-text));
}

.note-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 3px;
  margin-left: auto;
}

.note-copy-menu {
  position: relative;
  flex: 0 0 27px;
  width: 27px;
  height: 27px;
}

.note-copy-menu > summary {
  list-style: none;
}

.note-copy-menu > summary::-webkit-details-marker {
  display: none;
}

.note-copy-menu[open] > .note-action {
  border-color: var(--vc-muted, var(--vg-muted));
  background: var(--vc-accent-soft, var(--vg-accent-soft));
}

.note-copy-menu[open] > [data-tooltip]::after {
  display: none;
}

.note-copy-menu-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 7;
  display: flex;
  flex-direction: column;
  min-width: 148px;
  padding: 4px;
  border: 1px solid var(--vc-border, var(--vg-border));
  border-radius: 8px;
  background: var(--vc-surface, var(--vg-surface));
  box-shadow: var(--vc-shadow, var(--vg-shadow));
}

.note-copy-menu-panel button {
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: start;
  white-space: nowrap;
  cursor: pointer;
}

.note-copy-menu-panel button:hover,
.note-copy-menu-panel button:focus-visible {
  background: var(--vc-accent-soft, var(--vg-accent-soft));
}

.note-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  padding: 0;
  border: 1px solid var(--vc-border, var(--vg-border));
  border-radius: 7px;
  background: var(--vc-surface, var(--vg-surface));
  color: var(--vc-text, var(--vg-text));
  cursor: pointer;
}

.note-action:hover,
.note-action:focus-visible,
.note-action[aria-expanded='true'] {
  border-color: var(--vc-muted, var(--vg-muted));
  background: var(--vc-accent-soft, var(--vg-accent-soft));
  color: var(--vc-text, var(--vg-text));
}

.note-action:focus-visible {
  outline: 2px solid var(--vc-accent, var(--vg-accent));
  outline-offset: 1px;
}

.note-action .icon {
  width: 14px;
  height: 14px;
}

.note-actions [data-tooltip]::after {
  top: auto;
  bottom: calc(100% + 6px);
}

.note-actions [data-tooltip]:last-child::after {
  right: 0;
  left: auto;
  transform: none;
}

.add-menu > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  list-style: none;
}

.add-menu > summary::-webkit-details-marker {
  display: none;
}

.add-menu-panel {
  position: absolute;
  z-index: 6;
  display: flex;
  flex-direction: column;
  padding: 4px;
  background: var(--vc-surface, var(--vg-surface));
  border: 1px solid var(--vc-border, var(--vg-border));
  border-radius: 8px;
  box-shadow: var(--vc-shadow, var(--vg-shadow));
}

.add-menu-panel button {
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font-weight: 400;
  text-align: start;
  cursor: pointer;
}

.add-menu-panel button:hover {
  background: var(--vc-accent-soft, var(--vg-accent-soft));
}

.archive-actions {
  display: flex;
  flex: 0 0 auto;
}

.archive-actions > .button-quiet {
  border-radius: 8px 0 0 8px;
}

.archive-menu {
  position: relative;
}

.archive-menu > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 100%;
  padding: 0;
  border: 1px solid var(--vc-border, var(--vg-border));
  border-left: 0;
  border-radius: 0 8px 8px 0;
  list-style: none;
  cursor: pointer;
}

.archive-menu > summary::-webkit-details-marker {
  display: none;
}

.archive-menu > summary:hover,
.archive-menu[open] > summary {
  border-color: var(--vc-muted, var(--vg-muted));
  background: var(--vc-accent-soft, var(--vg-accent-soft));
}

.archive-menu > summary .icon {
  width: 13px;
  height: 13px;
}

.archive-menu-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 6;
  display: flex;
  flex-direction: column;
  min-width: 120px;
  padding: 4px;
  background: var(--vc-surface, var(--vg-surface));
  border: 1px solid var(--vc-border, var(--vg-border));
  border-radius: 8px;
  box-shadow: var(--vc-shadow, var(--vg-shadow));
}

.archive-menu-panel button {
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  text-align: start;
  white-space: nowrap;
  cursor: pointer;
}

.archive-menu-panel button:hover {
  background: var(--vc-accent-soft, var(--vg-accent-soft));
}

#copy-bundle[aria-disabled='true'] {
  opacity: 0.45;
  cursor: default;
}

@media (max-width: 720px) {
  #panel {
    width: min(320px, 58vw);
  }

  #panel > .feedback-panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  #panel > .feedback-panel-header .add-menu,
  #panel > .feedback-panel-header .add-menu > summary {
    width: 100%;
  }
}
