/* love2.us - editor page (M2.1). Mobile-first; form and live
 * preview sit side by side on wide screens.
 */
.editor-wrap { max-width: 1080px; margin: 0 auto; padding: 8px 20px 40px; }
.editor-wrap h1 {
  font-family: var(--font-display); font-weight: 400;
  font-size: 34px; margin: 10px 0 4px;
}
.editor-sub { color: var(--ink-soft); margin: 0 0 22px; max-width: 52ch; }
.editor-error {
  background: #fdecea; color: #8f2b23; border: 1.5px solid #f2b8b0;
  border-radius: var(--radius-sm); padding: 14px 16px; margin: 0 0 18px;
}
.editor-grid { display: grid; gap: 28px; }
@media (min-width: 900px) {
  .editor-grid { grid-template-columns: 380px 1fr; align-items: start; }
}

.field { display: block; margin-bottom: 18px; }
.field > span { display: block; font-weight: 700; margin-bottom: 6px; }
.field > span em { font-weight: 400; color: var(--ink-soft); font-style: normal; }
.field input[type="text"],
.field textarea {
  width: 100%; box-sizing: border-box;
  font: inherit; font-size: 16px; color: var(--ink);
  background: #fff; border: 1.5px solid #e8e0da;
  border-radius: var(--radius-sm); padding: 12px 14px;
}
.field input[type="text"]:focus,
.field textarea:focus {
  outline: none; border-color: var(--pink-ink);
  box-shadow: 0 0 0 3px rgba(201, 79, 124, 0.18);
}
.field textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
.counter { display: block; text-align: right; font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.hint { font-size: 13px; color: var(--ink-soft); margin: 8px 0 0; }

.photo-list { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.photo-list:empty { display: none; }
.photo-thumb { position: relative; width: 76px; height: 96px; }
.photo-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  border-radius: 10px; box-shadow: var(--shadow);
}
.photo-del {
  position: absolute; top: -8px; right: -8px;
  width: 24px; height: 24px; border-radius: 50%;
  border: none; background: var(--pink-ink); color: #fff;
  font-size: 16px; line-height: 1; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.photo-add {
  display: inline-block; padding: 10px 16px;
  border: 1.5px dashed var(--gold); border-radius: 999px;
  font-weight: 700; color: var(--pink-ink); cursor: pointer; background: #fff;
}

.save-status { font-size: 14px; color: var(--sage-deep); font-weight: 700; min-height: 20px; margin: 4px 0 14px; }
.save-status.error { color: #8f2b23; }
.editor-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.btn-danger { color: #8f2b23; border-color: #e8b0aa; }
#shareBox { margin-top: 4px; }

/* Publish share box: native share first (full width, thumb-sized),
 * then copy / open, then the app links. Same buttons and colours
 * as the rest of the site — nothing new invented here. */
.share-hint { margin: 0 0 12px; color: var(--ink-soft); }
#shareBox .share-row { margin-bottom: 10px; }
#shareBox .share-apps { margin-bottom: 0; }
.share-main { width: 100%; }
.share-apps .btn { min-width: 0; flex: 1 1 0; padding: 0 8px; font-size: 15px; }

/* M2.4 (H1/M1): the edit-link box sits under the share box; its
 * buttons (rotate / revoke) share the share-row layout. */
#editLinkBox { margin-top: 16px; text-align: left; }
#editLinkBox .share-row { justify-content: flex-start; }
#editLinkBox .link-chip { word-break: break-all; }

.editor-preview h2 {
  font-family: var(--font-display); font-weight: 400;
  font-size: 26px; margin: 0 0 4px;
}
.editor-preview .hint { margin: 0 0 12px; }
.preview-frame {
  background: #fff; border: 1.5px solid #e8e0da;
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
/* the rendered card lives inside the frame, not a full page */
.preview-frame .card-page { min-height: 0; }
.preview-frame .envelope-stage { padding: 28px 16px; min-height: 380px; }
.preview-frame .card-reveal { padding-bottom: 20px; }

/* ---- M2.2 additions ---- */
.status-line { font-size: 14px; font-weight: 700; margin: 0 0 18px; }
.status-badge {
  display: inline-block; padding: 3px 12px; border-radius: 999px;
  background: #f1ecff; color: var(--ink);
}
.status-badge.published { background: #e2f2e2; color: var(--sage-deep); }

.template-picker { display: grid; gap: 10px; }
.template-group { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.template-group-label { font-size: 13px; color: var(--ink-soft); font-weight: 700; min-width: 86px; }
.template-btn {
  background: #fff; border: 1.5px solid #e8e0da; border-radius: 999px;
  padding: 7px 14px; font: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer; color: var(--ink);
}
.template-btn.active {
  border-color: var(--pink-ink); background: #fdeef3; color: var(--pink-ink);
}

.field select {
  width: 100%; box-sizing: border-box;
  font: inherit; font-size: 16px; color: var(--ink);
  background: #fff; border: 1.5px solid #e8e0da;
  border-radius: var(--radius-sm); padding: 12px 14px;
}

.photo-item {
  width: 100%; background: #fff; border: 1.5px solid #e8e0da;
  border-radius: var(--radius-sm); padding: 12px; box-sizing: border-box;
  margin-bottom: 10px;
}
.photo-head { position: relative; width: 120px; height: 90px; margin-bottom: 10px; }
.photo-head img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  border-radius: 10px; box-shadow: var(--shadow);
}
.photo-caption {
  width: 100%; box-sizing: border-box; margin-bottom: 10px;
  font: inherit; font-size: 14px; padding: 8px 10px;
  border: 1.5px solid #e8e0da; border-radius: var(--radius-sm);
}
.photo-row { display: flex; gap: 8px; margin-bottom: 10px; }
.photo-row select {
  flex: 1; font-size: 14px; padding: 8px 10px;
  border: 1.5px solid #e8e0da; border-radius: var(--radius-sm); background: #fff;
}
.slider-row {
  display: flex; gap: 8px; align-items: center;
  font-size: 13px; margin-bottom: 8px;
}
.slider-row span:first-child { min-width: 72px; font-weight: 700; }
.slider-row input[type="range"] { flex: 1; }
.slider-val { min-width: 40px; text-align: right; color: var(--ink-soft); }
.focal-box {
  position: relative; height: 130px; border-radius: 10px; margin: 4px 0 10px;
  background-size: cover; background-repeat: no-repeat; cursor: crosshair;
  box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.12); overflow: hidden;
  touch-action: none;
}
.focal-dot {
  position: absolute; width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid #fff; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.35);
  transform: translate(-50%, -50%); pointer-events: none;
}
.focal-label {
  position: absolute; left: 8px; bottom: 8px; font-size: 12px;
  background: rgba(0, 0, 0, 0.55); color: #fff; padding: 3px 8px; border-radius: 999px;
}
.photo-bg-btn.active {
  border-color: var(--pink-ink); background: #fdeef3; color: var(--pink-ink); font-weight: 700;
}

/* custom confirm dialog (replaces native window.confirm) */
/* [hidden] must win: .btn sets display:inline-flex in the shared
 * stylesheet, which beats the UA [hidden]{display:none} rule, so
 * Unpublish / Publish / shareBox toggles via .hidden silently did
 * nothing (the Unpublish button stayed visible on drafts). */
[hidden] { display: none !important; }
.modal {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal-box {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; max-width: 400px; width: 100%; text-align: center;
  /* A long-press on the dialog must not select its title text
   * (it used to highlight blue on phones). */
  -webkit-user-select: none;
  user-select: none;
}
.modal-box h3 { margin: 0 0 8px; font-size: 20px; }
.modal-box p { color: var(--ink-soft); margin: 0 0 18px; }
.modal-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---- M2.3 (Photo Studio) ---- */
.photo-item .slider-row { margin-top: 10px; }
.photo-item .slider-row input { flex: 1; min-width: 0; }

.photo-order-row {
  display: flex; align-items: center; gap: 6px; margin-bottom: 8px;
  color: var(--ink-soft); font-size: 13px;
}
.drag-handle {
  cursor: grab; color: #b8aba0; letter-spacing: 1px; font-size: 15px;
  touch-action: none; user-select: none;
}
.photo-order-label { flex: 1; }
.photo-order-btn { padding: 3px 9px; font-size: 14px; }
.photo-main-btn { font-size: 12px; }
.photo-item.dragging { opacity: 0.45; }
.photo-item.drag-over { outline: 2px dashed var(--pink-ink); outline-offset: 4px; }

.photo-bg-badge {
  position: absolute; left: 8px; bottom: 8px; z-index: 2;
  background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 12px;
  font-weight: 700; padding: 3px 8px; border-radius: 999px;
}
.photo-center-btn, .photo-reset-btn { margin-top: 8px; }
.photo-reset-btn { margin-left: 8px; }

/* Focal box: a real <img> (not a background) so filter, focal
 * point and zoom render exactly like the shared renderer does. */
.focal-img {
  width: 100%; height: 100%; display: block; object-fit: cover;
  object-position: 50% 50%; touch-action: none; pointer-events: none;
}
.focal-box { touch-action: none; }

/* Background controls */
.check-row {
  display: flex; align-items: center; gap: 8px; font-size: 14px;
  color: var(--ink); margin: 4px 0 10px;
}
.check-row input { width: 18px; height: 18px; accent-color: var(--pink-ink); }
.field-sub { display: block; margin-top: 12px; }
.field-sub > span { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 4px; }

/* M2.4.x (Dear Me): writing prompts - chips above the message box.
 * Tapping one shows its guidance above the box; it never writes
 * into the message for the maker. */
.prompt-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.prompt-chip {
  min-height: 36px; padding: 0 14px; font-size: 14px; font-weight: 700;
  border-radius: 999px; background: #fff; border: 1.5px solid var(--lavender-deep);
  color: var(--ink); cursor: pointer;
}
.prompt-chip.active { background: var(--lavender); border-color: var(--lavender-deep); }

/* M2.4.x v1.2 (Dear Me space): write first, choose a look after.
 * The style step is two quiet buttons under the message box. */
.style-step-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
