/* ============================================================
   OMG Tamworth — admin / inline-editing UI
   Only ever visible to a logged-in owner. Deliberately styled
   distinct from the public site (dark admin chrome) but using
   the brand palette so it still feels like OMG.
   ============================================================ */

:root {
  --cms-dark: #1c1230;
  --cms-magenta: #DA1C5C;
  --cms-aqua: #55C2B8;
  --cms-yellow: #FFDE40;
}

/* ---- toolbar ---- */
.cms-toolbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  background: var(--cms-dark);
  color: #fff;
  font-family: 'Century Gothic', sans-serif;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
  flex-wrap: wrap;
}

.cms-toolbar__brand {
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--cms-yellow);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.cms-toolbar__brand::before {
  content: '\1F369';
}

.cms-toolbar__spacer { flex: 1; }

.cms-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  user-select: none;
}
.cms-switch input { width: 18px; height: 18px; accent-color: var(--cms-aqua); cursor: pointer; }

.cms-dirty {
  color: var(--cms-yellow);
  font-size: 0.82rem;
  font-weight: 600;
}

/* keep page content clear of the fixed bar */
body.cms-has-toolbar { padding-bottom: 64px; }

/* ---- buttons ---- */
.cms-btn {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #fff;
  background: rgba(255,255,255,0.12);
}
.cms-btn:hover { background: rgba(255,255,255,0.22); }
.cms-btn--primary { background: var(--cms-magenta); }
.cms-btn--primary:hover { background: #c01850; }
.cms-btn--ghost { background: rgba(255,255,255,0.10); }
.cms-btn--danger { background: transparent; color: #ff8ba7; border: 1px solid rgba(255,139,167,0.5); }
.cms-btn--danger:hover { background: rgba(255,139,167,0.15); }
.cms-btn--sm { padding: 5px 12px; font-size: 0.78rem; }

/* The Menu/Locations drawers have a LIGHT background, but the base button is
   white-on-transparent (styled for the dark toolbar). Re-style the buttons
   that live inside the drawer body so they're actually visible. */
.cms-drawer .cms-loc-section .cms-btn--ghost {
  color: var(--cms-dark);
  background: #eaf7f5;
  border: 1px dashed var(--cms-aqua);
}
.cms-drawer .cms-loc-section .cms-btn--ghost:hover {
  background: #d7efeb;
}
.cms-drawer .cms-loc-section .cms-btn--danger {
  color: #c01850;
  border-color: rgba(192,24,80,0.45);
}
.cms-drawer .cms-loc-section .cms-btn--danger:hover {
  background: rgba(192,24,80,0.10);
}

/* per-stop photo control in the Locations drawer */
.cms-locimg { display: flex; flex-direction: column; gap: 6px; min-width: 130px; }
.cms-locimg__thumb {
  width: 100%;
  height: 52px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  background-color: #eee;
  border: 1px solid #ddd;
}
.cms-locimg__ctrls { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- editable highlights ---- */
body.cms-editing [data-cms-text].cms-editable {
  outline: 2px dashed var(--cms-aqua);
  outline-offset: 3px;
  border-radius: 4px;
  cursor: text;
  transition: outline-color 0.2s ease;
}
body.cms-editing [data-cms-text].cms-editable:hover,
body.cms-editing [data-cms-text].cms-editable:focus {
  outline-color: var(--cms-magenta);
  outline-style: solid;
}

body.cms-editing [data-cms-img].cms-img-editable {
  outline: 3px solid var(--cms-magenta);
  outline-offset: 2px;
  cursor: pointer;
  position: relative;
}
body.cms-editing [data-cms-img].cms-img-editable::after {
  content: 'Click to change image';
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: var(--cms-magenta);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 50px;
  pointer-events: none;
}

/* ---- modal (login) ---- */
.cms-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100001;
  background: rgba(20,10,35,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.cms-modal {
  background: #fff;
  color: #222;
  border-radius: 16px;
  padding: 32px;
  width: 90%;
  max-width: 380px;
  font-family: 'Century Gothic', sans-serif;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  border-top: 6px solid var(--cms-magenta);
}
.cms-modal h3 { font-size: 1.3rem; margin-bottom: 6px; color: var(--cms-dark); }
.cms-modal p { font-size: 0.9rem; color: #666; margin-bottom: 18px; }

.cms-input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-family: inherit;
  font-size: 1rem;
}
.cms-input:focus { outline: none; border-color: var(--cms-aqua); box-shadow: 0 0 0 3px rgba(85,194,184,0.2); }
.cms-input--sm { padding: 7px 10px; font-size: 0.85rem; border-radius: 8px; }

.cms-modal__actions { display: flex; gap: 10px; margin-top: 18px; }
.cms-modal__actions .cms-btn { color: #fff; }
.cms-modal__actions .cms-btn--ghost { background: #ececec; color: #444; }
.cms-modal__actions .cms-btn--ghost:hover { background: #dcdcdc; }
.cms-login__err { margin-top: 12px; font-size: 0.85rem; color: var(--cms-magenta); min-height: 1em; }

/* ---- unsaved-changes confirm (sits above the drawer) ---- */
.cms-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 100002;
  background: rgba(20,10,35,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.cms-confirm {
  background: #fff;
  color: #222;
  border-radius: 16px;
  padding: 28px;
  width: 90%;
  max-width: 380px;
  font-family: 'Century Gothic', sans-serif;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  border-top: 6px solid var(--cms-magenta);
}
.cms-confirm h4 { font-size: 1.15rem; margin: 0 0 6px; color: var(--cms-dark); }
.cms-confirm p { font-size: 0.9rem; color: #666; margin: 0 0 18px; }
.cms-confirm__btns { display: flex; gap: 10px; justify-content: flex-end; }
.cms-confirm__btns .cms-btn--ghost { background: #ececec; color: #444; }
.cms-confirm__btns .cms-btn--ghost:hover { background: #dcdcdc; }
.cms-confirm__btns .cms-btn--danger { background: var(--cms-magenta); color: #fff; border: none; }
.cms-confirm__btns .cms-btn--danger:hover { background: #b31550; }

/* ---- locations drawer ---- */
.cms-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 100001;
  background: rgba(20,10,35,0.5);
  display: flex;
  justify-content: flex-end;
}
.cms-drawer {
  width: min(760px, 96vw);
  height: 100%;
  background: #f6f4fa;
  color: #222;
  overflow-y: auto;
  font-family: 'Century Gothic', sans-serif;
  box-shadow: -10px 0 40px rgba(0,0,0,0.3);
  animation: cmsDrawerIn 0.25s ease;
}
@keyframes cmsDrawerIn { from { transform: translateX(30px); opacity: 0.5; } to { transform: none; opacity: 1; } }

.cms-drawer__head {
  position: sticky;
  top: 0;
  background: var(--cms-dark);
  color: #fff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 2;
}
.cms-drawer__head h3 { font-size: 1.2rem; }

.cms-loc-section {
  background: #fff;
  margin: 18px;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.cms-loc-section h4 {
  font-size: 1rem;
  color: var(--cms-magenta);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cms-loc-hint, .cms-drawer__hint { font-size: 0.8rem; color: #888; margin-bottom: 12px; }

.cms-loc-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  padding: 12px 0;
  border-bottom: 1px dashed #e2e2e2;
}
.cms-loc-row:last-of-type { border-bottom: none; }

.cms-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.72rem; color: #777; }
.cms-field > span { font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.cms-field--check { flex-direction: row; align-items: center; gap: 8px; }
.cms-field--check input { width: 18px; height: 18px; accent-color: var(--cms-magenta); }

/* A flavour/drizzle switched off in the Menu drawer: still listed for the
   owner, but not orderable until it's ticked back on. */
.cms-loc-row.cms-row--off .cms-input { opacity: 0.5; text-decoration: line-through; }
.cms-field--check .cms-avail__tag {
  font-size: 0.66rem;
  font-weight: 700;
  color: #c01850;
  background: rgba(192,24,80,0.10);
  padding: 3px 8px;
  border-radius: 999px;
}

/* Monthly "on which weeks" (1st–5th) selector */
.cms-weeks__opts { display: flex; flex-wrap: wrap; gap: 6px 12px; padding-top: 3px; }
.cms-weeks__opt {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #444;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}
.cms-weeks__opt input { width: 16px; height: 16px; accent-color: var(--cms-magenta); }

.cms-drawer__foot {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-top: 1px solid #e2e2e2;
}

/* ---- toast ---- */
.cms-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--cms-dark);
  color: #fff;
  padding: 12px 22px;
  border-radius: 50px;
  font-family: 'Century Gothic', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 100002;
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  border-left: 4px solid var(--cms-aqua);
}
.cms-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.cms-toast--error { border-left-color: var(--cms-magenta); }

@media (max-width: 600px) {
  .cms-toolbar { gap: 8px; padding: 8px 10px; }
  .cms-toolbar__brand span { display: none; }
  .cms-loc-row .cms-field { flex: 1 1 45%; }
}

/* ---- rich-text floating format bar ---- */
.cms-fmt {
  position: fixed;
  z-index: 100002;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: var(--cms-dark);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.35);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.cms-fmt[hidden] { display: none; }
.cms-fmt__b {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.cms-fmt__b:hover { background: rgba(255,255,255,0.14); }
.cms-fmt__b.is-active { background: var(--cms-aqua); color: var(--cms-dark); }
.cms-fmt__b b, .cms-fmt__b i, .cms-fmt__b u { font-style: inherit; }
.cms-fmt__linkbox {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-left: 4px;
  margin-left: 2px;
  border-left: 1px solid rgba(255,255,255,0.2);
}
.cms-fmt__linkbox[hidden] { display: none; }
.cms-fmt__url {
  width: 180px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 6px;
  background: #fff;
  color: #1c1230;
  font-size: 13px;
}
.cms-fmt__apply {
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: var(--cms-magenta);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}
.cms-fmt__cancel {
  height: 28px;
  width: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}
.cms-fmt__cancel:hover { background: rgba(255,255,255,0.14); }

/* ---- Fundraisers drawer ------------------------------------------------- */
/* Each fundraiser is its own clearly-separated boxed card — no accent bar. */
.cms-fr-card {
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  background: #fcfcfc;
  padding: 18px;
  margin-bottom: 20px;
  align-items: flex-start;      /* top-align fields so every label sits on one line */
  gap: 14px 16px;
}
.cms-fr-card:last-of-type { margin-bottom: 8px; }
.cms-fr-card .cms-field { flex: 1 1 190px; }
/* Long inputs (intro, collection details, shareable link) get a full-width row. */
.cms-fr-card .cms-field:has(textarea),
.cms-fr-card .cms-field:has(.cms-fr-link) { flex-basis: 100%; }
.cms-fr-card .cms-field--check { flex: 0 0 auto; align-self: center; }
.cms-fr-card > .cms-btn--danger { align-self: center; margin-left: auto; }

.cms-fr-link { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cms-fr-link__url { flex: 1 1 auto; font-size: 0.78rem; background: rgba(0,0,0,0.05); padding: 6px 10px; border-radius: 6px; word-break: break-all; }
