/* D:\Hurricane Creek Automotive Website\hierarchy-toolset.firecrafting.net\static\css\hierarchy_editor.css */

/* ────────────────────────── Page Layout ────────────────────────── */
html, body {
  height: 100%;
  margin: 0;
}
body {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  position: relative; /* for the absolute message bar */
}
#content-wrapper {
  flex: 1 1 auto;
  overflow-x: auto;
  overflow-y: auto;
  margin: 1rem 0;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* ─── Message Bar (overlay) ─────────────────────────────────────── */
#message-bar {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: inline-block;
  background-color: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  z-index: 1000;
  white-space: nowrap;
  margin: 0;
}

/* ─── Palette & Trash Row ───────────────────────────────────────── */
#palette-row {
  display: flex;
  align-items: flex-start;
  border: 1px solid #ddd;
  border-radius: 0.5rem;
  padding: 1rem;
  gap: 2rem;
  background: #f8f9fa;
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
}
#trash-can-col {
  flex: 0 0 auto;
  min-width: 180px;
  max-width: 240px;
}
#role-palette-col {
  flex: 1 1 0;
  min-width: 0;
  overflow-x: auto;
}

/* ─── Role Palette ───────────────────────────────────────────────── */
#role-palette-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  overflow-x: auto;
  white-space: nowrap;
}
.role-palette-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.75rem;
  border-radius: 0.25rem;
  background-color: lightgray;
  color: #000;
  cursor: pointer;
  text-align: center;
}

/* ─── Trash Can ──────────────────────────────────────────────────── */
#trash-can-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem;
  min-height: 40px;
  max-height: 120px;
  border: 2px dashed #dc3545;
  border-radius: 4px;
  background: rgba(220,53,69,0.05);
  overflow-y: auto;
}
#trash-can-list .user-item {
  background: #f8d7da;
  display: inline-flex !important;
  width: auto !important;
  max-width: 260px;
  padding: 4px 8px;
  cursor: move;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.5rem;
  transition: transform 0.2s ease, background-color 0.2s ease;
  border: 2px solid #000;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

/* ─── NSN-Tree Blocks ───────────────────────────────────────────── */
.nsn-tree-block {
  background: #fff;
  margin-bottom: 1rem;
  position: relative;
  min-width: 260px;
  max-width: 100%;
  overflow: visible;
  outline-offset: -2px;
}
.nsn-tree-block .drag-handle {
  position: absolute;
  top: 4px;
  left: 4px;
  cursor: move;
}

/* ─── Role-Lanes ────────────────────────────────────────────────── */
.role-lane {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.5rem;
  border: 1px dashed #6c757d;
  border-radius: 4px;
  padding: 0.25rem;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  overflow-x: auto;
}
.role-lane:hover {
  background-color: rgba(108,117,125,0.1);
  border-color: rgba(108,117,125,0.4);
}
/* Above-NSN lanes are horizontal */
#above-roles-panel .role-lane {
  flex-direction: row;
  align-items: flex-start;
  gap: 1rem;
}

/* ─── Items Container ───────────────────────────────────────────── */
/* Ensure empty lanes have a hitbox for drops */
.role-lane .items-container {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.25rem 0;
  transition: transform 0.2s ease;
  min-height: 36px;    /* ← hit area even when empty */
}
.role-lane .items-container .user-item {
  background: #d1ecf1;
  padding: 4px 8px;
  cursor: move;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.5rem;
  transition: transform 0.2s ease, background-color 0.2s ease;
  border: 2px solid #000;
  border-radius: 0.5rem;
}
.user-item .drag-handle {
  cursor: move;
}

/* ─── Child NSN Container ───────────────────────────────────────── */
/* single horizontal row, no wrap */
.child-nsn-container {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.5rem;
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 0.25rem;
  width: max-content;
}

/* ─── Grid Layout for Above-NSN ─────────────────────────────────── */
.editor-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  column-gap: 1.5rem;
  row-gap: 1rem;
  align-items: stretch;
}
.grid-parent-cell,
.grid-children-cell {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: visible;
}
.grid-parent-cell {
  border-right: 1px solid #ddd;
  padding-right: 0.5rem;
}
.grid-children-cell {
  padding-left: 0.5rem;
  min-width: 0;
  overflow-x: auto;
}

/* ─── Overlays ───────────────────────────────────────────────────── */
.role-form {
  position: absolute;
  width: 260px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.field-edit {
  position: absolute;
  z-index: 10000;
}

/* Prevent Bootstrap containers from limiting width */
.container, .container-fluid {
  max-width: 100%;
}

/* ─── Drop-zone styling ───────────────────────────────────────────── */
.drop-zone,
.move-up-zone {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  border: 2px dashed #0d6efd;
  background: rgba(13,110,253,0.1);
  text-align: center;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.drop-zone:hover,
.move-up-zone:hover {
  background-color: rgba(13,110,253,0.2);
}

/* override the 100% width so it only wraps its text */
.move-up-zone {
  width: auto;
  display: inline-block;  /* shrink to fit */
}

/* ─── Sliding Filter Panel ──────────────────────────────────────────── */
.filter-menu {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 300px;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 1000;
}
.filter-menu.open {
  transform: translateX(0);
}

/* Shift main content when panel open */
#main-container {
  transition: transform 0.3s ease;
}
body.filter-open #main-container {
  transform: translateX(300px);
}

/* Highlight matching blocks */
.highlight-match {
  outline: 3px solid purple !important;
  background-color: rgba(128,0,128,0.1) !important;
}

/* ────────────────────── IMPORTANT BEHAVIORAL RULES ───────────────────── */
/* Hide empty lanes ONLY if the NSN tree already contains at least one block.
   This keeps empty lanes invisible in non-empty trees,
   BUT shows all lanes for a completely empty NSN tree so you can drop into it. */
.nsn-tree-block:not([data-nsn-id="above"]):has(.user-item) .role-lane:not(:has(.user-item)) {
  display: none !important;
}

/* Always-visible role-move drop-zones */
.move-role-zone {
  display: block !important;
  width: 100%;
  min-height: 36px;
  background: #eaf1ff;
  border: 2px dashed #007bff;
  border-radius: 6px;
  text-align: center;
  font-weight: bold;
  color: #1955b1;
  margin: 8px 0;
  padding: 6px 0;
  cursor: pointer;
  z-index: 200;
  transition: background 0.2s;
}
.move-role-zone:hover {
  background: #d6e5ff;
}
/* Up vs Down variants */
.move-role-up-zone   { /* inherits generic styling */ }
.move-role-down-zone {
  background: #eafae8 !important;
  border-color: #198754 !important;
  color: #217a2d !important;
}
