.visual-editor-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

.fixed-grid-container {
  flex: 1;
  position: relative;
  height: calc(100vh - 200px);
  overflow: hidden;
}

.editor-content {
  width: 100%;
  height: 100%;
  position: relative;
}

.canvas-container {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  cursor: grab;
}

.canvas-boundary {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.sitemap-grid {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  min-width: 100%;
  min-height: 100%;
  transition: transform 0.1s ease-out;
}

.grid-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(circle, #e0e0e0 1px, transparent 1px);
  background-size: 25px 25px; /* Slightly larger grid size */
  z-index: -1;
}

.tree-grid {
  position: relative;
  padding: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 8000px; /* Increased from 2000px */
  min-height: 5000px; /* Increased from 1000px */
}

.tree-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.node-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 30px;
}

.node-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  margin: 0 25px; /* Increased from 15px to 25px */
}

.node-card {
  background: white;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 18px;
  min-width: 220px;
  max-width: 320px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.08);
  margin-bottom: 25px;
  position: relative;
  transition: all 0.3s ease;
}

.node-card:hover {
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
  transform: translateY(-2px);
}

.node-card.selected {
  border: 2px solid #007bff;
  box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.2);
} 

.home-node {
  background: #f8f9fa;
  border: 1px solid #ccc;
}

.node-header {
  display: flex;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
  margin-bottom: 12px;
}

.node-icon {
  margin-right: 12px;
  color: #007bff;
  font-size: 16px;
}


.node-title {
  font-weight: 600;
  font-size: 16px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #333;
}

.connection-line {
  width: 2px;
  height: 35px; /* Increased from 20px to 35px */
  background-color: #ccc;
  position: absolute;
  top: -35px; /* Adjusted to match height */
  z-index: -1;
}

.children-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  position: relative;
  margin-top: 35px; /* Increased from 15px to 35px */
  min-width: 100%;
  gap: 20px; /* Added gap for consistent spacing */
}

.children-container::before {
  content: '';
  position: absolute;
  top: -35px; /* Increased from -15px to -35px */
  left: 50%;
  height: 35px; /* Increased from 15px to 35px */
  width: 2px;
  background-color: #ccc;
}

.sections-container {
  min-height: 30px;
  padding: 5px 0;
  width: 100%;
}

.section-card {
  background-color: #f9f9f9;
  border: 1px solid #eee;
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 12px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
}

.section-card:hover {
  border-color: #007bff;
  box-shadow: 0 3px 8px rgba(0,0,0,0.1);
  background-color: #f5f9ff;
}

.section-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  color: #333;
}
.offcanvas-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.3);
  z-index: 1040;
}
.section-content {
  font-size: 13px;
  color: #555;
  max-height: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.section-actions {
  position: absolute;
  top: 5px;
  right: 5px;
  display: none;
}

.section-card:hover .section-actions {
  display: block;
}

.section-action-btn {
  background: none;
  border: none;
  color: #777;
  font-size: 12px;
  cursor: pointer;
  padding: 3px;
}

.section-action-btn:hover {
  color: #007bff;
}

.add-section-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background-color: #f5f9ff;
  border: 1px dashed #99c2ff;
  border-radius: 6px;
  cursor: pointer;
  color: #007bff;
  font-size: 14px;
  margin-top: 12px;
  transition: all 0.2s ease;
}

.add-section-btn:hover {
  background-color: #e6f0ff;
  color: #0056b3;
}

.add-section-hover-btn {
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 24px;
  background-color: #007bff;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}


.section-card:hover .add-section-hover-btn {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.add-section-hover-btn:hover {
  transform: translateX(-50%) scale(1.2);
  background-color: #0056b3;
}
.node-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

.node-action-btn {
  background: none;
  border: none;
  color: #777;
  cursor: pointer;
  padding: 5px;
  margin-left: 5px;
}

.node-action-btn:hover {
  color: #007bff;
}

.add-child-hover-btn {
  display: none;
}

.node-card:hover .add-child-hover-btn {
  opacity: 1;
}

.controls {
  position: absolute;
  bottom: 25px;
  right: 25px;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.control-btn {
  width: 45px;
  height: 45px;
  margin-bottom: 12px;
  border-radius: 50%;
  background-color: white;
  border: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #333;
  box-shadow: 0 3px 8px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
}

.control-btn:hover {
  background-color: #f5f9ff;
  color: #007bff;
  transform: scale(1.1);
}


.editor-form {
  padding: 20px;
  border-top: 1px solid #ddd;
  max-height: 300px;
  overflow-y: auto;
  background-color: #f9f9f9;
}

.editor-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 15px;
}

.form-group {
  margin-bottom: 15px;
}

.form-label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
}

.form-textarea {
  width: 100%;
  min-height: 150px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: monospace;
  resize: vertical;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 15px;
  gap: 10px;
}

.btn {
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background-color: #007bff;
  color: white;
}

.btn-primary:hover:not([disabled]) {
  background-color: #0069d9;
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.btn-primary[disabled] {
  background-color: #7fb6ff;
  cursor: not-allowed;
}



.btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background-color: #5a6268;
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.mt-3 {
  margin-top: 1rem;
}

.mt-4 {
  margin-top: 1.5rem;
}

@keyframes slideIn {
  from { right: -400px; }
  to { right: 0; }
}

@keyframes slideOut {
  from { right: 0; }
  to { right: -400px; }
}

.offcanvas.show {
  animation: slideIn 0.3s forwards;
}

.offcanvas:not(.show) {
  animation: slideOut 0.3s forwards;
}


.form-control {
  border-radius: 6px;
  border: 1px solid #ced4da;
  padding: 10px 12px;
  transition: all 0.2s ease;
}

.form-control:focus {
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

textarea.form-control {
  min-height: 120px;
  resize: vertical;
}
.custom-section-form {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px dashed #ddd;
}

.custom-section-form h4 {
  margin-bottom: 15px;
  color: #444;
  font-size: 16px;
  font-weight: 600;
}

.mb-3 {
  margin-bottom: 1rem;
}

.offcanvas {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  height: 100%;
  background-color: white;
  box-shadow: -5px 0 15px rgba(0,0,0,0.1);
  z-index: 1050;
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  overflow-y: auto;
}

.offcanvas.show {
  right: 0;
}

.offcanvas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid #eaeaea;
  background-color: #f8f9fa;
}

.offcanvas-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #666;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background-color: #f1f1f1;
  color: #333;
  transform: rotate(90deg);
}

.offcanvas-body {
  padding: 20px;
}

.section-templates-container {
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 5px;
}

.section-template {
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  margin-bottom: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.section-template:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 0;
  background-color: #007bff;
  transition: height 0.3s ease;
}

.section-template:hover {
  background-color: #f8f9fa;
  border-color: #007bff;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.section-template:hover:before {
  height: 100%;
}

.section-template-title {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 5px;
  color: #333;
}

.section-template-desc {
  font-size: 14px;
  color: #666;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1100;
}

.modal.show {
  display: block;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
}

.modal-dialog {
  width: 500px;
  margin: 100px auto;
  position: relative;
}

.modal-content {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  overflow: hidden;
}

.modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-weight: 600;
  font-size: 18px;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 15px 20px;
  border-top: 1px solid #ddd;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255,255,255,0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #007bff;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

.loading-text {
  margin-top: 15px;
  font-size: 16px;
  color: #666;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.cdk-drag-preview {
  box-sizing: border-box;
  border-radius: 4px;
  box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2),
              0 8px 10px 1px rgba(0, 0, 0, 0.14),
              0 3px 14px 2px rgba(0, 0, 0, 0.12);
}

.cdk-drag-placeholder {
  opacity: 0;
}

.cdk-drag-animating {
  transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
}

.sections-container.cdk-drop-list-dragging .section-card:not(.cdk-drag-placeholder) {
  transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
}

/* Additional styles for better tree visualization */
.children-container {
  position: relative;
  padding-top: 20px;
}

.children-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 20px;
  background-color: #ccc;
}

.children-container > .node-container:not(:only-child)::before {
  content: '';
  position: absolute;
  top: -35px;
  left: 50%;
  width: 50%;
  height: 2px;
  background-color: #ccc;
  z-index: -1;
}
.children-container > .node-container:not(:first-child):not(:last-child)::before {
  width: 100%;
  left: 0;
}

.children-container > .node-container:first-child:not(:only-child)::before {
  left: 50%;
}

.children-container > .node-container:last-child:not(:only-child)::before {
  width: 50%;
  left: 0;
}
.section-category {
  margin-bottom: 2rem;
}

.section-category h4 {
  color: #333;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e0e0e0;
}

.drop-zone-highlight {
  background-color: #e3f2fd !important;
  border: 2px dashed #2196f3 !important;
}

.node-container[draggable="true"]:hover {
  cursor: grab;
}

.node-container[draggable="true"]:active {
  cursor: grabbing;
}
/* Drag and Drop Styles */
.node-container.dragging {
  opacity: 0.5;
  transform: scale(0.95);
  transition: all 0.2s ease;
}

.drop-zone {
  transition: all 0.2s ease;
}

.drop-zone.drag-over {
  background-color: rgba(0, 123, 255, 0.1);
  border: 2px dashed #007bff;
  border-radius: 8px;
  transform: scale(1.02);
}

.drop-zone.drag-over .node-card {
  border-color: #007bff;
  box-shadow: 0 0 10px rgba(0, 123, 255, 0.3);
}

/* Section template styles */
.no-custom-sections {
  margin: 10px 0;
}

.section-templates-container h4 {
  margin: 15px 0 10px 0;
  color: #333;
  font-weight: 600;
  border-bottom: 1px solid #eee;
  padding-bottom: 5px;
}

.section-templates-container h4:first-child {
  margin-top: 0;
}