/* QUANTUM LABS — Mini Circuit */

/* Circuit Grid */
.et-circuit {
  overflow-x: auto;
  margin-bottom: var(--sp-2);
}

/* Et Grid */
.et-grid {
  display: grid;
  grid-template-columns: 28px repeat(var(--et-steps), 36px);
  grid-template-rows: 20px repeat(var(--et-qubits), 32px);
  gap: 2px;
  min-width: max-content;
}

/* Et Grid Corner */
.et-grid-corner,
.et-col-head {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  color: var(--ash);
  font-family: var(--font-mono);
}

/* Et Row Head */
.et-row-head {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-right: var(--sp-1);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ash);
}
.et-row-head .katex {
  font-size: 0.85em !important;
}

/* Et Cell */
.et-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 30px;
  background: var(--graphite);
  border: 1px solid var(--wire);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.12s;
  position: relative;
}
.et-cell:hover {
  border-color: var(--ember);
  background: var(--steel);
}

/* Et Col Head */
.et-col-head.add-step-btn {
  cursor: pointer;
  color: var(--smoke);
  font-weight: bold;
}

/* Et Cell */
.et-cell.empty {
  border: none;
  background: transparent;
}

/* Et Cell Empty Inner */
.et-cell-empty-inner {
  width: 100%;
  height: 2px;
  background: var(--wire-light);
  border-radius: 1px;
}

/* Et Cell Filled */
.et-cell-filled {
  background: var(--ember-10);
  border-color: var(--ember-30);
}
.et-cell-filled.selected {
  background: var(--ember-20);
  border-color: var(--ember);
  box-shadow: 0 0 0 1px var(--ember);
}

/* Param badge on parametric gates in mini circuit */
.et-cell-filled .param-badge {
  position: absolute;
  bottom: -4px;
  left: 50%;
  z-index: 2;
  width: max-content;
  min-width: 40px;
  padding: 2px 4px;
  font-size: 7px !important;
  line-height: 1;
  color: var(--chalk);
  text-align: center;
  background: var(--carbon);
  border: 1px solid var(--wire-light);
  border-radius: 4px;
  box-shadow: var(--shadow-sm);
  transform: translateX(-50%);
  white-space: nowrap !important;
}

/* Et Cell Filled */
.et-cell-filled .param-badge .katex,
.et-cell-filled .param-badge .katex-html {
  display: inline-block !important;
  font-size: 1em !important;
  white-space: nowrap !important;
}
.et-cell-filled:hover .edit-param-btn {
  opacity: 1;
  transform: scale(1);
}

/* Editor Pending */
.editor-pending {
  border-color: var(--neon) !important;
}
.editor-pending .pending-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  font-size: var(--text-xs);
  margin: 0 auto;
  border-radius: 4px;
  background: var(--bone);
  color: var(--graphite);
  border: 1px solid var(--graphite);
  opacity: 0.8;
}

/* Et Cell Label */
.et-cell-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--bone);
}
.et-cell-label .katex {
  font-size: 0.85em !important;
}

/* Et Ctrl Dot */
.et-ctrl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ember);
  z-index: 1;
}

/* Et Targ Circle */
.et-targ-circle {
  position: relative;
  z-index: 1;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--ember);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Et Targ Cross */
.et-targ-cross {
  width: 12px;
  height: 2px;
  background: var(--ember);
  position: absolute;
}
.et-targ-cross::after {
  content: "";
  position: absolute;
  width: 2px;
  height: 12px;
  background: var(--ember);
  left: 5px;
  top: -5px;
}

/* Vertical connector line between control and target */
.et-connector {
  position: absolute;
  left: 50%;
  width: 2px;
  background: var(--ember);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 0;
}

/* SWAP X symbol */
.et-swap-x {
  position: relative;
  width: 12px;
  height: 12px;
  z-index: 1;
}

/* Box Target */
.box-target {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ember-10);
  border-radius: var(--radius-md);
}

/* Et Swap X */
.et-swap-x::before,
.et-swap-x::after {
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 100%;
  background: var(--ember);
  content: '';
}
.et-swap-x::before {
  transform: translateX(-50%) rotate(45deg);
}
.et-swap-x::after {
  transform: translateX(-50%) rotate(-45deg);
}

/* Mc Gate Grid */
.mc-gate-grid {
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  gap: var(--sp-1);
}

/* Mini Circuit Palette */
#mini-circuit-palette .ql-gate-btn {
  min-height: auto;
  aspect-ratio: 1 / 1;
  padding: 2px;
}
#mini-circuit-palette .ql-gate-sym {
  font-size: 10px;
}

/* U2 Gate Category */
.u2-gate-category {
  margin-bottom: var(--sp-4);
}

/* U2 Group Header */
.u2-group-header {
  border-bottom: none;
  padding-left: 0;
}
.u2-group-header.compact {
  padding-bottom: var(--sp-2);
  padding-top: 0;
}

/* Mini Circuit Grid */
#mini-circuit-grid {
  border: 1px solid var(--wire);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  background: var(--surface);
  margin-bottom: 0;
  display: flex;
  justify-content: flex-start;
}
#mini-circuit-grid .placed-gate.pending-ghost {
  width: 100%;
  height: 100%;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: var(--text-xs);
}
