/* Premium checkout modal — tablet landscape POS */
.pm-pay-overlay {
  background: rgba(8, 10, 18, 0.62);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 16px;
  align-items: center;
  justify-content: center;
}

/* Di atas sheet keranjang mobile (z-index ~450) */
#choosePaymentModal.open,
#kasirPinModal.open {
  z-index: 1300 !important;
  display: flex !important;
}

body.checkout-payment-modal #choosePaymentModal.open .payment-methods,
body.checkout-payment-modal #choosePaymentModal.open .payment-methods--visible {
  display: grid !important;
}

.pm-pay-modal {
  width: min(920px, 96vw);
  max-height: min(88vh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--pm-pay-surface, #ffffff);
  border-radius: 24px;
  border: 1px solid var(--pm-pay-border, rgba(15, 23, 42, 0.08));
  box-shadow:
    0 32px 64px rgba(15, 23, 42, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: pmPayIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme='dark'] .pm-pay-modal,
:root:not([data-theme='light']) .pm-pay-modal {
  --pm-pay-surface: #1a1f2e;
  --pm-pay-border: rgba(255, 255, 255, 0.08);
  --pm-pay-left-bg: #f8fafc;
  --pm-pay-text: #f1f5f9;
  --pm-pay-muted: #94a3b8;
  --pm-pay-line: rgba(255, 255, 255, 0.08);
  --pm-pay-numpad-bg: #12151f;
}

[data-theme='light'] .pm-pay-modal {
  --pm-pay-left-bg: #ffffff;
  --pm-pay-text: #0f172a;
  --pm-pay-muted: #64748b;
  --pm-pay-line: rgba(15, 23, 42, 0.08);
  --pm-pay-numpad-bg: #1e2433;
}

@keyframes pmPayIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.pm-pay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--pm-pay-line);
  flex-shrink: 0;
}

.pm-pay-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display, 'Bricolage Grotesque', sans-serif);
  font-size: 18px;
  font-weight: 800;
  color: var(--pm-pay-text);
  letter-spacing: -0.02em;
}

.pm-pay-header-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, rgba(245, 197, 24, 0.22), rgba(245, 197, 24, 0.06));
  color: #c9a000;
  font-size: 17px;
}

[data-theme='dark'] .pm-pay-header-icon,
:root:not([data-theme='light']) .pm-pay-header-icon {
  color: var(--accent, #f5c518);
}

.pm-pay-close {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: var(--pm-pay-line);
  color: var(--pm-pay-muted);
  cursor: pointer;
  font-size: 16px;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.pm-pay-close:hover {
  transform: scale(1.04);
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.pm-pay-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.pm-pay-left {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--pm-pay-left-bg, #fff);
}

[data-theme='dark'] .pm-pay-left,
:root:not([data-theme='light']) .pm-pay-left {
  background: #222838;
}

.pm-pay-left-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 12px;
  -webkit-overflow-scrolling: touch;
}

.pm-pay-footer {
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 6;
  padding: 12px 20px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--pm-pay-line);
  background: var(--pm-pay-left-bg, #fff);
  pointer-events: auto;
  isolation: isolate;
}

[data-theme='dark'] .pm-pay-footer,
:root:not([data-theme='light']) .pm-pay-footer {
  background: #222838;
}

.pm-pay-submit {
  width: 100%;
  min-height: 54px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  border: none;
  border-radius: 16px;
  background: linear-gradient(180deg, #fcd34d 0%, #f5c518 48%, #e6b800 100%);
  color: #111827;
  font-family: var(--font-display, 'Bricolage Grotesque', sans-serif);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 12px 28px rgba(245, 197, 24, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.pm-pay-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(245, 197, 24, 0.42);
  filter: brightness(1.03);
}

.pm-pay-submit:active:not(:disabled) {
  transform: scale(0.98);
}

.pm-pay-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* Right — numpad */
.pm-pay-right {
  display: flex;
  flex-direction: column;
  padding: 18px 16px;
  background: var(--pm-pay-numpad-bg, #1e2433);
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  gap: 10px;
}

.pm-pay-numpad-label {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.45);
}

.pm-pay-numpad-display {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: right;
  font-family: var(--font-display, 'Bricolage Grotesque', sans-serif);
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 800;
  color: #fde68a;
  letter-spacing: 0.02em;
}

.pm-pay-numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  flex: 1;
}

.pm-nk {
  min-height: 52px;
  border: none;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.09);
  color: #f8fafc;
  font-family: var(--font-display, 'Bricolage Grotesque', sans-serif);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
  transition: transform 0.1s ease, background 0.12s ease, box-shadow 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.pm-nk:hover {
  background: rgba(255, 255, 255, 0.14);
}

.pm-nk:active,
.pm-nk.pm-nk--pressed {
  transform: scale(0.94);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  background: rgba(255, 255, 255, 0.18);
}

.pm-nk--muted {
  font-size: 15px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.65);
}

/* Split pembayaran — di modal, setelah TOTAL */
.checkout-pay-split-slot {
  margin: 8px 0 12px;
  display: block !important;
}

.pm-pay-split-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pm-pay-split-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--pm-pay-line);
  background: rgba(245, 197, 24, 0.08);
  color: var(--pm-pay-text, var(--text-primary));
  font-family: var(--font-display, 'Bricolage Grotesque', sans-serif);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.pm-pay-split-toggle:hover {
  border-color: rgba(245, 197, 24, 0.55);
  background: rgba(245, 197, 24, 0.14);
}

.pm-pay-split-toggle.is-open,
.pm-pay-split-toggle.is-active {
  border-color: rgba(245, 197, 24, 0.65);
  background: rgba(245, 197, 24, 0.16);
}

.pm-pay-split-toggle-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pm-pay-split-toggle-main i {
  color: #c9a000;
  font-size: 15px;
}

[data-theme='dark'] .pm-pay-split-toggle-main i,
:root:not([data-theme='light']) .pm-pay-split-toggle-main i {
  color: var(--accent, #f5c518);
}

.pm-pay-split-badge {
  margin-left: auto;
  margin-right: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(15, 23, 42, 0.08);
  color: var(--pm-pay-muted, #64748b);
}

.pm-pay-split-badge.is-active {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

.pm-pay-split-chevron {
  font-size: 11px;
  color: var(--pm-pay-muted);
  transition: transform 0.2s ease;
}

.pm-pay-split-toggle.is-open .pm-pay-split-chevron {
  transform: rotate(180deg);
}

body.checkout-payment-modal .pm-pay-split-panel {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--pm-pay-line);
  background: rgba(15, 23, 42, 0.04);
}

[data-theme='dark'] body.checkout-payment-modal .pm-pay-split-panel,
:root:not([data-theme='light']) body.checkout-payment-modal .pm-pay-split-panel {
  background: rgba(0, 0, 0, 0.22);
}

body.checkout-payment-inline .checkout-pay-split-slot {
  margin-top: 8px;
}

/* Panel inside modal — premium totals */
body.checkout-payment-modal .checkout-pay-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

body.checkout-payment-modal .ep-checkout-mount { order: 0; }
body.checkout-payment-modal .totals-grid { order: 1; }
body.checkout-payment-modal .checkout-pay-split-slot { order: 2; }
body.checkout-payment-modal .payment-methods { order: 3; }
body.checkout-payment-modal .cash-section { order: 4; }

body.checkout-payment-modal .totals-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid var(--pm-pay-line);
}

[data-theme='dark'] body.checkout-payment-modal .totals-grid,
:root:not([data-theme='light']) body.checkout-payment-modal .totals-grid {
  background: rgba(0, 0, 0, 0.2);
}

body.checkout-payment-modal .total-row {
  font-size: 14px;
  color: var(--pm-pay-muted, var(--text-muted));
}

body.checkout-payment-modal .total-row.grand-total {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px dashed var(--pm-pay-line);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

body.checkout-payment-modal .total-row.grand-total span:last-child {
  font-family: var(--font-display, 'Bricolage Grotesque', sans-serif);
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 800;
  color: #c9a000;
  letter-spacing: -0.03em;
}

[data-theme='dark'] body.checkout-payment-modal .total-row.grand-total span:last-child,
:root:not([data-theme='light']) body.checkout-payment-modal .total-row.grand-total span:last-child {
  color: var(--accent, #f5c518);
}

body.checkout-payment-modal .payment-methods {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

body.checkout-payment-modal .pay-method {
  padding: 12px 8px;
  border-radius: 14px;
  font-size: 11px;
  min-height: 72px;
  background: rgba(15, 23, 42, 0.03);
  border: 1.5px solid var(--pm-pay-line);
}

body.checkout-payment-modal .pay-method.active {
  border-color: #e6b800;
  background: rgba(245, 197, 24, 0.12);
  box-shadow: 0 0 0 1px rgba(245, 197, 24, 0.2);
}

body.checkout-payment-modal .cash-section label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--pm-pay-muted);
}

body.checkout-payment-modal .cash-input-wrap {
  border-radius: 14px;
  padding: 4px 16px;
  min-height: 52px;
  background: #fff;
  border: 2px solid var(--pm-pay-line);
}

[data-theme='dark'] body.checkout-payment-modal .cash-input-wrap,
:root:not([data-theme='light']) body.checkout-payment-modal .cash-input-wrap {
  background: rgba(0, 0, 0, 0.25);
}

body.checkout-payment-modal .cash-input-wrap:focus-within {
  border-color: #e6b800;
  box-shadow: 0 0 0 4px rgba(245, 197, 24, 0.15);
}

body.checkout-payment-modal .pm-cash-input {
  font-size: 22px;
  cursor: default;
  caret-color: transparent;
}

body.checkout-payment-modal .quick-cash {
  gap: 8px;
}

body.checkout-payment-modal .quick-cash-btn {
  flex: 1 1 calc(50% - 4px);
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}

body.checkout-payment-modal .quick-cash-btn--exact {
  border-color: rgba(34, 197, 94, 0.45);
  color: #16a34a;
  background: rgba(34, 197, 94, 0.08);
}

body.checkout-payment-modal .kembalian-row {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.28);
  font-size: 14px;
}

body.checkout-payment-modal .kembalian-amount {
  font-size: 20px;
  color: #16a34a;
}

body.checkout-payment-modal .kembalian-amount.is-short {
  color: #dc2626;
}

/* Hide numpad for non-cash or inline checkout */
body.checkout-payment-inline .pm-pay-right,
body.pm-pay-no-numpad .pm-pay-right {
  display: none;
}

body.checkout-payment-inline .pm-pay-grid,
body.pm-pay-no-numpad .pm-pay-grid {
  grid-template-columns: 1fr;
}

body.checkout-payment-modal .cart-checkout-summary {
  display: none !important;
}

body.checkout-payment-modal .checkout-pay-cart-slot {
  display: none !important;
}

/* Legacy side-modal rules — superseded */
body.checkout-payment-modal .checkout-payment-footer {
  display: none;
}

@media (max-width: 768px) {
  .pm-pay-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .pm-pay-modal {
    width: 100%;
    max-height: min(94vh, 100dvh);
    border-radius: 20px 20px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .pm-pay-grid {
    grid-template-columns: 1fr;
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .pm-pay-right {
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
  .pm-pay-footer {
    position: relative;
    bottom: auto;
    flex-shrink: 0;
    z-index: 30;
    box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.45);
  }
  .pm-pay-submit,
  .checkout-confirm-btn {
    position: relative;
    z-index: 31;
    pointer-events: auto !important;
    touch-action: manipulation;
  }
  .pm-nk {
    min-height: 48px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) {
  .pm-pay-modal {
    width: min(96vw, 880px);
  }
}
