/**
 * Row Block Component Styles
 * Provides responsive column layouts with customizable sizes
 */

.row-block {
  width: 100%;
  max-width: 1140px;
  margin: 24px auto;
  padding: 0 15px;
}

.row-container {
  display: flex;
  gap: 24px;
  width: 100%;
  position: relative;
}

/* Column Layout Defaults - Equal width by default, adjustable via resize handles */
.row-layout-1-col .row-column {
  flex: 1 1 100%;
}

.row-layout-2-col .row-column {
  flex: 1 1 50%;
}

.row-layout-3-col .row-column {
  flex: 1 1 33.333%;
}

.row-layout-4-col .row-column {
  flex: 1 1 25%;
}

/* Column Styles */
.row-column {
  position: relative;
  transition: all 0.3s ease;
}

/* Editor-only styling - only show borders/background in editing mode */
body[data-editing-mode="true"] .row-column {
  min-height: 100px;
  padding: 16px;
  background: rgba(240, 240, 240, 0.3);
  border: 2px dashed #ccc;
  border-radius: 4px;
}

body[data-editing-mode="true"] .row-column:hover {
  background: rgba(0, 123, 255, 0.05);
  border-color: #007cba;
}

/* Column with content - remove editor styling */
body[data-editing-mode="true"] .row-column:has(.block-wrapper) {
  background: transparent;
  border: none;
  padding: 0;
}

/* Placeholder for empty columns */
.column-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 100px;
  color: #999;
  font-size: 14px;
  text-align: center;
  pointer-events: none;
  user-select: none;
}

/* Hide placeholder when column has content */
.row-column:has(.block-wrapper) .column-placeholder {
  display: none;
}

/* Drop zone active state */
.row-column[data-drop-active="true"] {
  background: rgba(0, 123, 255, 0.1);
  border-color: #007cba;
  border-style: solid;
}

/* Responsive Design */
@media (max-width: 992px) {
  /* Stack 4 columns into 2x2 grid on tablets */
  .row-layout-4-col .row-container {
    flex-wrap: wrap;
  }
  
  .row-layout-4-col .row-column {
    flex: 1 1 45%;
  }
}

@media (max-width: 768px) {
  .row-block {
    padding: 0 10px;
    margin: 16px auto;
  }
  
  .row-container {
    gap: 16px;
  }
  
  /* Stack all multi-column layouts on mobile */
  .row-layout-2-col .row-container,
  .row-layout-3-col .row-container,
  .row-layout-4-col .row-container {
    flex-direction: column;
  }
  
  .row-layout-2-col .row-column,
  .row-layout-3-col .row-column,
  .row-layout-4-col .row-column {
    flex: 1 1 100%;
    width: 100%;
  }
  
  .row-column {
    min-height: 80px;
    padding: 12px;
  }
}

/* Nested component spacing */
.row-column .block-wrapper {
  margin: 0;
}

.row-column .block-wrapper + .block-wrapper {
  margin-top: 16px;
}

/* Animation for adding components */
.row-column .block-wrapper {
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* Print styles */
@media print {
  .row-block {
    margin: 12px 0;
  }
  
  .row-column {
    border: none;
    background: transparent;
    padding: 0;
    break-inside: avoid;
  }
  
  .column-placeholder {
    display: none;
  }
}

