/* ═══════════════════════════════════
   Frontend Editor – Slideout Panel
   ═══════════════════════════════════ */

/* No scroll when panel is open */
body.fe-no-scroll {
  overflow: hidden;
}

/* ── Overlay ── */
#fe-overlay {
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
#fe-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── Slideout Panel ── */
#fe-slideout {
  position: fixed;
  top: 0;
  right: 0;
  width: 560px;
  max-width: 92vw;
  height: 100vh;
  z-index: 99999;
  background: #fff;
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.12);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#fe-slideout.is-open {
  transform: translateX(0);
}

/* ── Header ── */
.fe-slideout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
  background: #fafafa;
}
.fe-slideout-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #111;
  text-transform: capitalize;
}
#fe-close-slideout {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: #6b7280;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
#fe-close-slideout:hover {
  background: #f3f4f6;
  color: #111;
}

/* ── Body / Form Container ── */
#fe-slideout-body {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* ── Loading State ── */
.fe-loading {
  text-align: center;
  color: #9ca3af;
  padding: 60px 20px;
  font-size: 14px;
}

/* ── Error State ── */
.fe-error {
  color: #dc2626;
  padding: 20px;
  background: #fef2f2;
  border-radius: 8px;
  font-size: 14px;
}


/* ═══════════════════════════════════
   Form Fields
   ═══════════════════════════════════ */
.fe-field {
  margin-bottom: 24px;
}
.fe-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.fe-field input[type="text"],
.fe-field input[type="url"],
.fe-field textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #111;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.fe-field input[type="text"]:focus,
.fe-field input[type="url"]:focus,
.fe-field textarea:focus {
  outline: none;
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}
.fe-field textarea {
  resize: vertical;
  min-height: 90px;
}

/* ── Button fields (title + url) ── */
.fe-button-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Image Picker ── */
.fe-image-picker {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px;
  background: #fafafa;
}
.fe-image-preview {
  margin-bottom: 12px;
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fe-image-preview img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}
.fe-image-placeholder {
  color: #9ca3af;
  font-size: 13px;
  padding: 30px;
}
.fe-image-actions {
  display: flex;
  gap: 8px;
}

/* ── WYSIWYG overrides inside slideout ── */
.fe-wysiwyg-wrap {
  border-radius: 8px;
  overflow: hidden;
}
.fe-wysiwyg-wrap .wp-editor-container {
  border: 1px solid #d1d5db;
  border-radius: 8px;
}
.fe-wysiwyg-wrap .mce-panel {
  border-color: #e5e7eb !important;
}

/* ── Form Actions ── */
.fe-form-actions {
  display: flex;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
  margin-top: 8px;
}


/* ═══════════════════════════════════
   Buttons
   ═══════════════════════════════════ */
.fe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  font-family: inherit;
  line-height: 1.4;
}
.fe-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.fe-btn-primary {
  background: #111;
  color: #fff;
}
.fe-btn-primary:hover:not(:disabled) {
  background: #333;
}

.fe-btn-secondary {
  background: #e5e7eb;
  color: #374151;
}
.fe-btn-secondary:hover:not(:disabled) {
  background: #d1d5db;
}

.fe-btn-ghost {
  background: transparent;
  color: #6b7280;
}
.fe-btn-ghost:hover:not(:disabled) {
  background: #f3f4f6;
  color: #111;
}


/* ═══════════════════════════════════
   Edit Button on Sections
   ═══════════════════════════════════ */
.fe-edit-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #fff;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s, transform 0.2s, background 0.15s;
  pointer-events: none;
}
.fe-edit-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}
.fe-editable:hover .fe-edit-btn,
.fe-edit-btn:focus {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.fe-edit-btn:hover {
  background: rgba(0, 0, 0, 0.9);
}

/* ── Hover outline on editable sections ── */
.fe-editable {
  position: relative;
  transition: outline 0.2s;
}
.fe-editable.fe-hover {
  outline: 2px dashed rgba(0, 0, 0, 0.2);
  outline-offset: -2px;
}


/* ═══════════════════════════════════
   Toast Notification
   ═══════════════════════════════════ */
.fe-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 100000;
  background: #111;
  color: #fff;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.fe-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* ═══════════════════════════════════
   Responsive
   ═══════════════════════════════════ */
@media (max-width: 640px) {
  #fe-slideout {
    width: 100vw;
    max-width: 100vw;
  }
  #fe-slideout-body {
    padding: 20px;
  }
  .fe-edit-btn {
    top: 10px;
    right: 10px;
    padding: 6px 10px;
    font-size: 12px;
  }
}


/* ═══════════════════════════════════
   Print: hide everything
   ═══════════════════════════════════ */
@media print {
  #fe-slideout,
  #fe-overlay,
  .fe-edit-btn,
  .fe-toast {
    display: none !important;
  }
}
