/* Builder layout — used for both the embedded modal and the full-page non-embedded builder */
.embedded-builder-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 12px;
  align-items: start;
}

/* Everything except the floating palette goes in column 1 */
.embedded-builder-page > *:not(#createMenu) {
  grid-column: 1;
}

#createMenu.embedded-floating-menu {
  position: sticky;
  right: auto;
  width: 220px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 8px;
  z-index: 10;
  grid-column: 2;
  grid-row: 1 / span 20;
}

/* Embedded modal: stick near the top of the modal */
#createMenu.embedded-floating-menu.embedded-mode-menu {
  top: 12px;
}

/* Full-page non-embedded builder: account for the fixed 80px navbar */
#createMenu.embedded-floating-menu:not(.embedded-mode-menu) {
  top: 96px;
}

.embedded-menu-actions {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #dee2e6;
  background: rgba(255, 255, 255, 0.96);
  position: sticky;
  bottom: 0;
}

.embedded-cancel-prompt {
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 8px;
  background: #fff;
}

.builder-palette-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.builder-palette-item {
  align-items: flex-start;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-color: rgba(27, 166, 83, 0.24);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 0 !important;
  min-height: 86px;
  padding: 12px;
  position: relative;
  text-align: left;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    border-color 0.15s ease;
}

.builder-palette-item:hover,
.builder-palette-item:focus {
  border-color: rgba(27, 166, 83, 0.7);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
}

.builder-palette-item__icon {
  color: #127339;
  font-size: 1.1rem;
}

.builder-palette-item__title {
  color: #212529;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
}

.builder-palette-item__hint {
  color: #6c757d;
  font-size: 0.74rem;
  line-height: 1.35;
}

.builder-palette-item__badge {
  align-self: flex-end;
  background: rgba(53, 80, 160, 0.12);
  border-radius: 999px;
  color: #3550a0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
  padding: 2px 8px;
  text-transform: uppercase;
}

.builder-template-item {
  background: linear-gradient(180deg, #f5f7ff 0%, #eef3ff 100%);
  border-color: rgba(53, 80, 160, 0.28);
  border-style: dashed;
}

.builder-template-item .builder-palette-item__icon {
  color: #3550a0;
}

.builder-palette-section-hint {
  color: #6c757d;
  font-size: 0.74rem;
  line-height: 1.35;
}

/* Drag cursor for palette items in any builder layout */
.embedded-builder-page .builder-palette-item {
  cursor: grab;
}

.embedded-builder-page .builder-palette-item:active {
  cursor: grabbing;
}

#createMenu.embedded-floating-menu.menu-collapsed #createMenuItems {
  display: none;
}

#createMenu.embedded-floating-menu .menu-toggle {
  min-width: 36px;
}

#questionnaire-content .drop-indicator-row td {
  padding: 0;
  border: 0;
}

#questionnaire-content .drop-indicator-line {
  height: 0;
  border-top: 3px dashed #1ba653;
  margin: 4px 0;
}

@media (max-width: 1100px) {
  .embedded-builder-page {
    display: block;
    padding-bottom: 180px;
  }

  #createMenu.embedded-floating-menu,
  .embedded-menu-actions {
    position: static;
  }

  #createMenu.embedded-floating-menu {
    position: fixed;
    right: 16px;
    width: 220px;
  }

  #createMenu.embedded-floating-menu {
    top: auto;
    bottom: 120px;
    max-height: 40vh;
  }

  .embedded-menu-actions {
    border-top: 1px solid #dee2e6;
  }
}
