/**
 * chord-diagram-picker.css — Chord Diagram Picker modal (.cdp-*).
 *
 * Extracted from site.css 2026-06-12 (Diagram-Editor overhaul phase
 * DE-A, CHART-UI-V2-PLAN §12).  Zero visual change — rules moved
 * verbatim.  Descendant rules other modules apply to .cdp-mini-svg
 * (.coll-*, .cadm-*) stay with their owning module in site.css.
 */

/* ── Chord Diagram Picker — draggable floating window ──────────────── */
.cdp-window {
  position: fixed;
  z-index: 10000;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #ccc);
  border-radius: var(--r-lg, 8px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28), 0 2px 8px rgba(0,0,0,0.12);
  width: 520px;
  max-width: 92vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* Edge & corner resize handles */
.cdp-resize {
  position: absolute;
  z-index: 10001;
}
.cdp-resize--n  { top: -4px; left: 8px; right: 8px; height: 8px; cursor: n-resize; }
.cdp-resize--s  { bottom: -4px; left: 8px; right: 8px; height: 8px; cursor: s-resize; }
.cdp-resize--e  { right: -4px; top: 8px; bottom: 8px; width: 8px; cursor: e-resize; }
.cdp-resize--w  { left: -4px; top: 8px; bottom: 8px; width: 8px; cursor: w-resize; }
.cdp-resize--ne { top: -4px; right: -4px; width: 14px; height: 14px; cursor: ne-resize; }
.cdp-resize--nw { top: -4px; left: -4px; width: 14px; height: 14px; cursor: nw-resize; }
.cdp-resize--se { bottom: -4px; right: -4px; width: 14px; height: 14px; cursor: se-resize; }
.cdp-resize--sw { bottom: -4px; left: -4px; width: 14px; height: 14px; cursor: sw-resize; }
.cdp-window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border, #ddd);
  background: var(--bg-2, #f5f5f5);
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
  border-radius: var(--r-lg, 8px) var(--r-lg, 8px) 0 0;
}
.cdp-window-header:active { cursor: grabbing; }
.cdp-window-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1, #222);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cdp-window-close {
  background: none; border: none;
  font-size: 20px; line-height: 1;
  cursor: pointer;
  color: var(--text-3, #888);
  padding: 2px 6px;
  flex-shrink: 0;
}
.cdp-window-close:hover { color: var(--text-1, #222); }
.cdp-window-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.cdp-remove-btn {
  display: block;
  margin: 12px 18px 4px;
  padding: 6px 14px;
  border: 1px solid var(--danger, #d9534f);
  border-radius: var(--r-md, 4px);
  background: none;
  color: var(--danger, #d9534f);
  font-size: 13px;
  cursor: pointer;
}
.cdp-remove-btn:hover { background: rgba(217, 83, 79, 0.08); }

/* ── Suite Diagrams section inside ChordDiagramPicker ─────────── */
.cdp-suite-section {
  border-top: 1px solid var(--border);
  padding: 10px 18px 14px;
}
.cdp-suite-header {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 600; color: var(--text-2, #666);
  letter-spacing: .04em; text-transform: uppercase;
  margin-bottom: 8px;
}
.cdp-suite-count { font-weight: 400; opacity: .7; }
.cdp-suite-toggle {
  padding: 2px 9px; border-radius: 5px;
  font-size: 11px; font-weight: 500; font-family: inherit;
  border: 1px solid var(--border); background: var(--surface-2, #f4f4f4);
  color: var(--text); cursor: pointer;
}
.cdp-suite-toggle:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.cdp-suite-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(66px, 1fr));
  gap: 8px;
}
.cdp-suite-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 4px 4px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface, #fff);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.cdp-suite-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb, 255,140,0), .18);
}
.cdp-suite-card canvas { display: block; border-radius: 4px; }
.cdp-suite-card-label {
  font-size: 10px; text-align: center; color: var(--text-2, #555);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 66px;
}

.cdp-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 18px 18px;
  justify-content: flex-start;
}
.cdp-loading {
  color: var(--text-3, #888);
  font-size: 13px;
  padding: 20px 0;
  width: 100%;
  text-align: center;
}
.cdp-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px;
  border: 2px solid transparent;
  border-radius: var(--r-md, 4px);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--bg-2, #fafafa);
  overflow: visible;
}
.cdp-card:hover {
  border-color: var(--accent, #f2a93b);
  background: var(--bg-3, #f0f0f0);
}
.cdp-card--selected {
  border-color: var(--accent, #f2a93b);
  background: rgba(242, 169, 59, 0.1);
}
.cdp-card-label {
  font-size: 10px;
  color: var(--text-3, #888);
  margin-top: 2px;
  white-space: nowrap;
}
.cdp-more {
  font-size: 12px;
  color: var(--text-3, #888);
  align-self: center;
  padding: 8px;
}

/* ── Mini SVG diagrams (shared) ────────────────────────────────────── */
.cdp-mini-svg { display: block; overflow: visible; }

/* ── Editor-based picker window ── */
.cdp-window--editor {
  width: 620px;
  max-width: 95vw;
  max-height: 92vh;
  /* min(420px, 95vw) so the floor never overrides the 95vw max-width clamp on
     phones narrower than ~442px (420/0.95). Desktop >442px is identical. */
  min-width: min(420px, 95vw);
  min-height: 340px;
}
.cdp-editor-section {
  padding: 10px 12px 6px;
  border-bottom: 1px solid var(--border, #ddd);
  flex-shrink: 0;
  overflow: visible;
}
/* Override editor card inside picker: no border/shadow, compact */
.cdp-editor-section .cdp-editor-card {
  border: none;
  box-shadow: none;
  background: transparent;
  padding: 0;
  margin: 0;
}
.cdp-editor-section .cb-editor-layout {
  grid-template-columns: 92px 1fr 236px;
  gap: var(--space-md, 12px);
}
.cdp-editor-section .cb-editor-main {
  flex: 1;
  min-width: 0;
}
.cdp-editor-section .cb-tools-panel,
.cdp-editor-section .cb-props-panel {
  position: static;
  top: auto;
}
.cdp-editor-section .cb-section {
  padding: 0;
}
.cdp-editor-section .cb-section-body {
  padding: 0 0 var(--space-sm, 8px);
  gap: var(--space-sm, 8px);
}
.cdp-editor-section .cb-sidebar {
  width: 170px;
  flex-shrink: 0;
  overflow-y: visible;
  overflow-x: hidden;
  position: static;
  top: auto;
  padding: 10px;
  gap: 6px;
}
.cdp-editor-section .cb-sidebar-group { gap: 3px; }
.cdp-editor-section .cb-sidebar-divider { margin: 1px 0; }
.cdp-editor-section .cb-sidebar-group > label { font-size: var(--font-xs, 10px); }
.cdp-editor-section .cb-sidebar .stacker-iv-btn { min-width: 28px; padding: 3px 5px; font-size: 11px; }
/* Hide save bar / name input — picker has its own action buttons.
   Keep the export row visible so Undo/Redo/Copy PNG/download buttons are usable. */
.cdp-editor-section .stacker-builder-actions,
.cdp-editor-section .cb-ed-name {
  display: none;
}
/* Compact the export row in the picker and make it left-align so it hugs the board */
.cdp-editor-section .cb-ed-export-row {
  margin-top: 4px;
  gap: 6px;
  justify-content: flex-start;
  flex-wrap: wrap;
}
.cdp-editor-section .cb-ed-export-row button,
.cdp-editor-section .cb-ed-export-row .atc-btn {
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
}
/* Also hide info row in compact picker */
.cdp-editor-section .stacker-info-row { font-size: 11px; padding: 0 0 4px; }
/* Action buttons row */
.cdp-action-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border, #ddd);
}
.cdp-use-btn {
  padding: 5px 14px;
  border: none;
  border-radius: var(--r-md, 4px);
  background: var(--accent, #f2a93b);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.cdp-use-btn:hover { opacity: 0.9; }
.cdp-play-btn {
  padding: 7px 18px;
  border: 1px solid var(--accent, #f2a93b);
  border-radius: var(--r-md, 4px);
  background: none;
  color: var(--accent, #f2a93b);
  font-size: 13px;
  margin-right: 6px;
  font-weight: 600;
  cursor: pointer;
}
.cdp-play-btn:hover { background: rgba(232,133,74,.08); }
.cdp-play-btn--active {
  background: var(--accent, #f2a93b);
  color: #fff;
}
.cdp-play-btn--active:hover { opacity: 0.9; background: var(--accent, #f2a93b); }
.cdp-action-row .cdp-remove-btn {
  display: inline-block;
  margin: 0;
}
/* Title bar size controls */
.cdp-window-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  margin-right: 8px;
}
.cdp-size-btn {
  background: none; border: none;
  cursor: pointer; padding: 2px 5px;
  color: var(--text-3, #888);
  font-size: 14px; line-height: 1;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
}
.cdp-size-btn:hover { color: var(--text-1, #222); background: rgba(0,0,0,0.06); }
/* Alternatives section header */
.cdp-alt-section {
  padding: 0;
}
.cdp-alt-header {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3, #888);
  padding: 10px 18px 0;
}

/* ── Dark mode adjustments ─────────────────────────────────────────── */
[data-theme="dark"] .cdp-window {
  background: var(--surface);
  border-color: var(--border);
}
[data-theme="dark"] .cdp-window-header {
  background: var(--bg-2);
}
[data-theme="dark"] .cdp-card {
  background: var(--bg-2);
}
[data-theme="dark"] .cdp-card:hover {
  background: var(--bg-3);
}

/* ════════════════════════════════════════════════════════════════════
   Diagram-Editor overhaul §12 (2026-06-12) — visual hierarchy pass
   ════════════════════════════════════════════════════════════════════ */

/* ONE primary action: "Use this diagram" grows and reads as THE button;
   Play sits left, Remove demoted to a quiet text-danger on the right. */
.cdp-action-row { display: flex; align-items: center; gap: 10px; }
.cdp-action-row .cdp-play-btn   { order: 1; }
.cdp-action-row .cdp-use-btn {
  order: 2; flex: 1;
  padding: 10px 18px; font-size: 14px; font-weight: 700;
  background: var(--accent, #f2a93b); color: #fff;
  border: none; border-radius: var(--r-sm, 6px); cursor: pointer;
}
.cdp-action-row .cdp-use-btn:hover { filter: brightness(1.06); }
.cdp-action-row .cdp-remove-btn {
  order: 3; display: inline-block; margin: 0; padding: 6px 10px;
  background: transparent; border: none;
  color: var(--text-3, #888); cursor: pointer; font-size: 0.85em;
}
.cdp-action-row .cdp-remove-btn:hover { color: #c0392b; text-decoration: underline; }

/* Collapsible section headers — calm, uniform, clearly secondary */
.cdp-editor-card .cb-section > summary {
  cursor: pointer; user-select: none;
  font-size: var(--font-sm, 13px); font-weight: 600;
  letter-spacing: 0; text-transform: none;
  color: var(--text-2, #555);
  padding: var(--space-xs, 4px) 0;
}
.cdp-editor-card .cb-section .cb-section > summary {
  text-transform: none; letter-spacing: 0; font-weight: 500;
}

/* Armed finger tool (1-4 / mute / open) */
.cb-finger-btn--active {
  outline: 2px solid var(--accent, #f2a93b);
  outline-offset: -1px; font-weight: 700;
}

/* ── Sound prefs 🔊 popover (DE-C: audio prefs leave the filter row) ── */
.cdp-sound-btn {
  border: 1px solid var(--border, #ddd);
  background: var(--surface, #fff);
  border-radius: var(--radius-sm, 5px);
  padding: 2px 7px; cursor: pointer; font-size: 13px; line-height: 1.4;
}
.cdp-sound-btn:hover, .cdp-sound-btn.is-on {
  border-color: var(--accent, #c85a1a);
}
.cdp-alt-section { position: relative; }
.cdp-sound-pop {
  position: absolute; z-index: 30;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #ddd);
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.14);
  padding: var(--space-sm, 10px) var(--space-md, 12px);
  display: flex; flex-direction: column; gap: var(--space-xs, 6px);
  min-width: 220px;
}
.cdp-sound-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-sm, 10px);
}
.cdp-sound-slider {
  width: 110px; height: 4px; accent-color: var(--accent, #c85a1a); cursor: pointer;
}

/* ── Editing-grammar hint strip (plan §12 — replaces tooltip-only) ── */
.cdp-hint-strip {
  font-size: var(--font-xs, 11px);
  color: var(--text-soft, #8a8a8a);
  text-align: center;
  padding: 2px var(--space-sm, 10px) 0;
  line-height: 1.5;
  user-select: none;
}

/* ── DE-A inline-style sweep (2026-06-12): statics moved off element.style ── */
.cdp-alt-bar  { border-top: 1px solid var(--border, #ddd); }
.cdp-alt-grid { padding: 12px 16px 16px; }
.cdp-alt-card { position: relative; }

/* ════════════════════════════════════════════════════════════════════
   Diagram-editor v2 (redesigned) — picker chrome tuning (2026-06-15)
   The editor card itself is styled in site.css (.cb-editor-card.cbv2);
   here we only give the window/footer prototype-matched proportions.
   ════════════════════════════════════════════════════════════════════ */
.cdp-window--editor.cdp-window--v2 {
  width: 50rem;
  max-width: 95vw;
  border-radius: var(--radius-xl, 16px);
}
.cdp-window--v2 .cdp-window-header {
  background: transparent;
  border-bottom: none;
  padding: var(--space-md, 12px) var(--space-lg, 18px) var(--space-xs, 6px);
}
.cdp-window--v2 .cdp-editor-section {
  padding: var(--space-xs, 6px) var(--space-lg, 18px) var(--space-md, 12px);
  border-bottom: none;
}
/* Footer action bar reads like the prototype foot: quiet surface + hairline */
.cdp-window--v2 .cdp-action-row {
  padding: var(--space-md, 14px) var(--space-lg, 18px);
  margin-top: 0;
  border-top: var(--border-w, 1px) solid var(--border);
  background: var(--surface-2);
}
.cdp-window--v2 .cdp-action-row .cdp-use-btn {
  height: 2.75rem;
  border-radius: var(--radius-md, 9px);
  box-shadow: 0 2px 10px var(--accent-bg-hover);
}
.cdp-window--v2 .cdp-action-row .cdp-play-btn {
  border-radius: var(--radius-full, 999px);
  padding: var(--space-sm, 9px) var(--space-md, 16px);
}
.cdp-window--v2 .cdp-hint-strip { padding-top: var(--space-xs, 6px); }

/* ── DE-D polish (2026-06-12, design delegated to the assistant) ── */
/* The editing-grammar lives in the .cdp-hint-strip one-liner under the
   canvas (plan §12) — the duplicate paragraph custom-boards renders at
   the top of its main area is hidden in the PICKER context only (the
   standalone custom-boards page keeps it). */
.cdp-editor-card .stacker-info-row .stacker-start-info { display: none; }
/* Export/undo strip: one tidy row — undo/redo cluster left, exports
   pushed right, consistent gaps instead of ad-hoc wrapping. */
.cdp-editor-card .cb-ed-export-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-xs, 6px);
}
.cdp-editor-card .cb-ed-export-row > button:nth-child(3) { margin-left: auto; }
