/* ============================================================
   JesusChrist.com — Site Editor styles
   ============================================================ */
:root {
  --bg: #f3f5f7;
  --ink: #1f2933;
  --soft: #627180;
  --accent: #2f80d9;
  --gold: #6db3f2;
  --line: #dfe5eb;
  --danger: #c0392b;
  --ok: #2e7d32;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: #1c2733; color: #e8eef4;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  flex-wrap: wrap;
}
.topbar h1 { font-size: 18px; margin: 0; flex: 1; }
.topbar .hint { font-size: 12.5px; color: #93a5b8; }
.btn {
  border: none; border-radius: 10px;
  padding: 10px 18px;
  font-size: 15px; font-weight: 600;
  cursor: pointer;
  background: #e2e9f0; color: #1c2733;
}
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.primary { background: var(--accent); color: #fff; font-size: 16px; }
.btn.primary.dirty { background: #e07b39; color: #fff; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { filter: brightness(1.18); } }
.btn.ghost { background: transparent; color: #cfdae5; border: 1px solid #44566b; }
.btn.danger { background: #f3ded9; color: var(--danger); }
.btn.tiny { padding: 4px 9px; font-size: 13px; font-weight: 400; }

#save-status { font-size: 13.5px; min-width: 130px; }
#save-status.ok { color: #9fd99f; }
#save-status.warn { color: #f0c36b; }

/* ---------- layout ---------- */
.wrap { display: flex; max-width: 1200px; margin: 0 auto; gap: 20px; padding: 20px; align-items: flex-start; }
.sidebar {
  flex: none; width: 220px;
  position: sticky; top: 70px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px;
}
.sidebar h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--soft); margin: 0 0 8px; }
.sidebar button.pagelink {
  display: block; width: 100%; text-align: left;
  background: none; border: none; cursor: pointer;
  padding: 9px 10px; border-radius: 8px; font-size: 15px; color: var(--ink);
}
.sidebar button.pagelink:hover { background: #eef3f8; }
.sidebar button.pagelink.active { background: var(--gold); color: #12314d; font-weight: 700; }
.sidebar .childlist { margin-left: 18px; border-left: 2px solid var(--line); padding-left: 4px; }
.sidebar button.childlink { font-size: 14px; padding: 7px 8px; }
.sidebar hr { border: none; border-top: 1px solid var(--line); margin: 12px 0; }

/* banner editor box inside the page card */
.banner-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px 6px;
  margin: 2px 0 14px;
  background: #f9fbfc;
}

.content { flex: 1; min-width: 0; }

/* ---------- cards ---------- */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  margin-bottom: 16px; overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: #f6f9fc; border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.card-head .kind {
  font-size: 11.5px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase;
  background: var(--gold); color: #12314d;
  border-radius: 12px; padding: 2px 10px;
}
.card-head .label { flex: 1; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-head .hintlabel { font-size: 12px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.card-body { padding: 14px 16px; display: none; }
.card.open .card-body { display: block; }

label.field { display: block; margin-bottom: 12px; }
label.field > span {
  display: block; font-size: 12.5px; font-weight: 700;
  color: var(--soft); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .4px;
}
input[type="text"], textarea {
  width: 100%;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 11px;
  font-size: 15px; font-family: inherit;
  background: #fcfdfe;
}
textarea { min-height: 90px; resize: vertical; line-height: 1.55; }
textarea.tall { min-height: 160px; }
input:focus, textarea:focus { outline: 2px solid var(--gold); border-color: var(--gold); }

/* ---------- item rows ---------- */
.item-row {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 10px;
  background: #f9fbfc;
}
.item-row .row-tools {
  display: flex; gap: 6px; justify-content: flex-end; margin-top: 6px;
}
.grid2 { display: grid; grid-template-columns: 1fr 130px; gap: 10px; }
.add-row { margin-top: 4px; }

.muted { color: var(--soft); font-size: 13px; }

/* ---------- field label used by rich fields ---------- */
.field-label, .field > .field-label {
  display: block; font-size: 12.5px; font-weight: 700;
  color: var(--soft); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .4px;
}
div.field { margin-bottom: 12px; }

/* ---------- rich text editor ---------- */
.rich-wrap { border: 1px solid var(--line); border-radius: 8px; background: #fcfdfe; overflow: hidden; }
.rt-toolbar {
  display: flex; gap: 2px; align-items: center; flex-wrap: wrap;
  background: #eef2f6; border-bottom: 1px solid var(--line);
  padding: 4px 6px;
}
.rt-btn {
  border: none; background: none; cursor: pointer;
  font-size: 14px; padding: 4px 8px; border-radius: 6px; color: var(--ink);
}
.rt-btn:hover { background: #dbe5ee; }
.rt-div {
  width: 1px; height: 18px; background: var(--line);
  margin: 0 5px; display: inline-block; flex: none;
}
.rt-select {
  border: 1px solid var(--line); border-radius: 6px;
  background: #fff; color: var(--ink);
  font-size: 12.5px; padding: 3px 4px; max-width: 92px;
  cursor: pointer;
}
.rt-select.rt-font { max-width: 130px; }
.rt-color {
  width: 26px; height: 24px; padding: 1px; border: 1px solid var(--line);
  border-radius: 6px; background: #fff; cursor: pointer;
}
.rich-area ul, .rich-area ol { margin: 0 0 10px; padding-left: 26px; }
.rich-area hr { border: none; border-top: 2px solid var(--line); margin: 12px 0; }
.rich-area {
  min-height: 90px; max-height: 420px; overflow-y: auto;
  padding: 10px 12px; outline: none;
  font-size: 15px; line-height: 1.55;
}
.rich-area.tall { min-height: 160px; }
.rich-area.compact { min-height: 44px; }
.rich-area:focus { box-shadow: inset 0 0 0 2px var(--gold); }
.rich-area p { margin: 0 0 10px; }
.rich-area p:last-child { margin-bottom: 0; }
.rich-area a { color: var(--accent); }

/* ---------- drag & drop ---------- */
.drag-grip { cursor: grab; color: var(--soft); font-size: 15px; }
.section-card.dragging, .pagelink.dragging { opacity: .2; }

/* sidebar page glowing while a section hovers over it (drop to move) */
.pagelink.drop-target, .child-chip.drop-target {
  background: #eaf3fd !important;
  box-shadow: inset 0 0 0 2px var(--accent),
    0 0 10px 2px color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 8px;
}

/* child page chips inside the page card */
.childcards {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0 4px;
}
.child-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #f9fbfc;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}
.child-chip.active { background: #eaf3fd; border-color: var(--accent); }
.parent-chip { font-weight: 600; }
.child-chip:hover { border-color: var(--accent); background: #eef5fc; }
.child-chip.dragging { opacity: .25; }
.chip-count {
  background: var(--gold);
  color: #12314d;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 1px 8px;
}
.childcards .drop-indicator {
  width: 4px;
  height: 30px;
  margin: 0 1px;
}

/* the small translucent chip that follows the mouse while dragging */
.drag-ghost {
  position: absolute;
  top: -1000px; left: -1000px;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(47, 128, 217, .65);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
  pointer-events: none;
  z-index: 500;
}

/* glowing line showing where the dragged item will land */
.drop-indicator {
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
  margin: 4px 8px;
  pointer-events: none;
  box-shadow:
    0 0 6px 1px color-mix(in srgb, var(--accent) 85%, transparent),
    0 0 16px 4px color-mix(in srgb, var(--accent) 45%, transparent);
  animation: dropGlow .9s ease-in-out infinite;
}
@keyframes dropGlow {
  50% {
    box-shadow:
      0 0 10px 2px color-mix(in srgb, var(--accent) 95%, transparent),
      0 0 24px 7px color-mix(in srgb, var(--accent) 55%, transparent);
  }
}

/* ---------- upload dropzones ---------- */
.dropzone {
  border: 2px dashed var(--gold);
  border-radius: 10px;
  background: #f2f8fe;
  color: #3f5c78;
  text-align: center;
  padding: 18px 14px;
  margin: 10px 0;
  cursor: pointer;
  font-size: 14.5px;
}
.dropzone:hover { background: #e6f1fc; }
.dropzone.dz-over { background: #d6e9fa; border-color: var(--accent); }
.dropzone.dz-local { cursor: default; border-style: dotted; color: var(--soft); background: #f6f8fa; }

/* ---------- photo rows ---------- */
.photo-row { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.photo-thumb {
  width: 86px; height: 86px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--line); background: #eee;
  flex: none;
}
.photo-fields { flex: 1; min-width: 220px; }
.photo-row .row-tools { width: 100%; }

/* ---------- toggle switches (checkboxes styled as switches) ---------- */
.check-row {
  display: flex; align-items: center; gap: 10px;
  margin: 6px 0 10px; cursor: pointer; font-size: 15px;
}
.check-row input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 34px; height: 18px;
  margin: 0;
  border-radius: 999px;
  background: #c6d0d9;
  position: relative;
  cursor: pointer;
  transition: background .18s ease;
  outline: none;
}
.check-row input::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform .18s ease;
}
.check-row input:checked { background: var(--accent); }
.check-row input:checked::after { transform: translateX(16px); }
.check-row input:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }

/* ---------- login overlay ---------- */
#login-overlay {
  position: fixed; inset: 0; z-index: 300;
  /* fully opaque — the editor must not be visible before logging in */
  background: #fff;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
#login-overlay.visible { display: flex; }
.login-box {
  background: #fff; border-radius: 16px; padding: 34px 38px;
  max-width: 400px; width: 100%; text-align: center;
  border: 1px solid var(--line);
  box-shadow: 0 10px 40px rgba(23, 43, 66, .12);
}
.login-box h2 { margin: 0 0 6px; }
.login-box p { color: var(--soft); margin: 0 0 18px; }
.login-box input {
  width: 100%; font-size: 17px; padding: 12px 14px; margin-bottom: 12px;
  border: 1px solid var(--line); border-radius: 10px;
}
.login-box .btn { width: 100%; padding: 12px; font-size: 16px; }
.login-msg { color: var(--danger); min-height: 20px; margin-top: 10px; }

/* ---------- modal actions ---------- */
.modal-actions {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px;
}

/* ---------- theme picker ---------- */
.theme-option {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  background: #f9fbfc;
}
.theme-option:hover { border-color: var(--gold); }
.theme-option.selected { border-color: var(--gold); background: #eaf3fd; }
.theme-option input { accent-color: var(--accent); width: 18px; height: 18px; }
.swatches { display: flex; gap: 3px; flex: none; }
.swatch {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.2);
  display: inline-block;
}
.theme-name { font-weight: 700; flex: none; min-width: 110px; }
.theme-desc { color: var(--soft); font-size: 13.5px; }

/* ---------- modal ---------- */
#modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(30,24,14,.55);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
#modal.visible { display: flex; }
#modal .box {
  background: #fff; border-radius: 14px; max-width: 540px;
  padding: 26px 30px; line-height: 1.65; font-size: 15.5px;
}
#modal .box h2 { margin-top: 0; }
@media (max-width: 760px) {
  .wrap { flex-direction: column; }
  .sidebar { position: static; width: 100%; }
  .content { width: 100%; }
}

/* ---------- components panel (distinct from page sections) ---------- */
.components-panel {
  margin-top: 22px;
  border: 2px dashed #a8bdd4;
  border-radius: 14px;
  background: #edf3fa;
  padding: 12px 16px 16px;
}
.components-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px; color: #33506b;
}
.components-head .label {
  font-weight: 800; font-size: 13px;
  letter-spacing: .8px; text-transform: uppercase;
}
.components-head .hintlabel { font-size: 12px; color: var(--soft); margin-left: auto; }
.comp-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.comp-btn {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  min-width: 96px; padding: 12px 14px 10px;
  background: #ffffff; border: 1px solid var(--line); border-radius: 11px;
  cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600; color: #33506b;
  transition: border-color .12s, box-shadow .12s, color .12s;
}
.comp-btn:hover {
  border-color: #4a90d9; color: #1d6fc4;
  box-shadow: 0 2px 10px rgba(40, 90, 150, .14);
}
.comp-btn .comp-icon svg { width: 21px; height: 21px; }

/* ---------- split block editor ---------- */
.split-edit {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px; margin: 4px 0 10px; align-items: start;
}
.split-col-box {
  border: 1px dashed #b4c3d6; border-radius: 10px;
  padding: 10px; background: #f6f9fc;
}
.split-col-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11.5px; font-weight: 800; letter-spacing: .6px;
  text-transform: uppercase; color: var(--soft); margin-bottom: 8px;
}
.split-col-box .section-card.nested { box-shadow: none; margin-bottom: 10px; }
.mini-comps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mini-comps .btn.tiny svg { width: 13px; height: 13px; }

/* Center the icon without affecting the header's layout height. */
.card-head .section-icon {
  position: relative; flex: 0 0 25px; align-self: stretch;
  margin: -10px 0; color: var(--accent);
}
.card-head .section-icon svg {
  position: absolute; left: 0; top: 50%; width: 25px; height: 25px;
  transform: translateY(-50%);
}

/* ---------- settings: narrower, taller menu cards ---------- */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px; align-items: start;
}
.settings-grid .card { margin: 0; }
.settings-card .card-head { padding: 22px 18px; }
.settings-headtext { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.settings-headtext .label { font-size: 16px; }
.settings-headtext .hintlabel { max-width: none; white-space: normal; }

/* ---------- admins list ---------- */
.admin-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 0; border-bottom: 1px solid var(--line);
}
.admin-row:last-child { border-bottom: none; }
.admin-email { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.owner-badge {
  background: var(--gold); color: #12314d;
  font-size: 10.5px; font-weight: 800; letter-spacing: .5px;
  padding: 2px 9px; border-radius: 10px;
}
.you-badge { font-size: 11px; color: var(--soft); font-style: italic; }
.temp-pass {
  font-family: ui-monospace, Menlo, monospace; font-size: 16px; font-weight: 700;
  background: #eef3fa; border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 12px; margin: 10px 0; text-align: center; user-select: all;
}
.login-help { margin: 12px 0 0; font-size: 13px; text-align: center; }
.login-help a { color: #9fc3ec; }

/* ---------- settings popups ---------- */
.settings-card { cursor: pointer; }
.settings-card .card-head { pointer-events: none; } /* clicks land on the card */
.settings-modal-body { margin: 6px 0 2px; max-height: 60vh; overflow: auto; }
.invite-note {
  background: #eef7ee; border: 1px solid #bfdfc2; border-radius: 10px;
  padding: 10px 12px; margin-bottom: 12px; font-size: 13.5px;
}
.invite-note .err { color: #b23b3b; font-weight: 600; }

/* ---------- my profile ---------- */
.profile-head { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 16px; }
.profile-ava-wrap { display: flex; flex-direction: column; align-items: center; gap: 7px; flex: none; }
.profile-ava {
  width: 76px; height: 76px; border-radius: 50%;
  background: #dbe7f4; color: #33506b;
  font-weight: 800; font-size: 26px; letter-spacing: 1px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; overflow: hidden;
  border: 2px solid var(--line);
}
.profile-ava:hover { border-color: #4a90d9; }
.profile-ava img { width: 100%; height: 100%; object-fit: cover; }
.profile-photo-btns { display: flex; gap: 5px; }
.profile-id { padding-top: 6px; min-width: 0; }
.profile-name { font-size: 19px; font-weight: 800; }
.profile-mail { color: var(--soft); font-size: 13px; margin: 3px 0 8px; overflow: hidden; text-overflow: ellipsis; }
.profile-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- sidebar user chip ---------- */
.user-chip {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 7px 10px;
  background: none; border: none; border-radius: 10px;
  cursor: pointer; font: inherit; font-size: 14px; font-weight: 700;
  color: #1f2937; text-align: left;
}
.user-chip:hover { background: #eef3fa; }
.chip-ava {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: #dbe7f4; color: #33506b;
  font-size: 11.5px; font-weight: 800; letter-spacing: .5px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.chip-ava img { width: 100%; height: 100%; object-fit: cover; }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- deletable separator lines in text boxes ---------- */
.rich-area hr { cursor: pointer; }
.rich-area hr:hover { outline: 2px solid #f0b4b4; outline-offset: 2px; }
.rich-area hr.hr-selected { outline: 2px solid #e05858; outline-offset: 2px; }
