/* 30-rack.css — the HERO screen: a rack's RU elevation + catalog tray + the
 * per-instance port inspector. The elevation is drawn bottom-up as a real rack:
 * numbered units, monospace, full-width equipment blocks tinted by kind.
 */

/* ---- top: rack readiness gates --------------------------------------- */
.rack-gates {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
}
.rack-gates-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; margin-right: 4px;
}

/* ---- body layout: elevation | side ----------------------------------- */
.rack-body {
  display: grid; gap: 20px; align-items: start;
  grid-template-columns: minmax(280px, 1fr) minmax(300px, 1.1fr);
}

/* ---- the rack elevation --------------------------------------------- */
.rack-elevation {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px;
  box-shadow: var(--shadow);
}
.ru-grid {
  --ru-unit: 1.55rem;
  display: grid;
  /* two mounting rails framing the units */
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  background:
    linear-gradient(var(--bg), var(--bg)) padding-box,
    repeating-linear-gradient(var(--surface-2) 0 2px, transparent 2px 4px);
  overflow: hidden;
  font-family: var(--mono);
}
.ru-cell {
  display: flex; align-items: center;
  min-height: var(--ru-unit);
  padding: 0 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.ru-cell:first-child { border-top: none; }

/* empty mounting slot — shows its RU number, becomes a drop target when armed */
.ru-cell.empty {
  color: var(--ink-faint);
  background: repeating-linear-gradient(
    90deg, transparent 0 6px, color-mix(in srgb, var(--line) 30%, transparent) 6px 7px);
}
.ru-num {
  font-size: 10px; width: 100%;
  letter-spacing: .04em; user-select: none;
}
.ru-cell.empty.armable { cursor: pointer; }
.ru-cell.empty.armable:hover {
  background: color-mix(in srgb, var(--accent) 18%, var(--bg));
  box-shadow: inset 0 0 0 1px var(--accent);
}
.ru-cell.empty.armable .ru-num { color: var(--accent); }

/* equipment block — spans its U range, tinted by catalog kind via --eq-color */
.ru-cell.equip {
  --eq-color: var(--accent);
  flex-direction: column; align-items: flex-start; justify-content: center;
  gap: 1px; padding: 4px 10px; cursor: pointer;
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--eq-color) 20%, var(--surface-2)),
      var(--surface-2) 60%);
  border-bottom: 1px solid var(--bg);
  transition: filter .12s;
}
.ru-cell.equip:hover { filter: brightness(1.12); }
.ru-cell.equip.selected {
  box-shadow: inset 0 0 0 2px var(--eq-color);
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--eq-color) 32%, var(--surface-2)),
      var(--surface-2) 70%);
}
.equip-u { font-size: 9.5px; letter-spacing: .04em; }
.equip-name {
  font-size: 12.5px; font-weight: 700; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.equip-meta { font-size: 10px; }

/* ---- right side container ------------------------------------------- */
.rack-side { display: flex; flex-direction: column; gap: 16px; }

/* ---- catalog tray ---------------------------------------------------- */
.catalog-tray {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px;
}
.tray-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.tray-head h3 { margin: 0; font-size: 14px; }
.arm-hint { font-size: 12px; margin: 8px 0 12px; }
.tray-list { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow: auto; }
.tray-chip {
  --eq-color: var(--accent);
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 8px 10px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface-2);
  transition: border-color .12s, background .12s;
}
.tray-chip:hover { border-color: var(--eq-color); }
.tray-chip.armed {
  border-color: var(--eq-color);
  background: color-mix(in srgb, var(--eq-color) 16%, var(--surface-2));
  box-shadow: inset 0 0 0 1px var(--eq-color);
}
.chip-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.chip-body { min-width: 0; }
.chip-name {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip-meta { font-size: 11px; }

/* ---- inspector ------------------------------------------------------- */
.inspector {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px;
}
.inspector-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 10px;
}
.inspector-name { font-size: 15px; font-weight: 700; }
.inspector-sub { font-size: 12px; }

.port-list { display: flex; flex-direction: column; gap: 4px; max-height: 420px; overflow: auto; }
.port-list-head {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  padding-bottom: 4px;
}
.port-row {
  display: grid; align-items: center; gap: 8px;
  grid-template-columns: 64px 1fr auto;
  padding: 5px 8px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid transparent;
}
.port-row.occupied { border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.port-row.free { opacity: .92; }
.port-name { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--ink); }
.port-state { font-size: 12px; }
.port-row.occupied .port-state { color: var(--ok); }
.port-type { display: flex; align-items: center; gap: 6px; }
.port-type .ui-select { width: auto; min-width: 120px; font-size: 12px; padding: 4px 8px; }

/* designated-cable-type dot (shared by rack + cabling) */
.ep-dot {
  width: 10px; height: 10px; border-radius: 50%; flex: none;
  background: var(--ink-faint); box-shadow: 0 0 0 1px rgba(0,0,0,.3) inset;
}
.ep-dot.none { background: transparent; border: 1px dashed var(--ink-faint); box-shadow: none; }

@media (max-width: 820px) {
  .rack-body { grid-template-columns: 1fr; }
}
