/* experience_editor/elements.css – Element list, rows, inline editor */

/* ── Element list container ── */
.ee-elements {}
.ee-elements__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-1) var(--space-3);
}
.ee-elements__title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}
.ee-elements__list {
  display: flex;
  flex-direction: column;
}
.ee-elements__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-4);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}
.ee-elements__empty p { margin: 0; }
.ee-elements__empty-icon {
  font-size: 32px;
  color: var(--text-quaternary);
}
.ee-elements__add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  width: 100%;
  height: 48px;
  border: none;
  background: var(--accent-primary);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-on-accent);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
}
.ee-elements__add-btn:hover {
  background: var(--accent-hover);
}
.ee-elements__add-btn .material-symbols-rounded {
  font-size: 18px;
}

/* ── Element row ──
   Inter-element divider matches the panel divider style (--border-subtle). */
.ee-element {
  border-bottom: 1px solid var(--border-subtle);
}
.ee-element:last-child {
  border-bottom: none;
}
.ee-element__row {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
}
.ee-element__row:hover {
  background: var(--surface-hover);
}
.ee-element__handle {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-quaternary);
  cursor: grab;
  flex-shrink: 0;
}
.ee-element__caret {
  font-size: 14px;
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: transform var(--duration-fast) var(--ease-out);
}
.ee-element:has(.ee-element-editor:not([hidden])) .ee-element__caret {
  transform: rotate(90deg);
}
.ee-element__icon {
  font-size: 16px;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.ee-element__label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  flex-shrink: 0;
}
.ee-element__actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
  margin-left: auto;
}
.ee-element__badge { font-size: 10px; }
.ee-element__delete .material-symbols-rounded {
  font-size: 14px;
  color: var(--status-error);
}
.ee-element__delete {
  padding: 2px;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
}
.ee-element__row:hover .ee-element__delete { opacity: 1; }

/* ── Sortable states ── */
.sortable--ghost .ee-element__row { background: var(--surface-selected); }
.sortable--chosen { opacity: 0.8; }

/* ── Inline editor (Pattern 21 Section Spacing Standard, LOCKED 2026-04-29) ── */
.ee-element-editor {
  padding: var(--space-4);
}
.ee-element-editor[hidden] {
  display: none !important;
}
.ee-element-editor__form {
  display: flex;
  flex-direction: column;
  /* Pattern 21: no form gap. Section margins handle inter-section separation. */
}
/* Section gap owns ALL spacing between direct children — including the
   heading-to-first-content gap. Children must NOT add their own top padding
   to compensate; otherwise spacing becomes inconsistent depending on which
   child is first. */
.ee-element-editor__section { display: flex; flex-direction: column; gap: var(--space-3); }
/* The class's explicit `display: flex` would otherwise win over the UA
   `[hidden] { display: none }`. Restore the hidden attribute's behavior. */
.ee-element-editor__section[hidden] { display: none; }
/* Pattern 21: dashed hairline divider between sections, visually centered
   in the inter-section gap (16px above + 1px line + 16px below). General-
   sibling selector `~` so that out-of-flow nodes (e.g. a <dialog> rendered
   between sections by a type partial) don't break the divider chain.
   The picker wrapper (which holds the binding header + hidden search) also
   anchors the divider for the first real section that follows it. */
.ee-element-editor__section ~ .ee-element-editor__section,
.ee-binding-wrap ~ .ee-element-editor__section {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px dashed var(--border-subtle);
}
.ee-element-editor__section-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.ee-element-editor__section-header .form-label { margin-bottom: 0; }

/* Pattern 12 — filter prose readout. Live sentence beneath the pill cluster.
   Bolded content words (<strong>) come from FilterSettings#filter_prose. */
.filter-prose {
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-sunken);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.45;
}
.filter-prose strong {
  color: var(--text-primary);
  font-weight: var(--weight-semibold);
}
/* Pattern 21 + 22: heading is text-only with a leading 14px Material Symbol.
   No border, no padding-top, no margin. Sections sit tight to their headings
   (4px gap) and are separated by the inter-section divider above. */
.ee-element-editor__heading {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin: 0;
}
.ee-element-editor__heading .material-symbols-rounded {
  font-size: 14px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* ── Common Settings cluster (Pattern 19 toolbar wrapper) ── */
.cs-toolbar { margin: var(--space-3) var(--space-4) 0; }
.cs-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cs-row--universal {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px dashed var(--border-subtle);
}

/* ── Pattern 1b — Element row binding header (LOCKED).
     Renders below the row strip when an Element is expanded. Anatomy:
     question-text headline + right-aligned tail row (outlined neutral type
     pill + small swap-icon button). Promoted verbatim from the locked
     q-and-a-finals mockup. */
.ee-binding-header {
  /* Sits inside .ee-element-editor (already padded), so don't double-pad
     horizontally. Just give it room above for breathing space from the row
     strip. No left margin — that was a locked-mockup-specific artifact. */
  padding: 0 0 var(--space-2);
}
.ee-headline {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
  color: var(--text-primary);
  margin: 0;
}
.ee-tail-row {
  margin-top: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-1-5);
  justify-content: flex-end;
}
.ee-type-pill {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  background: var(--surface-base);
  border: 1px solid var(--border-subtle);
  padding: 1px 8px;
  border-radius: var(--radius-full);
  line-height: 1.4;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}
.ee-mini {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out);
}
.ee-mini:hover { color: var(--accent-primary); }
.ee-mini .material-symbols-rounded { font-size: 16px; }
/* ── Common settings toolbar ── */
.ee-common-settings {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-2);
}
.ee-common-settings__pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border: 1px dashed var(--accent-muted);
  border-radius: var(--radius-md);
  background: none;
  color: var(--accent-primary);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}
.ee-common-settings__pill:hover {
  border-color: var(--accent-primary);
  background: var(--accent-subtle);
}
.ee-common-settings__pill .material-symbols-rounded { font-size: 16px; }
.ee-common-settings__caret { font-size: 16px; }
.ee-common-settings__overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  border: none;
  background: none;
}
.ee-common-settings__check {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.ee-common-settings__toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: 28px;
  padding: 0 var(--space-2);
  border: 1px dashed var(--accent-muted);
  border-radius: var(--radius-md);
  background: none;
  cursor: pointer;
  color: var(--accent-primary);
  white-space: nowrap;
  transition: all var(--duration-fast) var(--ease-out);
}
.ee-common-settings__toggle:hover {
  border-color: var(--accent-primary);
  background: var(--accent-subtle);
}
.ee-common-settings__toggle:has(:checked) {
  border: 2px solid var(--accent-primary);
  background: var(--accent-subtle);
  color: var(--accent-primary);
}
.ee-common-settings__toggle:has(:checked):hover {
  background: var(--accent-subtle);
  box-shadow: var(--shadow-sm);
}
/* Button variant (no checkbox inside) — activated via modifier */
.ee-common-settings__toggle--on {
  border: 2px solid var(--accent-primary);
  background: var(--accent-subtle);
  color: var(--accent-primary);
}
.ee-common-settings__toggle .material-symbols-rounded { font-size: 16px; }
.ee-common-settings__label {
  font-size: var(--text-xs);
  font-weight: 600;
}

.ee-element-editor__placeholder {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}
.ee-element-editor__placeholder p { margin: 0; }

/* ── Lexxy editor — DS class lives in components/lexxy.css. Only the
   EE-Frame context override stays scoped here, since .ee-element-frame
   is intrinsically admin-only. ── */
.ee-element-frame .ds-lexxy-editor {
  --lexxy-editor-rows: 8lh;
  padding-bottom: var(--space-4);
}

/* ── Variable prompt menu item layout ── */
.variable-prompt__category {
  display: inline-block;
  padding: 0 0.4em;
  border-radius: var(--radius-sm);
  background: var(--accent-muted);
  color: var(--accent-primary);
  font-size: 0.75em;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}
.variable-prompt__key {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--text-primary);
}
.variable-prompt__desc {
  color: var(--text-secondary);
  font-size: 0.85em;
  margin-inline-start: auto;
}

/* ── Variable warnings (invalid variables indicator) ── */
.ee-variable-warnings {
  padding: var(--space-1) var(--space-2);
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--warning-text, #92400e);
  background: var(--warning-bg, #fefce8);
  border-radius: var(--radius-sm);
}

/* ── Question Picker ── */
.question-picker__summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2);
  background: var(--surface-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}
.question-picker__selected {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.question-picker__selected-type {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-primary);
  line-height: 1;
}
.question-picker__selected-text {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.question-picker__selected-name {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1;
}
.question-picker__change {
  flex-shrink: 0;
}
.question-picker__input {
  width: 100%;
}
.question-picker__results {
  display: flex;
  flex-direction: column;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-base);
  margin-top: var(--space-1);
}
.question-picker__result {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: var(--space-1) var(--space-2);
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--duration-fast) var(--ease-out);
}
.question-picker__result:hover {
  background: var(--surface-hover);
}
.question-picker__result + .question-picker__result {
  border-top: 1px solid var(--border-default);
}
.question-picker__result-text {
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: 1.3;
}
.question-picker__result-meta {
  font-size: 10px;
  color: var(--text-secondary);
  line-height: 1;
}
.question-picker__empty {
  padding: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-align: center;
}

/* ── Goto list (GotoMenu editor) ── */
.ee-goto-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: var(--space-2);
}
.ee-goto-list__item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
  background: var(--surface-hover);
  border-radius: var(--radius-sm);
}
.ee-goto-list__pos {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  min-width: 18px;
}
.ee-goto-list__label {
  font-weight: 500;
  color: var(--text-primary);
}
.ee-goto-list__step {
  margin-left: auto;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

/* ── Feed Card (Elements::Card participation view) ── */
.feed-card {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--surface-base);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  max-width: 480px;
}
.feed-card__banner {
  padding: var(--space-1-5) var(--space-4);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: white;
  line-height: 1.4;
  background: var(--accent-primary);
}
.feed-card__image-wrap {
  line-height: 0;
}
.feed-card__image {
  width: 100%;
  display: block;
}
.feed-card__body {
  padding: var(--space-4) var(--space-5);
  border-left: 3px solid transparent;
}
.feed-card__title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin: 0 0 var(--space-2);
}
.feed-card__title:last-child { margin-bottom: 0; }
.feed-card__description {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* Completion check badge */
.feed-card__check {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  filter: drop-shadow(0 1px 3px rgb(0 0 0 / 0.25));
}
.feed-card--completed {
  opacity: 0.75;
}
.feed-card--completed:hover {
  opacity: 1;
}

/* ── Report-only fields ── */
/* Show/hide fields that only matter when "Show in report" is checked.
   Uses CSS :has() so toggling the Report checkbox is instant (no server round-trip). */
.ee-element-editor__form:not(:has([name="element[show_in_report]"]:checked)) .ee-report-only {
  display: none;
}
