/* ==============================================
   WIREFRAME BUILDER PRO - STYLES
   ============================================== */

/* Base Styles */
body { 
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Section Styles */
.section { 
  position: relative; 
  min-height: 80px; 
}
.section:hover .section-controls { 
  opacity: 1; 
}
.section-controls {
  opacity: 0; 
  transition: opacity .2s;
  position: absolute; 
  top: 8px; 
  right: 8px;
  background: #fff; 
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
  padding: 4px; 
  z-index: 10;
  pointer-events: auto;
  display: flex;
  align-items: center;
}

/* Convert Dropdown */
.convert-dropdown {
  position: relative;
}
.convert-menu {
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 4px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 160px;
  z-index: 100;
  max-height: 300px;
  overflow-y: auto;
}
.convert-menu.hidden {
  display: none;
}
.convert-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  font-size: 0.75rem;
  color: #374151;
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}
.convert-option:hover {
  background: #f3e8ff;
}
.convert-option i {
  width: 16px;
  text-align: center;
}

/* Image Styles */
.image-placeholder {
  background: #e5e7eb; 
  display: flex; 
  align-items: center; 
  justify-content: center;
  color: #6b7280; 
  font-size: .875rem; 
  cursor: pointer; 
  border-radius: 6px;
  background-size: cover; 
  background-position: center;
  position: relative;
}
.image-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}
.image-placeholder:hover .image-controls {
  opacity: 1;
}
.image-control-btn {
  background: rgba(255,255,255,0.9);
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.75rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.image-control-btn:hover {
  background: white;
}

/* Text Styles */
.editable {
  outline: none;
  min-height: 1.5em;
  padding: 4px 6px;
  border-radius: 4px;
}
.editable:focus {
  outline: 2px solid #3b82f6;
  background: #f8faff;
}
.structure-heading {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: .75rem;
}
.structure-subheading {
  font-size: 1.25rem;
  font-weight: 500;
  color: #4b5563;
  margin-bottom: 1.25rem;
}
.structure-content {
  font-size: 1rem;
  line-height: 1.7;
  color: #374151;
}
.sample-text {
  color: #6b7280;
  font-style: italic;
}
.sample-text:not(:empty) {
  color: inherit;
  font-style: normal;
}

/* FAQ Styles */
.faq-item {
  border-bottom: 1px solid #e5e7eb;
  padding: 1rem 0;
}
.faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 1.1rem;
}
.faq-answer {
  margin-top: .75rem;
  color: #4b5563;
  line-height: 1.6;
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
}
.faq-answer.open {
  max-height: 300px;
}
.add-faq-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .875rem;
  color: #4f46e5;
  cursor: pointer;
  margin-top: 1rem;
}
.add-faq-btn:hover {
  text-decoration: underline;
}

/* Section Templates */
.section-template {
  cursor: pointer;
  transition: background .2s, transform .1s;
}
.section-template:hover {
  background: #e0e7ff;
  transform: scale(1.02);
}
.section-template:active {
  transform: scale(0.98);
}

/* Reorder Mode */
.reorder-mode .section {
  cursor: move;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  transition: all .15s ease;
}
.reorder-mode .section.drag-over {
  border-top: 4px solid #3b82f6;
  background: #eff6ff;
}
.reorder-mode .section.dragging {
  opacity: 0.6;
  z-index: 50;
}
.reorder-mode .section-controls {
  opacity: 1;
}

/* Page Tree */
.page-tree {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  padding: 0.125rem;
}
.page-item {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem 0.25rem;
  border-radius: 3px;
  cursor: pointer;
  transition: background .2s;
  position: relative;
  z-index: 20;
  font-size: 0.7rem;
  line-height: 1.2;
}
.page-item.draggable {
  cursor: move;
}
.page-item.dragging {
  opacity: 0.5;
  background: #c7d2fe;
}
.page-item.drag-over-top {
  border-top: 3px solid #4f46e5;
}
.page-item.drag-over-bottom {
  border-bottom: 3px solid #4f46e5;
}
.page-item.drag-over-child {
  background: #e0e7ff;
  border: 2px dashed #4f46e5;
}
.page-item:hover {
  background: #e0e7ff;
}
.page-item.active {
  background: #c7d2fe;
  font-weight: 600;
}
.page-item .indent {
  width: 0.5rem;
}
.page-item .toggle-children {
  width: 0.6rem;
  font-size: 0.5rem;
  cursor: pointer;
}
.page-item .page-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.page-toolbar {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 100;
}
.page-item:hover .page-toolbar {
  opacity: 1;
  pointer-events: auto;
}
.page-toolbar i {
  font-size: 0.7rem;
  padding: 0.15rem;
  cursor: pointer;
}
.children {
  margin-left: 0.5rem;
}
.add-gallery-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .875rem;
  color: #4f46e5;
  cursor: pointer;
  margin-top: 1rem;
}
.add-gallery-btn:hover {
  text-decoration: underline;
}

/* Progress & Badge */
.progress-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.progress-box {
  background: white;
  padding: 2rem;
  border-radius: 1rem;
  min-width: 300px;
  text-align: center;
}
.progress-bar {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin: 1rem 0;
}
.progress-fill {
  height: 100%;
  background: #4f46e5;
  transition: width 0.3s;
}
.perf-badge {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: #10b981;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Modal Base */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal.open {
  opacity: 1;
  pointer-events: auto;
}
.modal-content {
  background: white;
  border-radius: 1rem;
  max-width: 800px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-header {
  position: sticky;
  top: 0;
  background: white;
  border-bottom: 2px solid #e5e7eb;
  padding: 1.5rem;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-body {
  padding: 1.5rem;
}

/* SEO Modal */
.seo-field {
  margin-bottom: 1.5rem;
}
.seo-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #374151;
}
.seo-field input,
.seo-field textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.875rem;
}
.seo-field input:focus,
.seo-field textarea:focus {
  outline: 2px solid #8b5cf6;
  border-color: #8b5cf6;
}
.seo-field small {
  display: block;
  margin-top: 0.25rem;
  color: #6b7280;
  font-size: 0.75rem;
}
.char-count {
  float: right;
  color: #9ca3af;
}
.char-count.warning {
  color: #f59e0b;
}
.char-count.error {
  color: #ef4444;
}

/* Image Editor Modal */
.image-editor-modal .modal-content {
  max-width: 1200px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.image-editor-controls {
  padding: 2rem;
  border-right: 2px solid #e5e7eb;
  overflow-y: auto;
  max-height: 85vh;
}
.image-editor-preview {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f9fafb;
}
.crop-container {
  position: relative;
  max-width: 100%;
  max-height: 60vh;
  margin: 1rem 0;
}
.crop-canvas {
  max-width: 100%;
  max-height: 60vh;
  border: 2px solid #e5e7eb;
  border-radius: 0.5rem;
}

/* Control Groups */
.control-group {
  margin-bottom: 1.5rem;
}
.control-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #374151;
}
.control-group input[type="range"] {
  width: 100%;
}
.control-group select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
}
.value-display {
  display: inline-block;
  margin-left: 0.5rem;
  font-weight: 600;
  color: #6366f1;
}

/* Format Options */
.format-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.format-option {
  padding: 0.75rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.format-option:hover {
  border-color: #6366f1;
  background: #eef2ff;
}
.format-option.selected {
  border-color: #6366f1;
  background: #6366f1;
  color: white;
}
.format-option .format-name {
  font-weight: 600;
  font-size: 0.875rem;
}
.format-option .format-desc {
  font-size: 0.75rem;
  opacity: 0.8;
}

/* Settings */
.setting-row {
  display: grid;
  grid-template-columns: 200px 1fr 100px;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #e5e7eb;
}
.setting-row:hover {
  background: #f9fafb;
}
.setting-label {
  font-weight: 600;
  color: #374151;
}
.setting-description {
  font-size: 0.875rem;
  color: #6b7280;
}
.aspect-input {
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-family: monospace;
  text-align: center;
}
.aspect-input:focus {
  outline: 2px solid #8b5cf6;
  border-color: #8b5cf6;
}
.reset-btn {
  padding: 0.375rem 0.75rem;
  background: #ef4444;
  color: white;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
}
.reset-btn:hover {
  background: #dc2626;
}

/* Project List */
#project-list .project-item {
  padding: 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}
#project-list .project-item:hover {
  border-color: #6366f1;
  background: #eef2ff;
}
#project-list .project-item .project-name {
  font-weight: 600;
  color: #374151;
}
#project-list .project-item .project-meta {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

/* Toast Notifications */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in {
  animation: fadeIn 0.3s ease-out;
}

/* Compact Section Styles */
.section {
  font-size: 0.875rem;
}
.section .editable {
  line-height: 1.4;
}
.section .image-placeholder {
  font-size: 0.75rem;
}

/* Column Content Styles */
.column-content {
  min-height: 2rem;
}
.column-content p {
  margin-bottom: 0.5rem;
}
.column-content p:last-child {
  margin-bottom: 0;
}

/* Editable Heading Hierarchy */
.editable h1 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.25rem;
}
.editable h2 {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.25rem;
  color: #4b5563;
}
.editable h3 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.25rem;
}
.editable h4 {
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 0.25rem;
  color: #6b7280;
}
.editable h5 {
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 0.25rem;
  color: #9ca3af;
}
.editable h6 {
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 0.25rem;
  color: #9ca3af;
}

/* Editable List Styles */
.editable ul, .editable ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}
.editable ul {
  list-style-type: disc;
}
.editable ol {
  list-style-type: decimal;
}
.editable li {
  margin-bottom: 0.25rem;
  line-height: 1.4;
}
.editable li:last-child {
  margin-bottom: 0;
}

/* Button Styles */
.button-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.section-btn {
  cursor: text;
  transition: all 0.15s;
}
.section-btn:focus {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}
.add-btn-link {
  display: block;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.add-btn-link:hover {
  opacity: 1;
}
.column-block:hover .add-btn-link {
  opacity: 0.8;
}

/* Floating Format Toolbar */
.format-toolbar {
  position: fixed;
  z-index: 1000;
  background: #1f2937;
  border-radius: 6px;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.125rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transform: translateX(-50%);
}
.format-toolbar.hidden {
  display: none;
}
.format-toolbar button {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #d1d5db;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.15s;
}
.format-toolbar button:hover {
  background: #374151;
  color: white;
}
.format-toolbar button.active {
  background: #4f46e5;
  color: white;
}
.toolbar-divider {
  width: 1px;
  height: 20px;
  background: #4b5563;
  margin: 0 0.25rem;
}