/* "Deisgned by Kapil Pidhwani": ID Card Front & Back Merger styles; adapts via @container only. */
.tool-pane { container-type: inline-size; }
.idm-left-content { gap: 0.9rem; }
.pane-error a { color: inherit; text-decoration: underline; font-weight: 600; }

.idm-slots { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.65rem; min-width: 0; }
.idm-slot-card { display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
.idm-drop {
  position: relative; min-height: 112px; padding: 0.75rem 0.6rem;
  border: 1.5px dashed var(--border); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text-secondary);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.35rem; text-align: center; cursor: pointer; overflow: hidden;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.idm-drop:hover, .idm-drop:focus-visible, .idm-drop.dragover {
  border-color: var(--brand); background: var(--brand-soft); outline: none;
}
.idm-drop.is-loaded { border-style: solid; padding: 0.5rem; }
.idm-drop input[type="file"] { display: none; }
.idm-drop-body { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; max-width: 100%; }
.idm-drop-body iconify-icon { color: var(--brand-ink); }
.idm-slot-title { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); }
.idm-slot-sub { font-size: 0.73rem; color: var(--text-secondary); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idm-thumb { max-width: 100%; max-height: 76px; width: auto; height: auto; border-radius: var(--radius-chip); box-shadow: var(--shadow-sm); background: #fff; }
.idm-thumb[hidden], .idm-slot-bar[hidden], .idm-slot-tools[hidden], .idm-editor[hidden] { display: none; }

.idm-slot-bar, .idm-slot-tools, .idm-mask-btns { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; min-width: 0; }
.idm-mini-btn { padding: 0.34rem 0.6rem; font-size: 0.76rem; }

.idm-editor {
  display: flex; flex-direction: column; gap: 0.6rem; padding: 0.75rem;
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); min-width: 0;
}
.idm-editor-top, .idm-editor-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; min-width: 0; }
.idm-mask-cta {
  min-height: 44px; padding: 0.45rem 0.85rem; font-weight: 600;
  background: var(--cta-bg); color: var(--cta-text); border-color: var(--cta-bg);
}
.idm-mask-cta:hover, .idm-mask-cta:focus-visible { background: var(--cta-hover); color: var(--cta-text); border-color: var(--cta-hover); }

.idm-stage-wrap {
  display: flex; align-items: center; justify-content: center; padding: 0.6rem;
  background: var(--background); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
}
.idm-stage { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
.idm-stage canvas { display: block; max-width: 100%; height: auto; background: #fff; box-shadow: var(--shadow-sm); }
.idm-mask-layer { position: absolute; inset: 0; touch-action: none; }

.idm-mask {
  position: absolute; box-sizing: border-box; outline: 2px dashed var(--brand); outline-offset: 1px;
  touch-action: none; user-select: none;
}
.idm-mask.is-active, .idm-mask:focus-visible { outline: 2px solid var(--brand); z-index: 3; }
.idm-mask[hidden] { display: none; }
.idm-h {
  position: absolute; width: 44px; height: 44px; display: none;
  align-items: center; justify-content: center; touch-action: none;
}
.idm-mask.is-active .idm-h { display: flex; }
.idm-h::after {
  content: ""; width: 12px; height: 12px; border-radius: 50%;
  background: var(--brand); border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.idm-h[data-h="nw"] { left: -22px; top: -22px; }
.idm-h[data-h="ne"] { right: -22px; top: -22px; }
.idm-h[data-h="sw"] { left: -22px; bottom: -22px; }
.idm-h[data-h="se"] { right: -22px; bottom: -22px; }

.idm-stamp-box, .idm-layout-box { display: flex; flex-direction: column; gap: 0.6rem; min-width: 0; }
.idm-stamp-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }
.idm-check {
  display: inline-flex; align-items: center; gap: 0.42rem;
  font-size: 0.8rem; color: var(--text-secondary); cursor: pointer; user-select: none;
}
.idm-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }

.idm-preview-vp { min-height: 360px; max-height: 620px; padding: 0.85rem; align-items: center; justify-content: center; }
.idm-preview-vp > .pdf-page-canvas { max-height: 560px; border: 1px solid var(--border); }
.idm-preview-foot { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.5rem; }

@container (max-width: 360px) {
  .idm-slots { grid-template-columns: 1fr; }
  .idm-editor-top { align-items: stretch; }
  .idm-mask-cta { width: 100%; justify-content: center; }
}
