/* ── Image Upload Widget ──────────────────────────────────────── */
.img-upload-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.btn-upload-file,
.btn-upload-camera {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--color-border, #cbd5e1);
  background: var(--color-surface, #fff);
  color: var(--color-text, #1e293b);
  transition: background .15s, border-color .15s;
}
.btn-upload-file:hover  { background: #f1f5f9; border-color: #94a3b8; }
.btn-upload-camera      { border-color: var(--color-primary, #ff7a00); color: var(--color-primary, #ff7a00); }
.btn-upload-camera:hover{ background: #fff5ee; }

/* Preview thumbnail */
.img-upload-preview-wrap { margin-top: 10px; }
.img-upload-preview {
  position: relative;
  display: inline-block;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid var(--color-border, #cbd5e1);
  max-width: 200px;
}
.img-upload-preview img {
  display: block;
  width: 100%;
  max-height: 160px;
  object-fit: cover;
}
.img-upload-preview .img-preview-clear {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,.55);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 22px;
  text-align: center;
  padding: 0;
}
.img-upload-preview .img-preview-name {
  display: block;
  font-size: .75rem;
  color: var(--color-muted, #64748b);
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--color-surface, #fff);
}

/* ── Camera Modal ──────────────────────────────────────────────── */
#cameraModal { display: none; }
#cameraModal.cam-open {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.cam-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.65);
}

.cam-dialog {
  position: relative;
  background: #fff;
  border-radius: 14px;
  width: min(520px, 96vw);
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cam-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  font-weight: 600;
  font-size: .95rem;
  border-bottom: 1px solid #e2e8f0;
}
.cam-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #64748b;
  line-height: 1;
  padding: 0 4px;
}
.cam-close:hover { color: #1e293b; }

.cam-body {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
}
#camVideo {
  width: 100%;
  max-height: 380px;
  object-fit: cover;
  display: block;
}

.cam-footer {
  display: flex;
  gap: 10px;
  padding: 14px 18px;
  justify-content: flex-end;
  border-top: 1px solid #e2e8f0;
}

/* Responsive */
@media (max-width: 480px) {
  .cam-dialog { border-radius: 0; width: 100vw; height: 100dvh; justify-content: space-between; }
  #camVideo   { max-height: calc(100dvh - 120px); }
}
