/**
 * RETRO PASTEL PROFILE - CLEAN VISUAL & RAW WORKSPACE EDITOR
 * High-readability color palette, crisp contrast, and thicker UI icons.
 */

:root {
  --sidebar-w: 390px;
  --topbar-h: 46px;
  --color-border: #E8C5D8;
  --color-border-dark: #D694B8;
  --color-accent: #B82865;
  --color-accent-hover: #9E1F55;
  --color-bg-light: #FFF0F6;
  --color-bg-sidebar: #FFFFFF;
  --color-bg-header: #FFF2F8;
  --color-text: #1F1E24;
  --color-text-muted: #5C5862;
  --color-input-border: #D8B0C6;
}

body.editor-mode {
  margin: 0;
  padding: 0;
  background-color: var(--color-bg-light);
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--color-text);
  overflow-x: hidden;
}

/* ==========================================================================
   TOP APPLICATION BAR
   ========================================================================== */
.editor-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: var(--color-bg-header);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1000;
  box-sizing: border-box;
}

.editor-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.editor-back-link {
  color: var(--color-accent);
  text-decoration: none;
  font-size: 0.76rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.editor-back-link:hover {
  text-decoration: underline;
}

.editor-title-badge {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--color-text);
  padding-left: 10px;
  border-left: 1px solid var(--color-border);
}

.editor-save-status {
  font-size: 0.70rem;
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
}

.editor-save-status .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #2e7d32;
  display: inline-block;
}

.editor-topbar-center {
  display: flex;
  align-items: center;
  background: #FFFFFF;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 2px;
  gap: 2px;
}

.editor-page-tab {
  background: transparent;
  border: none;
  padding: 4px 12px;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  color: #555555;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.15s ease;
}

.editor-page-tab:hover {
  color: var(--color-accent);
}

.editor-page-tab.active {
  background: var(--color-accent);
  color: #FFFFFF;
}

.editor-topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.editor-bar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 3px;
  border: 1px solid var(--color-border);
  background: #FFFFFF;
  color: #333333;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.4;
}

.editor-bar-btn:hover:not(:disabled) {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: #FFF9FC;
}

.editor-bar-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.editor-bar-btn.active {
  background: #FFEBF5;
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.editor-btn-export {
  background: var(--color-accent);
  color: #FFFFFF;
  border: 1px solid var(--color-accent);
  font-weight: 700;
}

.editor-btn-export:hover {
  background: var(--color-accent-hover);
  color: #FFFFFF;
}

/* ==========================================================================
   MAIN TWO-COLUMN WORKSPACE
   ========================================================================== */
.editor-workspace {
  display: flex;
  margin-top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
}

/* Left: Sidebar Inspector Panel */
.editor-sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--color-bg-sidebar);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  height: 100%;
  box-sizing: border-box;
  z-index: 100;
}

/* Sidebar Top Navigation Tabs */
.sidebar-tab-switcher {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  background: #FDF7FA;
}

.sidebar-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 9px 8px;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  color: #555555;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.sidebar-tab-btn:hover {
  color: var(--color-accent);
  background: #FFFFFF;
}

.sidebar-tab-btn.active {
  background: #FFFFFF;
  color: var(--color-accent);
  border-bottom: 2px solid var(--color-accent);
  font-weight: 700;
}

/* Header Container */
.editor-sidebar-header {
  padding: 10px 14px;
  background: #FFFFFF;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Active Section Information Header */
.active-section-card {
  background: #FFF5FA;
  border: 1px solid #E5BED3;
  border-radius: 4px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.active-section-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: #FFE5F1;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid #FFD0E5;
}

.section-title-heading {
  font-size: 0.84rem;
  font-weight: 700;
  color: #1A1A1E;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-action-btns-row {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
}

.editor-btn-action-sm {
  background: #FFFFFF;
  border: 1px solid #D6B2C6;
  padding: 3px 8px;
  font-size: 0.70rem;
  font-weight: 700;
  color: #2D2B33;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1.3;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.editor-btn-action-sm:hover:not(:disabled) {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: #FFF9FC;
}

.editor-btn-action-sm:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.editor-btn-remove-sec {
  color: #777;
}

.editor-btn-remove-sec:hover:not(:disabled) {
  color: #C62828;
  border-color: #FFCDD2;
  background: #FFF5F5;
}

.editor-btn-add-sec {
  background: #FFE8F3;
  border-color: #D694B8;
  color: var(--color-accent);
  font-weight: 700;
}

.editor-btn-add-sec:hover {
  background: var(--color-accent);
  color: #FFFFFF;
}

.editor-sidebar-subrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.editor-view-modes {
  display: flex;
  align-items: center;
  gap: 3px;
  background: #F5EBF0;
  padding: 2px;
  border-radius: 4px;
}

.editor-mode-btn {
  background: transparent;
  border: none;
  padding: 3px 10px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #555555;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.15s ease;
}

.editor-mode-btn:hover {
  color: var(--color-accent);
}

.editor-mode-btn.active {
  background: #FFFFFF;
  color: var(--color-accent);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* Sidebar Scrollable Body */
.editor-sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
}

/* Form Styling with High Readability */
.editor-form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.editor-form-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #3B3640;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.editor-input,
.editor-textarea {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--color-input-border);
  border-radius: 3px;
  font-family: inherit;
  font-size: 0.80rem;
  color: #1A1A1E;
  background: #FFFFFF;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.editor-input:focus,
.editor-textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(184, 40, 101, 0.12);
}

.editor-textarea {
  min-height: 60px;
  resize: vertical;
  line-height: 1.45;
}

.editor-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Repeater Item Cards */
.editor-repeater-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.editor-repeater-item {
  background: #FAF6F8;
  border: 1px solid #E2BDD0;
  border-radius: 4px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.editor-repeater-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.editor-btn-icon {
  background: transparent;
  border: none;
  font-size: 0.70rem;
  font-weight: 700;
  color: #777;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 2px;
}

.editor-btn-icon:hover {
  color: #C62828;
  background: #FFEBEE;
}

.editor-btn-add {
  background: #FFFFFF;
  border: 1px dashed var(--color-accent);
  color: var(--color-accent);
  padding: 6px;
  border-radius: 3px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
  width: 100%;
}

.editor-btn-add:hover {
  background: #FFEBF5;
}

.editor-img-preview-box {
  background: #FAF6F8;
  border: 1px solid #E2BDD0;
  border-radius: 4px;
  padding: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.editor-img-preview-box img {
  max-width: 100%;
  max-height: 120px;
  object-fit: cover;
  border-radius: 2px;
}

/* Page Structure Outline Tree */
.outline-column-block {
  background: #FFF5FA;
  border: 1px solid #E5BED3;
  border-radius: 4px;
  padding: 10px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.outline-column-title {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.outline-widget-item {
  background: #FFFFFF;
  border: 1px solid #E2BDD0;
  border-radius: 3px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s ease;
}

.outline-widget-item:hover {
  border-color: var(--color-accent);
  background: #FFFDFE;
}

.outline-widget-item.active {
  border-color: var(--color-accent);
  background: #FFEBF5;
  font-weight: 700;
  color: var(--color-accent);
}

.outline-widget-label {
  font-size: 0.76rem;
  color: #1F1E24;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.outline-widget-item.active .outline-widget-label {
  color: var(--color-accent);
}

.outline-actions {
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Raw JSON Panel */
.editor-raw-panel {
  display: none;
  flex-direction: column;
  gap: 8px;
  height: 100%;
}

.editor-raw-textarea {
  width: 100%;
  flex: 1;
  min-height: 420px;
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  background: #FAF8F9;
  border: 1px solid var(--color-input-border);
  border-radius: 3px;
  padding: 10px;
  color: #1F1E24;
  resize: none;
  outline: none;
  box-sizing: border-box;
}

.editor-raw-textarea:focus {
  border-color: var(--color-accent);
  background: #FFFFFF;
}

.editor-raw-error {
  background: #FFEBEE;
  border: 1px solid #FFCDD2;
  color: #C62828;
  font-size: 0.70rem;
  padding: 5px 8px;
  border-radius: 3px;
  display: none;
}

.editor-raw-error.show {
  display: block;
}

/* Section Removed / Empty State */
.section-removed-state {
  text-align: center;
  padding: 30px 14px;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* Right: Preview Canvas */
.editor-preview-canvas {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  padding: 24px 20px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  background-color: var(--color-bg-page, #FFF0F6);
}

/* On-Canvas Widget Wrapper and Action Toolbar */
.editor-widget-wrapper {
  position: relative;
  transition: all 0.15s ease;
  border-radius: 4px;
  cursor: pointer;
}

body.show-outlines .editor-widget-wrapper {
  outline: 1.5px dashed rgba(217, 70, 128, 0.40);
  outline-offset: 3px;
}

body.show-outlines .editor-widget-wrapper:hover {
  outline: 1.5px solid var(--color-accent);
  outline-offset: 3px;
  background-color: rgba(255, 235, 245, 0.20);
}

.editor-widget-wrapper.active-editing {
  outline: 2px solid var(--color-accent) !important;
  outline-offset: 4px;
  background-color: rgba(255, 235, 245, 0.30);
}

/* Specific Domain Pill and Banner Outlines */
.domain-pill-box.editor-widget-wrapper {
  position: relative;
  transition: all 0.15s ease;
  cursor: pointer;
  display: flex;
}

body.show-outlines .domain-pill-box.editor-widget-wrapper {
  outline: 1.5px dashed rgba(184, 40, 101, 0.55);
  outline-offset: 2px;
}

body.show-outlines .domain-pill-box.editor-widget-wrapper:hover {
  outline: 1.5px solid var(--color-accent);
  outline-offset: 2px;
}

.domain-pill-box.editor-widget-wrapper.active-editing {
  outline: 2px solid var(--color-accent) !important;
  outline-offset: 3px;
}

.banner-container.editor-widget-wrapper {
  position: relative;
  transition: all 0.15s ease;
  cursor: pointer;
  display: block;
}

body.show-outlines .banner-container.editor-widget-wrapper {
  outline: 1.5px dashed rgba(184, 40, 101, 0.55);
  outline-offset: 2px;
}

body.show-outlines .banner-container.editor-widget-wrapper:hover {
  outline: 1.5px solid var(--color-accent);
  outline-offset: 2px;
}

.banner-container.editor-widget-wrapper.active-editing {
  outline: 2px solid var(--color-accent) !important;
  outline-offset: 3px;
}

.editor-widget-toolbar {
  position: absolute;
  top: -13px;
  right: 4px;
  display: none;
  align-items: center;
  gap: 2px;
  background: #FFFFFF;
  border: 1px solid var(--color-accent);
  border-radius: 3px;
  padding: 2px 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  z-index: 50;
}

.editor-widget-wrapper:hover .editor-widget-toolbar,
.editor-widget-wrapper.active-editing .editor-widget-toolbar {
  display: flex;
}

.editor-tool-btn {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  color: #2D2B33;
  padding: 2px 5px;
  border-radius: 2px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  transition: all 0.12s ease;
  line-height: 1;
}

.editor-tool-btn:hover:not(:disabled) {
  background: #FFEBF5;
  color: var(--color-accent);
}

.editor-tool-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.editor-tool-btn.btn-tool-del:hover:not(:disabled) {
  background: #FFEBEE;
  color: #C62828;
}

/* Thicker SVG Arrow icon styling */
.editor-arrow-svg {
  display: inline-block;
  vertical-align: middle;
  stroke-width: 3;
}

.editor-btn-svg {
  display: inline-block;
  vertical-align: middle;
}

/* Bottom of Column + Add Section Button */
.editor-col-add-btn {
  width: 100%;
  margin-top: 10px;
  padding: 7px;
  background: rgba(255, 255, 255, 0.85);
  border: 1.5px dashed var(--color-border-dark);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  color: #555555;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.editor-col-add-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: #FFF9FC;
}

/* ==========================================================================
   MODAL WINDOWS
   ========================================================================== */
.editor-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(30, 15, 25, 0.40);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
  box-sizing: border-box;
}

.editor-modal-backdrop.open {
  display: flex;
}

.editor-modal-card {
  background: #FFFFFF;
  border: 1px solid var(--color-border-dark);
  border-radius: 6px;
  width: 100%;
  max-width: 580px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  box-sizing: border-box;
}

.editor-modal-header {
  padding: 10px 16px;
  background: var(--color-bg-header);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.editor-modal-title {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--color-accent);
  text-transform: lowercase;
}

.editor-modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  color: #777;
  cursor: pointer;
  padding: 0 4px;
}

.editor-modal-close-btn:hover {
  color: var(--color-accent);
}

.editor-modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.editor-modal-footer {
  padding: 10px 16px;
  background: #FAF8F9;
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* Section Picker List */
.section-picker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-picker-item {
  background: #FFF5FA;
  border: 1px solid #E5BED3;
  border-radius: 4px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.section-picker-info h4 {
  font-size: 0.80rem;
  font-weight: 700;
  color: var(--color-accent);
  margin: 0 0 2px 0;
}

.section-picker-info p {
  font-size: 0.70rem;
  color: var(--color-text-muted);
  margin: 0;
}

.section-picker-add-btn {
  background: #FFFFFF;
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.section-picker-add-btn:hover {
  background: var(--color-accent);
  color: #FFFFFF;
}

/* Export Code Box */
.export-note {
  font-size: 0.74rem;
  color: #444;
  margin: 0 0 10px 0;
}

.export-code-container {
  background: #FAF8F9;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  overflow: hidden;
}

.export-code-header {
  background: var(--color-bg-header);
  border-bottom: 1px solid var(--color-border);
  padding: 4px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.export-code-title {
  font-size: 0.70rem;
  font-weight: 700;
  color: var(--color-accent);
  font-family: monospace;
}

.export-code-block {
  margin: 0;
  padding: 10px;
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: 0.74rem;
  line-height: 1.45;
  max-height: 320px;
  overflow: auto;
  color: #1F1E24;
  white-space: pre;
}

/* Tutorial Guide Modal */
.tutorial-step-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tutorial-step-card {
  background: #FFF5FA;
  border: 1px solid #E5BED3;
  border-radius: 5px;
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.tutorial-step-icon {
  font-size: 1.25rem;
  background: #FFFFFF;
  border: 1px solid var(--color-accent);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tutorial-step-content h4 {
  margin: 0 0 3px 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-accent);
}

.tutorial-step-content p {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.45;
  color: #333333;
}

/* Toast */
.toast-popup {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #252329;
  color: #FFFFFF;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 4px;
  z-index: 3000;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.2s ease;
  pointer-events: none;
}

.toast-popup.show {
  opacity: 1;
  transform: translateY(0);
}
