/*
 * Contract-pay image viewer feature styles.
 * Shared animation, skeleton and skin overrides remain in common files for now.
 */

#xnf-contract-pay-image-preview[hidden] {
  display: none !important;
}

#xnf-contract-pay-image-preview {
  position: fixed;
  inset: 0;
  z-index: 2147483025;
  overflow: hidden;
  outline: none;
  user-select: none;
}

.xnf-cp-image-viewer__mask {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 18, 0.3);
}

.xnf-cp-image-viewer__canvas {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}

#xnf-contract-pay-image-preview.is-dragging .xnf-cp-image-viewer__canvas,
#xnf-contract-pay-image-preview.is-dragging .xnf-cp-image-viewer__img {
  cursor: grabbing;
}

.xnf-cp-image-viewer__img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transform-origin: center center;
  cursor: grab;
  user-select: none;
  -webkit-user-drag: none;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

#xnf-contract-pay-image-preview.is-original-size .xnf-cp-image-viewer__img {
  max-width: none;
  max-height: none;
}

.xnf-cp-image-viewer__btn {
  position: absolute;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  overflow: hidden;
  isolation: isolate;
  opacity: 1;
  background: transparent;
  background-image: none;
  box-shadow: none;
  color: rgba(255, 255, 255, 0.94);
  text-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  user-select: none;
  cursor: pointer;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    filter 180ms ease,
    transform 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

.xnf-cp-image-viewer__btn:hover {
  border-color: rgba(147, 197, 253, 0.92);
  background: rgba(15, 23, 42, 0.94);
  background-image: none;
  box-shadow: none;
  filter: none;
  color: rgba(239, 246, 255, 0.98);
}

.xnf-cp-image-viewer__btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 3px;
}

.xnf-cp-image-viewer__btn:not(.xnf-cp-image-viewer__actions):active {
  filter: brightness(0.94);
  transform: scale(0.96);
}

.xnf-cp-image-viewer__close {
  top: 28px;
  right: 28px;
  width: 48px;
  height: 48px;
  font-size: 25px;
  font-weight: 300;
  line-height: 1;
}

.xnf-cp-image-viewer__prev,
.xnf-cp-image-viewer__next {
  top: 50%;
  width: 52px;
  height: 52px;
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
}

.xnf-cp-image-viewer__prev {
  left: 40px;
  transform: translateY(-50%);
}

.xnf-cp-image-viewer__next {
  right: 40px;
  transform: translateY(-50%);
}

.xnf-cp-image-viewer__close:hover {
  transform: translateY(-1px);
}

.xnf-cp-image-viewer__prev:hover {
  transform: translateY(-50%) translateY(-1px);
}

.xnf-cp-image-viewer__next:hover {
  transform: translateY(-50%) translateY(-1px);
}

.xnf-cp-image-viewer__prev:active {
  transform: translateY(-50%) scale(0.94);
}

.xnf-cp-image-viewer__next:active {
  transform: translateY(-50%) scale(0.94);
}

.xnf-cp-image-viewer__prev[hidden],
.xnf-cp-image-viewer__next[hidden] {
  display: none !important;
}

.xnf-cp-image-viewer__actions {
  left: 50%;
  bottom: 28px;
  width: min(460px, calc(100vw - 32px));
  height: 54px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: transparent;
  background-image: none;
  box-shadow: none;
  color: rgba(255, 255, 255, 0.94);
  transform: translateX(-50%);
  cursor: default;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.xnf-cp-image-viewer__actions:hover {
  border-color: rgba(147, 197, 253, 0.92);
  background: rgba(15, 23, 42, 0.94);
  background-image: none;
  box-shadow: none;
  color: rgba(239, 246, 255, 0.98);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.xnf-cp-image-viewer__actions__inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 6px;
  width: 100%;
  height: 100%;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.xnf-cp-image-action {
  position: relative;
  z-index: 1;
  min-width: 34px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  background: transparent;
  background-image: none;
  box-shadow: none;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  text-shadow: none;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease,
    color 150ms ease,
    transform 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

.xnf-cp-image-action:hover {
  border-color: rgba(191, 219, 254, 0.92);
  background: rgba(96, 165, 250, 0.22);
  background-image: none;
  box-shadow: none;
  color: #fff;
}

.xnf-cp-image-action:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.82);
  outline-offset: 2px;
}

.xnf-cp-image-action:active {
  border-color: rgba(219, 234, 254, 0.95);
  background: rgba(59, 130, 246, 0.35);
  background-image: none;
  box-shadow: none;
  filter: none;
  transform: scale(0.94);
}

.xnf-cp-image-action:disabled,
.xnf-cp-image-action[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.4;
  pointer-events: none;
}

.xnf-cp-image-mode {
  min-width: 48px;
  border-radius: 999px;
  background: transparent;
  background-image: none;
  box-shadow: none;
  font-size: 13px;
}

.xnf-cp-image-divider {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.52);
}

.xnf-cp-image-count,
.xnf-cp-image-zoom-text {
  min-width: 46px;
  text-align: center;
  white-space: nowrap;
}

#xnf-contract-pay-image-preview .xnf-cp-image-action:hover {
  border-color: rgba(191, 219, 254, 0.92) !important;
  background: rgba(96, 165, 250, 0.22) !important;
  background-image: none !important;
  box-shadow: none !important;
  color: #fff !important;
}

#xnf-contract-pay-image-preview .xnf-cp-image-mode {
  border: 1px solid rgba(255, 255, 255, 0.62) !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
}

#xnf-contract-pay-image-preview .xnf-cp-image-viewer__close:active {
  filter: brightness(0.94) !important;
  box-shadow:
    rgba(255, 255, 255, 0.3) 0 0 2px 1px inset,
    rgba(255, 255, 255, 0.1) 0 0 8px 3px inset !important;
}

#xnf-contract-pay-image-preview .xnf-cp-image-action:active {
  border-color: rgba(219, 234, 254, 0.95) !important;
  background: rgba(59, 130, 246, 0.35) !important;
  background-image: none !important;
  box-shadow: none !important;
  filter: none !important;
  transform: scale(0.94);
}

@media (max-width: 640px) {
  .xnf-cp-image-viewer__close {
    top: 16px;
    right: 16px;
  }

  .xnf-cp-image-viewer__prev {
    left: 14px;
  }

  .xnf-cp-image-viewer__next {
    right: 14px;
  }

  .xnf-cp-image-viewer__actions {
    bottom: 16px;
    width: min(460px, calc(100vw - 20px));
    padding: 0 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .xnf-cp-image-viewer__btn,
  .xnf-cp-image-action {
    transition: none;
  }

  .xnf-cp-image-viewer__btn::before {
    transition: none;
  }
}

@media (prefers-reduced-transparency: reduce) {
  #xnf-contract-pay-image-preview .xnf-cp-image-viewer__btn:not(.xnf-cp-image-viewer__actions) {
    background: rgba(24, 30, 43, 0.94) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  #xnf-contract-pay-image-preview .xnf-cp-image-viewer__btn:not(.xnf-cp-image-viewer__actions)::before {
    display: none;
  }

  #xnf-contract-pay-image-preview .xnf-cp-image-viewer__btn:not(.xnf-cp-image-viewer__actions)::after {
    mix-blend-mode: normal !important;
  }
}

[data-xnf-skeleton-kind="media"] > :is(.xnf-cp-image-viewer__img, .xnf-preview-large) {
  opacity: 0;
}

.xnf-cp-skeleton-media {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: grid;
  place-items: center;
}

.xnf-cp-skeleton-media-frame {
  position: relative;
  width: min(720px, 62vw);
  max-width: calc(100vw - 90px);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.24);
}

.xnf-cp-skeleton-media-frame > i {
  position: absolute;
  top: 18%;
  left: 50%;
  width: 54px;
  height: 42px;
  transform: translateX(-50%);
  border: 3px solid rgba(255, 255, 255, 0.34);
  border-radius: 5px;
}

.xnf-cp-skeleton-media-frame > span {
  position: absolute;
  right: 13%;
  bottom: 14%;
  left: 13%;
  height: 34%;
  clip-path: polygon(0 100%, 28% 32%, 46% 62%, 67% 10%, 100% 100%);
  background: rgba(255, 255, 255, 0.18);
}

@keyframes xnf-cp-skeleton-shimmer {
  100% { transform: translateX(100%); }
}


/* Shared extension overlay motion and media skeleton, scoped to this viewer. */
#xnf-contract-pay-image-preview { overscroll-behavior: contain; font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif; }
#xnf-contract-pay-image-preview:not([hidden]) { opacity: 0; transition: opacity 160ms cubic-bezier(0.16, 1, 0.3, 1); }
#xnf-contract-pay-image-preview.is-xnf-open { opacity: 1; }
#xnf-contract-pay-image-preview.is-xnf-closing { pointer-events: none; }
#xnf-contract-pay-image-preview .xnf-cp-image-viewer__canvas { transition: opacity 180ms cubic-bezier(0.16, 1, 0.3, 1), transform 220ms cubic-bezier(0.16, 1, 0.3, 1); }
#xnf-contract-pay-image-preview:not([hidden]) .xnf-cp-image-viewer__canvas { opacity: 0; transform: scale(0.985); }
#xnf-contract-pay-image-preview.is-xnf-open .xnf-cp-image-viewer__canvas { opacity: 1; transform: scale(1); }
.xnf-cp-skeleton { pointer-events: none; user-select: none; }
.xnf-cp-skeleton-media-frame::after { position: absolute; inset: 0; content: ""; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.78), transparent); animation: xnf-cp-skeleton-shimmer 1.35s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  #xnf-contract-pay-image-preview, #xnf-contract-pay-image-preview .xnf-cp-image-viewer__canvas { transition: none !important; }
  .xnf-cp-skeleton-media-frame::after { animation: none; display: none; }
}
