/*
 * Full-page checkout, standard variant (KRPL-454).
 *
 * Subscription carts are placed through the real WooCommerce checkout form, so the
 * full-page frame (topbar + shell from fullpage.css) wraps `[woocommerce_checkout]`
 * instead of the self-contained Krepling form. This layer lays that form out like
 * the regular full page: order review on the LEFT, the Krepling panel and
 * WooCommerce's Place order on the RIGHT.
 *
 * Nothing is moved out of the form (WooCommerce and Subscriptions read every field
 * on submit, and update_order_review swaps the review table and #payment in place):
 * the customer fields are only hidden — the Krepling panel fills them in — and
 * #order_review uses `display: contents` so its children become grid items.
 */

.kp-fullpage-std {
  --kp-fp-hair: oklch(0.92 0.006 285);
  --kp-fp-ink: oklch(0.18 0.01 285);
  --kp-fp-muted: oklch(0.55 0.012 285);
}

/* The self-contained full page gets border-box sizing from drawer.css, which this
 * variant doesn't load; without it the shell's and topbar's padding is added on top
 * of their 100% width and the page scrolls sideways on a phone. */
.kp-fullpage-standard .kp-fullpage-topbar-inner,
.kp-fullpage-std,
.kp-fullpage-std *,
.kp-fullpage-std *::before,
.kp-fullpage-std *::after {
  box-sizing: border-box;
}

.kp-fullpage-std .woocommerce {
  width: 100%;
}

@media (max-width: 600px) {
  .kp-fullpage-standard .kp-fullpage-topbar-inner {
    padding: 12px 16px;
  }

  .kp-fullpage-standard .kp-fullpage-brand-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }
}

/* ---- Two columns on the form itself ---- */
.kp-fullpage-std form.checkout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 550px;
  /* notices | customer fields (only when revealed) | review heading | review
   * table (takes the slack, so the tall payment card spanning rows 3-4 never
   * pulls the heading away from its table) */
  grid-template-rows: auto auto auto 1fr;
  column-gap: 48px;
  align-items: start;
  margin: 0;
}

.kp-fullpage-std form.checkout::before,
.kp-fullpage-std form.checkout::after {
  content: none;
  display: none;
}

/* Error notices WooCommerce prepends to the form on submit span both columns
 * (row 1; row 2 is for the customer fields when they have to be shown). */
.kp-fullpage-std form.checkout > .woocommerce-NoticeGroup,
.kp-fullpage-std form.checkout > .woocommerce-error,
.kp-fullpage-std form.checkout > .woocommerce-message,
.kp-fullpage-std form.checkout > .woocommerce-info {
  grid-column: 1 / -1;
  grid-row: 1;
  margin-bottom: 20px;
}

/* Customer fields stay in the form (submitted, validated) but are not shown:
 * the Krepling panel collects contact + address and syncs them in. */
.kp-fullpage-std #customer_details {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.kp-fullpage-std #order_review {
  display: contents;
}

/* ---- Left: order review card ---- */
.kp-fullpage-std #order_review_heading {
  grid-column: 1;
  grid-row: 3;
  margin: 0;
  padding: 22px 26px 6px;
  background: #ffffff;
  border: 1px solid var(--kp-fp-hair);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--kp-fp-ink);
}

.kp-fullpage-std .woocommerce-checkout-review-order-table {
  grid-column: 1;
  grid-row: 4;
  margin: 0 !important;
  background: #ffffff;
  border: 1px solid var(--kp-fp-hair) !important;
  border-top: 0 !important;
  border-radius: 0 0 16px 16px !important;
  border-collapse: separate !important;
  border-spacing: 0;
  overflow: hidden;
  font-size: 14px;
  box-shadow: 0 1px 2px 0 rgba(20, 19, 29, 0.04);
}

.kp-fullpage-std .woocommerce-checkout-review-order-table th,
.kp-fullpage-std .woocommerce-checkout-review-order-table td {
  padding: 10px 26px !important;
  border: 0 !important;
  border-top: 1px solid var(--kp-fp-hair) !important;
  background: transparent !important;
  vertical-align: top;
}

.kp-fullpage-std .woocommerce-checkout-review-order-table thead th {
  border-top: 0 !important;
  color: var(--kp-fp-muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kp-fullpage-std .woocommerce-checkout-review-order-table td:last-child,
.kp-fullpage-std .woocommerce-checkout-review-order-table th:last-child {
  text-align: right;
}

.kp-fullpage-std .woocommerce-checkout-review-order-table .order-total th,
.kp-fullpage-std .woocommerce-checkout-review-order-table .order-total td,
.kp-fullpage-std .woocommerce-checkout-review-order-table .recurring-total th,
.kp-fullpage-std .woocommerce-checkout-review-order-table .recurring-total td {
  font-weight: 600;
  color: var(--kp-fp-ink);
}

/* ---- Right: Krepling panel + Place order card ---- */
.kp-fullpage-std #payment {
  grid-column: 2;
  grid-row: 3 / span 2;
  margin: 0;
  padding: 0;
  background: #ffffff !important;
  border: 1px solid var(--kp-fp-hair);
  border-radius: 16px !important;
  box-shadow: 0 1px 2px 0 rgba(20, 19, 29, 0.04);
  overflow: hidden;
}

.kp-fullpage-std #payment ul.wc_payment_methods {
  margin: 0;
  padding: 0;
  border: 0;
  list-style: none;
}

.kp-fullpage-std #payment ul.wc_payment_methods > li {
  margin: 0;
  padding: 14px 26px;
  border-bottom: 1px solid var(--kp-fp-hair);
  list-style: none;
}

/* Krepling is the only gateway: no radio row, just the panel. */
.kp-fullpage-std #payment ul.wc_payment_methods > li.payment_method_krepling:only-child {
  padding: 0;
  border-bottom: 0;
}

.kp-fullpage-std #payment li.payment_method_krepling:only-child > input.input-radio,
.kp-fullpage-std #payment li.payment_method_krepling:only-child > label {
  display: none !important;
}

.kp-fullpage-std #payment .payment_box {
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
}

/* The classic panel is a fixed slide-in sheet by default (legacy index.css);
 * here it's an in-flow card body. */
.kp-fullpage-std .kp-legacy-checkout {
  position: static;
  inset: auto;
  width: 100%;
  max-width: none;
  height: auto;
  max-height: none;
  overflow: visible;
  box-shadow: none;
  z-index: auto;
  background: transparent;
}

.kp-fullpage-std .kp-legacy-checkout__shell {
  height: auto;
  min-height: 0;
  overflow: visible;
  padding: 28px 28px 8px;
  background: transparent;
}

/* Every layer of the sheet sizes to its content (the slide-in sheet pins heights
 * to the viewport, which left the footer hanging below the card). */
.kp-fullpage-std .kp-legacy-checkout,
.kp-fullpage-std .kp-legacy-checkout__shell,
.kp-fullpage-std .kp-legacy-checkout__view,
.kp-fullpage-std .kp-legacy-checkout__grid {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  flex: none !important;
}

/* Shown once on the page already: the store name + "Secured by" (topbar), the
 * order total and lines (order review on the left), the Krepling credit (topbar).
 * The note pointing at WooCommerce's Place order is redundant too: the button is
 * directly below, in the same card. */
.kp-fullpage-std .kp-legacy-checkout__header,
.kp-fullpage-std .kp-legacy-checkout__section--summary,
.kp-fullpage-std .krepling-powered-footer--legacy,
.kp-fullpage-std .kp-legacy-checkout__bridge-note {
  display: none !important;
}

.kp-fullpage-std .woocommerce-info,
.kp-fullpage-std .woocommerce-message,
.kp-fullpage-std .woocommerce-error {
  font-size: 14px;
  border-radius: 12px;
}

.kp-fullpage-std #payment .form-row.place-order {
  margin: 0;
  padding: 8px 28px 28px;
  background: transparent;
}

.kp-fullpage-std #payment .woocommerce-privacy-policy-text,
.kp-fullpage-std #payment .woocommerce-terms-and-conditions-wrapper {
  font-size: 12.5px;
  color: var(--kp-fp-muted);
}

.kp-fullpage-std #payment #place_order {
  float: none;
  width: 100%;
  min-height: 52px;
  margin-top: 12px;
  border: 0;
  border-radius: 12px;
  background: var(--kp-fp-btn, oklch(0.18 0.01 285));
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.kp-fullpage-std #payment #place_order:hover {
  filter: brightness(0.94);
}

.kp-fullpage-std #payment #place_order:disabled,
.kp-fullpage-std #payment #place_order.is-busy {
  opacity: 0.6;
  cursor: progress;
}

/* Coupon / returning-customer prompts above the form. */
.kp-fullpage-std .woocommerce-form-coupon-toggle,
.kp-fullpage-std .woocommerce-form-login-toggle {
  margin-bottom: 16px;
}

/* ---- Checkout Builder settings inside the panel ---- *
 * The self-contained full page gets these from drawer.css (scoped .kp-drawer),
 * which this variant doesn't load; same values, scoped to the standard variant. */

/* Fields & data collection: merchant section order (Contact / Delivery / Payment),
 * read from the --kp-order-* properties payment-shell.php sets on the panel. Same
 * scheme as the drawer: create banner pinned first, Contact before Email by default. */
/* `order` only works on flex/grid children; the legacy styles leave the column
 * a block (same fix as the drawer). gap 0: spacing comes from the sections. */
.kp-fullpage-std .kp-legacy-checkout__main {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.kp-fullpage-std [data-kp-checkout-tab="guest"] .kp-legacy-checkout__create-banner {
  order: -2;
}

.kp-fullpage-std [data-kp-checkout-tab="guest"] .kp-legacy-checkout__section--contact {
  order: var(--kp-order-contact, -1);
}

.kp-fullpage-std [data-kp-checkout-tab="guest"] .kp-legacy-checkout__section--address {
  order: var(--kp-order-delivery, 0);
}

.kp-fullpage-std [data-kp-checkout-tab="guest"] .kp-legacy-checkout__section--payment {
  order: var(--kp-order-payment, 1);
}

/* Nudges & widgets: one per line (the legacy styles lay the actions out in a row). */
.kp-fullpage-std .kp-legacy-checkout__actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  margin-top: 8px;
}

/* Nudges & widgets */
.kp-fullpage-std .kp-legacy-checkout__promo-banner {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 12px;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--kp-button-color);
  background: color-mix(in oklch, var(--kp-button-color) 14%, white);
}

.kp-fullpage-std .kp-legacy-checkout__nudge-line {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 10px;
  padding: 8px 11px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: color-mix(in oklch, var(--kp-button-color) 70%, black);
  background: color-mix(in oklch, var(--kp-button-color) 10%, white);
  border: 1px solid color-mix(in oklch, var(--kp-button-color) 22%, white);
}

.kp-fullpage-std .kp-legacy-checkout__urgency-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: oklch(0.55 0.15 55);
}

.kp-fullpage-std .kp-legacy-checkout__urgency-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: oklch(0.55 0.15 55);
  flex: none;
}

.kp-fullpage-std .kp-legacy-checkout__gift-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 0 2px;
  font-size: 13px;
  color: oklch(0.36 0.01 285);
  cursor: pointer;
}

.kp-fullpage-std .kp-legacy-checkout__gift-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--kp-button-color);
}

.kp-fullpage-std .kp-legacy-checkout__trust-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 12px 0 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--kp-fp-muted);
}

.kp-fullpage-std .kp-legacy-checkout__trust-badges span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Product suggestions */
.kp-fullpage-std .kp-legacy-checkout__suggestions {
  margin: 4px 0 16px;
}

.kp-fullpage-std .kp-legacy-checkout__suggestions-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: oklch(0.36 0.01 285);
}

.kp-fullpage-std .kp-legacy-checkout__suggestions-grid {
  display: flex;
  gap: 8px;
}

.kp-fullpage-std .kp-legacy-checkout__suggestion-card {
  flex: 0 1 132px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--kp-fp-hair);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
}

.kp-fullpage-std .kp-legacy-checkout__suggestion-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
}

.kp-fullpage-std .kp-legacy-checkout__suggestion-name {
  overflow: hidden;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.kp-fullpage-std .kp-legacy-checkout__suggestion-price {
  font-size: 11px;
  font-weight: 700;
  color: var(--kp-button-color);
}

/* Large product images (builder "Industry" style) in the order review. */
.kp-fullpage-std .kp-fp-std-thumb {
  display: block;
  margin: 0 0 8px;
}

.kp-fullpage-std .kp-fp-std-thumb img {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--kp-fp-hair);
}

/* WooCommerce rejected a field this page keeps hidden: show its own fields
 * (above both columns) so the shopper can fix it. */
.kp-fullpage-std-show-fields .kp-fullpage-std #customer_details {
  position: static !important;
  grid-column: 1 / -1;
  grid-row: 2;
  width: auto !important;
  height: auto !important;
  margin: 0 0 20px !important;
  padding: 22px 26px !important;
  overflow: visible !important;
  clip-path: none !important;
  white-space: normal !important;
  background: #ffffff;
  border: 1px solid var(--kp-fp-hair) !important;
  border-radius: 16px;
}

/* ---- Phone / tablet: one column, order review first ---- */
@media (max-width: 880px) {
  .kp-fullpage-std form.checkout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    row-gap: 0;
  }

  .kp-fullpage-std #order_review_heading,
  .kp-fullpage-std .woocommerce-checkout-review-order-table,
  .kp-fullpage-std #payment {
    grid-column: 1;
    grid-row: auto;
  }

  .kp-fullpage-std #payment {
    margin-top: 20px;
  }

  .kp-fullpage-std #order_review_heading {
    padding: 18px 18px 4px;
  }

  .kp-fullpage-std .woocommerce-checkout-review-order-table th,
  .kp-fullpage-std .woocommerce-checkout-review-order-table td {
    padding: 10px 18px !important;
  }

  .kp-fullpage-std .kp-legacy-checkout__shell {
    padding: 20px 20px 4px;
  }

  .kp-fullpage-std #payment .form-row.place-order {
    padding: 8px 20px 20px;
  }
}
