@import "accid-complete-palette.css";
/* ========================================
   ACCID GRID - cellIndex System (0-99)
   ======================================== */

/*
 * GRID TRUTH:
 * - Each module has cellIndex (0-99)
 * - Sort by cellIndex, append in order
 * - CSS Grid auto-flow handles layout
 * - Size (1x, 1.5x, 2x) controls span
 * - Responsive columns adapt to screen
 */


.module-drop-zone.first-drop-zone {
    height: 30px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, rgba(255, 0, 255, 0.4) 0%, rgba(255, 50, 255, 0.4) 100%);
    border: 5px dashed rgb(255, 0, 255);
    display: block;
    transition: 0.2s;
    position: absolute;
    width: 90%;
    top: -11px !important;
    z-index: 600;
    cursor: pointer;
    box-shadow: rgba(255, 0, 255, 0.6) 0px 0px 25px;
}

/* ==================== CONTAINER ==================== */

#moduleContainer {
  display: grid;

  /* 🔥 Responsive columns based on screen size */
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));

  /* Rows match column size for square cells */
  grid-auto-rows: minmax(150px, auto);

  column-gap: 16px;
  row-gap: 20px;
  padding: 20px 24px 20px 24px;
  font-size: 14px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  grid-auto-flow: dense;
}

/* ==================== RESPONSIVE BREAKPOINTS ==================== */

/* Mobile (< 640px) - 1-2 columns */
@media (max-width: 639px) {
  #moduleContainer {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr));
    grid-auto-rows: minmax(140px, auto);
    column-gap: 12px;
    row-gap: 16px;
    padding: 16px 12px 16px 12px;
  }
}

/* Tablet (640px - 1024px) - 3-4 columns */
@media (min-width: 640px) and (max-width: 1023px) {
  #moduleContainer {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr));
    grid-auto-rows: minmax(160px, auto);
    column-gap: 14px;
    row-gap: 18px;
    padding: 20px 20px 20px 20px;
  }
}

/* Desktop (1024px - 1536px) - 5-6 columns */
@media (min-width: 1024px) and (max-width: 1535px) {
  #moduleContainer {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr));
    grid-auto-rows: minmax(180px, auto);
    column-gap: 16px;
    row-gap: 20px;
    padding: 20px 24px 20px 24px;
  }
}

/* Large Desktop (> 1536px) - 6-8 columns */
@media (min-width: 1536px) {
  #moduleContainer {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
    grid-auto-rows: minmax(200px, auto);
    column-gap: 16px;
    row-gap: 20px;
    padding: 20px 24px 20px 24px;
  }
}

/* Force modules to be square */
.module-wrapper {
  aspect-ratio: 1 / 1;
  min-width: 0;
  overflow: hidden;
  background: white;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 10px;
  transition: all 0.15s ease-out;

  /* Spanning works with CSS vars */
  grid-column: span var(--col-span, 1);
  grid-row: span var(--row-span, 1);
}

.module-wrapper > * {
  max-width: 100%;
  max-height: 100%;
}

/* Responsive padding for modules */
@media (max-width: 639px) {
  .module-wrapper {
    padding: 6px;
    border-radius: 6px;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .module-wrapper {
    padding: 8px;
    border-radius: 8px;
  }
}

@media (min-width: 1024px) {
  .module-wrapper {
    padding: 10px;
    border-radius: 8px;
  }
}

/* ==================== CONSTRAIN IMAGES WITHIN CELLS ==================== */

.module-wrapper img,
.module-image img,
.image-container img {
  max-width: 100% !important;
  max-height: 100% !important;
  width: 100% !important;
  height: auto !important;
  object-fit: contain !important;
}

/* Override any inline styles on images */
.module-wrapper .module-image,
.module-wrapper .image-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ==================== GRID CELLS (MODULE OR PLACEHOLDER) ==================== */

.module-wrapper,
.grid-cell-placeholder {
  position: relative;
  background: white;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 16px;
  transition: all 0.2s ease;

  /* Default 1x size */
  grid-column: span 1;
  grid-row: span 1;
}

/* ==================== MODULE WRAPPER ==================== */

.module-wrapper {
  background: white;
  border-color: #e5e7eb;
  overflow: hidden; /* Prevent content from breaking grid */
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
}

/* Hidden modules - completely hidden in view mode, semi-transparent in edit mode */
.module-wrapper.module-hidden {
  display: none; /* Hidden by default in view mode */
}

body.edit-mode .module-wrapper.module-hidden {
  display: flex; /* Show in edit mode */
  opacity: 0.35;
  background: repeating-linear-gradient(
    45deg,
    #f3f4f6,
    #f3f4f6 10px,
    #e5e7eb 10px,
    #e5e7eb 20px
  );
  position: relative;
}

body.edit-mode .module-wrapper.module-hidden::before {
  content: '👁️‍🗨️ Hidden';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  z-index: 10;
  pointer-events: none;
}

.module-wrapper > * {
  max-width: 100% !important;
  max-height: 100% !important;
  width: auto !important;
  height: auto !important;
}

/* ==================== PLACEHOLDER CELLS ==================== */

.grid-cell-placeholder {
  /* PREVIEW MODE: Invisible but takes up space */
  background: transparent;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  z-index: 1; /* Keep placeholders below dragged modules */
}

.grid-cell-placeholder .cell-number {
  font-size: 24px;
  font-weight: 700;
  color: transparent; /* Hidden in preview */
  user-select: none;
}

/* EDIT MODE: Show placeholders */
body.edit-mode .grid-cell-placeholder {
  background: #f9fafb;
  border: 2px dashed #e5e7eb;
}

body.edit-mode .grid-cell-placeholder .cell-number {
  color: #d1d5db;
}

body.edit-mode .grid-cell-placeholder:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

body.edit-mode .grid-cell-placeholder:hover .cell-number {
  color: #6b7280;
}

/* Responsive placeholder cell numbers */
@media (max-width: 639px) {
  .grid-cell-placeholder {
    min-height: 60px;
  }

  .grid-cell-placeholder .cell-number {
    font-size: 16px;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .grid-cell-placeholder {
    min-height: 70px;
  }

  .grid-cell-placeholder .cell-number {
    font-size: 20px;
  }
}

/* ==================== SIZE VARIANTS (colSpan × rowSpan) ==================== */

/* Dynamic spanning based on colSpan and rowSpan attributes */
.module-wrapper[data-col-span="1"] { grid-column: span 1; }
.module-wrapper[data-col-span="2"] { grid-column: span 2; }
.module-wrapper[data-col-span="3"] { grid-column: span 3; }
.module-wrapper[data-col-span="4"] { grid-column: span 4; }
.module-wrapper[data-col-span="5"] { grid-column: span 5; }
.module-wrapper[data-col-span="6"] { grid-column: span 6; }

.module-wrapper[data-row-span="1"] { grid-row: span 1; }
.module-wrapper[data-row-span="2"] { grid-row: span 2; }
.module-wrapper[data-row-span="3"] { grid-row: span 3; }
.module-wrapper[data-row-span="4"] { grid-row: span 4; }
.module-wrapper[data-row-span="5"] { grid-row: span 5; }
.module-wrapper[data-row-span="6"] { grid-row: span 6; }

/* Legacy support for data-size */
.module-wrapper[data-size="1x"] {
  grid-column: span 1;
  grid-row: span 1;
}

.module-wrapper[data-size="1.5x"] {
  grid-column: span 1;
  grid-row: span 2;
}

.module-wrapper[data-size="2x"] {
  grid-column: span 2;
  grid-row: span 2;
}

/* ==================== NAVIGATION MODULE - FULL ROW ==================== */

/* Navigation modules get their own row - nothing else on that row */
/* ==================== NAVIGATION CONTAINER (Outside Grid) ==================== */

#navigationContainer {
  width: 100%;
  background: #2c3e50;
  color: white;
}

.navigation-module {
  width: 100%;
  padding: 15px 20px;
  position: relative;
}

/* Navigation editing state - above overlay */
.navigation-module.inline-editing {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 85vw !important;
  max-width: 1200px !important;
  max-height: 90vh !important;
  overflow-y: auto !important;
  z-index: 20000 !important;
  box-shadow: 0 25px 100px rgba(0, 0, 0, 0.5) !important;
  border: 3px solid #667eea !important;
  border-radius: 8px !important;
}

/* Navigation sticks to top */
.nav-top {
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Edit buttons in navigation */
.navigation-module .edit-button,
.navigation-module .delete-button {
  position: absolute;
  z-index: 10001 !important;
  pointer-events: auto !important;
  opacity: 0;
  transition: opacity 0.2s ease;
  background: rgba(59, 130, 246, 0.95);
  color: white;
  border: 2px solid white;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
}

.navigation-module .delete-button {
  background: rgba(239, 68, 68, 0.95);
  right: 10px;
  top: 10px;
}

.navigation-module .edit-button {
  right: 60px;
  top: 10px;
}

/* Show buttons in edit mode */
body.edit-mode .navigation-module .edit-button,
body.edit-mode .navigation-module .delete-button {
  opacity: 0.8;
}

body.edit-mode .navigation-module:hover .edit-button,
body.edit-mode .navigation-module:hover .delete-button {
  opacity: 1;
}

/* ==================== EDIT MODE STYLING ==================== */

body.edit-mode .module-wrapper {
  border-color: #e5e7eb;
  cursor: pointer;
  overflow: visible !important; /* Allow buttons to show outside cell */
}

/* Keep content inside constrained in edit mode */
body.edit-mode .module-wrapper > *:not(.edit-button):not(.delete-button):not(.resize-handle) {
  overflow: hidden;
}

body.edit-mode .module-wrapper:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

/* Dragging state */
.module-wrapper.dragging {
  opacity: 0.8;
  cursor: move !important;
  z-index: 10000 !important;
  position: relative;
  pointer-events: none; /* Let mouse events pass through to detect drop target */
}

/* Resizing state */
.module-wrapper.resizing {
  opacity: 0.9;
  outline: 3px solid #3b82f6;
  outline-offset: -3px;
  z-index: 1000;
  transition: none; /* Disable transitions during resize for immediate feedback */
}

body.resizing {
  cursor: nwse-resize !important;
  user-select: none;
}

/* Drop zone highlighting */
.module-wrapper.drop-target,
.module-wrapper.drop-target-highlight,
.grid-cell-placeholder.drop-target-highlight {
  border-color: #10b981 !important;
  background: rgba(16, 185, 129, 0.1) !important;
  transform: scale(1.02);
  transition: all 0.1s ease;
}

/* ==================== BADGE WRAPPER (contains order + type) ==================== */

.badge-module-type-wrap {
   position: absolute;
    bottom: -5px;
    left: -5px;
    padding: 4px 8px;
   border-top-right-radius: 8px;
   border-bottom-left-radius: 8px;
   border-bottom: 1px solid #6600ff;
  border-left: 1px solid #6600ff;
    background: rgb(51 51 51 / 38%);
    z-index: 899 !important;
    pointer-events: none;
    opacity: .33;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4;
}

body.edit-mode .module-wrapper:hover .badge-module-type-wrap,
body.edit-mode .module-wrapper-v2:hover .badge-module-type-wrap {
    opacity: 1;
}

/* Order badge inside wrapper */
.badge-module-type-wrap .order-badge {
    position: static;
    color: white;
    font-size: 14px;
    font-weight: bold;
    opacity: 1;
    padding: 0;
    margin-right: 4px;
    background: none;
}

/* Type badge inside wrapper */
.badge-module-type-wrap .module-type-badge {
    position: static;
    color: white;
    padding: 0;
    font-weight: 700;
    opacity: 1;
    display: flex;
    align-items: center;
    gap: 4px;
}

.badge-module-type-wrap .module-type-badge .type-icon {
    font-size: 14px;
    line-height: 1;
}

.badge-module-type-wrap .module-type-badge .type-label {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 11px;
    color: white;
}

/* Legacy standalone badges (fallback) */
.module-type-badge {
    position: absolute;
    top: -33px;
    left: 25px;
    color: rgba(255, 255, 255, .33);
    padding: 6px 12px;
    font-weight: 700;
    z-index: 899 !important;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 24px;
}

.module-type-badge .type-icon {
  font-size: 16px;
  line-height: 1;
}

.module-type-badge .type-label {
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-size: 20px;
  color: rgba(255,255,255,.33);
}

/* Show badge in edit mode */
body.edit-mode .module-type-badge {
  opacity: 0.8;
}

body.edit-mode .module-wrapper:hover .module-type-badge {
  opacity: 1;
}

/* ==================== ACTION BAR (BOTTOM, INSIDE MODULE) ==================== */

.module-action-bar {
  position: absolute;
  bottom: 29%;
  left: 12px;
  right: 12px;
  z-index: 10000 !important;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: auto !important;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

body.edit-mode .module-action-bar {
  opacity: 0.85;
}

body.edit-mode .module-wrapper:hover .module-action-bar,
body.edit-mode .module-wrapper-v2:hover .module-action-bar {
  opacity: 1;
}

/* Hide action bar and image buttons when editing */
.module-wrapper.inline-editing .module-action-bar,
.module-wrapper-v2.inline-editing .module-action-bar {
  display: none !important;
}

.module-wrapper.inline-editing .add-image-btn {
  display: none !important;
}

.module-wrapper.inline-editing .replace-image-btn {
  display: none !important;
}

/* Top row with EDIT only */
.action-bar-top-row {
    display: flex;
    gap: 8px;
    background: #ffffffe3;
    padding: 2px;
}

.edit-container {
  flex: 1;
  width: 100%;
}

/* Base button styles */
.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  color: white;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  pointer-events: auto !important;
  width: 100%;
}

.action-btn span {
  letter-spacing: 0.8px;
  text-transform: uppercase;
  font-weight: 700;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.action-btn.delete-btn { max-width: 50px;}
.action-btn.delete-btn span { font-size: 10px; color: rgba(59, 130, 246, 0.95);}

.action-btn.visibility-btn { max-width: 50px;}
.action-btn.visibility-btn span { font-size: 10px; color: rgba(59, 130, 246, 0.95);}

/* Edit button */
.action-btn.edit-btn {
  position: absolute !important;
      top: -20px !important;
    right: -2px !important;
    min-width: 40px;
    background: rgba(59, 130, 246, 0.95);
    padding: 8px 10px;
    font-size: 20px;
    width: 100%;
    max-width: 50px;
    border-radius: 50% !important;
}

.action-btn.edit-btn span {
  font-size: 10px;
}

.action-btn.edit-btn:hover {
  background: rgb(37, 99, 235);
}

/* Add Image button - FULL WIDTH BELOW */
.action-btn.add-image-btn {
  background: rgba(96, 165, 250, 0.95);
  padding: 14px 24px;
  font-size: 24px;
}

.action-btn.add-image-btn span {
  font-size: 12px;
}

.action-btn.add-image-btn:hover {
  background: rgb(59, 130, 246);
}

.replace-image-btn.add-image-btn:hover {
  background: rgb(59, 130, 246) !important;;
}



/* Keep content inside constrained in edit mode */
body.edit-mode .module-wrapper > *:not(.edit-button):not(.delete-button):not(.resize-handle) {
  overflow: hidden;
}


/* ====================  REPALCE IMAAGE QUICK CONTORLS ==================== */

.replace-image-btn.add-image-btn { position: absolute; top: 100% !important;     
  right: 25px;
  margin-bottom: 0 auto;
    background: rgba(102, 126, 234, 0.9);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    width: 100%;
        white-space: nowrap !important;
    max-width: 25% !important;
  min-width: 90px !important;
display:none;
}




  .hero-full .replace-image-btn.add-image-btn { top: 50% !important; }

/* ==================== CORNER BUTTONS (TOP-RIGHT, OUTSIDE) ==================== */

.corner-btn {
  position: absolute;
  border-radius: 50%;
  border: 3px solid white;
  cursor: pointer;
  z-index: 100;
  opacity: 0;
  transition: all 0.2s ease;
  pointer-events: auto !important;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
  aspect-ratio: 1 / 1;
  padding: 0;
  line-height: 1;
}

body.edit-mode .corner-btn:not(.close-edit-btn-corner) {
  opacity: 0.8;
}

body.edit-mode .module-wrapper:hover .corner-btn:not(.close-edit-btn-corner),
body.edit-mode .module-wrapper-v2:hover .corner-btn:not(.close-edit-btn-corner) {
  opacity: 1;
}

.corner-btn:hover {
  transform: scale(1.1);
}

/* Edit button (blue, top-center-right) */
.edit-btn-corner {
    top: -30px;
    right: 16px;
    min-width: 38px;
    width: 38px;
    height: 38px;
    font-size: 20px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.edit-btn-corner:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

/* Delete button (large, top-right) */
.delete-btn-corner {
    top: -4px;
    right: -16px;
    min-width: 35px;
    width: 35px;
    height: 35px;
    font-size: 16px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.delete-btn-corner:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

/* Visibility button (smaller, below delete) */
.visibility-btn-corner {
      top: 35px;
    right: -22px;
    min-width: 30px;
    width: 30px;
    height: 30px;
    font-size: 15px;
  background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
}

.visibility-btn-corner:hover {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}

.module-wrapper.module-hidden .visibility-btn-corner {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.module-wrapper.module-hidden .visibility-btn-corner:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

/* Duplicate button (icon only, below visibility) */
.duplicate-btn-corner {
    top: 72px;
    right: -22px;
    min-width: 25px;
    width: 25px;
    height: 25px;
    font-size: 15px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.duplicate-btn-corner:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

/* Width button (bottom-right corner) */
.width-btn-corner {
  bottom: -15px;
  right: -10px;
  min-width: 32px;
  width: 32px;
  height: 32px;
  font-size: 18px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.width-btn-corner:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

/* Height button (bottom-left corner) */
.height-btn-corner {
  bottom: -15px;
  left: -10px;
  min-width: 32px;
  width: 32px;
  height: 32px;
  font-size: 18px;
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.height-btn-corner:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
}

/* Close button (large, left side when editing) */
.close-edit-btn-corner {
  top: -16px;
  left: -16px;
  min-width: 50px;
  width: 50px;
  height: 50px;
  font-size: 28px;
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  opacity: 0;
  pointer-events: none;
}

.module-wrapper.inline-editing .close-edit-btn-corner {
  opacity: 1 !important;
  pointer-events: auto !important;
}

.close-edit-btn-corner:hover {
  background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
}

/* ==================== SPECIFC LAYOUT FIXES ==================== */

.navigation-module.nav-top .edit-button, .navigation-module.nav-top .delete-button  {
margin-right: 60px;

}

/* ==================== MOBILE RESPONSIVE ==================== */

@media (max-width: 639px) {
  /* Module type badge - smaller */
  .module-type-badge {
    padding: 6px 10px;
    bottom: -18px;
    left: -8px;
    font-size: 11px;
  }

  .module-type-badge .type-icon {
    font-size: 16px;
  }

  .module-type-badge .type-label {
    font-size: 10px;
  }

  /* Action bar - smaller on mobile */
  .module-action-bar {
    bottom: 6px;
    left: 8px;
    right: 8px;
    gap: 6px;
  }

  /* Edit button - smaller on mobile */
  .action-btn.edit-btn {
    padding: 10px 14px;
    font-size: 16px;
  }

  .action-btn.edit-btn span {
    font-size: 8px;
  }

  /* Add Image button - slightly smaller on mobile */
  .action-btn.add-image-btn {
    padding: 12px 18px;
    font-size: 20px;
  }

  .action-btn.add-image-btn span {
    font-size: 10px;
  }

  /* Corner buttons - smaller */
  .delete-btn-corner {
    min-width: 40px;
    width: 40px;
    height: 40px;
    font-size: 20px;
    top: -12px;
    right: -12px;
  }

  .visibility-btn-corner {
    min-width: 32px;
    width: 32px;
    height: 32px;
    font-size: 16px;
    top: 34px;
    right: -10px;
  }

  /* Shift+drag hint - smaller text */
  body.edit-mode .module-wrapper:not(.inline-editing):hover::after {
    font-size: 14px;
    letter-spacing: 0.5px;
    padding: 6px 12px;
    top: 12px;
  }
}

/* ==================== RESIZE HANDLE (PULLABLE CORNER) ==================== */

.resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: auto !important;
}

.resize-handle::after {
  content: '';
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 12px 12px;
  border-color: transparent transparent #3b82f6 transparent;
}

/* Show resize handle in edit mode */
body.edit-mode .resize-handle {
  opacity: 0.4;
}

body.edit-mode .module-wrapper:hover .resize-handle {
  opacity: 1;
}

.resize-handle:hover::after {
  border-color: transparent transparent #2563eb transparent;
}

/* Mobile: Larger touch target for resize handle */
@media (max-width: 639px) {
  .resize-handle {
    width: 32px;
    height: 32px;
  }

  .resize-handle::after {
    border-width: 0 0 16px 16px;
    bottom: 4px;
    right: 4px;
  }

  body.edit-mode .module-wrapper .resize-handle {
    opacity: 0.6;
  }

  body.edit-mode .module-wrapper:hover .resize-handle {
    opacity: 1;
  }
}

/* ==================== SHIFT+DRAG HINT (TOP, WITH BLACK BG) ==================== */

body.edit-mode .module-wrapper:not(.inline-editing):hover::after, body.edit-mode .module-wrapper-v2:not(.inline-editing):hover::after {
    content: 'Shift + Drag To Move';
    position: absolute;
    text-align: left;
    top: -20px;
    left: -20px;
    background: rgba(255, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    color: white;
    padding: 3px 6px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    opacity: 0.9;
    pointer-events: none;
    z-index: 50;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(255, 0, 0, 0.4);
    letter-spacing: 1px;
    white-space: pre;
}

/* Mobile: Hide shift+drag hint (not applicable on touch) */
@media (max-width: 639px) {
  body.edit-mode .module-wrapper:not(.inline-editing):hover::after,
  body.edit-mode .module-wrapper-v2:not(.inline-editing):hover::after {
    display: none;
  }
}

/* ==================== EXPANDED CELL EDITING ==================== */

/* Dimmed overlay when a cell is being edited */
body.cell-editing::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(3px);
  z-index: 15000;
  animation: fadeIn 0.2s ease;
  cursor: pointer;
}

/* Overlay element for click handling - LEGACY (being phased out) */
.editing-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(3px);
  z-index: 15000;
  cursor: pointer;
}


@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Expanded editing cell */
.module-wrapper.inline-editing {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 85vw !important;
  max-width: 1200px !important;
  height: auto !important;
  max-height: 90vh !important;
  z-index: 20000 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  box-shadow: 0 25px 100px rgba(0, 0, 0, 0.5) !important;
  border: 3px solid #667eea !important;
  animation: expandCell 0.3s ease !important;
  aspect-ratio: unset !important;
  grid-column: unset !important;
  grid-row: unset !important;
}

@keyframes expandCell {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Mobile responsive */
@media (max-width: 639px) {
  .module-wrapper.inline-editing {
    width: 95vw !important;
    max-height: 95vh !important;
  }
}

/* ==================== GRID PAINTER ==================== */

.grid-painter-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.grid-painter {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 400px;
}

.grid-painter-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #1f2937;
}

.grid-painter-grid {
  display: grid;
  grid-template-columns: repeat(var(--painter-cols, 6), 1fr);
  gap: 4px;
  margin-bottom: 16px;
}

.grid-painter-cell {
  aspect-ratio: 1;
  background: #f3f4f6;
  border: 2px solid #e5e7eb;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.1s ease;
}

.grid-painter-cell:hover {
  background: #dbeafe;
  border-color: #3b82f6;
}

.grid-painter-cell.selected {
  background: #3b82f6;
  border-color: #2563eb;
}

.grid-painter-cell.disabled {
  background: #fef2f2;
  border-color: #fecaca;
  cursor: not-allowed;
  opacity: 0.5;
}

.grid-painter-preview {
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
  margin-bottom: 16px;
  text-align: center;
  font-size: 14px;
  color: #6b7280;
}

.grid-painter-buttons {
  display: flex;
  gap: 8px;
}

.grid-painter-buttons button {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.grid-painter-buttons .btn-confirm {
  background: #3b82f6;
  color: white;
}

.grid-painter-buttons .btn-confirm:hover {
  background: #2563eb;
}

.grid-painter-buttons .btn-cancel {
  background: #e5e7eb;
  color: #374151;
}

.grid-painter-buttons .btn-cancel:hover {
  background: #d1d5db;
}


/* ==================== GRID v2.0 - SEMANTIC LAYOUT ==================== */
/* Uses order + layout_class instead of cellIndex (0-99) */

.page-grid-v2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--grid-min-col, 150px)), 1fr));
  grid-auto-rows: minmax(100px, auto);
  column-gap: var(--grid-gap, 16px);
  row-gap: 20px;
  padding: 20px 24px 20px 24px;
  overflow: visible;
  align-content: start; /* Pack rows at top, don't stretch to fill */
}

/* Full-page grid (container IS the grid, no sections) */
#moduleContainer.page-grid-v2 {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: calc(100vh - 60px);
}

/* Edit mode - extra gap for corner buttons */
body.edit-mode .page-grid-v2 {
  column-gap: 20px;
  row-gap: 24px;
  padding-left: 30px;
  padding-right: 30px;
}

/* Module wrapper v2 - semantic class-based sizing */
.module-wrapper-v2 {
  background: white;
  border-radius: 8px;
  padding: 10px;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  position: relative;
  aspect-ratio: auto; /* Let content determine height */
  overflow: visible; /* Allow corner buttons to extend outside */
}

body.edit-mode .module-wrapper-v2 {
  cursor: pointer;
  border-color: #e5e7eb;
}

body.edit-mode .module-wrapper-v2:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

/* ==================== LAYOUT WIDTH CLASSES ==================== */

.edit-mode .hero-full { margin-top: 40px;}

/* Full width - spans all columns */
.hero-full,
.card-full,
.nav-top,
.footer-full,
.section-full,
.banner {
  grid-column: 1 / -1;
}

/* Wide card - spans 2 columns */
.card-wide,
.feature {
  grid-column: span 2;
}

/* Half width - spans 2 columns (same as card-wide, semantic name) */
.half {
  grid-column: span 2;
}

/* Numeric column spans for granular width control */
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }

/* Default card - single column */
.card {
  /* Default - single column, no span needed */
}

/* ==================== ROW SPANNING CLASSES ==================== */

/* Row spans - for sidebars and tall content */
.row-span-2 { grid-row: span 2; }
.row-span-3 { grid-row: span 3; }
.row-span-4 { grid-row: span 4; }

/* Tall card - 2 rows, stays in flow */
.card-tall {
  grid-row: span 2;
}

/* Feature block - 2x2 (wide + tall) */
.feature-block {
  grid-column: span 2;
  grid-row: span 2;
}

/* ==================== ORDER BADGE (edit mode) ==================== */

.order-badge {
    position: absolute;
    position: absolute;
    top: -5px;
    left: 0px;
    color: rgb(39 39 39 / 33%);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.order-badge:after {
  content: "|||";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 16px;
  color: rgba(255, 255, 255, 0.5);
  opacity: 0;
  transition: opacity 0.2s;
}

body.edit-mode .order-badge {
  opacity: 0.7;
}

body.edit-mode .module-wrapper-v2:hover .order-badge {
  opacity: 1;
}

/* ==================== LAYOUT PICKER BUTTONS ==================== */

/* Width button - blue */
.layout-picker-btn {
    background: linear-gradient(135deg, var(--c4) 0%, var(--success) 100%) !important;
       position: absolute;
    bottom: -45px;
    max-height: 30px;
}

.layout-picker-btn:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
}

/* Height button - purple - breaks out of flex */
.height-picker-btn {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%) !important;
  background-color: #8b5cf6 !important;
  position: absolute !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  right: -5px !important;
  width: 20px !important;
  max-width: 20px !important;
  height: 80% !important;
  flex: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.height-picker-btn:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%) !important;
  top: 50%;
  transform: translate(0, -50%);
}


.action-btn.height-picker-btn span {
    letter-spacing: 0.8px;
    text-transform: uppercase;
    font-weight: 700;
    writing-mode: vertical-rl;
}


/* ==================== RESPONSIVE v2 ==================== */

@media (max-width: 768px) {
  .page-grid-v2 {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }

  /* Edit mode: maintain minimum spacing at all breakpoints */
  body.edit-mode .page-grid-v2 {
    column-gap: 30px;
    row-gap: 35px;
    padding-left: 70px;
    padding-right: 70px;
    padding-top: 30px;
    padding-bottom: 30px;
  }

  /* All multi-column items collapse to full width on mobile */
  .card-wide,
  .half,
  .feature {
    grid-column: 1 / -1;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .page-grid-v2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1025px) {
  .page-grid-v2 {
    grid-template-columns: repeat(auto-fit, minmax(var(--grid-min-col, 240px), 1fr));
  }
}

/* ==================== EMPTY STATE ==================== */

.empty-page-placeholder {
  grid-column: 1 / -1;
  padding: 60px;
  text-align: center;
  background: rgba(255, 255, 255, 0.1);
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  color: white;
  font-size: 18px;
}

/* ==================== V2 MODULE HIDDEN STATE ==================== */

.module-wrapper-v2.module-hidden {
  opacity: 0.4;
  filter: grayscale(50%);
}

body.edit-mode .module-wrapper-v2.module-hidden {
  border-style: dashed;
  border-color: #9ca3af;
}

/* ==================== V2 INLINE EDITING ==================== */

.module-wrapper-v2.inline-editing {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%);
  z-index: 20000 !important;  /* Must be above .editing-overlay (15000) */
  max-width: 90vw;
  max-height: 90vh;
  overflow: visible;
  padding: 0;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  color: #333 !important;  /* Force dark text so editor labels are always visible */
}

/* Ensure all editor form elements inside inline-editing have readable text */
.module-wrapper-v2.inline-editing label,
.module-wrapper-v2.inline-editing h3,
.module-wrapper-v2.inline-editing h4,
.module-wrapper-v2.inline-editing p,
.module-wrapper-v2.inline-editing span,
.module-wrapper-v2.inline-editing div {
  color: inherit;
}

/* ==================== V2 RESIZE HANDLE (PULLABLE CORNER) ==================== */

.resize-handle-v2 {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 36px;
  height: 36px;
  cursor: nwse-resize;
  z-index: 150;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.15s ease;
  /* Blue corner triangle */
  background: linear-gradient(135deg, transparent 50%, #3b82f6 50%);
  border-radius: 0 0 8px 0;
}

/* White arrows on top of blue corner */
.resize-handle-v2::before {
  content: '';
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background-image: url("/images/3arrows.svg");
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
}

/* Tooltip on hover */
.resize-handle-v2::after {
  content: '→ width  ↓ height  ↘ both';
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 8px;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.resize-handle-v2:hover::after {
  opacity: 1;
}

body.edit-mode .module-wrapper-v2:hover .resize-handle-v2 {
  opacity: 1;
}

.resize-handle-v2:hover {
  transform: scale(1.1);
  background: linear-gradient(135deg, transparent 50%, #2563eb 50%);
  filter: drop-shadow(0 2px 4px rgba(37, 99, 235, 0.5));
}

/* ==================== RESIZING MODE - Ghost Module Preview ==================== */

/* Nervous jiggle animation for ghost cards */
@keyframes nervousJiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-0.25deg) translateX(-0.5px); }
  75% { transform: rotate(0.25deg) translateX(0.5px); }
}

/* Other modules become white ghost boxes */
body.resizing-v2 .module-wrapper-v2:not(.resizing-active) {
  background: white !important;
  border: 2px dashed #cbd5e1 !important;
  box-shadow: none !important;
  opacity: 0.4;
  transition: all 0.15s ease;
  animation: nervousJiggle 0.3s ease-in-out infinite;
}

/* Hide ALL content inside ghost modules */
body.resizing-v2 .module-wrapper-v2:not(.resizing-active) > *:not(.order-badge):not(.module-type-badge):not(.corner-btn):not(.resize-handle) {
  opacity: 0 !important;
  visibility: hidden !important;
}

/* Keep badges visible and prominent on ghost modules */
body.resizing-v2 .module-wrapper-v2:not(.resizing-active) .order-badge {
  opacity: 1 !important;
  background: #64748b;
  color: white;
  font-size: 16px;
  padding: 4px 10px;
}

body.resizing-v2 .module-wrapper-v2:not(.resizing-active) .module-type-badge {
  opacity: 1 !important;
  background: rgba(100, 116, 139, 0.9);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
}

/* Hide corner buttons on ghost modules */
body.resizing-v2 .module-wrapper-v2:not(.resizing-active) .corner-btn {
  opacity: 0 !important;
  pointer-events: none;
}

/* The active resizing module stays fully visible */
body.resizing-v2 .module-wrapper-v2.resizing-active {
  z-index: 200;
  box-shadow: 0 0 0 4px #3b82f6, 0 8px 30px rgba(59, 130, 246, 0.4) !important;
  transition: box-shadow 0.15s ease;
}

/* ==================== DRAGGING MODE - Ghost Module Preview ==================== */

/* Other modules become white ghost boxes when dragging */
body.dragging-v2 .module-wrapper-v2:not(.dragging) {
  background: white !important;
  border: 2px dashed #cbd5e1 !important;
  box-shadow: none !important;
  opacity: 0.4;
  transition: all 0.15s ease;
  animation: nervousJiggle 0.3s ease-in-out infinite;
}

/* Hide ALL content inside ghost modules when dragging */
body.dragging-v2 .module-wrapper-v2:not(.dragging) > *:not(.order-badge):not(.module-type-badge):not(.corner-btn):not(.resize-handle) {
  opacity: 0 !important;
  visibility: hidden !important;
}

/* Keep badges visible on ghost modules when dragging */
body.dragging-v2 .module-wrapper-v2:not(.dragging) .order-badge {
  opacity: 1 !important;
  background: #64748b;
  color: white;
  font-size: 16px;
  padding: 4px 10px;
}

body.dragging-v2 .module-wrapper-v2:not(.dragging) .module-type-badge {
  opacity: 1 !important;
  background: rgba(100, 116, 139, 0.9);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
}

/* Hide corner buttons on ghost modules when dragging */
body.dragging-v2 .module-wrapper-v2:not(.dragging) .corner-btn {
  opacity: 0 !important;
  pointer-events: none;
}

/* The dragged module stays fully visible */
body.dragging-v2 .module-wrapper-v2.dragging {
  z-index: 200;
  box-shadow: 0 0 0 4px #10b981, 0 8px 30px rgba(16, 185, 129, 0.4) !important;
  opacity: 0.9;
}

/* ==================== ADD CARD PLACEHOLDER ==================== */

.add-card-placeholder {
  background: rgba(255, 255, 255, 0.1);
  border: 3px dashed rgba(255, 255, 255, 0.4);
  border-radius: 12px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  /* Always at the end, own row */
  order: 99999 !important;
  grid-column: 1 / -1;
}

.add-card-placeholder:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.6);
  transform: scale(1.02);
}

.add-card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.7);
}

.add-card-placeholder:hover .add-card-content {
  color: white;
}

.add-card-content .add-icon {
  font-size: 48px;
  font-weight: 300;
  line-height: 1;
}

.add-card-content .add-text {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Drag over state - green highlight */
.add-card-placeholder.drag-over {
  background: rgba(16, 185, 129, 0.3) !important;
  border-color: #10b981 !important;
  transform: scale(1.03);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.add-card-placeholder.drag-over .add-card-content {
  color: white;
}

.add-card-placeholder.drag-over .add-icon {
  transform: scale(1.2);
}

/* During resize mode - dim */
body.resizing-v2 .add-card-placeholder {
  opacity: 0.3;
  pointer-events: none;
}

/* During drag mode - show as valid target */
body.dragging-v2 .add-card-placeholder {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.5);
}

/* Size preview badge */
.resize-size-preview {
  position: fixed;
  background: #1e40af;
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════
   CONTAINER MODULE
   ═══════════════════════════════════════════════════════════ */

/* ── View mode: clean semantic output ── */
.module-container {
  position: relative;
}

/* Responsive: columns stack on mobile */
@media (max-width: 768px) {
  [data-container-layout="columns"] {
    flex-direction: column !important;
  }
  .container-child-wrapper {
    flex-basis: 100% !important;
    max-width: 100% !important;
    flex: 1 1 100% !important;
  }
}

/* ── Edit frame ── */
.container-edit-frame {
  border: 2px dashed rgba(102, 126, 234, 0.4);
  border-radius: 8px;
  padding: 8px 8px 12px;
  position: relative;
  min-height: 60px;
  background: rgba(255, 255, 255, 0.02);
  overflow: visible;
}

.container-edit-frame.drag-over {
  background: rgba(0, 123, 255, 0.05);
  border-color: rgba(0, 123, 255, 0.6);
}

/* Tag badge */
.container-tag-badge {
  position: absolute;
  top: -10px;
  left: 12px;
  background: #667eea;
  color: white;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  z-index: 10;
  pointer-events: none;
}

/* ── Toolbar ── */
.container-toolbar {
  margin-top: 4px;
}

/* Layout picker buttons */
.container-layout-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid rgba(102, 126, 234, 0.3);
  border-radius: 4px;
  background: rgba(102, 126, 234, 0.08);
  color: #667eea;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.container-layout-btn:hover {
  background: rgba(102, 126, 234, 0.15);
  border-color: rgba(102, 126, 234, 0.5);
}

.container-layout-btn.active {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.layout-btn-icon {
  font-size: 14px;
}

.layout-btn-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Tag picker */
.container-tag-select {
  padding: 4px 8px;
  border: 1px solid rgba(102, 126, 234, 0.3);
  border-radius: 4px;
  background: rgba(102, 126, 234, 0.08);
  color: #667eea;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.container-tag-select:hover,
.container-tag-select:focus {
  border-color: #667eea;
}

/* ── Ruler (0-100 track with pins) ── */
.container-ruler {
  padding: 8px 12px 4px;
}

.ruler-width-labels {
  display: flex;
  gap: 0;
  margin-bottom: 2px;
}

.ruler-width-label {
  text-align: center;
  overflow: hidden;
}

.ruler-width-value {
  font-size: 11px;
  font-weight: 700;
  color: #667eea;
}

.ruler-mode-label {
  display: block;
  font-size: 9px;
  color: #999;
  margin-top: 1px;
}

/* The track itself */
.ruler-track {
  position: relative;
  height: 28px;
  cursor: crosshair;
  user-select: none;
}

.ruler-track-bg {
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  height: 8px;
  background: linear-gradient(90deg, rgba(102,126,234,0.15) 0%, rgba(102,126,234,0.25) 100%);
  border-radius: 4px;
}

.ruler-add-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  color: rgba(102, 126, 234, 0.4);
  pointer-events: none;
  white-space: nowrap;
}

/* Pin marker */
.ruler-pin {
  position: absolute;
  top: 2px;
  width: 14px;
  height: 24px;
  margin-left: -7px;
  cursor: col-resize;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ruler-pin::before {
  content: '';
  width: 4px;
  height: 100%;
  background: #667eea;
  border-radius: 2px;
  transition: background 0.15s, width 0.15s;
}

.ruler-pin:hover::before {
  background: #4f5ed5;
  width: 6px;
  box-shadow: 0 0 8px rgba(102, 126, 234, 0.5);
}

.ruler-pin-tooltip {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.ruler-pin:hover .ruler-pin-tooltip {
  opacity: 1;
}

/* Scale labels */
.ruler-scale {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: #bbb;
  padding: 0 2px;
  margin-top: 2px;
}

/* ── Children area ── */
.container-children-area {
  position: relative;
  min-height: 40px;
  padding: 4px 12px 8px;
}

/* Empty state */
.container-empty-state {
  min-height: 80px;
  border: 2px dashed rgba(0, 123, 255, 0.3);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(0, 123, 255, 0.5);
  font-size: 13px;
  cursor: default;
  transition: all 0.2s;
}

.container-empty-state:hover {
  border-color: rgba(0, 123, 255, 0.5);
  background: rgba(0, 123, 255, 0.03);
}

/* Nested containers inside a column slot — always visible with a border */
.container-child-slot .container-edit-frame {
  border: 2px dashed rgba(102, 126, 234, 0.5);
  background: rgba(102, 126, 234, 0.03);
  min-height: 60px;
}

/* Nested empty container gets extra visual treatment */
.container-child-slot .container-empty-state {
  min-height: 50px;
  font-size: 11px;
  border-style: dotted;
}

/* Child slots */
.container-child-slot {
  position: relative;
  border: 1px solid rgba(102, 126, 234, 0.15);
  border-radius: 6px;
  transition: border-color 0.15s;
  overflow: visible;
  display: flex;
  flex-direction: column;
}


.container-child-slot:hover {
  border-color: rgba(102, 126, 234, 0.4);
}

/* Child header — type label at top of each filled slot */
.container-child-header {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #667eea;
  text-transform: capitalize;
  padding: 4px 4px 2px;
  background: rgba(102, 126, 234, 0.06);
  border-bottom: 1px solid rgba(102, 126, 234, 0.1);
  border-radius: 5px 5px 0 0;
}

/* Module content inside column slots: don't grow to fill, stay natural height */
.container-child-content {
  flex: 0 1 auto;
  overflow: hidden;
  min-height: 20px;
}

/* During palette drag: occupied column slots pulse to show they accept drops */
body.palette-dragging .container-column-dropzone[data-has-child="true"] {
  outline: 2px dashed rgba(0, 123, 255, 0.4);
  outline-offset: -2px;
  animation: columnPulse 1.5s ease-in-out infinite;
}

@keyframes columnPulse {
  0%, 100% { outline-color: rgba(0, 123, 255, 0.2); }
  50% { outline-color: rgba(0, 123, 255, 0.6); }
}

/* Child bar — buttons pinned to bottom of each filled slot */
.container-child-bar {
  display: flex;
  justify-content: center;
  padding: 4px 4px;
  background: rgba(102, 126, 234, 0.04);
  border-top: 1px solid rgba(102, 126, 234, 0.1);
  border-radius: 0 0 5px 5px;
  margin-top: auto;
}

.container-child-btn-row {
  display: flex;
  gap: 6px;
}

/* Ruler col badge — replaces plain percentage */
.ruler-col-badge {
  font-size: 10px;
  font-weight: 600;
  color: #667eea;
  background: rgba(102, 126, 234, 0.1);
  padding: 2px 8px;
  border-radius: 3px;
  white-space: nowrap;
}

.container-child-btn {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid rgba(102, 126, 234, 0.3);
  background: rgba(102, 126, 234, 0.1);
  color: #667eea;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.container-child-btn:hover {
  background: #667eea;
  color: white;
  transform: scale(1.1);
}

.container-child-delete {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
}

.container-child-delete:hover {
  background: #ef4444;
  color: white;
}

/* Lighter overlay for container child editing */
.container-child-overlay {
  background: rgba(0, 0, 0, 0.4) !important;
  backdrop-filter: blur(2px) !important;
}

/* Highlight slot while editing — subtle, stays behind overlay */
.container-child-slot.child-editing {
  outline: 3px solid #667eea;
  outline-offset: -1px;
  border-radius: 6px;
  background: rgba(102, 126, 234, 0.05);
}
.container-child-slot.child-editing .container-child-bar {
  background: rgba(102, 126, 234, 0.15);
}

/* Centered editor panel for container children */
.container-child-editor-host {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 650px;
  max-height: 85vh;
  overflow-y: auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 8px;
  z-index: 15002;
  color: #333;
}

/* Reset gradient text bleed — module content uses -webkit-text-fill-color: transparent
   which cascades into the edit form and makes everything invisible */
.container-child-editor-host .inline-edit-form,
.container-child-editor-host .inline-edit-form * {
  -webkit-text-fill-color: initial !important;
  background-clip: initial !important;
  -webkit-background-clip: initial !important;
  color: #333;
}

/* Column info banner at top of editor */
.container-child-editor-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 8px 8px 0 0;
  margin: -8px -8px 8px -8px;
}
.editor-banner-col {
  font-size: 13px;
  font-weight: 700;
  color: white;
  background: rgba(255, 255, 255, 0.2);
  padding: 3px 12px;
  border-radius: 4px;
}
.editor-banner-type {
  font-size: 14px;
  font-weight: 600;
  color: white;
}

/* Insertion line — used by both containers and page-level drops */
.container-insertion-line {
  pointer-events: none;
  transition: opacity 0.15s;
}

/* Page-level drag-over state */
#moduleContainer.page-drag-over {
  outline: 2px dashed rgba(0, 123, 255, 0.35);
  outline-offset: -2px;
  border-radius: 4px;
}

/* Page-level insertion line (same class reused from containers) */
#moduleContainer > .container-insertion-line {
  height: 4px;
  width: 100%;
  background: linear-gradient(90deg, transparent, #007bff 10%, #007bff 90%, transparent);
  border-radius: 2px;
  margin: -2px 0;
  pointer-events: none;
  z-index: 100;
}

/* ── Grid controls ── */
.container-grid-controls {
  background: rgba(102, 126, 234, 0.05);
  border-radius: 4px;
  margin: 4px 0;
}

.container-min-width-slider {
  accent-color: #667eea;
}

/* ── Auto-stack: transparent wrapper, no container chrome ── */
.auto-stack-wrapper {
  padding: 0;
  margin: 0;
}

.auto-stack-child {
  border: 1px solid rgba(102, 126, 234, 0.2);
  border-radius: 4px;
}

.auto-stack-dropzone {
  min-height: 28px;
  border: 1px dashed rgba(0, 123, 255, 0.25);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.auto-stack-dropzone.column-drag-over {
  border-color: #007bff;
  background: rgba(0, 123, 255, 0.08);
}

/* ── Per-column drop zones (columns mode) ── */
.container-column-dropzone {
  transition: all 0.2s;
  border: none;
  border-radius: 6px;
}

.container-column-dropzone[data-has-child="false"] {
  background: transparent;
}

.container-column-dropzone.column-drag-over {
  border-color: #007bff !important;
  background: rgba(0, 123, 255, 0.08) !important;
  box-shadow: inset 0 0 12px rgba(0, 123, 255, 0.1);
}

/* During palette drag: module content inside column slots becomes transparent
   to pointer events so the column slot catches all drag events.
   body.palette-dragging is toggled by dragstart/dragend on palette items. */
body.palette-dragging .container-column-dropzone > *:not(.container-column-placeholder):not(.auto-stack-wrapper):not(.container-child-bar):not(.container-child-content) {
  pointer-events: none;
}
body.palette-dragging .container-column-dropzone.column-drag-over {
  outline: 2px dashed rgba(0, 123, 255, 0.5);
  outline-offset: -2px;
}

/* Column placeholder (empty slot) — inset visually inside the flex slot */
.container-column-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  height: 100%;
  gap: 4px;
  cursor: default;
  padding: 4px 2px;
  overflow: hidden;
  border: 2px dashed rgba(0, 123, 255, 0.3);
  border-radius: 5px;
  margin: 2px 3px;
}

/* First and last placeholders hug the edges */
.container-column-dropzone:first-child .container-column-placeholder {
  margin-left: 0;
}
.container-column-dropzone:last-child .container-column-placeholder {
  margin-right: 0;
}

.column-placeholder-label {
  font-size: 14px;
  font-weight: 700;
  color: rgba(102, 126, 234, 0.4);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.column-placeholder-hint {
  font-size: 9px;
  color: rgba(0, 123, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.container-column-dropzone.column-drag-over .column-placeholder-label {
  color: #007bff;
}
.container-column-dropzone.column-drag-over .column-placeholder-hint {
  color: #007bff;
  font-weight: 600;
}

/* Append drop zone (stack/grid mode) */
.container-append-dropzone {
  min-height: 50px;
  border: 2px dashed rgba(0, 123, 255, 0.2);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  margin-top: 4px;
}
.container-append-dropzone:hover {
  border-color: rgba(0, 123, 255, 0.4);
  background: rgba(0, 123, 255, 0.03);
}

















