/* slotSelection.css
 * Tampilan seleksi Container Editor (E1c): slot terpilih, tombol "Pilih",
 * bilah aksi, baris jumlah, dialog enchant massal, dan badge ketik jumlah.
 *
 * Spesifisitas `.slot-host .slot.slot--…` — alasan yang sama dengan
 * slotInteraction.css (tema workbench dimuat sesudahnya).
 */

/* ── Slot terpilih & fokus ─────────────────────────────────────────────── */
.slot-host .slot.slot--selected {
  border-color: var(--wb-field, #5cc4b4);
  background: color-mix(in srgb, var(--wb-field, #5cc4b4) 20%, var(--wb-panel-raised, #191d22));
  box-shadow: inset 0 0 0 2px var(--wb-field, #5cc4b4);
}

.slot-host .slot.slot--selected::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--wb-field, #5cc4b4);
  box-shadow: 0 0 0 1.5px var(--wb-panel, #13161a);
}

.slot-host .slot:focus-visible {
  outline: 2px solid var(--wb-signal-strong, #95dd84);
  outline-offset: 1px;
  z-index: 1;
}

/* Mode Pilih: sapuan jari memilih, bukan menggulir. */
.slot-host.slot-host--selecting {
  touch-action: none;
}

.slot-host.slot-host--selecting .slot {
  cursor: cell;
}

.slot-host.slot-host--boxing,
.slot-host.slot-host--boxing .slot {
  cursor: crosshair;
}

/* Jumlah yang sedang diketik (keyboard). */
.slot__typing {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--wb-signal, #72c95f);
  color: var(--wb-canvas, #0c0e11);
  font: 700 11px/16px var(--font-mono, monospace);
  white-space: nowrap;
  pointer-events: none;
  z-index: 3;
}

/* ── Tombol "Pilih" di header grid ─────────────────────────────────────── */
.slot-select-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  margin-left: auto;
  padding: 4px 12px;
  border: 1px solid var(--wb-rule, #2a3038);
  border-radius: 999px;
  background: transparent;
  color: var(--wb-ink-soft, #b3bac3);
  font: 600 13px var(--font-body, inherit);
  cursor: pointer;
}

.slot-select-toggle:hover {
  border-color: var(--wb-field, #5cc4b4);
  color: var(--wb-ink, #eef0f3);
}

.slot-select-toggle.is-active {
  border-color: var(--wb-field, #5cc4b4);
  background: color-mix(in srgb, var(--wb-field, #5cc4b4) 18%, transparent);
  color: var(--wb-field-strong, #86dccf);
}

/* Undo bar tidak lagi perlu mendorong dirinya ke kanan — tombol Pilih
   sudah melakukannya. */
.grid-section__header .slot-select-toggle + * {
  margin-left: 0;
}

/* ── Bilah aksi ────────────────────────────────────────────────────────── */
.slot-actionbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--wb-field, #5cc4b4) 45%, var(--wb-rule, #2a3038));
  border-radius: var(--radius-sm, 6px);
  background: color-mix(in srgb, var(--wb-field, #5cc4b4) 7%, var(--wb-panel, #13161a));
  animation: slot-bar-in 140ms var(--ease-standard, ease);
}

.slot-actionbar[hidden],
.slot-actionbar__count[hidden] {
  display: none;
}

@keyframes slot-bar-in {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: none; }
}

.slot-actionbar__head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slot-actionbar__label {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--wb-field-strong, #86dccf);
}

.slot-actionbar__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--wb-ink-soft, #b3bac3);
  cursor: pointer;
}

.slot-actionbar__close:hover {
  background: var(--wb-panel-raised, #191d22);
  color: var(--wb-ink, #eef0f3);
}

.slot-actionbar__row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.slot-actionbar__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid var(--wb-rule, #2a3038);
  border-radius: var(--radius-sm, 6px);
  background: var(--wb-panel-raised, #191d22);
  color: var(--wb-ink, #eef0f3);
  font: 500 13px var(--font-body, inherit);
  cursor: pointer;
  white-space: nowrap;
}

.slot-actionbar__btn:hover:not(:disabled) {
  border-color: var(--wb-field, #5cc4b4);
}

.slot-actionbar__btn[aria-expanded="true"] {
  border-color: var(--wb-field, #5cc4b4);
  color: var(--wb-field-strong, #86dccf);
}

.slot-actionbar__btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.slot-actionbar__btn--danger {
  color: var(--wb-danger, #f08a78);
}

.slot-actionbar__count {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.slot-actionbar__count-input {
  width: 84px;
  min-height: 34px;
}

.slot-actionbar__chip {
  min-width: 40px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--wb-rule, #2a3038);
  border-radius: 999px;
  background: transparent;
  color: var(--wb-ink, #eef0f3);
  font: 600 13px var(--font-mono, monospace);
  cursor: pointer;
}

.slot-actionbar__chip:hover {
  border-color: var(--wb-signal, #72c95f);
}

.slot-actionbar__apply {
  min-height: 34px;
}

/* HP: menempel di atas navigasi bawah, tombol digeser ke samping. */
@media (max-width: 560px) {
  .slot-actionbar {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(var(--mobile-nav-height, 64px) + env(safe-area-inset-bottom, 0px) + 8px);
    z-index: 60;
    box-shadow: 0 10px 28px var(--wb-shadow, rgba(0, 0, 0, 0.45));
    background: var(--wb-panel-raised, #191d22);
    animation-name: slot-bar-up;
  }

  @keyframes slot-bar-up {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
  }

  .slot-actionbar__row {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    margin: 0 -2px;
    padding: 0 2px 2px;
  }

  .slot-actionbar__row::-webkit-scrollbar {
    display: none;
  }

  /* Ikon di atas label: target sentuh lebih tinggi, deretan lebih ringkas. */
  .slot-actionbar__btn {
    flex-direction: column;
    gap: 2px;
    min-width: 58px;
    min-height: 50px;
    padding: 6px 6px 4px;
    font-size: 11px;
  }

  .slot-actionbar__close {
    width: 36px;
    height: 36px;
  }

  .slot-actionbar__count {
    flex-wrap: nowrap;
    gap: 5px;
  }

  .slot-actionbar__count-input {
    width: 58px;
    min-width: 0;
    padding-left: 8px;
    padding-right: 4px;
  }

  .slot-actionbar__chip {
    min-width: 0;
    flex: 1 1 0;
    padding: 0 4px;
  }

  .slot-actionbar__apply {
    flex: none;
    padding-left: 12px;
    padding-right: 12px;
  }

  /* Header grid: label jenis kontainer tetap satu baris di samping
     tombol Pilih & undo. */
  .grid-section__header .grid-section__type-label {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .slot-select-toggle {
    flex: none;
    padding: 4px 10px;
  }

  /* Konten terakhir halaman tidak boleh tertutup bilah. */
  body.has-slot-actionbar .container-editor {
    padding-bottom: 170px;
  }
}

/* ── Dialog enchant massal ─────────────────────────────────────────────── */
.bulk-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.5);
}

.bulk-dialog {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(380px, 100%);
  padding: 18px 18px 16px;
  border: 1px solid var(--wb-rule, #2a3038);
  border-radius: var(--radius-md, 8px);
  background: var(--wb-panel-raised, #191d22);
  color: var(--wb-ink, #eef0f3);
  box-shadow: 0 20px 44px var(--wb-shadow, rgba(0, 0, 0, 0.45));
  animation: slot-menu-in 140ms var(--ease-standard, ease);
}

.bulk-dialog__title {
  margin: 0;
  font: 700 16px var(--font-display, inherit);
}

.bulk-dialog__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bulk-dialog__level {
  width: 110px;
}

.bulk-dialog__fit {
  margin: 0;
  font-size: 12px;
  color: var(--wb-ink-soft, #b3bac3);
}

.bulk-dialog__check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.bulk-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

@media (max-width: 560px) {
  .bulk-dialog-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .bulk-dialog {
    width: 100%;
    border-radius: 16px 16px 0 0;
    border-bottom: 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    animation: slot-sheet-in 180ms var(--ease-standard, ease);
  }

  .bulk-dialog__actions .btn {
    flex: 1;
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .slot-actionbar,
  .bulk-dialog {
    animation: none;
  }
}
