/* ==========================================================================
   Living prototype — annotation kit for the PLAN copy only (pa-*).
   Badges Mới / Đổi / Bỏ, section outlines, dashed purple design notes and the
   floating "Thay đổi do plan này" panel. Loaded only by plan/index.html.
   Colours come from the prototype's own tokens, so light and dark both work.
   ========================================================================== */

/* ---------- Badges (Mới / Đổi / Bỏ) ---------- */
.pa-badge {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  font: 650 10px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 6px; border-radius: var(--radius-xs);
  border: 1px solid transparent; white-space: nowrap;
}
.pa-new     { color: var(--positive); background: var(--positive-soft); border-color: color-mix(in oklab, var(--positive) 35%, transparent); }
.pa-changed { color: var(--warning);   background: var(--warning-soft);   border-color: color-mix(in oklab, var(--warning) 35%, transparent); }
.pa-removed { color: var(--negative);  background: var(--negative-soft);  border-color: color-mix(in oklab, var(--negative) 35%, transparent); text-decoration: line-through; }
.pa-removed .pa-badge__x { text-decoration: line-through; }

/* ---------- Section outlines ---------- */
.pa-mark-new     { outline: 2px solid var(--positive); outline-offset: 2px; border-radius: var(--radius-xs); }
.pa-mark-changed { outline: 2px dashed var(--warning); outline-offset: 2px; border-radius: var(--radius-xs); }
.pa-mark-removed { outline: 2px dashed var(--negative); outline-offset: 2px; border-radius: var(--radius-xs); opacity: .55; }

/* ---------- Design note (dashed purple box) ---------- */
.pa-note {
  border: 1.5px dashed var(--purple);
  background: var(--purple-soft);
  color: var(--text-body);
  border-radius: var(--radius-card);
  padding: 10px 12px;
  font-size: var(--text-sm);
  line-height: 1.5;
  margin: 10px 0;
  max-width: 100%;
}
.pa-note__head {
  display: flex; align-items: center; gap: 6px;
  font: 650 var(--text-2xs)/1 var(--font-sans); letter-spacing: .09em; text-transform: uppercase;
  color: var(--purple); margin-bottom: 5px;
}
.pa-note b { color: var(--text); }

/* ---------- Floating panel: Thay đổi do plan này ---------- */
.pa-panel {
  position: fixed; right: 14px; bottom: 14px; z-index: 125;
  width: min(380px, calc(100vw - 28px));
  background: var(--raised); color: var(--text-body);
  border: 1px solid var(--border); border-radius: var(--radius-frame);
  box-shadow: var(--shadow-lg);
  font-family: var(--font-sans); font-size: var(--text-sm);
  /* a long change list must not push the "Hiện thay đổi" toggle off-screen: cap the height, only the list scrolls
     (66px = bottom gap + the fixed copy switcher bar) */
  max-height: calc(100vh - 66px); display: flex; flex-direction: column;
}
.pa-panel__head, .pa-panel__sub { flex: none; }
.pa-panel__head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 12px; border: 0; background: transparent; cursor: pointer; text-align: left;
  font: 650 var(--text-base)/1.2 var(--font-sans); color: var(--text);
}
.pa-panel__head:hover { background: var(--hover); border-radius: var(--radius-frame); }
.pa-panel__chev { margin-left: auto; color: var(--text-faint); transition: transform var(--dur) var(--ease); }
.pa-panel.is-collapsed .pa-panel__chev { transform: rotate(-90deg); }
.pa-panel__count {
  font: 650 10px/1 var(--font-mono); padding: 2px 6px; border-radius: var(--radius-xs);
  background: var(--accent-soft); color: var(--accent-soft-fg);
}
.pa-panel__sub {
  padding: 0 12px 7px; color: var(--text-faint); font-size: var(--text-2xs);
}
.pa-panel.is-collapsed .pa-panel__sub { display: none; }
.pa-panel__body { padding: 2px 12px 11px; display: flex; flex-direction: column; gap: 8px;
  overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.pa-panel.is-collapsed .pa-panel__body { display: none; }
.pa-toggle {
  display: flex; align-items: center; gap: 7px; cursor: pointer; user-select: none;
  font-size: var(--text-xs); color: var(--text-muted);
}
.pa-toggle input { accent-color: var(--accent); width: 14px; height: 14px; margin: 0; }
.pa-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pa-list li { display: flex; align-items: flex-start; gap: 7px; line-height: 1.45; }
.pa-list li + li { border-top: 1px solid var(--border-subtle); padding-top: 6px; }
.pa-item__text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pa-item__route { flex: none; font-size: var(--text-xs); color: var(--link); white-space: nowrap; }
.pa-item__route:hover { text-decoration: underline; }
.pa-empty { color: var(--text-faint); font-size: var(--text-xs); }

/* ---------- "Hiện thay đổi" off → the clean post-plan UI ---------- */
html.pa-hide-changes .pa-badge,
html.pa-hide-changes .pa-note { display: none !important; }
html.pa-hide-changes .pa-mark-new,
html.pa-hide-changes .pa-mark-changed,
html.pa-hide-changes .pa-mark-removed { outline: none !important; opacity: 1 !important; }

/* Research copy: while the detail drawer or the Copilot panel is open the changes panel steps aside
   (the Mới/Đổi badges inside the drawer still mark what is new), so it never covers drawer content. */
body:has(.drawer.is-open) .pa-panel,
body:has(.cp.is-open) .pa-panel { display: none; }
