/*
 * Krepling subscription selector (One-time / Subscribe + plans).
 * Ported verbatim from krepling-pay-working (assets/css/krepling-style.css).
 * Self-contained .kp-subscription-* rules; applies in the legacy checkout.
 */

.kp-subscription-section {
  margin: 18px 0 24px;
}

.kp-subscription-mode-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kp-subscription-mode,
.kp-subscription-composite,
.kp-subscription-plan-card {
  width: 100%;
  border: 1px solid rgba(145, 23, 242, 0.2);
  border-radius: 12px;
  background: #fff;
  color: var(--kp-text-color);
  text-align: left;
  box-shadow: none;
  outline: none;
}

.kp-subscription-mode {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  /* Layout feedback item 2: the One-time / Subscribe options are clickable — show
   * a pointer cursor and a hover state. */
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

/* Hover state for the two payment options (skip the already-selected one). */
.kp-subscription-mode:not(.is-active):hover,
.kp-subscription-composite:not(.is-active):hover {
  border-color: var(--kp-button-color);
  box-shadow: 0 0 0 1px rgba(145, 23, 242, 0.12);
}

/* The Subscribe option's button sits inside a bordered composite wrapper; move
 * the pointer + hover affordance onto the wrapper so the whole card responds. */
.kp-subscription-composite {
  cursor: pointer;
}

.kp-subscription-mode.is-active,
.kp-subscription-composite.is-active,
.kp-subscription-plan-card.is-active {
  border-color: var(--kp-button-color);
  box-shadow: 0 0 0 1px rgba(145, 23, 242, 0.12);
}

.kp-subscription-composite {
  overflow: hidden;
}

.kp-subscription-composite .kp-subscription-mode {
  border: 0;
  border-radius: 12px;
  box-shadow: none;
}

.kp-subscription-composite.is-expanded .kp-subscription-mode {
  border-radius: 12px 12px 0 0;
  padding-bottom: 12px;
}

.kp-subscription-mode-copy,
.kp-subscription-plan-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.kp-subscription-mode-copy {
  flex: 1 1 auto;
}

.kp-subscription-mode .kp-subscription-mode-copy {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.kp-subscription-radio,
.kp-subscription-plan-radio {
  display: inline-flex;
  width: 22px;
  height: 22px;
  min-width: 22px;
  border: 2px solid rgba(0, 0, 0, 0.12);
  border-radius: 50%;
  position: relative;
  transition: border-color 0.2s ease;
}

.kp-subscription-mode.is-active .kp-subscription-radio,
.kp-subscription-plan-radio.is-active {
  border-color: var(--kp-button-color);
}

.kp-subscription-mode.is-active .kp-subscription-radio::after,
.kp-subscription-plan-radio.is-active::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--kp-button-color);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.kp-subscription-label,
.kp-subscription-plan-name {
  font-family: PPRadioGrotesk-Bold;
  font-size: 16px;
  line-height: 20px;
}

.kp-subscription-plan-description {
  color: #000000;
  opacity: 0.7;
  font-family: PPRadioGrotesk-Regular;
  font-size: 16px;
  line-height: 22px;
  max-width: 36ch;
}

.kp-subscription-save,
.kp-subscription-plan-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(145, 23, 242, 0.18);
  background: rgba(145, 23, 242, 0.08);
  color: var(--kp-button-color);
  font-family: PPRadioGrotesk-Bold;
  font-size: 11px;
  line-height: 14px;
  padding: 4px 12px;
  white-space: nowrap;
}

.kp-subscription-save.hideclass,
.kp-subscription-plan-save.hideclass,
.kp-subscription-compare.hideclass {
  display: none !important;
}

.kp-subscription-plan-nudge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  border-radius: 999px;
  border: 1px solid rgba(145, 23, 242, 0.12);
  background: rgba(145, 23, 242, 0.10);
  color: var(--kp-button-color);
  font-family: PPRadioGrotesk-Bold;
  font-size: 11px;
  line-height: 14px;
  padding: 6px 14px;
  margin-bottom: 6px;
  white-space: nowrap;
}

.kp-subscription-prices,
.kp-subscription-plan-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.kp-subscription-current,
.kp-subscription-plan-price {
  font-family: PPRadioGrotesk-Bold;
  font-size: 16px;
  line-height: 20px;
}

.kp-subscription-compare {
  color: var(--kp-text-color);
  opacity: 0.5;
  text-decoration: line-through;
  font-family: PPRadioGrotesk-Regular;
  font-size: 14px;
  line-height: 18px;
}

.kp-subscription-plan-panel {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(145, 23, 242, 0.2);
  border-radius: 12px;
  background: #fff;
}

.kp-subscription-composite .kp-subscription-plan-panel {
  --kp-subscription-plan-panel-gap: 18px;
  margin-top: 0;
  padding: 0 18px 0;
  border: 0;
  border-radius: 0 0 12px 12px;
  background: transparent;
  display: block;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  transition:
    height 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    max-height 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    padding-bottom 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.24s ease;
}

.kp-subscription-composite.is-expanded .kp-subscription-plan-panel {
  max-height: calc(var(--kp-subscription-plan-panel-height, 0px) + var(--kp-subscription-plan-panel-gap, 0px));
  padding-bottom: 18px;
  opacity: 1;
  pointer-events: auto;
}

.kp-subscription-plan-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  color: rgba(0, 0, 0, 0.55);
  font-family: PPRadioGrotesk-Bold;
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.kp-subscription-plan-heading span:first-child,
.kp-subscription-plan-heading span:last-child {
  flex: 1 1 auto;
  height: 0;
  background: none;
  border-top: 2px dotted rgba(0, 0, 0, 0.18);
}

/* Compact plan card (design): keep name + price + total + Save% + radio; hide the
 * verbose lines (description, "For N month", "Ends on…", monthly equivalent, nudge). */
.kp-subscription-plan-card .kp-subscription-plan-description,
.kp-subscription-plan-card .kp-subscription-plan-billing-copy,
.kp-subscription-plan-card .kp-subscription-plan-monthly-copy,
.kp-subscription-plan-card .kp-subscription-plan-end-date,
.kp-subscription-plan-card .kp-subscription-plan-nudge {
  display: none !important;
}

.kp-subscription-plan-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kp-subscription-plan-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
}

.kp-subscription-plan-price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.kp-subscription-plan-price {
  font-size: 24px;
  line-height: 28px;
}

.kp-subscription-plan-unit,
.kp-subscription-plan-meta,
.kp-subscription-plan-billing-copy,
.kp-subscription-plan-monthly-copy,
.kp-subscription-plan-end-date {
  color: var(--kp-text-color);
  font-family: PPRadioGrotesk-Regular;
  font-size: 13px;
  line-height: 17px;
}

.kp-subscription-plan-billing-copy,
.kp-subscription-plan-monthly-copy,
.kp-subscription-plan-end-date {
  color: #000000;
  opacity: 0.7;
}

.kp-subscription-plan-meta {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.kp-subscription-plan-meta::before {
  content: none !important;
  display: none !important;
}

.kp-subscription-plan-total-label,
.kp-subscription-plan-total-unit {
  color: var(--kp-text-color);
  opacity: 0.72;
}

.kp-subscription-plan-total-amount {
  color: var(--kp-text-color);
  opacity: 0.9;
  font-family: PPRadioGrotesk-Bold;
}

.kp-subscription-plan-actions {
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  justify-content: space-between;
  align-self: stretch;
  min-width: 72px;
  padding-top: 2px;
  gap: 0;
}

.kp-subscription-plan-save {
  margin-top: auto;
}

@media (max-width: 767px) {
  .kp-subscription-mode,
  .kp-subscription-composite,
  .kp-subscription-plan-card {
    padding: 14px;
  }

  .kp-subscription-mode {
    gap: 12px;
  }

  .kp-subscription-composite {
    padding: 0;
  }

  .kp-subscription-composite .kp-subscription-mode {
    padding: 14px;
  }

  .kp-subscription-composite.is-expanded .kp-subscription-mode {
    padding-bottom: 12px;
  }

  .kp-subscription-composite .kp-subscription-plan-panel {
    --kp-subscription-plan-panel-gap: 14px;
    padding: 0 14px 0;
  }

  .kp-subscription-composite.is-expanded .kp-subscription-plan-panel {
    padding-bottom: 14px;
  }

  .kp-subscription-mode .kp-subscription-mode-copy {
    flex-wrap: wrap;
  }

  .kp-subscription-prices {
    align-items: flex-end;
    flex-direction: column;
    gap: 4px;
  }

  .kp-subscription-plan-card {
    flex-direction: column;
  }

  .kp-subscription-plan-actions {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    align-self: auto;
    padding-top: 0;
  }

  .kp-subscription-plan-save {
    margin-top: 0;
  }
}

/* ---- >3 plans: native <select> (browser/OS dropdown) ---- *
 * The closed control is styled to match the design (white, rounded, custom
 * chevron); the open list is the native OS dropdown. */
.kp-subscription-plan-select {
  position: relative;
}

.kp-subscription-plan-native-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  margin: 0;
  padding: 16px 44px 16px 18px;
  border: 1px solid rgba(145, 23, 242, 0.2);
  border-radius: 12px;
  background: #fff;
  color: var(--kp-text-color);
  font-family: PPRadioGrotesk-Regular;
  font-size: 16px;
  line-height: 20px;
  cursor: pointer;
  text-overflow: ellipsis;
}

.kp-subscription-plan-native-select:focus {
  outline: none;
  border-color: var(--kp-button-color);
  box-shadow: 0 0 0 1px rgba(145, 23, 242, 0.12);
}

/* Custom chevron over the native control (the native arrow is hidden by
 * appearance:none); pointer-events:none so clicks still open the select. */
.kp-subscription-plan-select-caret {
  position: absolute;
  right: 18px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-60%) rotate(45deg);
  opacity: 0.45;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .kp-subscription-composite .kp-subscription-plan-panel {
    transition: none;
  }
}
