/* Resumable checkout and profile-completion UI.
   Scoped classes keep legacy checkout/profile styles untouched. */

.listing-payment-modal[hidden] { display: none !important; }
.listing-payment-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 27, 45, .58);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  overflow-y: auto;
}
.listing-payment-modal__card {
  width: min(100%, 460px);
  max-height: min(760px, calc(100dvh - 48px));
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 24px;
  background: #fff;
  color: #121827;
  box-shadow: 0 28px 80px rgba(15, 23, 42, .24);
  padding: 26px;
  scrollbar-width: thin;
}
.listing-payment-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}
.listing-payment-modal__header h2 {
  margin: 0;
  font-size: clamp(22px, 3vw, 28px);
  line-height: 1.18;
  letter-spacing: -.02em;
}
.listing-payment-modal__header p {
  margin: 8px 0 0;
  color: #8992a6;
  font-size: 15px;
  line-height: 1.4;
}
.listing-payment-modal__close {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #7d8698;
  font-size: 23px;
  line-height: 1;
  cursor: pointer;
}
.listing-payment-modal__close:hover,
.listing-payment-modal__close:focus-visible { background: #f3f5f9; color: #171e2e; outline: none; }
.listing-payment-methods { display: grid; gap: 10px; }
.listing-payment-method {
  width: 100%;
  min-height: 74px;
  display: grid;
  grid-template-columns: 1fr 24px;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  border: 1px solid #e4e7ee;
  border-radius: 17px;
  background: #f8f9fb;
  color: #202839;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease, transform .16s ease;
}
.listing-payment-method:hover:not(:disabled) { border-color: #c7b5ff; background: #fff; transform: translateY(-1px); }
.listing-payment-method.is-selected {
  border-color: #8a3ffc;
  background: linear-gradient(180deg, #fff 0%, #faf7ff 100%);
  box-shadow: 0 0 0 2px rgba(138, 63, 252, .12);
}
.listing-payment-method:disabled { opacity: .48; cursor: not-allowed; }
.listing-payment-method__copy { min-width: 0; }
.listing-payment-method__title { display: block; font-weight: 750; font-size: 16px; line-height: 1.25; }
.listing-payment-method__subtitle { display: block; margin-top: 4px; color: #8c95a7; font-size: 13px; line-height: 1.3; }
.listing-payment-method__radio {
  width: 21px;
  height: 21px;
  border: 1.5px solid #cbd2de;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 5px #fff;
}
.listing-payment-method.is-selected .listing-payment-method__radio { border-color: #8a3ffc; background: #8a3ffc; }
.listing-payment-modal__footer { margin-top: 20px; display: grid; gap: 12px; }
.listing-payment-modal__total { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; font-size: 14px; color: #697386; }
.listing-payment-modal__total strong { color: #171e2e; font-size: 19px; letter-spacing: -.015em; }
.listing-payment-modal__submit,
.listing-payment-auth__submit,
.listing-payment-auth__back {
  min-height: 50px;
  border-radius: 14px;
  border: 0;
  padding: 0 18px;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  transition: transform .16s ease, opacity .16s ease, box-shadow .16s ease;
}
.listing-payment-modal__submit,
.listing-payment-auth__submit {
  width: 100%;
  color: #fff;
  background: linear-gradient(135deg, #8238f5, #a43df1);
  box-shadow: 0 10px 24px rgba(132, 55, 245, .22);
}
.listing-payment-modal__submit:hover:not(:disabled),
.listing-payment-auth__submit:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 13px 28px rgba(132, 55, 245, .28); }
.listing-payment-modal__submit:disabled,
.listing-payment-auth__submit:disabled { opacity: .55; cursor: wait; }
.listing-payment-modal__message { min-height: 20px; margin: 0; color: #be2f3f; font-size: 13px; line-height: 1.45; }
.listing-payment-modal__message.is-success { color: #15803d; }
.listing-payment-auth { display: grid; gap: 16px; }
.listing-payment-auth__field { display: grid; gap: 8px; }
.listing-payment-auth__field label { font-size: 14px; font-weight: 700; color: #2b3445; }
.listing-payment-auth__field input {
  width: 100%;
  min-height: 50px;
  box-sizing: border-box;
  border: 1px solid #dfe3eb;
  border-radius: 14px;
  background: #f6f7fa;
  color: #151c2b;
  padding: 0 15px;
  font: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.listing-payment-auth__field input:focus { border-color: #8a3ffc; background: #fff; box-shadow: 0 0 0 3px rgba(138, 63, 252, .12); }
.listing-payment-auth__hint { margin: -4px 0 0; color: #858fa3; font-size: 13px; line-height: 1.4; }
.listing-payment-auth__actions { display: grid; gap: 10px; }
.listing-payment-auth__back { width: 100%; background: #f0f2f6; color: #343d4f; }

.profile-completion-notice {
  margin: 18px auto;
  width: min(calc(100% - 32px), 1368px);
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  border: 1px solid #f2c38d;
  border-radius: 18px;
  background: #fff8ee;
  color: #71310b;
}
.profile-completion-notice__copy h2 { margin: 0; font-size: 18px; line-height: 1.25; }
.profile-completion-notice__copy p { margin: 5px 0 0; color: #985421; font-size: 14px; line-height: 1.4; }
.profile-completion-notice__action {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 17px;
  border-radius: 12px;
  background: #8a3ffc;
  color: #fff;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}
.profile-completion-dot { display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: #ff7a1a; vertical-align: top; }

.profile-security-create-password {
  border: 1px solid #e3e6ee;
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
}
.profile-security-create-password__header { padding: 18px 20px; border-bottom: 1px solid #edf0f4; }
.profile-security-create-password__header h3 { margin: 0; font-size: 17px; }
.profile-security-create-password__header p { margin: 6px 0 0; color: #7f899c; font-size: 14px; }
.profile-security-create-password__body { padding: 20px; display: grid; gap: 16px; }
.profile-security-create-password__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.profile-security-create-password__field { display: grid; gap: 7px; }
.profile-security-create-password__field label { font-size: 14px; font-weight: 700; }
.profile-security-create-password__field input {
  min-height: 48px;
  box-sizing: border-box;
  border: 1px solid #dfe3eb;
  border-radius: 13px;
  background: #f6f7fa;
  padding: 0 14px;
  font: inherit;
  outline: none;
}
.profile-security-create-password__field input:focus { border-color: #8a3ffc; background: #fff; box-shadow: 0 0 0 3px rgba(138,63,252,.12); }
.profile-security-create-password__submit { justify-self: start; min-height: 44px; border: 0; border-radius: 12px; padding: 0 20px; background: #8a3ffc; color: #fff; font: inherit; font-weight: 750; cursor: pointer; }

@media (max-width: 680px) {
  .listing-payment-modal { place-items: end center; padding: 0; }
  .listing-payment-modal__card {
    width: 100%;
    max-height: min(88dvh, 760px);
    border-radius: 22px 22px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    padding: 20px 16px calc(18px + env(safe-area-inset-bottom));
  }
  .listing-payment-modal__header { margin-bottom: 16px; }
  .listing-payment-modal__header h2 { font-size: 23px; }
  .listing-payment-method { min-height: 68px; padding: 13px 15px; border-radius: 15px; }
  .listing-payment-modal__submit,
  .listing-payment-auth__submit,
  .listing-payment-auth__back { min-height: 52px; }
  .profile-completion-notice {
    width: min(calc(100% - 24px), 1368px);
    grid-template-columns: 1fr;
    margin: 12px auto;
    padding: 15px;
    border-radius: 15px;
  }
  .profile-completion-notice__action { width: 100%; box-sizing: border-box; }
  .profile-security-create-password__grid { grid-template-columns: 1fr; }
  .profile-security-create-password__submit { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .listing-payment-method,
  .listing-payment-modal__submit,
  .listing-payment-auth__submit { transition: none; }
}

/* Desktop product detail: purchase guide belongs to the middle information column.
   The markup remains semantically inside the buy aside, but display:contents lets
   the existing guide participate in the parent grid without absolute positioning. */
@media (min-width: 1081px) {
  html body .listing-page .listing-hero-layout {
    display: grid !important;
    grid-template-columns: minmax(0, 1.42fr) minmax(300px, .92fr) minmax(270px, .78fr) !important;
    grid-template-rows: auto auto !important;
    column-gap: 24px !important;
    row-gap: 14px !important;
    align-items: start !important;
    position: static !important;
  }

  html body .listing-page .listing-hero-layout > .listing-gallery-column {
    grid-column: 1 !important;
    grid-row: 1 / span 2 !important;
  }

  html body .listing-page .listing-hero-layout > .listing-info-column {
    grid-column: 2 !important;
    grid-row: 1 !important;
  }

  html body .listing-page .listing-hero-layout > .listing-buy-column {
    display: contents !important;
  }

  html body .listing-page .listing-hero-layout > .listing-buy-column > .listing-buy-card {
    grid-column: 3 !important;
    grid-row: 1 / span 2 !important;
    align-self: start !important;
  }

  html body .listing-page .listing-hero-layout > .listing-buy-column > .listing-transaction-guide--after-buy {
    position: static !important;
    inset: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    z-index: auto !important;
    grid-column: 2 !important;
    grid-row: 2 !important;
    align-self: start !important;
    justify-self: stretch !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    transform: none !important;
  }
}

/* Owner actions: clear hierarchy. Destructive is solid red, edit is explicit blue. */
html body .listing-page .listing-owner-actions .seller-action-btn--delete,
html body .listing-page .listing-owner-actions .seller-action-btn--delete:hover,
html body .listing-page .listing-owner-actions .seller-action-btn--delete:focus-visible,
html body .listing-page .listing-owner-actions .seller-action-btn--delete:active {
  border-color: #dc2626 !important;
  background: #dc2626 !important;
  color: #fff !important;
  box-shadow: none !important;
}

html body .listing-page .listing-owner-actions .seller-action-btn--delete:hover {
  border-color: #b91c1c !important;
  background: #b91c1c !important;
}

html body .listing-page .listing-owner-actions .seller-action-btn--delete:active {
  border-color: #991b1b !important;
  background: #991b1b !important;
  transform: scale(.985) !important;
}

html body .listing-page .listing-owner-actions .seller-action-btn--edit,
html body .listing-page .listing-owner-actions .seller-action-btn--edit:hover,
html body .listing-page .listing-owner-actions .seller-action-btn--edit:focus-visible,
html body .listing-page .listing-owner-actions .seller-action-btn--edit:active {
  border-color: #2563eb !important;
  background: #2563eb !important;
  color: #fff !important;
  box-shadow: none !important;
}

html body .listing-page .listing-owner-actions .seller-action-btn--edit:hover {
  border-color: #1d4ed8 !important;
  background: #1d4ed8 !important;
}

html body .listing-page .listing-owner-actions .seller-action-btn--edit:active {
  border-color: #1e40af !important;
  background: #1e40af !important;
  transform: scale(.985) !important;
}

/* Purchase flow belongs directly to the canvas: no outer white card. */
html body .listing-page .listing-transaction-guide {
  margin-top: 16px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

html body .listing-page .listing-transaction-guide__brand {
  margin-bottom: 6px !important;
  padding: 0 !important;
  min-height: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: #7c3aed !important;
  font-size: 10px !important;
  letter-spacing: .12em !important;
}

html body .listing-page .listing-transaction-guide h3 {
  margin: 0 0 14px !important;
  font-size: 0 !important;
  line-height: 0 !important;
}

html body .listing-page .listing-transaction-guide h3::before {
  content: "Как проходит сделка";
  display: block;
  color: #101828;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 760;
}

html body .listing-page .listing-transaction-guide ol {
  gap: 10px 14px !important;
}

html body .listing-page .listing-transaction-guide li {
  grid-template-columns: 28px minmax(0, 1fr) !important;
  gap: 9px !important;
  min-height: 36px !important;
  padding: 2px 0 !important;
}

html body .listing-page .listing-transaction-guide li::before {
  width: 26px !important;
  height: 26px !important;
  border: 1px solid rgba(255,255,255,.42) !important;
  border-radius: 9px !important;
  background: linear-gradient(145deg, #8b5cf6 0%, #6d28d9 55%, #5b21b6 100%) !important;
  color: #fff !important;
  box-shadow: 0 5px 12px rgba(91,33,182,.18) !important;
  font-size: 11px !important;
  font-weight: 800 !important;
}

html body .listing-page .listing-transaction-guide li strong {
  color: #344054 !important;
  font-weight: 700 !important;
}

html body .listing-page .listing-transaction-guide li span {
  color: #7a8496 !important;
}

html body .listing-page .listing-transaction-guide > p {
  margin: 12px 0 0 !important;
  padding: 11px 0 0 !important;
  border-top: 1px solid #eaecf0 !important;
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0 !important;
}

html body .listing-page .listing-transaction-guide > p::before {
  content: "Если возникнет проблема — не подтверждайте получение и откройте спор. Поддержка сделает возврат.";
  display: block;
  color: #667085;
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 640px) {
  html body .listing-page .listing-transaction-guide {
    padding: 0 !important;
  }
}
