/* BGS Sales — Checkout Frontend Styles */

/* Reset body so the active theme's background doesn't bleed through. */
body.bgs-funnel-body {
  background: #f8fafc;
  color: #111827;
}

/* Shared navigation for funnel and store checkout templates. */
.bgs-checkout-back-link {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top));
  left: max(1rem, env(safe-area-inset-left));
  z-index: 9990;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem;
  border: 0;
  background: transparent;
  color: rgba(17, 24, 39, 0.5);
  font: 500 0.75rem/1 sans-serif;
  text-decoration: none;
  transition: color 0.15s, opacity 0.15s;
}

.bgs-checkout-back-link:hover,
.bgs-checkout-back-link:focus-visible {
  color: rgba(17, 24, 39, 0.85);
}

.bgs-checkout-back-link:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 2px;
}

.bgs-checkout-back-link svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bgs-checkout-back-link--below-preview {
  top: calc(max(1rem, env(safe-area-inset-top)) + 38px);
}

/* ── Wrap ──────────────────────────────────────────────────────────────────── */
.bgs-checkout-wrap {
  min-height: 100vh;
  background: #f8fafc;
}

.bgs-checkout-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1rem 4rem;
}

/* ── Header ────────────────────────────────────────────────────────────────── */
.bgs-checkout-header {
  padding: 1.5rem 0 1.25rem;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 2rem;
}

.bgs-checkout-header img {
  max-height: 40px;
  width: auto;
}

.bgs-checkout-header__site-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

/* Template 2 — dark header */
.bgs-checkout-wrap--checkout-2 .bgs-checkout-header--dark {
  background: #111827;
  padding: 1rem 1.5rem;
  margin-bottom: 2rem;
  border-bottom: none;
}

.bgs-checkout-wrap--checkout-2 .bgs-checkout-header--dark .bgs-checkout-header__site-name {
  color: #fff;
}

.bgs-checkout-header__tagline {
  font-size: 0.75rem;
  color: #9ca3af;
  margin: 0.25rem 0 0;
}

.bgs-checkout-wrap--checkout-2 .bgs-checkout-header--dark .bgs-checkout-header__tagline {
  color: #6b7280;
}

/* ── Express Pay ───────────────────────────────────────────────────────────── */
.bgs-express-pay {
  margin-bottom: 1.5rem;
}

.bgs-express-pay__buttons {
  min-height: 44px;
}

.bgs-express-pay__divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  color: #9ca3af;
  font-size: 0.8125rem;
}

.bgs-express-pay__divider::before,
.bgs-express-pay__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

/* ── Order Bump Strip ──────────────────────────────────────────────────────── */
.bgs-order-bump {
  border: 2px dashed #d97706;
  border-radius: 0.75rem;
  background: #fffbeb;
  margin: 1rem 0;
  overflow: hidden;
}

.bgs-order-bump__badge {
  background: #d97706;
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 3px 12px;
  text-align: center;
}

.bgs-order-bump__inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  cursor: pointer;
}

.bgs-order-bump__inner input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
  border: 2px solid #d97706;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: #d97706;
}

.bgs-order-bump__image {
  flex-shrink: 0;
}

.bgs-order-bump__img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 0.25rem;
  border: 1px solid #fde68a;
  display: block;
}

.bgs-order-bump__content {
  flex: 1;
  min-width: 0;
}

.bgs-order-bump__headline {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #92400e;
  line-height: 1.3;
}

.bgs-order-bump__product-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: #b45309;
  margin-top: 0.1rem;
}

.bgs-order-bump__description {
  margin-top: 0.2rem;
  font-size: 0.75rem;
  color: #78350f;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bgs-order-bump__price {
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.bgs-order-bump__price-original {
  font-size: 0.75rem;
  color: #9ca3af;
  text-decoration: line-through;
}

.bgs-order-bump__price-final {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #d97706;
}

.bgs-order-bump__price-save {
  font-size: 0.6875rem;
  font-weight: 700;
  background: #d97706;
  color: #fff;
  padding: 1px 5px;
  border-radius: 999px;
}

/* Loading state while toggling */
.bgs-order-bump--loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ── Thank You Page ─────────────────────────────────────────────────────────── */
.bgs-thankyou {
  text-align: center;
  padding: 2rem 1rem 3rem;
}

.bgs-thankyou__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #dcfce7;
  color: #16a34a;
  font-size: 2rem;
  font-weight: 700;
  margin: 0 auto 1.25rem;
}

.bgs-thankyou__title {
  font-size: 1.625rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 0.5rem;
}

.bgs-thankyou__subtitle {
  font-size: 0.9375rem;
  color: #6b7280;
  margin: 0 0 1.75rem;
}

.bgs-thankyou__meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: #e5e7eb;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  overflow: hidden;
  max-width: 480px;
  margin: 0 auto 2rem;
  text-align: left;
}

.bgs-thankyou__meta-item {
  background: #fff;
  padding: 0.875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.bgs-thankyou__meta-label {
  font-size: 0.75rem;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.bgs-thankyou__meta-value {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #111827;
}

.bgs-thankyou--invalid p {
  color: #6b7280;
  font-size: 0.9375rem;
}

.bgs-thankyou__coupon {
  background: #fefce8;
  border: 2px dashed #ca8a04;
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  max-width: 360px;
  margin: 0 auto 1.75rem;
}

.bgs-thankyou__coupon-label {
  font-size: 0.8125rem;
  color: #92400e;
  margin: 0 0 0.5rem;
}

.bgs-thankyou__coupon-code {
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #92400e;
  font-family: ui-monospace, monospace;
}

.bgs-thankyou__cta {
  display: inline-block;
  margin-top: 1.75rem;
  padding: 0.6875rem 1.75rem;
  background: #111827;
  color: #fff;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
}

.bgs-thankyou__cta:hover {
  background: #374151;
  color: #fff;
}

/* ── WooCommerce Checkout — Shared Base Reset ──────────────────────────────── */

/* Un-float WC's col2-set so templates can use their own layouts */
.bgs-funnel-body .woocommerce-checkout .col2-set { display: block; }
.bgs-funnel-body .woocommerce-checkout .col2-set .col-1,
.bgs-funnel-body .woocommerce-checkout .col2-set .col-2 { float: none; width: 100%; }

/* Billing/shipping field wrappers — 2-col inline grid */
.bgs-funnel-body .woocommerce-billing-fields__field-wrapper,
.bgs-funnel-body .woocommerce-shipping-fields__field-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 1rem;
}
.bgs-funnel-body .woocommerce-billing-fields__field-wrapper .form-row-wide,
.bgs-funnel-body .woocommerce-shipping-fields__field-wrapper .form-row-wide { grid-column: 1 / -1; }
.bgs-funnel-body .woocommerce-billing-fields__field-wrapper .form-row-first,
.bgs-funnel-body .woocommerce-shipping-fields__field-wrapper .form-row-first { grid-column: 1; }
.bgs-funnel-body .woocommerce-billing-fields__field-wrapper .form-row-last,
.bgs-funnel-body .woocommerce-shipping-fields__field-wrapper .form-row-last  { grid-column: 2; }

/* Form rows */
.bgs-funnel-body .woocommerce-checkout .form-row {
  float: none; width: 100%; clear: unset;
  margin: 0 0 0.875rem; padding: 0;
}
.bgs-funnel-body .woocommerce-checkout .form-row label:not(.checkbox) {
  display: block;
  font-size: 0.8125rem; font-weight: 600;
  color: #374151; margin-bottom: 0.375rem; line-height: 1.4;
}
.bgs-funnel-body .woocommerce-checkout .form-row .required {
  color: #ef4444; text-decoration: none;
}

/* All input / select / textarea */
.bgs-funnel-body .woocommerce-checkout input[type="text"],
.bgs-funnel-body .woocommerce-checkout input[type="email"],
.bgs-funnel-body .woocommerce-checkout input[type="tel"],
.bgs-funnel-body .woocommerce-checkout input[type="number"],
.bgs-funnel-body .woocommerce-checkout input[type="password"],
.bgs-funnel-body .woocommerce-checkout select,
.bgs-funnel-body .woocommerce-checkout textarea {
  display: block; width: 100%;
  padding: 0.6875rem 0.875rem;
  font-size: 0.9375rem; line-height: 1.5;
  color: #111827; background: #fff;
  border: 1.5px solid #d1d5db;
  border-radius: 0.5rem;
  outline: none; -webkit-appearance: none; appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
.bgs-funnel-body .woocommerce-checkout input:focus,
.bgs-funnel-body .woocommerce-checkout select:focus,
.bgs-funnel-body .woocommerce-checkout textarea:focus {
  border-color: #111827;
  box-shadow: 0 0 0 3px rgba(17,24,39,.08);
}
.bgs-funnel-body .woocommerce-checkout .form-row.woocommerce-invalid input,
.bgs-funnel-body .woocommerce-checkout .form-row.woocommerce-invalid select { border-color: #ef4444; }
.bgs-funnel-body .woocommerce-checkout .form-row.woocommerce-validated input,
.bgs-funnel-body .woocommerce-checkout .form-row.woocommerce-validated select { border-color: #22c55e; }

/* Section headings */
.bgs-funnel-body .woocommerce-billing-fields > h3,
.bgs-funnel-body .woocommerce-shipping-fields > h3,
.bgs-funnel-body .woocommerce-additional-fields > h3 {
  font-size: 0.9375rem; font-weight: 700;
  color: #111827; margin: 0 0 1.25rem;
  letter-spacing: -.01em;
}

/* Shipping toggle */
.bgs-funnel-body #ship-to-different-address label {
  display: flex; align-items: center; gap: .5rem;
  font-size: .9375rem; font-weight: 600; color: #374151; cursor: pointer; margin-bottom: 0;
}
.bgs-funnel-body #ship-to-different-address input[type="checkbox"] {
  width: 1.125rem; height: 1.125rem; accent-color: #111827; flex-shrink: 0;
}

/* Order review table */
.bgs-funnel-body .woocommerce-checkout-review-order-table {
  width: 100%; border-collapse: collapse; margin-bottom: 1.25rem;
}
.bgs-funnel-body .woocommerce-checkout-review-order-table th,
.bgs-funnel-body .woocommerce-checkout-review-order-table td {
  padding: .625rem 0; text-align: left; font-size: .9rem;
  color: #374151; border: none; border-bottom: 1px solid #f3f4f6;
}
.bgs-funnel-body .woocommerce-checkout-review-order-table thead th {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: #9ca3af;
}
.bgs-funnel-body .woocommerce-checkout-review-order-table .product-total { text-align: right; }
.bgs-funnel-body .woocommerce-checkout-review-order-table .order-total th,
.bgs-funnel-body .woocommerce-checkout-review-order-table .order-total td {
  font-weight: 700; font-size: 1.0625rem; color: #111827; border-bottom: none;
}
.bgs-funnel-body .woocommerce-checkout-review-order-table .cart-subtotal th,
.bgs-funnel-body .woocommerce-checkout-review-order-table .cart-subtotal td {
  color: #6b7280; font-size: .875rem; border-bottom: none;
}
.bgs-funnel-body .woocommerce-checkout-review-order-table .product-name img {
  width: 40px; height: 40px; object-fit: cover; border-radius: .375rem;
  display: inline-block; vertical-align: middle; margin-right: .5rem;
}

/* Payment section */
.bgs-funnel-body .woocommerce-checkout-payment { background: transparent; border: none; padding: 0; }
.bgs-funnel-body #payment ul.wc_payment_methods {
  list-style: none; margin: 0 0 1.25rem; padding: 0; border: none;
}
.bgs-funnel-body #payment .payment_methods li.payment_method {
  border: 1.5px solid #e5e7eb; border-radius: .625rem;
  margin-bottom: .5rem; overflow: hidden; transition: border-color .15s;
}
.bgs-funnel-body #payment .payment_methods li.payment_method label {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem; cursor: pointer;
  font-weight: 600; font-size: .9375rem; color: #111827;
}
.bgs-funnel-body #payment .payment_methods li.payment_method input[type="radio"] {
  width: 1rem; height: 1rem; accent-color: #111827; flex-shrink: 0;
}
.bgs-funnel-body #payment .payment_methods li.payment_method .payment_box {
  padding: .875rem 1rem; border-top: 1px solid #e5e7eb;
  background: #f9fafb; font-size: .875rem; color: #6b7280;
}

/* Place Order button — base (templates override colour/style) */
.bgs-funnel-body #place_order {
  display: block; width: 100%;
  padding: 1rem 1.5rem;
  background: #111827; color: #fff;
  border: none; border-radius: .625rem;
  font-size: 1.0625rem; font-weight: 700;
  cursor: pointer; letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
  transition: background .15s, transform .1s, box-shadow .15s;
}
.bgs-funnel-body #place_order:hover {
  background: #1f2937;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(17,24,39,.3);
}
.bgs-funnel-body #place_order:active { transform: translateY(0); }

/* WC notices */
.bgs-funnel-body .woocommerce-notices-wrapper .woocommerce-error,
.bgs-funnel-body .woocommerce-notices-wrapper .woocommerce-message,
.bgs-funnel-body .woocommerce-notices-wrapper .woocommerce-info {
  border-radius: .625rem; padding: .75rem 1rem;
  margin: 0 0 1rem; font-size: .9rem; border-left-width: 4px;
}
