/* Stitch Bootstrap Design Editor - Editor UI Layout & Component Styles */

/* App Shell Layout */
#app-root {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background-color: var(--bg-dark);
}

/* Header Navbar */
.editor-header {
  height: var(--toolbar-height);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 20;
  user-select: none;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.brand-title i {
  font-size: 22px;
  color: var(--accent-primary);
}

.brand-tag {
  font-size: 10px;
  text-transform: uppercase;
  background: var(--accent-purple);
  color: white;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Main 3-Column Grid Container */
.editor-main-container {
  display: flex;
  flex: 1;
  min-height: 0;
  width: 100%;
  position: relative;
  overflow: hidden;
}

/* Left Sidebar & Right Sidebar Common */
.editor-sidebar {
  width: var(--sidebar-width-left);
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  z-index: 10;
  transition: width 0.2s ease;
}

.editor-sidebar-right {
  width: var(--sidebar-width-right);
  border-right: none;
  border-left: 1px solid var(--border-color);
}

.sidebar-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-dark);
}

.sidebar-header h2 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background-color: var(--bg-surface);
}

/* Navigation Accordion / Tabs inside Left Sidebar */
.nav-tabs-custom {
  display: flex;
  background: var(--bg-dark);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin-bottom: 12px;
}

.nav-tabs-custom .nav-link-custom {
  flex: 1;
  text-align: center;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.nav-tabs-custom .nav-link-custom.active {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 1px 3px rgba(79, 70, 229, 0.3);
}

/* Control Groups & Panels */
.control-section {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px;
}

.control-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-group-sm {
  margin-bottom: 12px;
}

.form-group-sm:last-child {
  margin-bottom: 0;
}

.form-label-sm {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-control-editor {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 12px;
  border-radius: 6px;
  padding: 6px 10px;
  width: 100%;
  transition: all 0.15s ease;
}

.form-control-editor:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Color Picker Input Styling */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-surface);
  padding: 4px 8px 4px 4px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.color-swatch-input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: none;
}

.color-swatch-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-swatch-input::-webkit-color-swatch {
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.color-hex-value {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-main);
  flex: 1;
}

/* Range Slider */
.range-slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-range-editor {
  flex: 1;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.range-val-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  min-width: 42px;
  text-align: right;
  color: var(--accent-primary);
  font-weight: 600;
}

/* Center Workspace Area */
.editor-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #f1f5f9;
  position: relative;
  overflow: hidden;
}

/* Viewport Controls Bar */
.viewport-toolbar {
  height: 42px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 5;
}

.viewport-toggle-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.viewport-toggle-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
}

.viewport-toggle-btn.active {
  background: rgba(79, 70, 229, 0.1);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  font-weight: 600;
}

/* Preview Frame Stage */
.preview-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: auto;
  background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
  background-size: 20px 20px;
}

.iframe-container {
  height: 100%;
  width: 100%;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.iframe-container.viewport-tablet {
  width: 768px !important;
}

.iframe-container.viewport-mobile {
  width: 375px !important;
}

#previewIframe {
  width: 100%;
  height: 100%;
  border: none;
  background: white;
}

/* Drag & Drop File Target Overlay */
.dropzone-overlay {
  border: 2px dashed var(--accent-primary);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 36px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.dropzone-overlay:hover, .dropzone-overlay.dragover {
  border-color: var(--accent-success);
  background: rgba(16, 185, 129, 0.05);
}

.dropzone-icon {
  font-size: 42px;
  color: var(--accent-primary);
  margin-bottom: 12px;
}

/* Inspector Tree & Property Views */
.inspector-empty {
  text-align: center;
  padding: 40px 10px;
  color: var(--text-dim);
}

.inspector-empty i {
  font-size: 32px;
  margin-bottom: 12px;
  display: block;
}

.element-tag-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  color: #0284c7;
  background: rgba(2, 132, 199, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(2, 132, 199, 0.2);
}

.breadcrumb-path {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  padding: 8px 10px;
  background: var(--bg-dark);
  border-radius: 6px;
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
}

.breadcrumb-item {
  color: var(--text-muted);
  cursor: pointer;
}

.breadcrumb-item:hover {
  color: var(--accent-primary);
  text-decoration: underline;
}

/* Code Viewer Modal / Drawer */
.modal-backdrop-custom {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop-custom.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog-custom {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 90%;
  max-width: 900px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

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

.modal-body-custom {
  padding: 0;
  flex: 1;
  overflow: auto;
  background: #0f172a;
}

.code-editor-area {
  width: 100%;
  height: 450px;
  background: #0f172a;
  color: #f8fafc;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 16px;
  border: none;
  resize: none;
  outline: none;
  line-height: 1.6;
}

.modal-footer-custom {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-surface);
}

/* Status Bar Footer */
.editor-statusbar {
  height: 28px;
  width: 100%;
  flex-shrink: 0;
  box-sizing: border-box;
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 11px;
  color: var(--text-dim);
}

.status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-success);
  margin-right: 6px;
}
