/* ==========================================================================
   JUMP PAGE BUILDER — Standalone admin surface
   ========================================================================== */

/* Main layout */
.jp-main {
  max-width: 820px;
  margin: 0 auto;
  padding: 16px;
}

/* Tab panels — show/hide via JS */
.jp-tab-panel[hidden] {
  display: none !important;
}

/* ==========================================================================
   SECTIONS EDITOR
   ========================================================================== */
.jp-sections-editor {
  max-width: 720px;
  margin: 0 auto;
  padding: 0;
}
.jp-section-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.jp-section-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: grab;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.jp-section-item:hover {
  border-color: var(--color-gold-400, #d4a843);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.jp-section-item.dragging {
  opacity: 0.5;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.jp-section-drag {
  flex-shrink: 0;
  width: 20px;
  color: #94a3b8;
  cursor: grab;
  font-size: 14px;
  text-align: center;
  user-select: none;
}
.jp-section-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-gold-50, #fef9ee);
  border-radius: 6px;
  font-size: 1.1rem;
}
.jp-section-info {
  flex: 1;
  min-width: 0;
}
.jp-section-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text, #1a1a2e);
}
.jp-section-type {
  font-size: 0.75rem;
  color: var(--color-muted, #94a3b8);
  text-transform: capitalize;
}
.jp-section-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.jp-section-actions button {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
  border: 1px solid var(--color-border, #e5e7eb);
  background: var(--color-surface, #fff);
  cursor: pointer;
  color: var(--color-muted, #64748b);
}
.jp-section-actions button:hover {
  border-color: var(--color-gold-400, #d4a843);
  color: var(--color-text, #1a1a2e);
}
.jp-section-actions .jp-section-delete:hover {
  border-color: #ef4444;
  color: #ef4444;
}

/* Section type picker grid */
#jp-section-type-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.jp-type-card {
  padding: 14px;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.jp-type-card:hover {
  border-color: var(--color-gold-400, #d4a843);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.jp-type-card-icon {
  font-size: 1.5rem;
  margin-bottom: 4px;
}
.jp-type-card-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text, #1a1a2e);
}
.jp-type-card-desc {
  font-size: 0.75rem;
  color: var(--color-muted, #94a3b8);
  margin-top: 2px;
}

/* Section editor form */
.jp-editor-field {
  margin-bottom: 16px;
}
.jp-editor-field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text, #1a1a2e);
  margin-bottom: 4px;
}
.jp-editor-field input,
.jp-editor-field textarea,
.jp-editor-field select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 6px;
  font-size: 0.875rem;
  background: var(--color-surface, #fff);
}
.jp-editor-field textarea {
  min-height: 60px;
  resize: vertical;
}
.jp-editor-repeater-item {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  align-items: start;
}
.jp-editor-repeater-item input { flex: 1; }
.jp-editor-repeater-remove {
  padding: 6px 8px;
  border: 1px solid var(--color-border, #e5e7eb);
  background: var(--color-surface, #fff);
  border-radius: 4px;
  cursor: pointer;
  color: #94a3b8;
  font-size: 13px;
  flex-shrink: 0;
}
.jp-editor-repeater-remove:hover { color: #ef4444; border-color: #ef4444; }

/* ==========================================================================
   CHIP SELECTORS (page-level style controls)
   ========================================================================== */
.jp-chip-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.jp-chip {
  cursor: pointer;
  display: inline-flex;
}
.jp-chip input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.jp-chip span {
  display: inline-block;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 6px;
  background: var(--color-surface, #fff);
  color: var(--color-muted, #64748b);
  transition: all 0.15s;
}
.jp-chip input:checked + span {
  border-color: var(--color-gold-400, #d4a843);
  background: var(--color-gold-50, #fef9ee);
  color: var(--color-text, #1a1a2e);
  font-weight: 600;
}
.jp-chip:hover span {
  border-color: var(--color-gold-400, #d4a843);
}

/* ==========================================================================
   PREVIEW PANEL
   ========================================================================== */
.jp-preview-panel {
  position: fixed;
  right: 0;
  top: 56px;
  bottom: 0;
  width: 420px;
  background: #f8fafc;
  border-left: 1px solid #e5e7eb;
  z-index: 40;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s;
}
.jp-preview-panel.collapsed {
  transform: translateX(100%);
}
.jp-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.jp-preview-header h3 {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
}
.jp-preview-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.jp-device-toggle {
  display: flex;
  gap: 2px;
  background: #f1f5f9;
  border-radius: 4px;
  padding: 2px;
}
.jp-device-btn {
  padding: 3px 8px;
  font-size: 11px;
  border: none;
  background: transparent;
  color: #64748b;
  border-radius: 3px;
  cursor: pointer;
  font-weight: 500;
}
.jp-device-btn.active {
  background: #fff;
  color: #1a1a2e;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.jp-preview-collapse {
  border: none;
  background: transparent;
  font-size: 18px;
  color: #94a3b8;
  cursor: pointer;
  padding: 2px 6px;
}
.jp-preview-frame-wrap {
  flex: 1;
  overflow: auto;
  display: flex;
  justify-content: center;
  padding: 12px;
  position: relative;
}
.jp-preview-iframe {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  height: 100%;
  min-height: 500px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.jp-preview-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(248,250,252,0.9);
}
.jp-preview-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #e5e7eb;
  border-top-color: #d4a843;
  border-radius: 50%;
  animation: jp-spin 0.6s linear infinite;
}
@keyframes jp-spin { to { transform: rotate(360deg); } }
.jp-preview-empty {
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
  padding: 40px 20px;
}

/* When preview is open, push main content left */
body.jp-preview-open .jp-main {
  margin-right: 420px;
}

/* Mobile: preview goes below */
@media (max-width: 1024px) {
  .jp-preview-panel {
    position: relative;
    width: 100%;
    top: auto;
    right: auto;
    bottom: auto;
    border-left: none;
    border-top: 1px solid #e5e7eb;
    max-height: 60vh;
  }
  body.jp-preview-open .jp-main {
    margin-right: 0;
  }
}

/* ==========================================================================
   AI GENERATION
   ========================================================================== */
.jp-ai-generate-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #d4a843;
  border-radius: 4px;
  background: #fef9ee;
  color: #92400e;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 12px;
}
.jp-ai-generate-btn:hover {
  background: #fde68a;
}
.jp-ai-generate-btn.loading {
  opacity: 0.6;
  pointer-events: none;
}
.jp-ai-candidates {
  display: grid;
  gap: 12px;
}
.jp-ai-candidate {
  padding: 14px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.jp-ai-candidate:hover {
  border-color: #d4a843;
}
.jp-ai-candidate-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 6px;
}
.jp-ai-candidate-preview {
  font-size: 13px;
  color: #1a1a2e;
  line-height: 1.5;
}

/* A/B split row */
.funnel-ab-split-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.funnel-ab-split-label {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.funnel-ab-slider {
  flex: 1;
}
