/* content-editor.css — WYSIWYG content editor styles */

/* ─── Toolbar ──────────────────────────────────────────── */
.editor-toolbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  background: #1a1a2e; color: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,.3);
  font-family: 'Open Sans', sans-serif;
}
.toolbar-left { display: flex; align-items: center; gap: 16px; }
.toolbar-back {
  color: #8ecae6; text-decoration: none; font-weight: 600; font-size: 0.9rem;
  white-space: nowrap;
}
.toolbar-back:hover { color: #fff; }
.toolbar-title { font-weight: 700; font-size: 1rem; white-space: nowrap; }
.toolbar-center { flex: 1; display: flex; justify-content: center; }
.toolbar-section-nav {
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2);
  color: #fff; padding: 6px 12px; border-radius: 6px; font-size: 0.85rem;
  cursor: pointer; max-width: 220px;
}
.toolbar-section-nav option { background: #1a1a2e; color: #fff; }
.toolbar-right { display: flex; align-items: center; gap: 10px; }
.toolbar-draft-count {
  background: #3a86ff; color: #fff; padding: 3px 10px; border-radius: 12px;
  font-size: 0.8rem; font-weight: 600; display: none;
}
.toolbar-draft-count.visible { display: inline-block; }
.toolbar-btn {
  padding: 7px 16px; border: none; border-radius: 6px;
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
  white-space: nowrap; transition: background .2s;
}
.toolbar-btn-primary { background: #2d6a4f; color: #fff; }
.toolbar-btn-primary:hover { background: #40916c; }
.toolbar-btn-secondary { background: rgba(255,255,255,.15); color: #fff; }
.toolbar-btn-secondary:hover { background: rgba(255,255,255,.25); }

/* ─── Site wrapper ─────────────────────────────────────── */
.editor-mode .site-wrapper {
  margin-top: 56px;
}
.editor-mode .header {
  position: static;
}
.editor-mode .nav {
  position: static; display: flex !important;
  background: none; box-shadow: none;
  padding: 0; gap: 0;
  flex-wrap: wrap;
}
.editor-mode .nav a {
  color: inherit; opacity: .7; font-size: 0.85rem;
}
.editor-mode .hero { min-height: auto; padding: 60px 0 40px; }
.editor-mode .footer { position: static; }

/* ─── Edit handles ─────────────────────────────────────── */
[data-cms] { pointer-events: auto; }
[data-cms]::before, [data-cms]::after { cursor: pointer; }
.editor-img-btn {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px;
  background: #3a86ff; color: #fff;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; font-size: 14px; font-style: normal;
  cursor: pointer; z-index: 10;
  opacity: 0; transition: opacity .15s;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.editor-img-btn:hover { background: #2563eb; }
.editor-img-btn::before { content: none !important; opacity: 0 !important; }
.editor-img-btn::after { content: none !important; }
.hero:hover > .editor-img-btn,
.logo:hover > .editor-img-btn { opacity: 1; }

[data-cms] {
  position: relative;
  outline: 2px dashed transparent;
  outline-offset: 2px;
  border-radius: 4px;
  transition: outline-color .15s, background .15s;
  cursor: pointer;
}
[data-cms]:hover {
  outline-color: #3a86ff;
  background: rgba(58, 134, 255, .06);
}
[data-cms].editor-selected {
  outline-color: #3a86ff;
  outline-style: solid;
  background: rgba(58, 134, 255, .1);
}
[data-cms].has-draft {
  outline-color: #fb8500;
  outline-style: dashed;
}
[data-cms].has-draft::after {
  content: '';
  position: absolute; top: -4px; right: -4px;
  width: 10px; height: 10px;
  background: #fb8500; border-radius: 50%;
  border: 2px solid #fff;
}
[data-cms].has-draft:hover::after {
  background: #fb8500;
}

/* Edit pencil icon on hover */
[data-cms]::before {
  content: '✎';
  position: absolute; top: 2px; right: 2px;
  background: #3a86ff; color: #fff;
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px; font-size: 11px;
  opacity: 0; transform: scale(.7);
  transition: opacity .15s, transform .15s;
  pointer-events: none;
}
[data-cms]:hover::before {
  opacity: 1; transform: scale(1);
}
[data-cms].has-draft::before {
  background: #fb8500;
}

/* ─── Sidebar ──────────────────────────────────────────── */
.editor-sidebar {
  position: fixed; top: 0; right: -440px; bottom: 0;
  width: 420px; z-index: 1001;
  background: #16213e; color: #e0e0e0;
  box-shadow: -4px 0 24px rgba(0,0,0,.4);
  display: flex; flex-direction: column;
  transition: right .25s ease;
  font-family: 'Open Sans', sans-serif;
}
.editor-sidebar.open { right: 0; }
.editor-sidebar-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.4); display: none;
}
.editor-sidebar-overlay.open { display: block; }

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-header h3 { margin: 0; font-size: 1rem; font-weight: 700; }
.sidebar-close {
  background: none; border: none; color: #aaa; font-size: 1.5rem;
  cursor: pointer; line-height: 1;
}
.sidebar-close:hover { color: #fff; }

.sidebar-meta {
  padding: 10px 20px; font-size: 0.8rem; color: #888;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-body {
  flex: 1; overflow-y: auto; padding: 16px 20px;
}
.sidebar-footer {
  padding: 12px 20px; border-top: 1px solid rgba(255,255,255,.1);
}

.sidebar-field-group { margin-bottom: 20px; }
.sidebar-label {
  display: block; font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
  color: #8ecae6; margin-bottom: 6px;
}
.sidebar-readonly {
  background: rgba(255,255,255,.05); padding: 10px 12px;
  border-radius: 6px; font-size: 0.85rem; line-height: 1.5;
  color: #aaa; white-space: pre-wrap; word-break: break-word;
  max-height: 120px; overflow-y: auto;
}
.sidebar-draft-input, .sidebar-edit-input {
  width: 100%; padding: 10px 12px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
  border-radius: 6px; color: #fff; font-size: 0.85rem;
  font-family: inherit; resize: vertical;
  box-sizing: border-box;
}
.sidebar-draft-input:focus, .sidebar-edit-input:focus {
  outline: none; border-color: #3a86ff;
}
.sidebar-draft-actions, .sidebar-edit-actions {
  display: flex; gap: 8px; margin-top: 8px;
}
.sidebar-btn {
  padding: 7px 14px; border: none; border-radius: 6px;
  font-size: 0.8rem; font-weight: 600; cursor: pointer;
  transition: background .2s;
}
.sidebar-btn-primary { background: #2d6a4f; color: #fff; }
.sidebar-btn-primary:hover { background: #40916c; }
.sidebar-btn-secondary { background: rgba(255,255,255,.15); color: #fff; }
.sidebar-btn-secondary:hover { background: rgba(255,255,255,.25); }
.sidebar-btn-danger { background: #d00; color: #fff; }
.sidebar-btn-danger:hover { background: #f44; }
.sidebar-btn-ghost { background: rgba(255,255,255,.08); color: #aaa; }
.sidebar-btn-ghost:hover { background: rgba(255,255,255,.15); color: #fff; }

/* ─── Multi-field editor (ingredients) ─────────────────── */
.multi-field { margin-bottom: 14px; }
.multi-field-label {
  display: block; font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
  color: #8ecae6; margin-bottom: 4px;
}
.multi-field-input {
  width: 100%; padding: 8px 10px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
  border-radius: 6px; color: #fff; font-size: 0.85rem;
  font-family: inherit; resize: vertical; box-sizing: border-box;
}
.multi-field-input:focus { outline: none; border-color: #3a86ff; }
.multi-field-input.multi-field-short { resize: none; }
.multi-field-row { display: flex; gap: 10px; }
.multi-field-row .multi-field { flex: 1; }
.multi-field-actions { display: flex; gap: 8px; margin-top: 12px; }

/* ─── FAQ details/summary ─────────────────────────────── */
.faq-item details.faq-details { margin-bottom: 8px; }
.faq-item summary.faq-summary {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; cursor: pointer;
  background: rgba(255,255,255,.03); border-radius: 8px;
  font-weight: 600; font-size: 0.95rem; list-style: none;
}
.faq-item summary.faq-summary::-webkit-details-marker { display: none; }
.faq-item summary.faq-summary .faq-icon { margin-left: auto; transition: transform .2s; }
.faq-item details.faq-details[open] > summary .faq-icon { transform: rotate(45deg); }
.faq-item .faq-answer-body { padding: 8px 16px 16px; color: var(--clr-text-muted, #888); font-size: 0.9rem; line-height: 1.6; }
.faq-edit-row { display: flex; gap: 8px; margin-top: 8px; padding: 0 16px 12px; }
.faq-edit-btn {
  padding: 5px 12px; border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.06); color: #aaa; border-radius: 4px;
  font-size: 0.75rem; cursor: pointer; font-weight: 600;
}
.faq-edit-btn:hover { background: rgba(255,255,255,.12); color: #fff; }

/* ─── History modal ────────────────────────────────────── */
.history-modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,.6); display: none;
  align-items: center; justify-content: center;
}
.history-modal-overlay.open { display: flex; }
.history-modal {
  background: #16213e; color: #e0e0e0;
  border-radius: 12px; width: 600px; max-width: 90vw;
  max-height: 80vh; display: flex; flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
}
.history-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,.1);
}
.history-modal-header h3 { margin: 0; font-size: 1rem; }
.history-modal-close {
  background: none; border: none; color: #aaa; font-size: 1.5rem;
  cursor: pointer;
}
.history-modal-close:hover { color: #fff; }
.history-modal-body {
  flex: 1; overflow-y: auto; padding: 16px 20px;
}
.history-modal-footer {
  padding: 12px 20px; border-top: 1px solid rgba(255,255,255,.1);
  text-align: center;
}

.history-entry {
  padding: 12px 16px; margin-bottom: 10px;
  background: rgba(255,255,255,.05); border-radius: 8px;
  border-left: 3px solid #3a86ff;
}
.history-entry.current { border-left-color: #2d6a4f; }
.history-entry-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.history-entry-version {
  font-weight: 700; font-size: 0.85rem;
}
.history-entry-date { font-size: 0.8rem; color: #888; }
.history-entry-editor { font-size: 0.75rem; color: #666; }
.history-entry-value {
  font-size: 0.8rem; color: #aaa; white-space: pre-wrap;
  word-break: break-word; max-height: 60px; overflow: hidden;
}
.history-entry-restore {
  margin-top: 8px; padding: 5px 12px;
  background: #2d6a4f; color: #fff; border: none;
  border-radius: 4px; font-size: 0.75rem; font-weight: 600;
  cursor: pointer;
}
.history-entry-restore:hover { background: #40916c; }

/* ─── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
  .editor-toolbar { padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
  .toolbar-section-nav { max-width: 150px; }
  .toolbar-btn { padding: 6px 10px; font-size: 0.8rem; }
  .editor-sidebar { width: 100%; right: -100%; }
}
