/* Website editor — adds its own layout on top of style.css (dashboard skin).
   Scoped to body.editor-page so it can never leak into the dashboard. */

body.editor-page { background: var(--bg); }

/* ---- gate (no admin session) ---- */
.ed-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.ed-gate .login-card { display: grid; gap: 14px; justify-items: center; text-align: center; }

/* ---- header ---- */
header .ed-head { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* ---- two-column layout ---- */
main.editor {
  max-width: 1480px;
  display: grid;
  grid-template-columns: 246px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 18px;
}
.ed-side { position: sticky; top: 72px; display: grid; gap: 10px; }
.ed-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-nav .btn.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.ed-new { width: 100%; }

ul.ed-pages { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ed-page-item {
  width: 100%; text-align: left; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; cursor: pointer; display: grid; gap: 3px;
  font: inherit;
}
.ed-page-item:hover { border-color: #b9c6d8; }
.ed-page-item.on { border-color: var(--navy); box-shadow: inset 3px 0 0 var(--navy); }
.ed-page-item .t { font-weight: 600; font-size: 13px; color: var(--text); }
.ed-page-item .s { font-size: 11.5px; color: var(--muted); word-break: break-all; }
.ed-page-item .tags { display: flex; gap: 5px; }
.tag { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; }
.tag.home { background: #e8f0fe; color: var(--navy); }
.tag.draft { background: #fff4d6; color: #8a6100; }
.tag.live { background: #e3f5ec; color: var(--green); }

/* ---- pane ---- */
.ed-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.ed-bar .sp { flex: 1; }
.ed-pane .card { margin-bottom: 14px; }
.ed-pane h2 { margin: 0 0 4px; }
.ed-section-title { font-size: 15px; margin: 18px 0 10px; }

/* ---- form fields ---- */
.ed-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px;
  font: inherit; font-size: 14px; color: var(--text); background: #fff;
}
.field textarea { min-height: 76px; resize: vertical; line-height: 1.45; }
.field-hint { font-size: 11.5px; color: var(--muted); }
.field.inline { flex-direction: row; align-items: center; gap: 10px; color: var(--text); font-size: 13.5px; }
.field.inline input[type="checkbox"] { width: 16px; height: 16px; }
.field-row2 { display: flex; gap: 10px; align-items: end; }
.field-row2 .field { flex: 1; }

/* ---- sections ---- */
.ed-sec { background: #fff; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; overflow: hidden; }
.ed-sec-head {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  background: #fafbfd; border-bottom: 1px solid var(--line); cursor: pointer;
}
.ed-sec-head .n { font-size: 11px; color: var(--muted); font-weight: 700; min-width: 18px; }
.ed-sec-head .t { font-size: 13.5px; font-weight: 600; }
.ed-sec-head .d { font-size: 11.5px; color: var(--muted); }
.ed-sec-head .sp { flex: 1; }
.ed-sec-head .btn { padding: 3px 7px; font-size: 12px; }
.ed-sec-body { padding: 14px; display: grid; gap: 12px; }
.ed-sec.collapsed .ed-sec-body { display: none; }

/* ---- repeatable item lists (cards, FAQ answers, buttons…) ---- */
.ed-list { display: grid; gap: 10px; }
.ed-item { border: 1px dashed var(--line); border-radius: 8px; padding: 10px; display: grid; gap: 10px; background: #fcfdff; }
.ed-item-head { display: flex; align-items: center; gap: 6px; }
.ed-item-head .n { font-size: 11px; font-weight: 700; color: var(--muted); }
.ed-item-head .sp { flex: 1; }
.ed-item-head .btn, .ed-sec-head .btn { padding: 3px 8px; font-size: 12px; }

.ed-addrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.ed-addrow .btn { font-size: 12.5px; }
.ed-empty { text-align: center; padding: 34px 18px; color: var(--muted); display: grid; gap: 12px; justify-items: center; }

/* ---- colour pickers (site settings) ---- */
.ed-colors { display: flex; gap: 18px; flex-wrap: wrap; }
.ed-color { display: grid; gap: 6px; justify-items: center; font-size: 12px; color: var(--muted); }
.ed-color input[type="color"] { width: 64px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: #fff; }

/* ---- image library ---- */
.ed-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 12px; }
.ed-media .m { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; gap: 8px; }
.ed-media .m img { width: 100%; height: 96px; object-fit: cover; border-radius: 6px; background: #eef1f6; }
.ed-media .m .fn { font-size: 11px; word-break: break-all; color: var(--muted); }
.ed-media .m .row { display: flex; gap: 6px; }
.ed-media .m .btn { font-size: 12px; padding: 5px 8px; }
.ed-drop {
  border: 1.5px dashed var(--line); border-radius: 10px; padding: 20px; text-align: center;
  background: #fff; display: grid; gap: 8px; justify-items: center; margin-bottom: 14px;
}

/* ---- design view (live canvas) ---- */
.ed-tabs { display: flex; gap: 4px; margin-right: 6px; }
.ed-tabs .btn { font-size: 12.5px; }
.ed-tabs .btn.on { background: var(--navy); border-color: var(--navy); color: #fff; }

.ed-design { display: grid; }
.ed-body { display: grid; grid-template-columns: 206px minmax(0, 1fr) 308px; gap: 14px; align-items: start; }

.ed-rail {
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  display: grid; gap: 8px; align-content: start;
}
.ed-rail h4 { margin: 0; font-size: 13px; }
.ed-rail p { margin: 0; font-size: 11.5px; line-height: 1.45; }
.ed-widget {
  display: grid; gap: 2px; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; cursor: grab; background: #fcfdff;
}
.ed-widget:hover { border-color: var(--navy); background: #fff; }
.ed-widget .w-t { font-size: 13px; font-weight: 600; }
.ed-widget .w-d { font-size: 11px; color: var(--muted); line-height: 1.4; }

.ed-stage { display: grid; gap: 10px; min-width: 0; overflow-x: auto; }
.ed-devices { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; position: sticky; left: 0; }
.ed-devices .btn { font-size: 12px; }
.ed-devices .btn.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.ed-devices .muted { font-size: 12px; }
.ed-frame {
  margin: 0 auto; max-width: 100%; overflow: hidden; background: #fff;
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 34px rgba(15, 23, 42, .12);
  transition: max-width .18s ease;
}
.ed-frame[data-device="tablet"] { max-width: 768px; }
.ed-frame[data-device="phone"] { max-width: 390px; }
/* Desktop must never render narrower than the site's own breakpoint (900px,
   site.css): a laptop's stage column is often ~600px, and at that width the
   frame would quietly show the mobile layout while "Desktop" was selected.
   Below that the stage scrolls sideways instead. */
.ed-frame[data-device="desktop"] { min-width: 1024px; }
.ed-frame iframe { display: block; width: 100%; height: 74vh; min-height: 460px; border: 0; background: var(--bg); }

.ed-inspect {
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  display: grid; gap: 10px; align-content: start;
  max-height: calc(100vh - 150px); overflow: auto;
}
.ed-inspect h4 { margin: 0; font-size: 13px; }
.ed-inspect > p { margin: 0; font-size: 12px; line-height: 1.5; }
.ed-ins-head { display: flex; align-items: center; gap: 6px; }
.ed-ins-head .n { font-size: 11px; font-weight: 700; color: var(--muted); min-width: 18px; }
.ed-ins-head .t { font-size: 13.5px; font-weight: 600; }
.ed-ins-head .sp { flex: 1; }
.ed-ins-head .btn { padding: 3px 7px; font-size: 12px; }
.ed-inspect .ed-sec-body { padding: 0; gap: 12px; border: 0; }

@media (max-width: 1240px) {
  .ed-body { grid-template-columns: 186px minmax(0, 1fr); }
  .ed-inspect { grid-column: 1 / -1; max-height: none; }
}
@media (max-width: 900px) {
  main.editor { grid-template-columns: 1fr; }
  .ed-side { position: static; }
  .ed-body { grid-template-columns: 1fr; }
}
