

/* ── Page Toolbar ── */
.editor-toolbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: #1a1a2e;
  color: #eee;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 0.85rem;
  box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.3);
  flex-wrap: wrap;
  opacity: 0.55;
  transition: opacity 0.3s ease;
}
.editor-toolbar:hover {
  opacity: 1;
}
body.editor-active .editor-toolbar {
  opacity: 1;
}
body:not(.editor-active) .editor-tb-btn[data-action="save"],
body:not(.editor-active) .editor-tb-btn[data-action="add-section"],
body:not(.editor-active) .editor-tb-btn[data-action="reset"] {
  display: none;
}
.editor-toolbar .tb-label {
  font-weight: 600;
  margin-right: 8px;
  color: #aaa;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.editor-tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: #eee;
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.editor-tb-btn:hover {
  background: rgba(255,255,255,0.18);
}
.editor-tb-btn.tb-save {
  background: #27ae60;
  border-color: #27ae60;
  color: #fff;
}
.editor-tb-btn.tb-save:hover {
  background: #2ecc71;
}
.editor-tb-btn.tb-danger {
  background: rgba(192, 57, 43, 0.3);
  border-color: rgba(192, 57, 43, 0.4);
}
.editor-tb-btn.tb-danger:hover {
  background: rgba(192, 57, 43, 0.6);
}
.editor-tb-btn.tb-success {
  background: #2980b9;
  border-color: #2980b9;
}
.editor-tb-btn.tb-success:hover {
  background: #3498db;
}
.editor-tb-spacer {
  flex: 1;
}
.editor-tb-status {
  font-size: 0.78rem;
  color: #888;
  margin-left: auto;
}

/* ── Section Controls ── */
.editor-section {
  position: relative;
  transition: all 0.3s ease;
}
body.editor-active .editor-section:hover {
  outline: 2px dashed #00b894;
  outline-offset: 4px;
}
.editor-section.is-editing {
  outline: 2px solid rgba(2, 91, 75, 0.5);
  outline-offset: 2px;
}

.editor-section-controls {
  position: absolute;
  top: -36px;
  right: 0;
  display: none;
  align-items: center;
  gap: 2px;
  padding: 3px 6px;
  background: #1a1a2e;
  border-radius: 8px 8px 0 0;
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.15);
  white-space: nowrap;
}
.editor-section.controls-visible > .editor-section-controls,
.editor-section.is-editing > .editor-section-controls {
  display: flex;
}
.editor-section:first-child .editor-section-controls {
  top: -36px;
}

.editor-sc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #ccc;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}
.editor-sc-btn:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}
.editor-sc-btn.sc-add {
  color: #2ecc71;
}
.editor-sc-btn.sc-delete:hover {
  background: rgba(192, 57, 43, 0.5);
  color: #fff;
}
.editor-sc-btn[data-copy]:hover {
  background: rgba(52, 152, 219, 0.5);
  color: #fff;
}
.editor-sc-btn[data-paste]:hover {
  background: rgba(46, 204, 113, 0.5);
  color: #fff;
}

/* separator between button groups */
.sc-sep {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: rgba(255,255,255,0.15);
  margin: 0 2px;
  flex-shrink: 0;
}

/* copied section indicator */
.editor-section.is-copied {
  outline: 3px solid #3498db !important;
  outline-offset: 3px;
  animation: pulseCopy 1.5s ease-in-out infinite;
}
@keyframes pulseCopy {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(52, 152, 219, 0); }
}

/* ── Content in Edit Mode ── */
body.editor-active main,
body.editor-active [contenteditable="true"] {
  cursor: text;
}
body.editor-active img:not(.brand-logo):not(.hero-bg):not(.no-edit) {
  cursor: pointer;
  outline: 2px solid transparent;
  transition: outline 0.2s ease;
}
body.editor-active img:not(.brand-logo):not(.hero-bg):not(.no-edit):hover {
  outline: 2px dashed rgba(2, 91, 75, 0.5);
}
body.editor-active [contenteditable="true"]:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 2px;
  box-shadow: 0 0 0 2px rgba(2, 91, 75, 0.2);
}

/* ── Image Editor Overlay ── */
.editor-img-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
.editor-img-panel {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  font-family: var(--font-body, 'Inter', sans-serif);
}
.editor-img-panel h3 {
  margin: 0 0 16px;
  font-size: 1.2rem;
}
.editor-img-panel .img-current {
  display: block;
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
  margin-bottom: 16px;
  border-radius: 8px;
}
.editor-img-panel input[type="url"],
.editor-img-panel input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 12px;
  box-sizing: border-box;
}
.editor-img-panel .img-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.editor-img-panel .img-actions button {
  padding: 8px 20px;
  border-radius: 8px;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.editor-img-panel .img-actions .img-cancel {
  background: #eee;
  color: #555;
}
.editor-img-panel .img-actions .img-cancel:hover {
  background: #ddd;
}
.editor-img-panel .img-actions .img-apply {
  background: var(--color-primary, #025B4B);
  color: #fff;
}
.editor-img-panel .img-actions .img-apply:hover {
  opacity: 0.9;
}
.editor-img-panel .img-hint {
  font-size: 0.8rem;
  color: #999;
  text-align: center;
  margin-bottom: 12px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Notification Toast ── */
.editor-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 99999;
  padding: 12px 28px;
  border-radius: 12px;
  background: #1a1a2e;
  color: #eee;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 0.9rem;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}
.editor-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.editor-toast.toast-success {
  background: #27ae60;
}
.editor-toast.toast-error {
  background: #c0392b;
}

/* ── Responsive ── */
@media (max-width: 768px) {

  .editor-toolbar {
    padding: 8px 12px;
    gap: 4px;
  }
  .editor-tb-btn {
    padding: 5px 8px;
    font-size: 0.75rem;
  }
  .editor-section-controls {
    top: auto;
    bottom: 0;
    border-radius: 0 8px 0 8px;
    gap: 1px;
    padding: 2px 4px;
  }
  .editor-section:hover {
    outline-width: 1px;
  }
  .editor-img-panel {
    padding: 24px;
}

/* ── Inline Text Formatting Toolbar ── */
.editor-text-toolbar {
  position: absolute;
  z-index: 10000;
  display: flex;
  background: #1a1a2e;
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition: opacity 0.15s ease, transform 0.15s ease;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) translateX(-50%);
  margin-top: -10px;
}
.editor-text-toolbar.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) translateX(-50%);
}
.editor-text-toolbar::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -6px;
  border-width: 6px;
  border-style: solid;
  border-color: #1a1a2e transparent transparent transparent;
}
.editor-text-btn {
  background: transparent;
  border: none;
  color: #fff;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-weight: bold;
  transition: background 0.2s ease;
}
.editor-text-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}
.editor-text-btn i {
  font-style: italic;
}
.editor-text-btn u {
  text-decoration: underline;
}
.editor-text-btn.is-active {
  color: #2ecc71;
  background: rgba(46, 204, 113, 0.15);
}
