/* ==========================================================================
   checkout.css — единое оформление оплаты трёх тарифов через Lava.top

   Окно живёт в конце body, поверх остальных контекстов наложения. Поля
   переиспользуют общие .form-input и .form-status из layout.css.
   ========================================================================== */

.checkout-modal {
  position: fixed;
  inset: 0;
  z-index: 1150;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 16px;
}

.checkout-modal[hidden] {
  display: none;
}

.checkout-modal__backdrop {
  position: absolute;
  inset: 0;
  background-color: var(--black);
  opacity: .72;
  backdrop-filter: blur(4px);
}

.checkout-modal__card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  padding: 28px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  background-color: var(--main-bg);
  animation: checkout-modal-in var(--dur) var(--ease);
}

@keyframes checkout-modal-in {
  from {
    opacity: 0;
    translate: 0 16px;
  }
}

.checkout-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  background-color: var(--card-bg);
  color: var(--text-color);
  transition: background-color var(--dur) var(--ease),
              color var(--dur) var(--ease);
}

.checkout-modal__close:hover,
.checkout-modal__close:focus-visible {
  background-color: var(--card-bg-hover);
  color: var(--primary300);
}

.checkout-modal__head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 52px;
  margin-bottom: 16px;
}

.checkout-modal__eyebrow {
  color: var(--primary200);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  line-height: 1.2;
  text-transform: uppercase;
}

.checkout-modal__title {
  font-size: 30px;
  line-height: 1.1;
}

.checkout-modal__subtitle {
  color: var(--text-gray);
  font-size: var(--fs-small);
}

.checkout-modal__form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.checkout-modal__form .form-input {
  padding: 13px 16px;
}

.checkout-modal__label {
  display: block;
  margin-bottom: 8px;
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  line-height: 1.2;
}

.checkout-modal__group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.checkout-modal__choices {
  display: grid;
  gap: 8px;
}

.checkout-modal__choices--currency {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.checkout-modal__choices--method {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.checkout-choice {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.checkout-choice[hidden] {
  display: none;
}

.checkout-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.checkout-choice__body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-input);
  background-color: var(--input-bg);
  transition: background-color var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              color var(--dur) var(--ease);
}

.checkout-choice__body--icon {
  flex-direction: row;
  gap: 8px;
}

.checkout-choice__body--icon > svg {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  color: var(--primary200);
}

.checkout-choice__body--icon > span {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.checkout-choice__body strong,
.checkout-choice__body small {
  overflow-wrap: anywhere;
}

.checkout-choice__body strong {
  font-size: 15px;
  font-weight: var(--fw-medium);
  line-height: 1.25;
}

.checkout-choice__body small {
  margin-top: 4px;
  color: var(--text-gray);
  font-size: var(--fs-xs);
  line-height: 1.25;
}

.checkout-choice:hover .checkout-choice__body {
  background-color: var(--input-bg-focus);
}

.checkout-choice input:checked + .checkout-choice__body {
  border-color: var(--primary300);
  background-color: var(--card-bg-hover);
}

.checkout-choice input:focus-visible + .checkout-choice__body {
  outline: 2px solid var(--primary300);
  outline-offset: 2px;
}

.checkout-modal__total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
}

.checkout-modal__total span {
  color: var(--text-gray);
  font-size: var(--fs-small);
}

.checkout-modal__total strong {
  font-size: 30px;
  line-height: 1;
  text-align: right;
}

.checkout-modal__submit {
  min-height: 56px;
  padding-block: 14px;
}

.checkout-modal__secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-gray);
  font-size: var(--fs-xs);
  line-height: 1.3;
  text-align: center;
}

.checkout-modal__secure svg {
  flex: 0 0 auto;
}

.checkout-return {
  position: fixed;
  top: 88px;
  left: 50%;
  z-index: 1200;
  width: min(calc(100% - 32px), 620px);
  padding: 16px 52px 16px 18px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-btn);
  background-color: var(--card-bg);
  color: var(--text-color);
  box-shadow: 0 16px 40px var(--blackOverlay);
  translate: -50% 0;
}

.checkout-return--success {
  border-color: var(--success);
}

.checkout-return--error {
  border-color: var(--error);
}

.checkout-return__close {
  position: absolute;
  top: 50%;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  translate: 0 -50%;
}

.checkout-return__close:hover,
.checkout-return__close:focus-visible {
  background-color: var(--card-bg-hover);
}

@media (max-width: 768px) {
  .checkout-modal {
    align-items: flex-end;
    padding: 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .checkout-modal__card {
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    padding: 20px 16px max(16px, env(safe-area-inset-bottom));
  }

  .checkout-modal__head {
    margin-bottom: 12px;
  }

  .checkout-modal__title {
    font-size: 26px;
  }

  .checkout-modal__form {
    gap: 12px;
  }

  .checkout-modal__total strong {
    font-size: 26px;
  }
}

@media (max-width: 520px) {
  .checkout-modal__close {
    top: 12px;
    right: 12px;
  }

  .checkout-choice__body {
    min-height: 44px;
    padding-inline: 8px;
  }

  .checkout-choice__body strong {
    font-size: 14px;
  }

  .checkout-modal__secure {
    font-size: 12px;
  }
}

@media (max-width: 360px) {
  .checkout-modal {
    padding-inline: 4px;
  }

  .checkout-modal__card {
    padding-inline: 12px;
  }

  .checkout-choice__body--icon {
    gap: 6px;
  }

  .checkout-choice__body strong {
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .checkout-modal__card {
    animation: none;
  }
}

.checkout-modal__hint {
  margin: 8px 0 0;
  color: var(--text-gray);
  font-size: 13px;
  line-height: 1.4;
}
