/* AlpEver Template Studio & Visual WYSIWYG Editor Styles */

.template-editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1100px) {
  .template-editor-grid {
    grid-template-columns: 1fr;
  }
}

.editor-pane {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Editor Mode Switcher Tabs */
.editor-mode-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.editor-tabs-group {
  display: flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.editor-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
}

.editor-tab-btn:hover {
  color: var(--text-main);
}

.editor-tab-btn.active {
  background: #ffffff;
  color: var(--brand-orange);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Visual Editor Formatting Toolbar */
.visual-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-bottom: none;
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
  padding: 8px 10px;
}

.toolbar-btn-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.toolbar-separator {
  width: 1px;
  height: 20px;
  background: var(--border-subtle);
  margin: 0 4px;
}

.t-btn {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  transition: all var(--transition-fast);
}

.t-btn:hover {
  background: var(--brand-orange-light);
  color: var(--brand-orange);
  border-color: var(--brand-orange-border);
}

.t-btn:active {
  transform: translateY(1px);
}

.t-btn-cta {
  background: #fff7ed;
  color: #ea580c;
  border-color: #fed7aa;
  font-size: 12px;
  font-weight: 700;
  gap: 4px;
}

.t-btn-cta:hover {
  background: #ffedd5;
  border-color: #f97316;
}

/* Visual Editor Content Canvas */
.visual-editor-canvas {
  width: 100%;
  min-height: 280px;
  max-height: 380px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  padding: 18px 20px;
  color: #1e293b;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.visual-editor-canvas:focus {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

.visual-editor-canvas p {
  margin: 0 0 14px 0;
}

.visual-editor-canvas p:last-child {
  margin-bottom: 0;
}

.visual-editor-canvas h1,
.visual-editor-canvas h2,
.visual-editor-canvas h3 {
  color: #0f172a;
  margin: 18px 0 10px 0;
  font-weight: 700;
}

.visual-editor-canvas h1:first-child,
.visual-editor-canvas h2:first-child,
.visual-editor-canvas h3:first-child {
  margin-top: 0;
}

.visual-editor-canvas a {
  color: var(--brand-orange);
  text-decoration: underline;
}

.visual-editor-canvas hr {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 20px 0;
}

.visual-editor-canvas blockquote {
  border-left: 4px solid var(--brand-orange);
  background: #f8fafc;
  padding: 10px 16px;
  margin: 16px 0;
  border-radius: 4px;
  color: #334155;
}

/* Raw HTML Code Editor */
.code-editor-box {
  width: 100%;
  min-height: 320px;
  max-height: 380px;
  background: #0f172a;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: #f8fafc;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  padding: 16px;
  resize: vertical;
}

.code-editor-box:focus {
  outline: none;
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

/* Right Live Preview Pane */
.preview-pane {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 520px;
  box-shadow: var(--shadow-md);
}

.preview-toolbar {
  padding: 12px 18px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.preview-device-toggle {
  display: flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.device-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all var(--transition-fast);
}

.device-btn:hover {
  color: var(--text-main);
}

.device-btn.active {
  background: #ffffff;
  color: var(--brand-orange);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Clean High-Contrast Preview Envelope (Fixed UI) */
.preview-envelope {
  padding: 14px 18px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}

.envelope-row {
  display: flex;
  align-items: baseline;
  margin-bottom: 6px;
}

.envelope-row:last-child {
  margin-bottom: 0;
}

.envelope-label {
  width: 68px;
  color: #64748b;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.envelope-val {
  color: #0f172a;
  font-weight: 600;
  word-break: break-word;
}

.preview-iframe-wrapper {
  flex: 1;
  background: #ffffff;
  display: flex;
  justify-content: center;
  align-items: stretch;
  overflow: hidden;
  transition: all 0.2s ease;
}

.preview-iframe-wrapper.mobile-mode {
  background: #f1f5f9;
  padding: 24px 0;
}

.preview-iframe-wrapper.mobile-mode iframe {
  width: 375px !important;
  border-radius: 24px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  border: 6px solid #cbd5e1;
}

.preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
}

/* Dynamic Variable Badge Inside Editor */
.var-pill-tag {
  display: inline-block;
  padding: 1px 8px;
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
  border-radius: 9999px;
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
  user-select: all;
  margin: 0 2px;
}

/* Campaign Wizard Steps */
.wizard-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
  position: relative;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 2;
  cursor: pointer;
}

.wizard-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.wizard-step.active .wizard-circle {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.35);
}

.wizard-step.completed .wizard-circle {
  background: var(--color-success);
  border-color: transparent;
  color: #fff;
}

.wizard-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.wizard-step.active .wizard-label {
  color: var(--text-main);
}