/**
 * Product modals — modern minimal (iOS / SaaS dashboard)
 */
:root {
  --prod-modal-radius: 28px;
  --prod-modal-radius-md: 18px;
  --prod-modal-radius-sm: 20px;
  --prod-modal-bg: #ffffff;
  --prod-modal-surface: #f4f4f5;
  --prod-modal-surface-2: #f8fafc;
  --prod-modal-border: rgba(15, 23, 42, 0.06);
  --prod-modal-text: #0f172a;
  --prod-modal-muted: #475569;
  --prod-modal-accent: #007bff;
  --prod-modal-accent-hover: #0056b3;
  --prod-modal-shadow:
    0 4px 6px -2px rgba(15, 23, 42, 0.04),
    0 16px 40px -8px rgba(15, 23, 42, 0.1), 0 0 0 1px rgba(15, 23, 42, 0.03);
  --prod-modal-header-h: 3.5rem;
  --prod-modal-ease: cubic-bezier(0.32, 0.72, 0, 1);
  --prod-modal-font:
    "Noto Sans Lao", "Noto Sans", system-ui, -apple-system, sans-serif;
  --prod-modal-actions-h: 7.25rem;
  --prod-modal-backdrop-z: 1040;
  --prod-modal-z: 1050;
  --prod-modal-actions-z: 1055;
  --prod-modal-backdrop-bg: rgba(15, 23, 42, 0.5);
}

/* Backdrop — flat overlay, no blur (opacity ຕ້ອງບໍ່ໃຊ້ !important ເພື່ອ fade ປິດໄດ້) */
.modal-backdrop.prod-modal-backdrop {
  background-color: #0f172a !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.modal-backdrop.prod-modal-backdrop.show {
  opacity: 0.5;
}

/* Tab-injected modals are hoisted to body; keep dialog above a single backdrop */
.modal.prod-modal-modern.show {
  z-index: var(--prod-modal-z) !important;
}

.modal-backdrop.show {
  z-index: var(--prod-modal-backdrop-z) !important;
}

.prod-modal-modern.modal.show {
    display: block;
}

/* Avoid scroll jump when inputs inside modal receive focus */
.prod-modal-modern .modal-body {
    overflow-anchor: none;
}

/* Typography — ตัวอักษรชัด */
.prod-modal-modern,
.prod-modal-modern .modal-content {
  font-family: var(--prod-modal-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Shell */
.prod-modal-modern.prod-modal-anim .modal-dialog {
  --animate-duration: 0.38s;
  will-change: auto;
}

.prod-modal-modern.prod-modal-preopen .modal-dialog {
  opacity: 0;
  transform: scale(0.88);
}

.prod-modal-modern .modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: min(calc(100dvh - 2rem), 92vh);
  border: none;
  border-radius: var(--prod-modal-radius);
  background: #ffffff;
  box-shadow: var(--prod-modal-shadow);
  overflow: hidden;
}

/* Modal content — ພື້ນຂາວທັງໝົດ */
.prod-modal-modern .modal-content,
.prod-modal-modern .modal-body,
.prod-modal-modern .modal-footer,
.prod-modal-modern .tab-content {
  background-color: #ffffff;
}

.prod-modal-modern .modal-body > .row,
.prod-modal-modern .modal-body .product-add-responsive,
.prod-modal-modern .modal-body .product-edit-responsive {
  background-color: #ffffff;
}

.prod-modal-modern .modal-dialog {
  max-width: min(1140px, calc(100vw - 1.5rem));
}

/* Header — AdminLTE bg-primary */
.prod-modal-modern .modal-header.bg-primary {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0;
}

.prod-modal-modern .modal-header.bg-primary .modal-title,
.prod-modal-modern .modal-header.bg-primary h5,
.prod-modal-modern .modal-header.bg-primary h6 {
  color: #fff;
}

.prod-modal-modern .modal-header.bg-primary .close {
  color: #fff;
  opacity: 0.85;
  text-shadow: none;
}

.prod-modal-modern .modal-header.bg-primary .close:hover {
  opacity: 1;
  color: #fff;
}

/* Body — AdminLTE default (inputs ใช้สไตล์ theme ไม่ override) */
.prod-modal-modern .modal-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #ffffff !important;
  color: inherit;
}

/* Desktop — add/edit: scroll form area; footer in modal flow (no viewport-fixed overlap) */
@media (min-width: 768px) {
  #md-product.prod-modal-modern .modal-content,
  #md-product-edit.prod-modal-modern .modal-content {
    display: flex;
    flex-direction: column;
  }

  #md-product.prod-modal-modern .modal-body,
  #md-product-edit.prod-modal-modern .modal-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    padding-bottom: 0;
  }

  #md-product .modal-body > .tab-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  #md-product .product-add-responsive,
  #md-product-edit .product-edit-responsive {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #md-product .prod-modal-actions-fixed,
  #md-product-edit .prod-modal-actions-fixed {
    flex-shrink: 0;
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    width: 100%;
    max-width: 100%;
    margin-top: 0;
  }
}

#md-barcode.prod-modal-modern .modal-body,
#md-barcode.prod-modal-modern .modal-body .bc-panel {
  background: #ffffff !important;
}

/* Form — AdminLTE 3 default (label ຢູ່ເທິງ, .form-control ຕາມ theme) */
.prod-modal-modern .modal-body .form-group {
  margin-bottom: 1rem;
}

.prod-modal-modern .product-add-responsive label,
.prod-modal-modern .product-edit-responsive label,
.prod-modal-modern #body-edit-product label {
  font-weight: 500;
}

.prod-modal-modern .product-add-responsive .row > [class*="col-"] > label,
.prod-modal-modern .product-edit-responsive .row > [class*="col-"] > label,
.prod-modal-modern .custom-5-col > .col > label,
.prod-modal-modern .form-group > label {
  display: block;
  margin-bottom: 0.35rem;
}

.prod-modal-modern .modal-body label.d-flex {
  display: flex !important;
}

/* Linked unit — clean minimal cards */
.prod-modal-modern .prod-linked-unit-section {
  margin-bottom: 1rem;
}

.prod-modal-modern .prod-linked-unit-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.prod-modal-modern .prod-linked-unit-section__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #334155;
  margin: 0;
}

.prod-modal-modern .prod-linked-unit-section__add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  color: var(--prod-modal-accent);
  background: rgba(37, 99, 235, 0.08);
  transition: background 0.15s ease;
}

.prod-modal-modern .prod-linked-unit-section__add:hover {
  background: rgba(37, 99, 235, 0.14);
  color: var(--prod-modal-accent-hover);
}

.prod-modal-modern .prod-linked-unit-picker {
  border: 1px solid #e2e8f0;
  border-radius: var(--prod-modal-radius-md);
  background: #fff;
  padding: 0.75rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.prod-modal-modern .prod-linked-unit-picker .form-control {
  border-color: #e2e8f0;
  background: #f8fafc;
}

.prod-modal-modern .prod-linked-unit-picker .form-control:focus {
  background: #fff;
}

.prod-modal-modern .prod-unit-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
  min-height: 0;
}

.prod-modal-modern .prod-unit-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.55rem 0.3rem 0.65rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #1e40af;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
}

.prod-modal-modern .prod-unit-chip .close {
  font-size: 1rem;
  line-height: 1;
  opacity: 0.55;
  padding: 0 0.15rem;
  margin: 0;
  color: inherit;
  text-shadow: none;
}

.prod-modal-modern .prod-unit-chip .close:hover {
  opacity: 1;
}

.prod-modal-modern .prod-unit-cards-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.prod-modal-modern .prod-unit-card {
  border: 1px solid #e2e8f0;
  border-radius: var(--prod-modal-radius-md);
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}

.prod-modal-modern .prod-unit-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  background: rgba(0, 123, 255, 0.06);
  border-bottom: 1px solid rgba(0, 123, 255, 0.15);
}

.prod-modal-modern .prod-unit-card__title {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #0f172a;
}

.prod-modal-modern .prod-unit-card__title ion-icon {
  font-size: 1.05rem;
  color: var(--prod-modal-accent);
}

.prod-modal-modern .prod-unit-card__remove {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  color: #b91c1c;
  background: #fff;
  border: 1px solid #fecaca;
  border-radius: 8px;
}

.prod-modal-modern .prod-unit-card__remove:hover {
  color: #fff;
  background: #ef4444;
  border-color: #ef4444;
}

.prod-modal-modern .prod-unit-card__body {
  padding: 0.85rem 0.85rem 0.65rem;
}

.prod-modal-modern .prod-unit-card__body .row > [class*="col-"] {
  margin-bottom: 0.5rem;
}

.prod-modal-modern .prod-unit-card__body label {
  font-size: 0.8125rem;
  color: #64748b;
  margin-bottom: 0.25rem;
}

@media (max-width: 767.98px) {
  .prod-modal-modern .prod-unit-card__body .row > [class*="col-"] {
    flex: 0 0 50%;
    max-width: 50%;
  }
}

@media (max-width: 420px) {
  .prod-modal-modern .prod-unit-card__body .row > [class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

/* Footer — fixed bar (not sticky)) */
.prod-modal-modern .modal-footer {
  flex-shrink: 0;
  padding: 0.875rem 1.25rem 1rem;
  background: #ffffff !important;
  border-top: 1px solid #dee2e6;
  gap: 0.5rem;
}

.prod-modal-modern .modal-footer.prod-modal-footer,
.prod-modal-modern .modal-content > .modal-footer.prod-modal-footer {
  border-radius: 0 0 var(--prod-modal-radius) var(--prod-modal-radius);
  overflow: hidden;
}

.prod-modal-modern .add-product-actions,
.prod-modal-modern .prod-modal-actions-fixed {
  flex-shrink: 0;
  z-index: var(--prod-modal-actions-z);
  margin: 0 !important;
  width: 100%;
  max-width: 100%;
  padding: 0.875rem 1rem max(0.875rem, env(safe-area-inset-bottom, 0));
  background: #ffffff !important;
  border-top: 1px solid #dee2e6 !important;
  border-radius: 0 0 var(--prod-modal-radius) var(--prod-modal-radius);
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
  touch-action: manipulation;
  overflow: hidden;
}

/* Desktop — add/edit actions stay inside modal (see flex rules above) */

.prod-modal-modern .modal-content > .modal-footer.prod-modal-footer {
  position: relative;
  flex-shrink: 0;
  margin: 0;
  box-shadow: none;
}

/* Large action buttons (SaaS) */
.prod-modal-modern .prod-modal-btn-lg,
.prod-modal-modern .prod-modal-footer .btn,
.prod-modal-modern .add-product-actions .btn,
.prod-modal-modern .prod-modal-actions-fixed .btn,
.prod-modal-modern #body-edit-product .add-product-actions .btn,
.prod-modal-modern .modal-footer .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: var(--prod-modal-radius-md);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: 0.01em;
  min-height: 3.25rem;
  padding: 0.65rem 1.15rem;
  border: none;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  line-height: 1.25;
  transition: background 0.12s ease;
}

.prod-modal-modern .prod-modal-btn-lg ion-icon,
.prod-modal-modern .modal-footer .btn ion-icon,
.prod-modal-modern .add-product-actions .btn ion-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.prod-modal-modern .prod-modal-actions-row {
  display: flex;
  flex-wrap: wrap;
  margin-left: 0;
  margin-right: 0;
  margin-bottom: 0;
}

.prod-modal-modern .prod-modal-actions-row > [class*="col-"] {
  padding-left: 0.35rem;
  padding-right: 0.35rem;
  margin-bottom: 0.5rem;
}

/* Modal buttons — 2 columns (mobile + desktop) */
.prod-modal-modern .prod-modal-actions-row > .col-6 {
  flex: 0 0 50%;
  max-width: 50%;
}

.prod-modal-modern .prod-modal-footer .btn:active,
.prod-modal-modern .add-product-actions .btn:active {
  transform: scale(0.98);
}

.prod-modal-modern .prod-modal-footer .btn-primary,
.prod-modal-modern .add-product-actions .btn-primary,
.prod-modal-modern .prod-modal-actions-fixed .btn-primary,
.prod-modal-modern #body-edit-product .add-product-actions .btn-primary {
  background: var(--prod-modal-accent);
}

.prod-modal-modern .prod-modal-footer .btn-primary:hover,
.prod-modal-modern .add-product-actions .btn-primary:hover {
  background: var(--prod-modal-accent-hover);
}

.prod-modal-modern .prod-modal-footer .btn-default,
.prod-modal-modern .prod-modal-footer .btn-secondary,
.prod-modal-modern .add-product-actions .btn-default {
  background: var(--prod-modal-surface);
  color: var(--prod-modal-text);
}

.prod-modal-modern .prod-modal-footer .btn-default:hover,
.prod-modal-modern .add-product-actions .btn-default:hover {
  background: #e4e4e7;
}

.prod-modal-modern .prod-modal-footer .btn-secondary,
.prod-modal-modern .modal-footer .btn-secondary {
  background: var(--prod-modal-surface);
  color: var(--prod-modal-text);
}

.prod-modal-modern .prod-modal-footer .btn-info {
  background: #0ea5e9;
  color: #fff;
}

.prod-modal-modern .prod-modal-footer .btn-info:hover {
  background: #0284c7;
  color: #fff;
}

.prod-modal-modern .prod-modal-footer .btn-danger {
  background: #ef4444;
  color: #fff;
}

.prod-modal-modern .prod-modal-footer .btn-danger:hover {
  background: #dc2626;
  color: #fff;
}

.prod-modal-modern .prod-modal-footer .btn-primary:hover,
.prod-modal-modern .add-product-actions .btn-primary:hover {
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.22);
}

.prod-modal-modern .modal-footer.prod-modal-footer--stacked {
  flex-direction: column;
  align-items: stretch;
}

.prod-modal-modern
  .modal-footer.prod-modal-footer--stacked
  .prod-modal-actions-row
  > .col-6 {
  flex: 0 0 50%;
  max-width: 50%;
}

/* Product manage menu — modal-md card grid (~480px) */
#md-product-menu.prod-modal-modern .modal-dialog {
  width: min(100%, 480px);
  max-width: min(480px, calc(100vw - 1.5rem));
  margin-left: auto;
  margin-right: auto;
}

#md-product-menu .modal-content,
#md-product-menu .prod-menu-body,
#md-product-menu .prod-menu-actions {
  width: 100%;
  max-width: 100%;
}

#md-product-menu .prod-menu-body {
  padding: 0.75rem 0.85rem 0.85rem;
  background: #f4f6f9;
}

#md-product-menu .prod-menu-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0;
  padding: 0;
}

#md-product-menu .prod-menu-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  min-height: 5.75rem;
  padding: 0.65rem 0.45rem 0.55rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  color: #1e293b;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

#md-product-menu .prod-menu-item--wide {
  grid-column: 1 / -1;
}

@media (max-width: 320px) {
  #md-product-menu .prod-menu-actions {
    grid-template-columns: 1fr;
  }

  #md-product-menu .prod-menu-item--wide {
    grid-column: auto;
  }
}

#md-product-qty-adjust.prod-modal-modern .modal-dialog {
  width: min(100%, 440px);
  max-width: min(440px, calc(100vw - 1.5rem));
  margin-left: auto;
  margin-right: auto;
}

/* Image modal — image-only, responsive preview */
#md-viewImage.prod-modal-modern,
#md-viewImage.prod-view-image-modal {
  isolation: isolate;
}

#md-viewImage.prod-modal-modern .modal-dialog {
  max-width: min(420px, calc(100vw - 1.5rem));
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

#md-viewImage.prod-modal-modern .modal-content {
  overflow: hidden;
}

#md-viewImage.prod-modal-modern .modal-body,
#md-viewImage.prod-view-image-modal .prod-view-image-modal__body {
  padding: 1.25rem 1rem;
  overflow-y: auto;
  max-height: min(70vh, calc(100vh - 12rem));
}

#md-viewImage .prod-view-image-zone {
  position: relative;
  width: 100%;
  max-width: 100%;
}

#md-viewImage .prod-view-image-zone__preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

#md-viewImage .prod-view-image-img,
#md-viewImage.prod-modal-modern #ProdIMG {
  display: block;
  width: 100%;
  max-width: min(320px, 100%);
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  object-position: center center;
  margin: 0 auto;
  cursor: pointer;
  border-radius: var(--prod-modal-radius-md) !important;
  border: 1px solid var(--prod-modal-border) !important;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  background: #f8fafc;
}

#md-viewImage .prod-view-image-zone__name {
  font-size: 1.05rem;
  word-break: break-word;
}

#md-viewImage .prod-view-image-zone__status {
  min-height: 1.25rem;
}

#md-viewImage .prod-crop-inline {
  display: none !important;
}

/* Barcode modal */
#md-barcode.prod-modal-modern .modal-content {
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
}

#md-barcode.prod-modal-modern .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

/* Mobile — fullscreen, sticky footer, touch / no input zoom (iOS) */
@media (max-width: 767.98px) {
  .prod-modal-modern {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  /* iOS Safari: font-size < 16px ເຮັດໃຫ້ zoom ຕອນ focus — ຕ້ອງ 16px+ */
  .prod-modal-modern
    input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not(
      [type="file"]
    ),
  .prod-modal-modern select,
  .prod-modal-modern textarea,
  .prod-modal-modern .form-control,
  .prod-modal-modern .jstree-dd-display,
  .prod-modal-modern .jstree-dd-search,
  .prod-modal-modern
    .select2-container
    .select2-selection--single
    .select2-selection__rendered {
    font-size: 16px;
    line-height: 1.35;
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(37, 99, 235, 0.12);
  }

  .prod-modal-modern textarea.form-control {
    min-height: 5.5rem;
  }

  .prod-modal-modern .form-control-sm,
  .prod-modal-modern input.form-control-sm,
  .prod-modal-modern .jstree-dd-search {
    font-size: 16px;
    min-height: 44px;
  }

  .prod-modal-modern .btn,
  .prod-modal-modern .close,
  .prod-modal-modern .jstree-dd-toggle,
  .prod-modal-modern .input-dropdown-clear,
  .prod-modal-modern .image-drop-zone {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .prod-modal-modern .input-dropdown-single .input-dropdown-clear,
  .prod-modal-modern .input-dropdown-jstree .jstree-dd-toggle {
    min-width: 44px;
    min-height: 44px;
  }

  .prod-modal-modern .input-dropdown-result {
    max-height: min(42dvh, 280px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  .prod-modal-modern .input-dropdown-result .list-group-item,
  .prod-modal-modern .input-dropdown-result .list-group-item-action {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
    font-size: 16px;
    touch-action: manipulation;
  }

  .prod-modal-modern .prod-modal-btn-lg,
  .prod-modal-modern .add-product-actions .btn {
    min-height: 48px;
    font-size: 1rem;
  }

  .prod-modal-modern .custom-control-label {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
  }

  .prod-modal-modern .modal-body {
    touch-action: pan-y;
    overscroll-behavior: contain;
  }

  .prod-modal-modern .modal-content {
    border-radius: 0;
    max-height: none;
    height: 100%;
    min-height: 100dvh;
  }

  .prod-modal-modern .modal-header,
  .prod-modal-modern .prod-modal-header {
    padding-top: max(0.875rem, env(safe-area-inset-top, 0));
  }

  .prod-modal-modern .modal-body {
    background: #ffffff !important;
  }

  #md-product .modal-body,
  #md-product-edit .modal-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 0 !important;
  }

  #md-product .modal-body > .tab-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  #md-product .product-add-responsive,
  #md-product-edit .product-edit-responsive {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #md-product .prod-modal-actions-fixed,
  #md-product-edit .prod-modal-actions-fixed {
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    margin-top: 0;
    flex-shrink: 0;
  }

  .prod-modal-modern .add-product-actions,
  .prod-modal-modern .prod-modal-actions-fixed,
  .prod-modal-modern .modal-footer.prod-modal-footer {
    border-radius: 0 0 var(--prod-modal-radius-md) var(--prod-modal-radius-md);
  }

  .prod-modal-modern .prod-modal-footer .btn,
  .prod-modal-modern .add-product-actions .btn,
  .prod-modal-modern .prod-modal-actions-fixed .btn {
    transition: none;
    transform: none;
  }

  .prod-modal-modern .modal-content > .modal-footer.prod-modal-footer {
    position: relative;
    flex-shrink: 0;
  }

  /* Zoom + fade — mobile (no slide) */
  .prod-modal-modern.prod-modal-anim {
    overflow: hidden;
  }

  .prod-modal-modern.prod-modal-anim.fade .modal-dialog {
    transition: none !important;
    transform-origin: center center;
  }

  .prod-modal-modern.prod-modal-anim .modal-dialog {
    margin: 0 auto;
    width: 100%;
    max-width: 100%;
  }

  .prod-modal-modern.prod-modal-preopen .modal-dialog {
    opacity: 0;
    transform: scale(0.88);
  }

  .prod-modal-modern.prod-modal-anim.show:not(.prod-modal-preopen):not(
      .prod-modal-leaving
    )
    .modal-dialog {
    animation: prodModalZoomFadeIn 0.38s var(--prod-modal-ease) both;
  }

  .prod-modal-modern.prod-modal-anim.prod-modal-leaving .modal-dialog {
    animation: prodModalZoomFadeOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
  }

  #md-product-edit.prod-modal-zoom-center-top.prod-modal-modern.prod-modal-anim
    .modal-dialog {
    transition: none !important;
    transform-origin: center center;
    margin: auto;
    width: calc(100% - 1rem);
    max-width: calc(100% - 1rem);
    min-height: auto;
    height: auto;
    max-height: min(calc(100dvh - 1rem), 92vh);
  }

  #md-product-edit.prod-modal-zoom-center-top.prod-modal-modern.prod-modal-anim
    .modal-dialog.modal-dialog-centered {
    min-height: calc(100% - 1rem);
  }

  #md-product-edit.prod-modal-zoom-center-top.prod-modal-preopen .modal-dialog {
    opacity: 0;
    transform: scale(0.88);
  }

  #md-product-edit.prod-modal-zoom-center-top.prod-modal-anim.show:not(
      .prod-modal-preopen
    ):not(.prod-modal-leaving)
    .modal-dialog {
    animation: prodModalZoomFadeIn 0.38s var(--prod-modal-ease) both;
  }

  #md-product-edit.prod-modal-zoom-center-top.prod-modal-anim.prod-modal-leaving
    .modal-dialog {
    animation: prodModalZoomFadeOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
  }

  #md-viewImage.prod-modal-modern.prod-modal-anim .modal-dialog,
  #md-product-menu.prod-modal-modern.prod-modal-anim .modal-dialog,
  #md-product-qty-adjust.prod-modal-modern.prod-modal-anim .modal-dialog {
    width: min(100%, 540px);
    max-width: min(540px, calc(100vw - 1rem));
    min-height: auto;
    height: auto;
    margin-left: auto;
    margin-right: auto;
  }

  #md-product-menu.prod-modal-modern.prod-modal-anim .modal-dialog {
    width: min(100%, 480px);
    max-width: min(480px, calc(100vw - 1rem));
  }

  #md-product-qty-adjust.prod-modal-modern.prod-modal-anim .modal-dialog {
    width: min(100%, 440px);
    max-width: min(440px, calc(100vw - 1rem));
  }

  #md-viewImage.prod-modal-modern.prod-modal-anim .modal-dialog {
    width: min(100%, 420px);
    max-width: min(420px, calc(100vw - 1rem));
  }
}

@keyframes prodModalZoomFadeIn {
  from {
    opacity: 0;
    transform: scale(0.88);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes prodModalZoomFadeOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.92);
  }
}

/* Image upload zone inside add/edit */
.prod-modal-modern .image-drop-zone {
  border-radius: var(--prod-modal-radius-md);
  border: 2px dashed var(--prod-modal-border);
  background: var(--prod-modal-bg);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.prod-modal-modern .image-drop-zone:hover,
.prod-modal-modern .image-drop-zone:focus {
  border-color: rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.04);
  outline: none;
}

.prod-modal-modern .image-drop-zone img {
  border-radius: 14px;
}

.prod-modal-modern .add-product-actions .continues-add-wrap,
.prod-modal-modern .add-product-actions .continues-add-wrap .mui-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #334155;
}

@media (prefers-reduced-motion: reduce) {
  .prod-modal-modern.prod-modal-preopen .modal-dialog {
    opacity: 1;
    transform: none;
  }

  .prod-modal-modern.prod-modal-anim.show:not(.prod-modal-preopen):not(
      .prod-modal-leaving
    )
    .modal-dialog,
  .prod-modal-modern.prod-modal-anim.prod-modal-leaving .modal-dialog {
    animation: none !important;
  }

  #md-product-edit.prod-modal-zoom-center-top.prod-modal-preopen .modal-dialog {
    opacity: 1;
    transform: none;
  }
}

/* Ionicon loading spin (product tab) */
.prod-ion-spin {
  animation: prod-ion-spin 0.85s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

@keyframes prod-ion-spin {
  to {
    transform: rotate(360deg);
  }
}

.prod-qty-segment ion-icon {
  vertical-align: middle;
  font-size: 1.1rem;
  margin-right: 0.2rem;
}
