/* Apple Store–style payment modal */

.cko-overlay {
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --soft: #f5f5f7;
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --radius: 18px;

  position: fixed;
  inset: 0;
  z-index: 2147483000;
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  animation: ckoFade 0.22s ease;
}

@keyframes ckoFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.cko-overlay[hidden] {
  display: none !important;
}

.cko-overlay.is-open {
  display: flex;
}

body.modal-open {
  overflow: hidden;
}

.cko-modal {
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-x: hidden;
  overflow-y: auto;
  background: #fff;
  color: var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.28);
  position: relative;
  margin: auto;
  flex-shrink: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

@media (max-width: 520px) {
  .cko-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .cko-modal {
    max-width: 100%;
    max-height: 94vh;
    border-radius: 20px 20px 0 0;
  }
}

/* Header */
.cko-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 0;
}

.cko-header h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ink);
}

.cko-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #86868b;
  background: var(--soft);
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.cko-close:hover {
  background: #e8e8ed;
  color: var(--ink);
}

/* Product summary */
.cko-summary {
  display: flex;
  gap: 14px;
  align-items: center;
  margin: 20px 24px 0;
  padding: 0 0 20px;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.cko-summary img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 10px;
  background: var(--soft);
  flex-shrink: 0;
}

.cko-summary__meta {
  flex: 1;
  min-width: 0;
}

.cko-summary__meta strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.cko-summary__meta span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.cko-summary__price {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
}

/* Methods */
.cko-methods {
  padding: 20px 24px 8px;
}

.cko-section-label {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.payment-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 4px;
  background: var(--soft);
  border-radius: 12px;
}

.payment-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 64px;
  padding: 10px 6px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.payment-option span {
  line-height: 1.1;
}

.payment-option:hover {
  background: rgba(255, 255, 255, 0.55);
}

.payment-option.is-selected {
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.payment-option__mark {
  display: block;
  object-fit: contain;
}

.payment-option__mark--apple {
  height: 18px;
  width: auto;
}

.payment-option__mark--visa {
  height: 14px;
  width: auto;
}

.payment-option__mark--paypal {
  height: 16px;
  width: auto;
}

/* Panels */
.cko-panel {
  display: none;
  margin-top: 18px;
}

.cko-panel.is-active {
  display: block;
  animation: panelIn 0.2s ease;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Apple Pay modes */
.apple-mode {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.apple-mode__btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 14px 14px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  transition: background 0.12s ease;
}

.apple-mode__btn:last-child {
  border-bottom: none;
}

.apple-mode__btn:hover {
  background: #fafafa;
}

.apple-mode__btn.is-selected {
  background: #fbfbfd;
}

.apple-mode__glyph {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--soft);
  color: var(--ink);
}

.apple-mode__glyph--cash {
  padding: 0;
  background: transparent;
  overflow: hidden;
}

.apple-cash-mini {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #ff8fb8 0%, #ff4f81 42%, #e91e63 100%);
}

.apple-cash-mini__mark {
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.apple-mode__copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.apple-mode__copy strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.apple-mode__copy span {
  font-size: 12px;
  color: var(--muted);
}

.apple-mode__check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid #d2d2d7;
  flex-shrink: 0;
  position: relative;
}

.apple-mode__btn.is-selected .apple-mode__check,
.paypal-card.is-selected .apple-mode__check {
  border-color: var(--blue);
  background: var(--blue);
}

.apple-mode__btn.is-selected .apple-mode__check::after,
.paypal-card.is-selected .apple-mode__check::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 1.6px 1.6px 0;
  transform: rotate(45deg);
}

/* Saved card (Visa) */
.saved-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  box-shadow: none;
}

.saved-card__mark {
  width: 48px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.saved-card__mark img {
  height: 14px;
  width: auto;
  display: block;
}

.saved-card__meta {
  min-width: 0;
}

.saved-card__meta strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.saved-card__meta span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.cko-field {
  margin: 0;
}

.cko-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.cko-field input {
  width: 100%;
  box-sizing: border-box;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 17px;
  letter-spacing: 0.12em;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cko-field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.18);
}

.cko-field--cvc input {
  max-width: 120px;
  letter-spacing: 0.2em;
  text-align: center;
}

/* PayPal */
.paypal-flow {
  border: none;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

.paypal-account {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.paypal-account__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #003087;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.paypal-account__meta {
  flex: 1;
  min-width: 0;
}

.paypal-account__meta strong,
.paypal-account strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.paypal-account__meta span,
.paypal-account span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 1px;
}

.paypal-account__logo {
  height: 18px;
  width: auto;
  margin-left: auto;
  flex-shrink: 0;
}

.paypal-cards {
  display: grid;
  gap: 0;
  margin-bottom: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.paypal-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  text-align: left;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  box-shadow: none;
  transition: background 0.12s ease;
}

.paypal-card:last-child {
  border-bottom: none;
}

.paypal-card:hover {
  background: #fafafa;
}

.paypal-card.is-selected {
  background: #fbfbfd;
  border-color: transparent;
  box-shadow: none;
}

.paypal-card__brand-img {
  height: 16px;
  width: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

.paypal-card__meta {
  flex: 1;
  min-width: 0;
}

.paypal-card__meta strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.paypal-card__meta span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 1px;
}

.paypal-logo {
  display: flex;
  justify-content: center;
  align-items: center;
}

.paypal-logo__img {
  height: 28px;
  width: auto;
  display: block;
  object-fit: contain;
}

.paypal-logo--sm .paypal-logo__img {
  height: 24px;
}

.paypal-logo--sm {
  margin-bottom: 8px;
}

/* Footer / CTA */
.cko-error {
  margin: 14px 0 0;
  color: #bf4800;
  font-size: 13px;
}

.cko-footer {
  padding: 20px 0 24px;
  border-top: none;
  margin-top: 8px;
}

.cko-overlay .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 980px;
  padding: 0 22px;
  min-height: 48px;
  font: inherit;
  font-size: 17px;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.btn--full {
  width: 100%;
}

.btn--apple-pay {
  background: #000;
  color: #fff;
}

.btn--apple-pay:hover {
  background: #1d1d1f;
}

.btn--apple-pay .btn__apay {
  height: 20px;
  width: auto;
  display: block;
}

.btn--apple-pay .btn__label {
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.btn--cko-primary {
  background: var(--blue);
  color: #fff;
  font-weight: 400;
}

.btn--cko-primary:hover {
  background: var(--blue-hover);
}

.btn--paypal {
  background: #ffc439;
  color: #003087;
  font-weight: 600;
}

.btn--paypal:hover {
  background: #f2b720;
}

.btn--apple-pay:disabled,
.btn--cko-primary:disabled,
.btn--paypal:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.cko-secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  text-align: center;
}

/* ===== Apple Pay sheet (sprite.2) ===== */
.apay-sheet__logo {
  height: 28px;
  width: auto;
  display: block;
  object-fit: contain;
}

.apay-cash-card__top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.apay-cash-card__pay {
  height: 22px;
  width: auto;
  opacity: 0.95;
  object-fit: contain;
}

.apay-cash-card__tag {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.apay-sheet {
  width: min(92%, 380px);
  background: rgba(28, 28, 30, 0.96);
  color: #f5f5f7;
  border-radius: 28px 28px 22px 22px;
  padding: 10px 18px 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial,
    sans-serif;
  animation: apayRise 0.35s ease;
}

@keyframes apayRise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.apay-sheet__grab {
  width: 36px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  margin: 4px auto 14px;
}

.apay-sheet__brand {
  display: flex;
  justify-content: center;
  color: #fff;
  margin-bottom: 16px;
}

.apay-card-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.apay-card-row__thumb {
  width: 52px;
  height: 34px;
  border-radius: 6px;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 6px;
}

.apay-card-row__thumb img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.apay-card-row__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.apay-card-row__meta strong {
  font-size: 15px;
  font-weight: 600;
}

.apay-card-row__meta span {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.62);
}

.apay-cash-card {
  padding: 4px 0 14px;
}

.apay-cash-card__art {
  position: relative;
  width: 100%;
  aspect-ratio: 1.58 / 1;
  border-radius: 16px;
  padding: 18px 18px 16px;
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.35), transparent 42%),
    linear-gradient(145deg, #ff8fb8 0%, #ff4f81 38%, #e91e63 68%, #ad1457 100%);
  box-shadow: 0 14px 34px rgba(173, 20, 87, 0.45);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
}

.apay-cash-card__balance,
.apay-cash-card__name {
  color: #fff;
  display: block;
}

.apay-cash-card__balance {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: auto;
}

.apay-cash-card__name {
  font-size: 14px;
  opacity: 0.9;
  margin-top: 4px;
}

.apay-total,
.apay-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 12px 4px;
}

.apay-total {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.apay-total strong {
  font-size: 20px;
  font-weight: 600;
}

.apay-line span,
.apay-total span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 14px;
}

.apay-line strong {
  font-size: 15px;
  font-weight: 600;
}

.apay-auth {
  padding-top: 18px;
  min-height: 118px;
  display: grid;
  place-items: center;
}

.apay-confirm,
.apay-faceid,
.apay-done {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.apay-confirm.is-active,
.apay-faceid.is-active,
.apay-done.is-active {
  display: flex;
}

.apay-confirm[hidden],
.apay-faceid[hidden],
.apay-done[hidden],
.apay-sheet[hidden],
.apay-sheet.is-hidden,
#apayCardRow[hidden],
#apayCashCard[hidden],
.pay-overlay__card[hidden],
.pay-overlay__card.is-hidden {
  display: none !important;
}

.apay-confirm p,
.apay-faceid p,
.apay-done p {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
}

.apay-confirm__phone {
  position: relative;
  width: 42px;
  height: 72px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 10px;
}

.apay-confirm__btn {
  position: absolute;
  right: -5px;
  top: 18px;
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: #fff;
  animation: apayClick 1.1s ease-in-out infinite;
}

.apay-confirm__arrow {
  position: absolute;
  right: -18px;
  top: 20px;
  width: 12px;
  height: 10px;
  border-top: 2px solid #fff;
  border-right: 2px solid #fff;
  transform: rotate(45deg);
  opacity: 0.9;
}

@keyframes apayClick {
  0%,
  100% {
    transform: translateX(0);
    opacity: 1;
  }
  50% {
    transform: translateX(2px);
    opacity: 0.55;
  }
}

.apay-faceid__glyph {
  position: relative;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
}

.apay-faceid__scan {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 12px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #7dd3fc, #fff, #7dd3fc, transparent);
  box-shadow: 0 0 12px rgba(125, 211, 252, 0.8);
  animation: apayScan 1.2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes apayScan {
  0% {
    top: 12px;
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
  100% {
    top: 40px;
    opacity: 0.35;
  }
}

.apay-done__check {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #30d158;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 700;
  animation: apayPop 0.35s ease;
}

@keyframes apayPop {
  from {
    transform: scale(0.7);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Processing overlay */
.pay-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: rgba(0, 0, 0, 0.35);
  display: grid;
  place-items: center;
  border-radius: var(--radius);
}

.pay-overlay--apple {
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.pay-overlay.hidden {
  display: none;
}

.pay-overlay__card {
  width: min(90%, 280px);
  background: #fff;
  border-radius: 14px;
  padding: 28px 20px 22px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}

.pay-overlay__card p {
  margin: 14px 0 0;
  font-size: 14px;
  color: var(--ink);
}

.pay-spinner {
  width: 32px;
  height: 32px;
  margin: 0 auto;
  border-radius: 50%;
  border: 3px solid #e8e8ed;
  border-top-color: var(--blue);
  animation: paySpin 0.8s linear infinite;
}

@keyframes paySpin {
  to {
    transform: rotate(360deg);
  }
}
