.checkout-page {
  min-height: calc(100vh - 4rem);
  background: var(--background);
  padding: 6rem 0 4rem;
}

.checkout-page__back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1.5rem;
  color: #6b7280;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 400;
}

.checkout-page__back-link:hover {
  color: var(--color-accent);
}

.checkout-page .go-back-link-icon {
  width: 10px;
  height: 10px;
}

.checkout-page h1 {
  margin: 0 0 3rem;
  font-size: 2rem;
  color: #020617;
}

.checkout-page__layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  gap: 2rem;
  align-items: start;
}

.checkout-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.checkout-card,
.checkout-summary {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  padding: 1.5rem;
}

.checkout-card h2,
.checkout-summary h2 {
  margin: 0 0 1.25rem;
  font-size: 1.25rem;
  color: #020617;
}

.checkout-customer-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
}

.checkout-customer-box p {
  margin: 0 0 0.5rem;
  font-size: 1rem;

  color: #111827;
}

.checkout-customer-box small {
  color: #111827;
  font-weight: 300;
  margin-top: 0.5rem;
  font-size: 1rem;
}

.checkout-customer-type {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.checkout-customer-type span {
  font-weight: 300;
}

.checkout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.checkout-field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
  font-weight: 700;
  color: #111827;
}

.checkout-field input,
.checkout-field select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  height: 42px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0 0.75rem;
  font-size: 1rem;
  font-weight: 300;
  background: #fff;
}

.checkout-field select {
  padding-right: 2.5rem;
  cursor: pointer;
}

.checkout-field .select-arrow {
  position: absolute;
  right: 0.85rem;
  top: 2.9rem;
  width: 9px;
  height: 9px;
  pointer-events: none;
  color: var(--color-text);
  fill: currentColor;
}

.checkout-field select:disabled {
  background: #f3f4f6;
  color: #4b5563;
  cursor: default;
  opacity: 1;
}

.checkout-field input[readonly] {
  background: #f3f4f6;
  color: #4b5563;
  cursor: default;
}

.checkout-field input:focus,
.checkout-field select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.checkout-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 300;
  margin-top: 1rem;
}

.checkout-checkbox input[type="checkbox"] {
  accent-color: var(--color-accent);
}

.checkout-checkbox:has(input.is-invalid) {
  color: #b91c1c;
}

.checkout-checkbox input[type="checkbox"].is-invalid {
  outline: 2px solid #ec0909;
  outline-offset: 2px;
}

[data-shipping-profile-group].is-invalid {
  padding: 0.75rem;
  border: 1px solid #ec0909;
  border-radius: var(--radius);
  background: #fff7f7;
}

/* Payment options */
.checkout-payment-list {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.checkout-payment-option {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;

  min-height: 74px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;

  background: var(--card);
  color: var(--card-foreground);

  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);

  cursor: pointer;

  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.12s ease;
}

.checkout-payment-option:hover {
  background: var(--color-bg);
  border-color: rgba(255, 0, 152, 0.45);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.checkout-payment-option:active {
  transform: translateY(1px);
}

.checkout-payment-option:focus-within {
  border-color: var(--color-accent);
  box-shadow:
    0 0 0 3px rgba(255, 0, 152, 0.1),
    0 1px 3px rgba(0, 0, 0, 0.08);
}

.checkout-payment-option:has(input[name="payment_method"]:checked) {
  background: rgba(255, 0, 152, 0.025);
  border-color: var(--color-accent);
  box-shadow:
    0 0 0 3px rgba(255, 0, 152, 0.08),
    0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Radio bleibt */
.checkout-payment-option input[name="payment_method"] {
  margin: 0;
  width: 18px;
  height: 18px;

  justify-self: start;
  align-self: center;

  cursor: pointer;
}

.checkout-radio input[type="radio"],
.checkout-payment-option input[type="radio"] {
  accent-color: #000;
}

/* Linkes Auswahl-Icon */
.payment-option__icon {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;

  margin-left: auto;
}

.payment-option__icon svg {
  width: 44px;
  height: 32px;
  flex-shrink: 0;
}

.payment-option__icon > svg use {
  pointer-events: none;
}

.checkout-payment-option:hover .payment-option__icon {
  color: var(--color-text);
}

.checkout-payment-option:has(input[name="payment_method"]:checked)
  .payment-option__icon {
  color: var(--color-accent);
}

/* Text */
.payment-option__content {
  display: block;
  min-width: 0;
}

.checkout-payment-option strong {
  display: block;
  margin: 0 0 0.2rem;

  color: var(--color-text);
  font-size: 1rem;
  font-weight: var(--font-weight-bold);
  line-height: 1.3;
}

.checkout-payment-option small {
  display: block;
  margin: 0;

  color: var(--color-text-light);
  font-size: 0.875rem;
  font-weight: var(--font-weight-normal);
  line-height: 1.45;
}

/* Markenlogos rechts */
.payment-option__logos {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;

  min-width: max-content;
  line-height: 0;
}

.payment-option__logos > svg,
.payment-option__logos > img {
  display: block;

  width: auto;
  height: 22px;
  min-height: 22px;
  max-width: 48px;
  max-height: 22px;

  object-fit: contain;
  flex-shrink: 0;
}

/* Aufklappbarer Detailbereich */
.checkout-payment-option__details {
  display: none;
  grid-column: 1 / -1;

  margin: 0.25rem -1.25rem -1rem;
  padding: 1.25rem;

  background: var(--color-bg);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);

  cursor: default;
}

.checkout-payment-option:has(input[name="payment_method"]:checked)
  .checkout-payment-option__details {
  display: block;
}

.checkout-payment-option__details .checkout-field:last-child {
  margin-bottom: 0;
}

.checkout-payment-note {
  margin: 0;

  color: var(--color-text-light);
  font-size: 0.875rem;
  font-weight: var(--font-weight-normal);
  line-height: 1.5;
}

/* Deaktiviert */
.checkout-payment-option:has(input[name="payment_method"]:disabled) {
  background: var(--muted);
  color: var(--muted-foreground);

  cursor: not-allowed;
  opacity: 0.65;
}

.checkout-payment-option:has(input[name="payment_method"]:disabled):hover {
  border-color: var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transform: none;
}

.safe-payment-info {
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.015em;
  margin-top: 0.75rem;
  color: var(--color-text-light);
}

.payment-infos-below {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;

  gap: 1rem;
  margin: 0rem 0.8rem 1rem;
}

.stripe-payment-element {
  min-height: 44px;
}

.stripe-payment-element:empty {
  display: none;
}

.stripe-payment-element:not(:empty) {
  padding: 0.25rem 0;
}

#stripe-payment-loading {
  margin-bottom: 1rem;
}

#stripe-payment-error {
  margin-top: 0.75rem;
}

.checkout-payment-option > input[name="payment_method"] {
  margin: 0;
  width: 18px;
  height: 18px;
  align-self: center;
  justify-self: start;
  cursor: pointer;
}

.checkout-payment-option > input[name="payment_method"]:disabled {
  cursor: not-allowed;
}

#checkout-payment-stripe .checkout-payment-note {
  margin-bottom: 1rem;
}

.payment-option__content,
.payment-option__icon {
  cursor: pointer;
}

.checkout-payment-option:has(input[name="payment_method"]:disabled)
  .payment-option__content,
.checkout-payment-option:has(input[name="payment_method"]:disabled)
  .payment-option__icon {
  cursor: not-allowed;
}

/* Shipping address list */

.checkout-shipping-address-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.checkout-shipping-address-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
}

.checkout-shipping-address-option:has(input:checked) {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(255, 0, 152, 0.1);
}

.checkout-shipping-address-option__body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  color: #4b5563;
}

.checkout-shipping-address-option__title {
  margin-bottom: 0.25rem;
  color: #111827;
}

.checkout-shipping-addresses__empty {
  margin: 1rem 0 0;
  color: #6b7280;
  font-size: 0.9rem;
}

.checkout-shipping-method__hint {
  margin-bottom: 0.5rem;
}

.checkout-shipping-method__hint2 {
  margin-top: 0.5rem;
}

.checkout-summary {
  position: sticky;
  top: 6rem;
}

.checkout-summary__items {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.checkout-summary__placeholder {
  margin: 0;
  color: #6b7280;
  font-size: 0.9rem;
}

.checkout-summary__totals {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.checkout-summary__row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 300;
}

.checkout-summary__total {
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
  font-weight: 700;
}

.checkout-summary__total strong {
  color: var(--color-accent);
  font-size: 1.5rem;
}

.checkout-summary-item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 0.75rem;
  padding: 1rem 0;
}

.checkout-summary-item + .checkout-summary-item {
  border-top: 1px solid #e5e7eb;
}

.checkout-summary-item__image {
  width: 56px;
  height: 56px;
  object-fit: contain;
  background: #f3f4f6;
  border-radius: 6px;
}

.checkout-summary-item__line,
.checkout-summary-service,
.checkout-summary-item__group-total {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}

.checkout-summary-item__title {
  display: block;
  font-size: 0.9rem;
}

.checkout-summary-item__variant,
.checkout-summary-item__quantity,
.checkout-summary-service__quantity {
  display: block;
  margin-top: 0.15rem;
  color: #6b7280;
  font-size: 0.8rem;
}

.checkout-summary-service {
  margin-top: 0.6rem;
  padding-left: 0.75rem;
  border-left: 2px solid #bbf7d0;
  color: #166534;
  font-size: 0.85rem;
}

.checkout-summary-item__price,
.checkout-summary-service__price {
  white-space: nowrap;
  font-size: 0.85rem;
}

.checkout-summary-item__group-total {
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px dashed #e5e7eb;
  font-size: 0.85rem;
  font-weight: 700;
}

.checkout-submit {
  width: 100%;
  justify-content: center;
  margin-top: 1.5rem;
}

.checkout-submit[aria-busy="true"] {
  cursor: wait;
}

.checkout-submit[aria-busy="true"]::after {
  content: "";
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;

  border: 2px solid rgba(255, 255, 255, 0.45);

  border-top-color: var(--primary-foreground);

  border-radius: 50%;

  animation: checkout-submit-spin 0.7s linear infinite;
}

.checkout-submit__loading-text {
  display: none;
}

.checkout-submit[aria-busy="true"] .checkout-submit__default-text {
  display: none;
}

.checkout-submit[aria-busy="true"] .checkout-submit__loading-text {
  display: inline;
}

.checkout-customer-box a {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 700;

  transition: color 0.2s ease;
}

.checkout-customer-box a:hover {
  color: var(--color-accent);
}

.checkout-summary__hint {
  font-size: 0.8rem;
  line-height: 1.4;
  font-weight: 400;
  letter-spacing: 0.015em;
  margin-top: 0.75rem;
  color: var(--color-text-light);
}

.checkout-consents {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.checkout-consents .checkout-checkbox {
  margin-top: 0;
  align-items: flex-start;
}

.checkout-consents span {
  font-size: 0.8rem;
  line-height: 1.4;
  font-weight: 400;
  letter-spacing: 0.015em;
  color: var(--color-text-light);
  padding-bottom: 0.5rem;
}

.checkout-consent-text a {
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}

.checkout-consent-text a:hover {
  color: var(--color-accent);
}

.paypal-button-container {
  min-height: 45px;
  margin-top: 1rem;
}

.paypal-button-container:empty {
  display: none;
}

#paypal-payment-loading {
  margin-top: 1rem;
}

#paypal-payment-error {
  margin-top: 0.75rem;
}

@keyframes checkout-submit-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  .checkout-page__layout {
    grid-template-columns: 1fr;
  }

  .checkout-summary {
    position: static;
  }

  .checkout-grid {
    grid-template-columns: 1fr;
  }

  .checkout-customer-box {
    align-items: flex-start;
    flex-direction: column;
  }

  .checkout-payment-option {
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 0.75rem;
    padding: 1rem;
  }

  .payment-option__icon {
    justify-self: end;
    margin-left: 0;
  }

  .payment-option__icon svg {
    width: 36px;
    height: 26px;
  }

  .checkout-payment-option__details {
    grid-column: 1 / -1;

    margin-right: -1rem;
    margin-bottom: -1rem;
    margin-left: -1rem;
    padding: 1rem;
  }

  .payment-infos-below {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .required-notice {
    justify-content: flex-start;
    margin-left: 0;
  }
}

@media (max-width: 520px) {
  .checkout-page {
    padding-top: 4.5rem;
  }

  .checkout-card,
  .checkout-summary {
    padding: 1rem;
  }

  .checkout-payment-option {
    grid-template-columns: 22px minmax(0, 1fr) auto;
    gap: 0.6rem;
  }

  .payment-option__icon {
    gap: 0.15rem;
  }

  .payment-option__icon svg {
    width: 28px;
    height: 22px;
  }

  .checkout-customer-box .btn {
    width: 100%;
    justify-content: center;
  }
}
