/* Web/css/home-layout.css
   Phase 6 — Curate · Home Layout view (READ-ONLY).
   Visual target: .navi-plan/MOCKUP.html — dark admin aesthetic, matches the
   existing tokens.css palette. Editing controls land in Phase 7. */

/* ── sidebar group accent ── */
.nav-group--curate .nav-group-label {
  color: var(--color-violet-light);
}

/* ── layout ── */
.hl-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  overflow-y: auto;
  height: 100%;
}

.hl-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.hl-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.hl-sub {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.hl-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hl-version {
  font: 12px var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
}

.hl-status {
  font-size: 13px;
  color: var(--text-secondary);
}

.hl-status--error {
  color: var(--status-critical);
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius);
  padding: 10px 12px;
}

/* ── columns ── */
.hl-cols {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hl-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

/* Expanded layout — applied dynamically when anonymous + new diverge and
   we render them as separate columns (see buildColumns in home-layout.js). */
.hl-grid--4col {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1100px) {
  .hl-grid,
  .hl-grid--4col { grid-template-columns: 1fr; }
}

.hl-col {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  min-height: 240px;
}

.hl-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.hl-col-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
}

.hl-col-who {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.hl-pill {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.hl-pill--ok {
  background: rgba(34, 197, 94, 0.14);
  color: var(--status-positive);
}

.hl-pill--over {
  background: var(--accent-glow);
  color: var(--color-violet-light);
}

.hl-col-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.hl-warn {
  font-size: 11px;
  color: var(--status-warning);
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
}

.hl-empty {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 16px;
  font-style: italic;
}

/* ── section row ── */
.hl-sec {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 11px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.hl-sec--cta {
  background: linear-gradient(180deg, rgba(124, 92, 252, 0.10), var(--bg-elevated));
  border-color: rgba(124, 92, 252, 0.35);
}

.hl-sec-body {
  flex: 1;
  min-width: 0;
}

.hl-sec-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hl-sec-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 4px;
}

.hl-sec-id {
  font: 10px var(--font-mono);
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── badges ── */
.hl-badge {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 10px;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: nowrap;
}

.hl-badge--tmpl {
  color: var(--color-violet-light);
}

.hl-badge--render {
  color: var(--color-link);
}

.hl-badge--icon {
  color: var(--text-primary);
}

.hl-badge--param {
  color: var(--status-positive);
}

.hl-badge--over {
  color: var(--color-violet-light);
  border-color: rgba(124, 92, 252, 0.45);
  background: var(--accent-glow);
}

.hl-badge--warn {
  color: var(--status-warning);
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.08);
}

/* ── footer meta ── */
.hl-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.hl-meta strong {
  color: var(--text-secondary);
  font-weight: 600;
}

.hl-note {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 4px 0 0;
}

.hl-note code {
  background: var(--bg-elevated);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--color-violet-light);
  font: 11px var(--font-mono);
}

/* ── Phase 7 editing affordances ───────────────────────────────────────── */

/* toolbar buttons (sit alongside the existing icon-btn) */
.hl-toolbar .ctl {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font: inherit;
  cursor: pointer;
}
.hl-toolbar .ctl:hover {
  border-color: var(--text-muted);
}
.hl-toolbar .ctl:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.hl-btn-primary {
  background: var(--color-violet, #7c5cff) !important;
  border-color: var(--color-violet, #7c5cff) !important;
  color: #fff !important;
  font-weight: 600;
}
.hl-btn-ghost {
  background: transparent !important;
  color: var(--text-secondary) !important;
}

.hl-dirty {
  color: var(--status-warning);
  font-size: 11px;
  font-weight: 600;
}

.hl-status--warn {
  color: var(--status-warning);
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.hl-status--info {
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}

/* drag handle + draggable row state */
.hl-sec {
  cursor: grab;
}
.hl-sec--dragging {
  opacity: 0.4;
  cursor: grabbing;
}
.hl-sec--over {
  border-color: var(--color-violet-light);
  box-shadow: inset 0 0 0 1px var(--color-violet-light);
}
.hl-grip {
  color: var(--text-muted);
  font-size: 14px;
  cursor: grab;
  flex-shrink: 0;
  line-height: 1.2;
  padding-top: 2px;
}
.hl-sec--dragging .hl-grip {
  cursor: grabbing;
}

.hl-sec-acts {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.hl-iconbtn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 5px;
  line-height: 1;
}
.hl-iconbtn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.hl-iconbtn--del:hover {
  color: var(--status-critical);
  background: rgba(239, 68, 68, 0.08);
}

.hl-add {
  margin-top: 2px;
  background: none;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 9px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
}
.hl-add:hover {
  border-color: var(--color-violet-light);
  color: var(--color-violet-light);
  background: rgba(124, 92, 252, 0.05);
}

.hl-sec-issue {
  margin-top: 4px;
  font-size: 11px;
  color: var(--status-warning);
}

/* ── modals (scrim + dialog) ─────────────────────────────────────────── */

.hl-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  z-index: 80;
}
.hl-scrim[hidden] {
  display: none;
}

.hl-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: min(480px, 92vw);
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.hl-modal--narrow {
  width: min(380px, 92vw);
}
.hl-modal h3 {
  margin: 0 0 4px;
  font-size: 16px;
  color: var(--text-primary);
}
.hl-modal-hint {
  color: var(--text-secondary);
  font-size: 12px;
  margin: 0 0 14px;
}
.hl-modal-hint code {
  background: var(--bg-elevated);
  padding: 1px 5px;
  border-radius: 4px;
  font: 11px var(--font-mono);
  color: var(--color-violet-light);
}

.hl-field {
  margin-bottom: 12px;
}
.hl-field label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 600;
}
.hl-field input,
.hl-field select {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font: inherit;
}
.hl-field input:disabled {
  opacity: 0.5;
}

/* segmented toggle (Template default / Custom text / i18n key) */
.hl-seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 8px;
}
.hl-seg button {
  background: var(--bg-elevated);
  border: none;
  color: var(--text-secondary);
  padding: 6px 11px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.hl-seg button.on {
  background: var(--color-violet, #7c5cff);
  color: #fff;
  font-weight: 600;
}

.hl-modal-acts {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* template-picker tiles inside the add modal */
.hl-tmpl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.hl-tmpl-opt {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px;
  cursor: pointer;
  text-align: left;
  color: var(--text-primary);
  font: inherit;
}
.hl-tmpl-opt:hover {
  border-color: var(--color-violet-light);
}
.hl-tmpl-opt--picked {
  border-color: var(--color-violet);
  background: var(--accent-glow);
}
.hl-tmpl-opt--disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.hl-tmpl-opt--disabled:hover {
  border-color: var(--border);
}
.hl-tn {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}
.hl-td {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.4;
}

/* disabled seg option (e.g. "Template default" on a no-default rail) */
.hl-seg button:disabled,
.hl-seg button.hl-seg-btn--off {
  opacity: 0.35;
  cursor: not-allowed;
}

/* inline hint next to a field label */
.hl-field-hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 10px;
  margin-left: 6px;
}

/* genre_combo multi-select checklist */
.hl-checklist {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  max-height: 180px;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.hl-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 400;
  cursor: pointer;
  margin: 0;
}
.hl-check input {
  width: auto;
}

/* search-and-add show picker (curated show_ids / pins / excludes) */
.hl-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hl-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.hl-picker-empty {
  font-size: 11px;
  color: var(--text-muted);
}
.hl-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-glow);
  border: 1px solid rgba(124, 92, 252, 0.45);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  color: var(--text-primary);
  max-width: 220px;
}
.hl-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hl-chip-x {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 0;
  width: auto;
}
.hl-chip-x:hover {
  color: var(--status-negative, #f87171);
}
.hl-picker-search {
  position: relative;
}
.hl-picker-results {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  margin-top: 2px;
  background: var(--bg-surface, var(--bg-elevated));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.hl-picker-row {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 10px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.hl-picker-row:last-child {
  border-bottom: none;
}
.hl-picker-row:hover {
  background: var(--accent-glow);
}
.hl-picker-row:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.hl-picker-none {
  padding: 8px 10px;
  font-size: 11px;
  color: var(--text-muted);
}

/* new section-card badges (cap / pin / exclude) */
.hl-badge--cap { color: var(--color-link); }
.hl-badge--pin { color: var(--status-warning); }
.hl-badge--ex { color: var(--text-muted); }

/* toast (save success / failure) */
.hl-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--status-positive);
  color: #062416;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  z-index: 90;
}
.hl-toast--show {
  opacity: 1;
  pointer-events: auto;
}

/* ── Phase 8 cheap labeled-block preview ────────────────────────────────
   Renders each rail as a placeholder BLOCK (not a real card grid — that
   would need PASS-1/PASS-2 hydration). The four block shapes mirror the
   render-vocab grouping in `previewVariantOf`:
     hero    — wide strip (hero_carousel)
     poster  — thumbnail row (poster_row / rail)
     list    — stacked rows (vertical_list)
     cta     — button bar (cta / cta_card)
   Visual target: .navi-plan/MOCKUP.html `.preview` block. */
.hl-preview {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hl-preview-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.hl-preview-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.hl-preview-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* Phase 8 fix 1 — preview is ALWAYS 4 columns (one per lifecycle), even
   when the editor merges anonymous + new into a single column. The
   .hl-pv-cols--4col modifier is kept (still applied unconditionally by
   the JS) so future revisions can vary the lifecycle count without
   re-writing the base class. */
.hl-pv-cols {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.hl-pv-cols--4col {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1100px) {
  .hl-pv-cols,
  .hl-pv-cols--4col { grid-template-columns: 1fr; }
}

.hl-pv-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.hl-pv-name {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.hl-rail {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hl-rl-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hl-rl-chip {
  margin-left: auto;
  font: 10px var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-weight: 500;
  flex-shrink: 0;
}

.hl-strip {
  border-radius: 7px;
}

/* hero — wide single strip */
.hl-rail--hero .hl-strip {
  height: 46px;
  background: linear-gradient(135deg, rgba(124, 92, 252, 0.32), rgba(91, 141, 239, 0.28));
  border: 1px solid rgba(124, 92, 252, 0.30);
}

/* poster — thumbnail row */
.hl-rail--poster .hl-strip {
  display: flex;
  gap: 5px;
  background: none;
}
.hl-rail--poster .hl-strip > div {
  width: 38px;
  height: 50px;
  border-radius: 5px;
  background: linear-gradient(135deg, rgba(124, 92, 252, 0.20), rgba(91, 141, 239, 0.18));
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* list — stacked rows */
.hl-rail--list .hl-strip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: none;
}
.hl-rail--list .hl-strip > div {
  height: 30px;
  border-radius: 5px;
  background: linear-gradient(90deg, rgba(124, 92, 252, 0.14), rgba(91, 141, 239, 0.10));
  border: 1px solid var(--border);
}

/* cta — button bar (label + CTA-like button on the right) */
.hl-rail--cta .hl-strip {
  height: 40px;
  background: rgba(124, 92, 252, 0.12);
  border: 1px solid var(--color-violet-light);
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 8px;
  font-size: 11px;
  color: var(--color-violet-light);
}
.hl-rail--cta .hl-cta-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.hl-rail--cta .hl-cta-btn {
  margin-left: auto;
  background: var(--color-violet, #7c5cff);
  color: #fff;
  border-radius: 5px;
  padding: 3px 9px;
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
}

.hl-pv-empty {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  padding: 8px 0;
}
