/* nrbikepaypal — minimal storefront styling.
 * Most of the visual contract is inherited from .nrb-pay-info via nrbikecic
 * (same selectors, same dark/light theme tokens). The PayPal SDK injects
 * its own iframe-based buttons inside #nrbpp-buttons.
 */
#nrbpp-buttons {
  min-height: 44px;
}
#nrbpp-buttons > div + div {
  margin-top: 8px;
}
#nrbpp-spinner {
  font-family: inherit;
}

/* PayPal Pay-in-4 message banner — round the cross-origin iframe.
 * The iframe inside .nrbpp-message is rendered by paypal.com SDK and
 * its `style` API does not expose borderRadius. Wrapping in a clipping
 * container with border-radius + overflow:hidden gives us rounded
 * corners without touching their iframe content. The iframe paints a
 * solid background to its edges so clipping is purely visual — no text
 * or logo gets cut at 0.5rem (verified on cart sidebar 2026-05-09). */
.nrbpp-message {
  border-radius: 0.5rem;
  overflow: hidden;
}

/* === v6 custom-element sizing (Task 6) ===
   v5 styled .paypal-buttons (the iframe wrapper) ; v6 mounts a custom
   element whose iframe is in shadow DOM and not reachable from external
   CSS. Style hooks in v6 are CSS variables on the custom element. */

paypal-button, paypal-pay-later-button, paypal-credit-button {
  display: block;
  width: 100%;
  min-height: 44px;
  --paypal-button-border-radius: 4px;
}

.nrbpp-funding-slot + .nrbpp-funding-slot { margin-top: 8px; }
.nrbpp-funding-slot.nrbpp-funding-applepay,
.nrbpp-funding-slot.nrbpp-funding-googlepay { margin-top: 8px; }

apple-pay-button {
  --apple-pay-button-width: 100%;
  --apple-pay-button-height: 44px;
  --apple-pay-button-border-radius: 4px;
  display: block;
}

.nrbpp-card-form { margin-top: 12px; padding: 12px; border: 1px solid #d8d8d8; border-radius: 6px; background: #fafafa; }
.nrbpp-card-form__title { font-size: 0.85rem; font-weight: 600; margin-bottom: 8px; color: #333; }
/* PayPal v6 <paypal-hosted-card-field> renders its own iframe-internal
 * <input> with a visible UA-default border. Stacking our own 1px wrapper
 * border on top produced a visible double-border. Fix : let PayPal own
 * the field's visual chrome ; we just give the wrapper height + spacing
 * so the iframe has the right amount of room. */
.nrbpp-card-input { height: 36px; margin-bottom: 6px; }
.nrbpp-card-input paypal-hosted-card-field { display: block; height: 100%; }
.nrbpp-card-row { display: flex; gap: 6px; margin-bottom: 8px; }
.nrbpp-card-input--half { flex: 1; }
.nrbpp-card-submit { width: 100%; height: 44px; background: #003087; color: #fff; border: 0; border-radius: 4px; font-weight: 600; cursor: pointer; }
.nrbpp-card-submit:hover { background: #001f5f; }

/* Phase 3 : FastlaneCardComponent unified mount + watermarks. The
 * component renders the entire 3-fields + cardholder-name + opt-in
 * checkbox stack as one Web Component, so the wrapper only needs
 * spacing + a mount slot. */
.nrbpp-card-form--fastlane .nrbpp-card-mount { min-height: 200px; margin-bottom: 8px; }
.nrbpp-card-form--fastlane .nrbpp-card-watermark { margin: 8px 0 12px; font-size: 0.75rem; }
.nrbpp-card-form--fastlane .nrbpp-card-watermark > * { display: inline-block; }

/* Watermark inside recognized-buyer banner (step 1) */
.nrbpp-fl-banner__watermark { margin-top: 4px; font-size: 0.75rem; opacity: 0.85; }
.nrbpp-fl-banner__watermark > * { display: inline-block; }

/* Watermark next to email field (step 1, default state) */
.nrbpp-fl-email-watermark { margin-top: 6px; font-size: 0.75rem; opacity: 0.85; line-height: 1; }
.nrbpp-fl-email-watermark > * { display: inline-block; }

/* Express buttons on the full cart page : PayPal (front.js) + Google Pay
   (cart-drawer-mount.js, appended). Stack them full-width with an even gap so
   they read as one express cluster. */
#nrbpp-express-buttons { display: flex; flex-direction: column; gap: 8px; }
#nrbpp-express-buttons paypal-button { min-height: 48px; }
/* Google Pay slot — fill the rail width + height-match the PayPal button. The
   GPay button is mounted with buttonSizeMode:'fill', so it expands to the slot.
   Override Google Pay's hard-coded 240px min-width so it never overflows the
   ~322px-wide cart summary. */
#nrbpp-express-buttons .nrbpp-funding-googlepay { width: 100%; min-height: 48px; }
#nrbpp-express-buttons .nrbpp-funding-googlepay > *,
#nrbpp-express-buttons .gpay-card-info-container-fill,
#nrbpp-express-buttons .gpay-card-info-container,
#nrbpp-express-buttons .gpay-card-info-iframe {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 100% !important;
  min-height: 48px;
}

/* Pay-Later message wrapper — display:block ensures it stretches full width */
.nrbpp-message { display: block; max-width: 100%; }

/* === Hook-output styles (extracted from inline ; Task 7) === */

.nrb-pay-info { margin: 6px 0 0; }
.nrb-pay-info__brands {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 4px;
  flex-wrap: wrap;
}
.nrb-pay-info__brand-logo { height: 24px; width: auto; }
.nrb-pay-info__secured {
  display: inline-flex;
  align-items: center;
  height: 24px;
  gap: 4px;
  color: #666;
  font-size: 0.78rem;
  margin-left: 4px;
}
.nrb-pay-info__secured svg { width: 12px; height: 12px; fill: currentColor; }
.nrb-pay-info__subtitle {
  font-size: 0.85rem;
  color: #555;
  margin-top: 4px;
}
.nrb-pay-info__test-mode {
  margin-top: 8px;
  margin-bottom: 12px;  /* Breathing room between the disclaimer chip and the
                          payment button(s) below — without this, the amber
                          chip sits flush against the gold "Payer avec PayPal"
                          button which reads as "test-mode is part of the
                          button" rather than "test-mode applies to this
                          section". */
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(212,169,72,0.12);
  border-left: 3px solid #d4a948;
  font-size: 0.78rem;
  color: #7a5f1f;
}
.nrb-pay-info__test-mode--demo {
  background: rgba(0,170,85,0.12);
  border-left-color: #00aa55;
  color: #1a5934;
}
#nrbpp-buttons { margin-top: 10px; }

/* .nrbpp-express is hidden until front.js mounts the paypal-button
   inside it (mountExpress() sets the --ready class). Without this, the
   "ou achetez en express" divider would render server-side and sit
   visible alone for ~1 s while the v6 SDK boots (clientToken fetch +
   createInstance + components download + findEligibleMethods).
   If eligibility skips us, the wrapper stays hidden and the cart simply
   has no express option — correct UX vs an orphan divider. */
.nrbpp-express { display: none; margin-top: 12px; }
.nrbpp-express.nrbpp-express--ready { display: block; }
.nrbpp-express__divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  color: #888;
  font-size: 0.78rem;
}
.nrbpp-express__divider-line {
  flex: 1;
  height: 1px;
  background: #e0e0e0;
}
.nrbpp-express__divider-text { /* no layout properties needed — flex child, natural size */ }

/* Fastlane recognition banner — rendered above the step-1 form when a
   buyer's email is recognised by PayPal Fastlane's cross-merchant network.
   Stays empty (no visual presence) until fastlane.js mounts the banner. */
#nrbpp-fastlane-recognition { margin: 0 0 16px; }
#nrbpp-fastlane-recognition:empty { display: none; }
.nrbpp-fl-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #f5f0fb;
  border: 1px solid #d6c5ec;
  color: #3b256d;
  font-size: 0.95rem;
}
.nrbpp-fl-banner__icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  color: #6e3ec0;
}
.nrbpp-fl-banner__text { flex: 1 1 auto; line-height: 1.35; }
.nrbpp-fl-banner__text strong { color: #3b256d; }
.nrbpp-fl-banner__btn {
  flex: 0 0 auto;
  background: #6e3ec0;
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
}
.nrbpp-fl-banner__btn:hover { background: #5a2fa6; }
.nrbpp-fl-banner__btn:disabled { background: #9787b8; cursor: progress; }
@media (max-width: 480px) {
  .nrbpp-fl-banner { flex-wrap: wrap; gap: 8px; }
  .nrbpp-fl-banner__btn { width: 100%; padding: 10px; }
}

/* === Item #3 — Fastlane confirm button at step 4 === */

/* Slot wrapper — top margin only if standard buttons follow */
.nrbpp-fastlane-confirm-slot { margin-bottom: 10px; }

/* The "Confirmer le paiement Fastlane" primary button */
.nrbpp-fastlane-confirm {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 48px;
  background: #6e3ec0;
  color: #fff;
  border: 0;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.nrbpp-fastlane-confirm:hover:not(:disabled) { background: #5a2fa6; }
.nrbpp-fastlane-confirm:disabled { background: #9787b8; cursor: progress; }
.nrbpp-fastlane-confirm__icon { flex: 0 0 auto; }

/* Separator between the Fastlane button and the standard PayPal buttons */
.nrbpp-fastlane-confirm-sep {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
  color: #888;
  font-size: 0.78rem;
}
.nrbpp-fastlane-confirm-sep::before,
.nrbpp-fastlane-confirm-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e0e0e0;
}

/* Dark mode. The nrbike_racing theme signals dark by the ABSENCE of a
   [data-theme] attribute on <html> (light = html[data-theme="light"]); it never
   sets Bootstrap's [data-bs-theme], so the previous html[data-bs-theme="dark"]
   selector was inert and these dark tones never applied. Use the theme's
   canonical dark selector. These nrbpp- classes are unique + unlayered with no
   competing neutral rule, so the light base stays untouched (safe default). */
html:not([data-theme="light"]):not(.nrbike-light) .nrbpp-fastlane-confirm { background: #7e4ed0; }
html:not([data-theme="light"]):not(.nrbike-light) .nrbpp-fastlane-confirm:hover:not(:disabled) { background: #6e3ec0; }
html:not([data-theme="light"]):not(.nrbike-light) .nrbpp-fastlane-confirm-sep { color: #999; }
html:not([data-theme="light"]):not(.nrbike-light) .nrbpp-fastlane-confirm-sep::before,
html:not([data-theme="light"]):not(.nrbike-light) .nrbpp-fastlane-confirm-sep::after { background: #444; }

/* === Item #4 — Fastlane token-expiry notice === */

.nrbpp-fl-expired-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #fff8e1;
  border: 1px solid #f9a825;
  color: #5d4037;
  font-size: 0.9rem;
  margin-bottom: 12px;
}
.nrbpp-fl-expired-notice__icon { flex: 0 0 auto; margin-top: 1px; color: #f9a825; }
.nrbpp-fl-expired-notice__text { flex: 1 1 auto; line-height: 1.4; }
.nrbpp-fl-expired-notice__btn {
  flex: 0 0 auto;
  background: #f9a825;
  color: #3e2723;
  border: 0;
  border-radius: 6px;
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
}
.nrbpp-fl-expired-notice__btn:hover { background: #f57f17; }
@media (max-width: 480px) {
  .nrbpp-fl-expired-notice { flex-wrap: wrap; }
  .nrbpp-fl-expired-notice__btn { width: 100%; padding: 10px; }
}
html:not([data-theme="light"]):not(.nrbike-light) .nrbpp-fl-expired-notice {
  background: rgba(249,168,37,.1);
  border-color: #f9a825;
  color: #ffe082;
}
html:not([data-theme="light"]):not(.nrbike-light) .nrbpp-fl-expired-notice__icon { color: #f9a825; }
html:not([data-theme="light"]):not(.nrbike-light) .nrbpp-fl-expired-notice__btn { background: #f9a825; color: #212121; }

/* === Item #5 — Fastlane "Modifier l'adresse" link at step 4 === */

#nrbpp-fl-address-mount { margin-top: 8px; margin-bottom: 4px; }
#nrbpp-fl-address-mount:empty { display: none; }

.nrbpp-fl-change-address {
  background: none;
  border: 0;
  padding: 0;
  color: #6e3ec0;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.nrbpp-fl-change-address:hover:not(:disabled) { color: #5a2fa6; }
.nrbpp-fl-change-address:disabled { color: #9787b8; cursor: progress; text-decoration: none; }
html:not([data-theme="light"]):not(.nrbike-light) .nrbpp-fl-change-address { color: #b388ff; }
html:not([data-theme="light"]):not(.nrbike-light) .nrbpp-fl-change-address:hover:not(:disabled) { color: #d0aaff; }
