/* ══════════════════════════════════════════════════════════════════
   Berkeley Professional Education — CMS edit-mode UI.
   Injected on every page by server.js; all rules are scoped under
   .cms-* (plus a body flag) so the public site is never affected.
   ══════════════════════════════════════════════════════════════════ */

.cms-ui, .cms-ui * { box-sizing: border-box; font-family: "DM Sans", -apple-system, sans-serif; }

/* ─────── Hover affordance on editable fields (edit mode only) ─────── */
body.cms-editing [data-cms],
body.cms-editing [data-cms-img],
body.cms-editing [data-cms-gallery] {
  outline: 1.5px dashed rgba(27, 132, 249, 0.0);
  outline-offset: 3px;
  transition: outline-color .15s ease;
}
body.cms-editing [data-cms]:hover,
body.cms-editing [data-cms-img]:hover,
body.cms-editing [data-cms-gallery]:hover {
  outline-color: rgba(27, 132, 249, 0.9);
  cursor: pointer;
}
body.cms-editing [data-cms].cms-active,
body.cms-editing [data-cms-img].cms-active,
body.cms-editing [data-cms-gallery].cms-active {
  outline: 2px solid #1B84F9;
  outline-offset: 3px;
}

/* Overlay gradients (scrims) above editable background images: in edit
   mode they pass pointer events through so the image underneath can be
   hovered. The overlay itself is never editable and never replaced. */
body.cms-editing .cms-overlay { pointer-events: none; }

/* "Edit background" chip — placed inside full-bleed background layers
   that sit underneath content and can't be reached by hovering. */
.cms-bg-chip {
  position: absolute; top: 14px; right: 14px; z-index: 6;
  display: inline-flex; align-items: center; gap: 7px;
  background: #1B84F9; color: #fff; border: 2px solid #fff;
  border-radius: 999px; padding: 7px 14px; cursor: pointer;
  font-family: "DM Sans", sans-serif; font-size: 12px; font-weight: 700;
  box-shadow: 0 4px 14px rgba(1,1,51,.35);
}
.cms-bg-chip:hover { background: #010133; }
.cms-bg-chip svg { pointer-events: none; }

/* Floating pencil button that follows the hovered field */
.cms-pencil {
  position: fixed; z-index: 9990;
  width: 30px; height: 30px; border-radius: 999px;
  background: #1B84F9; color: #fff; border: 2px solid #fff;
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(1,1,51,.35); cursor: pointer; padding: 0;
}
.cms-pencil.is-visible { display: inline-flex; }
.cms-pencil svg { pointer-events: none; }

/* ─────── Password gate ─────── */
.cms-gate {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(1,1,51,0.96);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.cms-gate-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: 8px;
  padding: 36px; box-shadow: 0 24px 60px rgba(0,0,0,.4);
}
.cms-gate-card h2 { font-family: "EB Garamond", serif; font-weight: 500; font-size: 26px; color: #010133; margin: 0 0 6px; }
.cms-gate-card p { font-size: 14px; color: #666; margin: 0 0 20px; line-height: 1.5; }
.cms-gate-card input[type="password"] {
  width: 100%; font-size: 15px; padding: 11px 13px; color: #010133;
  border: 1px solid #C7C7CE; border-radius: 4px; margin-bottom: 14px;
}
.cms-gate-error { color: #B3261E; font-size: 13px; margin: -6px 0 12px; display: none; }

/* ─────── Toolbar ─────── */
.cms-toolbar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  z-index: 9995; display: flex; align-items: center; gap: 10px;
  background: #010133; color: #fff; border: 1px solid rgba(253,181,21,.5);
  border-radius: 999px; padding: 8px 10px 8px 18px;
  box-shadow: 0 14px 40px rgba(1,1,51,.45);
  max-width: calc(100vw - 24px); flex-wrap: wrap; justify-content: center;
}
.cms-toolbar .cms-tb-label { font-size: 13px; font-weight: 600; white-space: nowrap; }
.cms-toolbar .cms-tb-label small { font-weight: 400; opacity: .65; margin-left: 6px; }
.cms-badge {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; background: #FDB515; color: #010133;
}
.cms-badge.is-clean { background: rgba(255,255,255,.16); color: #fff; }

/* ─────── Buttons ─────── */
.cms-btn {
  font-size: 13px; font-weight: 600; border-radius: 999px; cursor: pointer;
  padding: 8px 16px; border: 1px solid transparent; white-space: nowrap;
  transition: transform .15s ease, background .15s ease;
}
.cms-btn:hover { transform: translateY(-1px); }
.cms-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.cms-btn-gold { background: #FDB515; color: #010133; }
.cms-btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.cms-btn-navy { background: #010133; color: #fff; }
.cms-btn-outline { background: #fff; color: #010133; border-color: #C7C7CE; }
.cms-btn-danger { background: transparent; color: #FF8A80; border-color: rgba(255,138,128,.45); }

/* ─────── Floating editor panel ─────── */
.cms-panel {
  position: fixed; z-index: 9998; width: 400px; max-width: calc(100vw - 20px);
  background: #fff; border-radius: 10px; border: 1px solid #E4E4E4;
  box-shadow: 0 26px 64px rgba(1,1,51,.35);
  display: flex; flex-direction: column; max-height: min(560px, calc(100vh - 40px));
}
.cms-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px; border-bottom: 1px solid #EFEFEF;
}
.cms-panel-title { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #010133; }
.cms-panel-close { border: none; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: #666; padding: 2px 6px; }
.cms-panel-body { padding: 14px 16px; overflow: auto; }
.cms-panel-foot {
  display: flex; gap: 10px; justify-content: flex-end; align-items: center;
  padding: 12px 16px; border-top: 1px solid #EFEFEF;
}
.cms-panel-foot .cms-note { margin-right: auto; font-size: 12px; color: #B3261E; }

.cms-field-label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #666; margin: 12px 0 5px; }
.cms-field-label:first-child { margin-top: 0; }
.cms-field-label .req { color: #B3261E; }
.cms-input, .cms-textarea {
  width: 100%; font-size: 14px; color: #010133; padding: 9px 11px;
  border: 1px solid #C7C7CE; border-radius: 5px; background: #fff;
}
.cms-input.is-invalid { border-color: #B3261E; }
.cms-textarea { min-height: 110px; resize: vertical; line-height: 1.5; }

/* Mode tabs (Plain / Formatted) */
.cms-tabs { display: inline-flex; background: #F2F2F2; border-radius: 999px; padding: 3px; margin-bottom: 10px; }
.cms-tab {
  border: none; background: transparent; font-size: 12px; font-weight: 600;
  padding: 6px 14px; border-radius: 999px; cursor: pointer; color: #666;
}
.cms-tab.is-active { background: #010133; color: #fff; }

/* WYSIWYG */
.cms-rt-toolbar { display: flex; gap: 4px; margin-bottom: 6px; flex-wrap: wrap; }
.cms-rt-btn {
  width: 30px; height: 28px; border: 1px solid #DDD; background: #fff; border-radius: 5px;
  font-size: 13px; cursor: pointer; color: #010133; display: inline-flex; align-items: center; justify-content: center;
}
.cms-rt-btn:hover { background: #F2F2F2; }
.cms-rich {
  min-height: 120px; max-height: 260px; overflow: auto; padding: 10px 12px;
  border: 1px solid #C7C7CE; border-radius: 5px; font-size: 14px; line-height: 1.55; color: #1A1A1A;
}
.cms-rich:focus { outline: 2px solid rgba(27,132,249,.4); }
.cms-rich a { color: #002676; }

/* Image editor bits */
.cms-img-preview {
  width: 100%; height: 150px; border-radius: 6px; border: 1px solid #E4E4E4;
  background-color: #F2F2F2; background-size: cover; background-position: center; margin-bottom: 10px;
}
.cms-help { font-size: 12px; color: #666; line-height: 1.45; margin: 6px 0 0; }

/* ─────── Toasts ─────── */
.cms-toast-wrap { position: fixed; top: 16px; right: 16px; z-index: 10001; display: flex; flex-direction: column; gap: 8px; }
.cms-toast {
  background: #010133; color: #fff; border-radius: 8px; padding: 11px 16px;
  font-size: 13px; font-weight: 600; box-shadow: 0 10px 30px rgba(1,1,51,.35);
  border-left: 4px solid #FDB515; animation: cms-toast-in .25s ease both;
}
.cms-toast.is-error { border-left-color: #FF5449; }
@keyframes cms-toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

@media (max-width: 640px) {
  .cms-panel { left: 10px !important; right: 10px; width: auto; }
  .cms-toolbar { border-radius: 16px; }
}

/* ─────── Hero gallery editor ─────── */
.cms-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.cms-thumb {
  position: relative; width: 74px; height: 52px; border-radius: 6px;
  background-color: #F2F2F2; background-size: cover; background-position: center;
  border: 2px solid #DDD; cursor: pointer; padding: 0;
}
.cms-thumb.is-selected { border-color: #1B84F9; box-shadow: 0 0 0 2px rgba(27,132,249,.25); }
.cms-thumb.is-missing-alt::after {
  content: "!"; position: absolute; top: -6px; right: -6px; width: 16px; height: 16px;
  border-radius: 999px; background: #B3261E; color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.cms-gal-tools { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.cms-gal-tools .cms-btn { padding: 7px 12px; font-size: 12px; }

/* ═══════════════ In-page People picker (people-picker.js) ═══════════════
   Edit-mode only: a bar above every section driven by the global People
   system, plus the picker modal it opens. */
.cms-people-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 0 16px; padding: 10px 14px;
  background: #1B84F9; color: #fff; border-radius: 8px;
  font-family: "DM Sans", sans-serif;
  box-shadow: 0 6px 18px rgba(1,1,51,.28);
}
.cms-people-bar svg { flex-shrink: 0; }
.cms-people-bar .cms-pb-title { font-size: 13px; font-weight: 700; }
.cms-people-bar .cms-pb-state {
  font-size: 12px; color: rgba(255,255,255,.85);
  padding: 3px 10px; border-radius: 999px; background: rgba(255,255,255,.16);
}
.cms-people-bar .cms-pb-state.is-managed { background: rgba(253,181,21,.9); color: #010133; font-weight: 600; }
.cms-people-bar .cms-btn { margin-left: auto; padding: 7px 14px; font-size: 12px; }

/* Picker modal */
.cms-people-modal {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(1,1,51,0.72);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.cms-pp-card {
  width: 100%; max-width: 560px; max-height: min(80vh, 720px);
  background: #fff; border-radius: 10px; box-shadow: 0 24px 60px rgba(0,0,0,.4);
  display: flex; flex-direction: column; font-family: "DM Sans", sans-serif;
}
.cms-pp-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px; border-bottom: 1px solid #E4E4E4;
}
.cms-pp-head h2 { font-family: "EB Garamond", serif; font-weight: 500; font-size: 22px; color: #010133; margin: 0; }
.cms-pp-body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.cms-pp-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; border-top: 1px solid #E4E4E4;
}
.cms-pp-manage { margin-right: auto; font-size: 13px; font-weight: 600; color: #002676; text-decoration: none; }
.cms-pp-manage:hover { text-decoration: underline; }
.cms-pp-empty { font-size: 13px; color: #666; line-height: 1.55; background: #FAFAFA; border: 1px dashed #D9D9D9; border-radius: 8px; padding: 14px 16px; margin: 0 0 12px; }

.cms-pp-row {
  display: flex; align-items: center; gap: 10px;
  background: #FAFAFA; border: 1px solid #E4E4E4; border-radius: 8px;
  padding: 8px 10px; margin-bottom: 8px;
}
.cms-pp-avatar {
  width: 34px; height: 34px; border-radius: 999px; flex-shrink: 0;
  background: #E4E4E4 center/cover no-repeat;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #666;
}
.cms-pp-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cms-pp-name { font-size: 14px; font-weight: 600; color: #010133; line-height: 1.3; }
.cms-pp-role { font-size: 12px; color: #666; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cms-pp-label {
  flex: 0 0 150px; border: 1px solid #C7C7CE; border-radius: 6px;
  padding: 7px 9px; font-family: inherit; font-size: 13px; color: #010133; min-width: 0;
}
.cms-pp-tools { display: flex; gap: 2px; flex-shrink: 0; }
.cms-pp-tools button {
  width: 28px; height: 28px; border: 1px solid transparent; background: none;
  border-radius: 6px; cursor: pointer; color: #010133; font-size: 13px; line-height: 1;
}
.cms-pp-tools button:hover { background: #ECECEC; }
.cms-pp-tools button:disabled { opacity: .3; cursor: default; }
.cms-pp-tools button.is-danger { color: #B3261E; }

.cms-pp-add { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.cms-pp-add select {
  flex: 1; min-width: 0; border: 1px solid #C7C7CE; border-radius: 6px;
  padding: 9px 10px; font-family: inherit; font-size: 13px; color: #010133; background: #fff;
}
