.capture-modal[hidden] {
  display: none !important;
}

.capture-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 16px;
  background: rgba(0, 0, 0, 0.65);
  overscroll-behavior: contain;
}

.capture-dialog {
  width: 100%;
  max-width: 440px;
  /* max-height: 90dvh; */
    height: min(700px, calc(100vh - 32px));
  height: min(700px, calc(100dvh - 32px));
    min-height: 0;

  display: flex;
  flex-direction: column;

  background: #fff;
  border-radius: 16px;
  overflow: hidden;

  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.25);
}
.capture-header {
  flex: 0 0 auto;

  padding: 16px 18px;
  border-bottom: 1px solid #eee;
  background: #fff;
}
.capture-header h3 {
  margin: 0;
  font-size: 17px;
}
/* BODY: ONLY THIS PART SCROLLS */
.capture-body {
  flex: 1 1 0%;
  min-height: 0;
  min-width: 0;

  padding: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;

  background: #f6f6f7;
  text-align: center;
}

/* PRODUCT IMAGE */
#capturePreview {
  display: block;
  width: 100% !important;
  max-width: 100%;
  max-height: none !important;
  height: auto !important;

  object-fit: contain;
  border-radius: 10px;
  background: #fff;
}
/* FOOTER: ALWAYS VISIBLE */
.capture-actions {
  flex: 0 0 auto;

  display: flex;
  gap: 10px;

  padding: 14px 16px;
  border-top: 1px solid #eee;
  background: #fff;
}

.capture-actions button {
  flex: 1;
  min-width: 0;
  min-height: 44px;

  padding: 12px 8px;
  border: 0;
  border-radius: 9px;

  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

#captureSave {
  background: #c21c2c;
  color: white;
}

#captureShare {
  background: #2363d1;
  color: white;
}

#captureCancel {
  background: #ececef;
  color: #333;
}

/* MOBILE */
@media (max-width: 560px) {
  .capture-modal {
    padding: 12px;
  }

  .capture-dialog {
    height: auto;
    max-height: calc(100dvh - 24px);
  }

  .capture-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 12px;
  }

  .capture-actions {
    gap: 8px;
    padding: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}

/* .capture-dialog h3 {
  margin: 0;
  padding: 16px;
  font-size: 17px;
  border-bottom: 1px solid #eee;
} */

/* #capturePreview {
  display: block;
  max-width: 100%;
  max-height: 65vh;
  width: auto !important;
  height: auto;
  margin: 16px auto;
  object-fit: contain;
} */
 /* #capturePreview {
  display: block;
  width: 100% !important;
  max-height: none;
  height: auto !important;
  object-fit: contain;
}

.capture-actions {
  display: flex;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid #eee;
}

.capture-actions button {
  flex: 1;
  min-width: 0;
  padding: 12px 8px;
  border: none;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

#captureSave {
  background: #c21c2c;
  color: white;
}

#captureShare {
  background: #2363d1;
  color: white;
}

#captureCancel {
  background: #ececef;
  color: #333;
}

/* Khóa cuộn trang khi modal mở */
html.capture-open,
body.capture-open {
  overflow: hidden;
  overscroll-behavior: none;
}

.capture-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.capture-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
} */



/* capture toast */

.capture-toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 20px);

  display: flex;
  align-items: center;
  gap: 10px;

  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 13px 18px;

  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;

  z-index: 100000;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0.2s ease;
}

.capture-toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* SUCCESS */
.capture-toast.success {
  background: #e8f7ee;
  color: #166534;
  border: 1px solid #86efac;
}

/* ERROR */
.capture-toast.error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.capture-toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;

  width: 22px;
  height: 22px;
  border-radius: 50%;

  font-size: 14px;
  font-weight: 700;
}

.capture-toast.success .capture-toast-icon {
  background: #16a34a;
  color: white;
}

.capture-toast.error .capture-toast-icon {
  background: #dc2626;
  color: white;
}

@media (max-width: 560px) {
  .capture-toast {
    bottom: 24px;
    font-size: 13px;
    padding: 12px 14px;
  }
}
