/* =====================================================
   UNC Management — Inline Site Editor Styles
   ===================================================== */

:root {
  --tb-h: 48px;
  --cms-green: #1a5c3a;
  --cms-green-dark: #144a2e;
}

/* ── Body offset when edit mode is on ── */
body.cms-edit-mode .nav-header {
  top: var(--tb-h) !important;
}
body.cms-edit-mode .hero {
  padding-top: var(--tb-h);
}

/* =====================================================
   EDITING TOOLBAR
   ===================================================== */
#cms-toolbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--tb-h);
  background: #111827;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 16px;
  z-index: 99999;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  border-bottom: 2px solid var(--cms-green);
}

.cms-tb-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.cms-tb-logo {
  height: 30px;
  width: auto;
  border-radius: 6px;
  display: block;
  flex-shrink: 0;
}

.cms-tb-mode {
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.cms-tb-badge {
  background: rgba(26,92,58,0.4);
  border: 1px solid var(--cms-green);
  color: #6ee7b7;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  letter-spacing: 0.04em;
}

.cms-tb-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.cms-tb-hint {
  color: #6b7280;
  font-size: 13px;
}

.cms-tb-unsaved {
  color: #fbbf24;
  font-size: 13px;
  font-weight: 500;
}
.cms-tb-unsaved.hidden { display: none; }
.cms-tb-hint.hidden { display: none; }

.cms-tb-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cms-tb-btn {
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.cms-tb-save {
  background: var(--cms-green);
  color: #fff;
}
.cms-tb-save:hover { background: var(--cms-green-dark); }
.cms-tb-save:disabled { opacity: 0.6; cursor: not-allowed; }

.cms-tb-settings {
  background: rgba(255,255,255,0.08);
  color: #d1d5db;
}
.cms-tb-settings:hover { background: rgba(255,255,255,0.14); color: #fff; }

.cms-tb-exit {
  background: rgba(220,38,38,0.15);
  color: #fca5a5;
}
.cms-tb-exit:hover { background: rgba(220,38,38,0.25); color: #fca5a5; }

/* =====================================================
   EDITABLE ELEMENTS
   ===================================================== */
body.cms-edit-mode .cms-editable {
  position: relative;
  outline: 2px dashed transparent;
  outline-offset: 4px;
  border-radius: 3px;
  cursor: pointer !important;
  transition: outline-color 0.15s;
}

body.cms-edit-mode .cms-editable::after {
  content: '✏ Edit';
  position: absolute;
  top: -22px;
  left: 0;
  background: var(--cms-green);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s, transform 0.15s;
  pointer-events: none;
  z-index: 1000;
  letter-spacing: 0.04em;
}

body.cms-edit-mode .cms-editable:hover {
  outline-color: var(--cms-green);
  background: rgba(26,92,58,0.05);
}

body.cms-edit-mode .cms-editable:hover::after {
  opacity: 1;
  transform: translateY(0);
}

body.cms-edit-mode .cms-editable.cms-edited {
  outline-color: #f59e0b;
}

/* =====================================================
   POPOVER
   ===================================================== */
#cms-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.2);
  z-index: 100000;
  backdrop-filter: blur(1px);
}
#cms-overlay.active { display: block; }

#cms-popover {
  display: none;
  position: absolute;
  width: 400px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border-radius: 12px;
  box-shadow:
    0 4px 6px rgba(0,0,0,0.05),
    0 20px 60px rgba(0,0,0,0.2),
    0 0 0 1px rgba(0,0,0,0.06);
  z-index: 100001;
  font-family: 'Inter', sans-serif;
  overflow: hidden;
  animation: popIn 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#cms-popover.active { display: block; }

@keyframes popIn {
  from { opacity: 0; transform: scale(0.94) translateY(-6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.cms-pop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

#cms-pop-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.01em;
}

#cms-pop-close {
  width: 26px; height: 26px;
  border: none;
  background: #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #6b7280;
  transition: background 0.15s;
  font-family: inherit;
}
#cms-pop-close:hover { background: #d1d5db; color: #111827; }

.cms-pop-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 50vh;
  overflow-y: auto;
}

.cms-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cms-field label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cms-field input,
.cms-field textarea {
  padding: 9px 12px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: #111827;
  outline: none;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
  line-height: 1.5;
}
.cms-field input:focus,
.cms-field textarea:focus {
  border-color: var(--cms-green);
  box-shadow: 0 0 0 3px rgba(26,92,58,0.1);
}

.cms-pop-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}

#cms-pop-cancel {
  padding: 8px 16px;
  border: 1.5px solid #e5e7eb;
  background: #fff;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  color: #374151;
  transition: background 0.15s;
}
#cms-pop-cancel:hover { background: #f3f4f6; }

#cms-pop-update {
  padding: 8px 18px;
  background: var(--cms-green);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
#cms-pop-update:hover { background: var(--cms-green-dark); }

/* =====================================================
   TOAST
   ===================================================== */
#cms-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--cms-green);
  color: #fff;
  padding: 12px 22px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 200000;
  white-space: nowrap;
}
#cms-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
#cms-toast.error { background: #dc2626; }

/* ── Mobile tweaks ── */
@media (max-width: 600px) {
  #cms-toolbar { padding: 0 12px; }
  .cms-tb-mode { display: none; }
  .cms-tb-hint { display: none; }
  .cms-tb-btn { padding: 6px 10px; font-size: 12px; }
  #cms-popover { width: calc(100vw - 24px); left: 12px !important; }
}
