/* ═══════════════════════════════════════════════════════════════════════════
   LANDING COPY EDITOR
   Fullscreen overlay (super-admin only). Two-column split: left = editable
   field list grouped by section; right = live iframe preview of the landing
   page being edited.
   ═══════════════════════════════════════════════════════════════════════════ */

.lce-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  font-family: var(--font-body, system-ui, sans-serif);
}

.lce-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* ── Top bar ────────────────────────────────────────────────────────── */

.lce-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2, var(--bg));
  flex-shrink: 0;
}

.lce-topbar-left {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}

.lce-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: 0.02em;
}

.lce-tabs {
  display: flex;
  gap: 4px;
}

.lce-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.lce-tab:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); color: var(--text); }
.lce-tab.is-active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.lce-tab-count {
  font-size: 11px;
  color: var(--text3);
  padding: 1px 6px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--text3) 12%, transparent);
}
.lce-tab.is-active .lce-tab-count {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--accent);
}
.lce-tab-dirty {
  color: var(--amber);
  font-size: 14px;
  line-height: 1;
}

.lce-topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lce-dirty-summary {
  font-size: 12px;
  color: var(--amber);
  font-weight: 500;
}

.lce-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 20px;
  line-height: 1;
  color: var(--text2);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.lce-close:hover:not(:disabled) {
  background: color-mix(in srgb, var(--red) 12%, transparent);
  border-color: color-mix(in srgb, var(--red) 40%, transparent);
  color: var(--red);
}
.lce-close:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Body split ─────────────────────────────────────────────────────── */

.lce-body {
  display: grid;
  grid-template-columns: minmax(380px, 480px) 1fr;
  flex: 1;
  min-height: 0;
  gap: 0;
}

/* ── Left panel: list of editable fields ────────────────────────────── */

.lce-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
  background: var(--bg);
  overflow: hidden;
}

.lce-list-toolbar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.lce-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.lce-search:focus { border-color: var(--accent); }

.lce-status {
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text3);
}
.lce-status-error { color: var(--red); }

.lce-list > .lce-group,
.lce-list > .lce-status {
  /* nothing — wrapper for clarity */
}

/* Make group container the scroll surface (everything after toolbar). */
.lce-list {
  /* container itself non-scrolling; child blocks scroll together */
}
.lce-list > :nth-child(n+2) {
  /* Scroll target — everything after the toolbar is one scrollable region */
}
/* simpler: wrap children in scroll region — we use overflow on a sub-container instead */

.lce-group {
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.lce-group:last-child { border-bottom: none; }

.lce-group-header {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 16px;
  background: var(--bg2, var(--bg));
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
}

/* Make everything below the toolbar scroll together. We achieve this by
   making the .lce-list itself the scroll surface and letting groups stack. */
.lce-list {
  overflow-y: auto;
}
.lce-list-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
}

.lce-item {
  padding: 12px 16px;
  border-top: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
}
.lce-item:first-of-type { border-top: none; }
.lce-item.is-dirty {
  background: color-mix(in srgb, var(--amber) 6%, transparent);
  border-left: 2px solid var(--amber);
  padding-left: 14px;
}

.lce-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--text3);
}

.lce-item-tag {
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
}

.lce-item-context {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  color: var(--text3);
  opacity: 0.8;
}

.lce-item-revert {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text2);
  cursor: pointer;
}
.lce-item-revert:hover {
  background: color-mix(in srgb, var(--text3) 8%, transparent);
  color: var(--text);
}

.lce-item-textarea {
  width: 100%;
  min-height: 28px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  line-height: 1.55;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
}
.lce-item-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent);
}
.lce-item.is-dirty .lce-item-textarea {
  border-color: color-mix(in srgb, var(--amber) 50%, transparent);
}

.lce-item-preview {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text2);
  line-height: 1.4;
  font-style: normal;
  padding: 4px 2px;
}
.lce-item-preview em {
  color: var(--text3);
  font-style: italic;
}

/* ── Right panel: iframe preview ────────────────────────────────────── */

.lce-preview {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg2, var(--bg));
}

.lce-preview-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.lce-origin-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  outline: none;
}
.lce-origin-input:focus { border-color: var(--accent); }

.lce-preview-reload,
.lce-preview-open {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text2);
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
}
.lce-preview-reload:hover,
.lce-preview-open:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--text);
}

.lce-iframe {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  background: white;
}
