/* ========================================
   DONATION TEMPLATE STYLES
   Template-specific styles for donation pages
======================================== */

.donation-header {
  text-align: center;
  margin-bottom: 2rem;
}

.donation-header h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: #1a2a3a;
}

.donation-intro {
  text-align: left;
  padding: 0 1rem;
}

.donation-intro p {
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

/* Featured image: floated to the right of body copy on desktop,
   centred above the body copy on mobile. */
.donation-featured-image {
  float: right;
  width: 100%;
  /* Per-page override: set --ctf-featured-image-max-width inline on the
     <figure> from the editor's "Featured Image Max Width" ACF field.
     Defaults to 350px when not set. Mobile rule below ignores this. */
  max-width: var(--ctf-featured-image-max-width, 350px);
  margin: 0 0 1rem 1.5rem;
}

.donation-featured-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* Clear the float so the .donation-options block below starts on its own line
   even when the body copy is shorter than the image. */
.donation-intro.has-featured-image::after {
  content: "";
  display: block;
  clear: both;
}

/* Donation Options */
.donation-options {
  text-align: left;
  margin: 2rem 0;
}

.monthly-prompt {
  margin: 1rem 0 0;
  display: flex;
  align-items: flex-start;
  padding-left: 10%;
}

.monthly-prompt p {
  margin: -10px 0 -5px 0;
  font-size: 0.9rem;
  line-height: 1.4;
  color: #1a2a3a;
  max-width: 700px;
  text-align: left;
}

.toggle-wrapper {
  position: relative;
  display: inline-block;
  margin-top: 1rem;
}

.prompt-arrow {
  flex-shrink: 0;
  width: 39px;
  height: 30px;
  margin: -15px 0.5rem 0 0;
  background-image: url('https://www.taxpayer.com/media/black_arrow_25.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  font-size: 0;
}

.donation-frequency-toggle {
  position: relative;
  display: inline-flex;
  background: #f8fafb;
  border: 2px solid #e1e8ed;
  border-radius: 50px;
  padding: 4px;
}

.donation-frequency-toggle input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: #dd230f;
  border-radius: 50px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
}

.donation-frequency-toggle input[type="radio"]:checked#frequency-once ~ .toggle-slider {
  transform: translateX(calc(100% + 4px));
}

.toggle-label {
  position: relative;
  z-index: 2;
  padding: 0.75rem 2rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1a2a3a;
  cursor: pointer;
  transition: color 0.3s ease;
  user-select: none;
  text-align: center;
  min-width: 150px;
}

.donation-frequency-toggle input[type="radio"]:checked + input + .toggle-slider + .toggle-label,
.donation-frequency-toggle input[type="radio"]:checked ~ .toggle-label:last-of-type {
  color: #fff;
}

.frequency-description {
  margin-top: 1rem;
}

.description {
  display: none;
  font-style: italic;
  color: #6c757d;
}

.description.active {
  display: block;
}

/* Amount Selection */
.amount-section {
  margin: 2rem 0;
}

.amount-section h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: #1a2a3a;
}

.amount-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.amount-option {
  display: block;
  position: relative;
  cursor: pointer;
  min-width: 0;
}

.amount-option.amount-featured {
  position: relative;
}

.amount-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: #dd230f;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 12px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(221, 35, 15, 0.3);
  z-index: 10;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.amount-option input[type="radio"] {
  position: absolute;
  opacity: 0;
}

.amount-display {
  display: block;
  background: #f8fafb;
  border: 2px solid #e1e8ed;
  padding: 0.75rem;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: #1a2a3a;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.amount-option:hover .amount-display {
  background: #ffe5e5 !important;
  border-color: #dd230f !important;
}

.amount-option.amount-featured .amount-display {
  border-color: #dd230f;
  border-width: 2px;
  transition: border-color 0.3s ease;
}

.amount-option input[type="radio"]:checked + .amount-display {
  background: #dd230f !important;
  border-color: #dd230f !important;
  color: #fff !important;
}

.amount-option:has(input[type="radio"]:checked) .amount-badge {
  box-shadow: 0 0 2px 1px rgba(255, 255, 255, 0.7), 0 2px 6px rgba(0, 0, 0, 0.25);
}

.amount-option small {
  display: block;
  font-size: 0.8rem;
  margin-top: 0.5rem;
  color: #6c757d;
  font-weight: normal;
}

.amount-option input[type="radio"]:checked + .amount-display + small,
.amount-option input[type="radio"]:checked ~ small {
  color: #fff;
}

.custom-amount {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-width: 0;
  width: 100%;
}

.custom-amount .amount-display {
  flex: 1;
  padding: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #e1e8ed;
  border-radius: 8px 0 0 8px;
  border-right: none;
  background: #f8fafb;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-size: 1.1rem;
  font-weight: 600;
  color: #1a2a3a;
}

.custom-amount:hover .amount-display {
  background: #ffe5e5;
  border-color: #dd230f;
}

.custom-amount.selected .amount-display,
.custom-amount:has(input[type="radio"]:checked) .amount-display {
  background: #dd230f;
  border-color: #dd230f;
  color: #fff;
}

.custom-amount input[type="number"] {
  flex: 1;
  min-width: 0;
  padding: 0.75rem;
  border: 2px solid #e1e8ed;
  border-radius: 0 8px 8px 0;
  font-size: 1.1rem;
  font-weight: 800;
  color: #1a2a3a;
  background: #f8fafb;
  transition: all 0.2s ease;
  text-align: center;
  height: auto;
  -moz-appearance: textfield;
}

.custom-amount input[type="number"]::-webkit-outer-spin-button,
.custom-amount input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.custom-amount:hover input[type="number"] {
  background: #ffe5e5;
  border-color: #dd230f;
}

.custom-amount input[type="number"]:focus {
  outline: none;
}

.custom-amount input[type="number"]:focus-visible {
  border-color: #dd230f;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(221, 35, 15, 0.2);
}

.donation-info-text {
  margin-top: 1rem;
  text-align: left;
}

.donation-info-text p {
  margin: 0.25rem 0;
  font-size: 0.85rem;
  line-height: 1.4;
}

.magazine-note {
  color: #dd230f;
  font-weight: 600;
}

.tax-note {
  color: #6c757d;
  font-style: italic;
}

/* Toggle magazine text based on frequency */
.monthly-mag-text,
.onetime-mag-text {
  display: none;
}

body.frequency-monthly .monthly-mag-text {
  display: inline;
}

body.frequency-once .onetime-mag-text {
  display: inline;
}

/* Default to one-time text if no body class set */
body:not(.frequency-monthly):not(.frequency-once) .onetime-mag-text {
  display: inline;
}

.donation-note {
  background: #ffe5e5;
  border-left: 4px solid #dd230f;
  padding: 1rem;
  margin-top: 1.5rem;
}

.donation-note p {
  margin: 0.5rem 0;
}

/* Form Sections */
.donor-info-section,
.payment-section {
  margin: 2rem 0;
}

.donor-info-section h3,
.payment-section h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: #1a2a3a;
}

.payment-section {
  position: relative;
  background: #f8fafb;
  padding: 2rem;
  border-radius: 8px;
  border: 1px solid #e1e8ed;
}

/* Donate Button */
.donate-button {
  width: 100%;
  margin-top: 1.5rem;
  font-size: 1.25rem;
  padding: 1rem 2rem;
  border-radius: 8px;
}

/* Other Options */
.other-options {
  margin: 3rem 0 2rem 0;
  padding-top: 2rem;
  border-top: 2px solid #e1e8ed;
}

.other-options h3 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: #1a2a3a;
}

.option-list p {
  margin-bottom: 1rem;
  line-height: 1.6;
}

.contact-info {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #e1e8ed;
  text-align: center;
  color: #6c757d;
}

.contact-info a {
  color: #1a8cff;
}

@media (max-width: 768px) {
  .donation-featured-image {
    float: none;
    margin: 0 auto 1.5rem;
    max-width: 100%;
    text-align: center;
  }

  .donation-featured-image img {
    margin: 0 auto;
    max-width: 400px;
  }

  .donation-header h1 {
    font-size: 1.75rem;
  }

  .donation-frequency {
    flex-direction: column;
    align-items: center;
  }

  .frequency-btn {
    width: 100%;
    max-width: 300px;
  }

  .amount-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .payment-section {
    padding: 1rem;
  }

  .express-payment-buttons {
    flex-direction: column;
    gap: 12px;
  }

  .wallet-row-buttons {
    flex-direction: column;
    gap: 12px;
  }

  .express-checkout-container {
    flex: none;
    width: 100%;
    min-width: 0;
  }

  #express-checkout-element {
    width: 100%;
  }

  .paypal-button-container {
    flex: none;
    width: 100%;
    min-width: 0;
  }
}

/* ========================================
   ENHANCED FUNCTIONALITY STYLES
   Additional styles for improved form feedback
======================================== */

/* Button States */
.donate-button:disabled,
.donate-button.btn-disabled {
  background-color: #6c757d;
  border-color: #6c757d;
  opacity: 0.65;
  cursor: not-allowed;
}

/* Browser autofill detection for PostHog (see tracking.js). */
@keyframes ctf-donation-autofill-start {
  from { opacity: 1; }
  to { opacity: 1; }
}

.donation-form input:-webkit-autofill {
  animation-name: ctf-donation-autofill-start;
  animation-duration: 0.01s;
}

.donate-button:not(:disabled):not(.btn-disabled):hover {
  background-color: #c41e0b;
  border-color: #b01a09;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(221, 35, 15, 0.3);
}

/* Loading States */
.processing {
  position: relative;
  pointer-events: none;
}

.processing::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -8px 0 0 -8px;
  width: 16px;
  height: 16px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

/* Amount Selection Enhancement - REMOVED (incorrect selectors) */

/* Custom Amount Input Focus */
.amount-other input:focus {
  border-color: #dd230f;
  box-shadow: 0 0 0 0.2rem rgba(221, 35, 15, 0.25);
}

/* Toggle hover effect */
.toggle-label:hover {
  opacity: 0.8;
}

@media (max-width: 480px) {
  .amount-grid {
    grid-template-columns: 1fr;
  }

  .donation-intro p {
    font-size: 1rem;
  }

  .toggle-label {
    min-width: 120px;
    padding: 0.65rem 1.5rem;
    font-size: 0.85rem;
  }

  .amount-badge {
    font-size: 0.65rem;
    padding: 3px 8px;
    top: -10px;
  }

  .monthly-prompt {
    padding-left: 5%;
  }

  .monthly-prompt p {
    max-width: 100%;
    font-size: 0.85rem;
  }
}

/* Smooth Transitions */
.amount-option label,
.frequency-btn,
.donate-button {
  transition: all 0.2s ease-in-out;
}

/* Success State for Donation Button */
.donate-button.success {
  background-color: #28a745;
  border-color: #28a745;
}

/* Lock Icon — default template: floated above wallet row */
.payment-section > .card-lock-icon {
  float: right;
  width: 36px;
  height: 36px;
  margin: 0 0 0.5rem 0.5rem;
  content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath fill='%23fbcf95' d='M144 144v48H304V144c0-44.2-35.8-80-80-80s-80 35.8-80 80zM80 192V144C80 64.5 144.5 0 224 0s144 64.5 144 144v48h16c35.3 0 64 28.7 64 64V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V256c0-35.3 28.7-64 64-64H80z'/%3E%3C/svg%3E");
}

/* Lock Icon — express-inline: beside card field */
.card-lock-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath fill='%23fbcf95' d='M144 144v48H304V144c0-44.2-35.8-80-80-80s-80 35.8-80 80zM80 192V144C80 64.5 144.5 0 224 0s144 64.5 144 144v48h16c35.3 0 64 28.7 64 64V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V256c0-35.3 28.7-64 64-64H80z'/%3E%3C/svg%3E");
}

.card-element-row__main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.card-element-row__main .stripe-card-element,
.card-element-row__main .stripe-payment-element {
  flex: 1 1 auto;
  min-width: 0;
  margin-bottom: 1rem;
}

.card-element-row__main .card-lock-icon {
  margin: 0 0 1rem;
}

/* Mobile Enhancements */
/* ========================================
 * Stripe Elements Styling
 * ======================================== */

/* Express Payment Buttons Container - match Stripe's tight spacing (4px gap) */
.express-payment-buttons {
  display: flex;
  gap: 7.5px;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.wallet-row-feedback {
  flex-wrap: wrap;
  position: relative;
}

.wallet-row-buttons {
  position: relative;
  display: flex;
  gap: 7.5px;
  align-items: flex-start;
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
}

/* Monthly-only pages (and monthly toggle): wallet row is Apple/Google/Link only */
.express-payment-buttons--no-paypal .express-checkout-container {
  flex: 1 1 100%;
  width: 100%;
}

/* PayPal container uses display:flex below, which overrides the [hidden]
 * attribute in WebKit/mobile. Force-hide when the container is explicitly
 * hidden or the wallet row is marked PayPal-free (JS drives both). PayPal now
 * supports monthly (Subscriptions), so frequency no longer hides it — the
 * frequency-monthly selector was removed. */
.paypal-button-container[hidden],
.express-payment-buttons--no-paypal .paypal-button-container {
  display: none !important;
}

.paypal-wallet-block[hidden] {
  display: none !important;
}

/* PayPal on #4 (pe-wallets): vertical layout + disableMaxWidth (set in PHP)
 * lets the white PayPal button span the full form width at 48px tall. */
.donation-template--pe-wallets .paypal-wallet-block[hidden] {
  display: none;
}

.donation-template--pe-wallets .paypal-top {
  width: 100%;
  min-height: 48px;
  margin: 0 0 1rem;
}

.donation-template--pe-wallets .paypal-top .paypal-button-container {
  flex: none;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 48px;
  min-height: 48px;
  max-height: 48px;
  overflow: hidden;
}

.donation-template--pe-wallets .paypal-top .paypal-button-container > div,
.donation-template--pe-wallets .paypal-top .paypal-button-container > div > div,
.donation-template--pe-wallets .paypal-top .paypal-button-container div[data-funding-source] {
  width: 100% !important;
  max-width: 100% !important;
}

.donation-template--pe-wallets .paypal-top .paypal-button-container iframe {
  width: 100% !important;
  max-width: 100% !important;
  height: 48px !important;
  min-height: 48px !important;
  max-height: 48px !important;
}

/* Express Checkout failed — PayPal expands to full wallet row width */
.express-payment-buttons--no-stripe .express-checkout-container {
  display: none;
}

.express-payment-buttons--no-stripe .paypal-button-container {
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
}

/* "Or pay with credit card" label between wallet buttons and the card field.
 * Uses Inter (variable font, loaded from Google Fonts in content-donation.php)
 * so we can pick a continuous weight between 500 and 600. Falls back to the
 * site's normal stack if Inter fails to load. */
.payment-divider {
  margin: 0 0 1rem;
  color: #6b7280;
  font-size: 14px;
  font-weight: 650;
  font-family: "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
}

/*
 * Inline Payment Element layouts (#3 pe-express WITH Express Checkout,
 * #4 pe-wallets WITHOUT): Link email + Payment Element (card / native
 * Apple-Google Pay) as the primary path, with PayPal as a secondary
 * option below the Donate button — all in one shaded box.
 */
.donation-template--pe-wallets .pe-wallets-inline-flow .payment-section--pe-wallets-inline .stripe-link-authentication-element,
.donation-template--pe-express .pe-wallets-inline-flow .payment-section--pe-wallets-inline .stripe-link-authentication-element {
  width: 100%;
  margin: 0 0 1rem;
}

.donation-template--pe-wallets .pe-wallets-inline-flow .payment-section--pe-wallets-inline .stripe-payment-element,
.donation-template--pe-express .pe-wallets-inline-flow .payment-section--pe-wallets-inline .stripe-payment-element {
  width: 100%;
  margin: 0 0 0.75rem;
}

.donation-template--pe-wallets .payment-divider--express-inline,
.donation-template--pe-express .payment-divider--express-inline,
.donation-template--express-inline .payment-divider--express-inline {
  margin: 1.25rem 0 1rem;
}

/* #2 express-inline: white payment box when active; greyed/disabled until amount selected. */
.donation-template--express-inline .express-inline-payment-flow .payment-section {
  background: #ffffff;
}

.donation-template--express-inline .express-inline-payment-flow .payment-section.is-awaiting-amount {
  background: #f8fafb;
  pointer-events: none;
  user-select: none;
}

.donation-template--express-inline .express-inline-payment-flow .payment-section.is-awaiting-amount > *:not(.payment-section-overlay) {
  opacity: 0.55;
}

.donation-template--pe-wallets .pe-wallets-inline-flow .payment-section--pe-wallets-inline.is-awaiting-amount,
.donation-template--pe-express .pe-wallets-inline-flow .payment-section--pe-wallets-inline.is-awaiting-amount {
  background: #f8fafb;
  pointer-events: none;
  user-select: none;
}

.donation-template--pe-wallets .pe-wallets-inline-flow .payment-section--pe-wallets-inline.is-awaiting-amount > *:not(.payment-section-overlay),
.donation-template--pe-express .pe-wallets-inline-flow .payment-section--pe-wallets-inline.is-awaiting-amount > *:not(.payment-section-overlay) {
  opacity: 0.55;
}

/*
 * Generic "OR" divider (Payment Element page without Express Checkout). A bare
 * "OR" reads better flanked by hairlines than as a lone centered word.
 */
.payment-divider--or {
  display: flex;
  align-items: center;
  gap: 12px;
}

.payment-divider--or::before,
.payment-divider--or::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: #e1e8ed;
}

/*
 * OR divider above the card / PE block on #4 (pe-wallets), below PayPal.
 * Matches the default template .payment-divider grey (#6b7280).
 */
.payment-divider--secondary {
  margin: 1.25rem 0 1rem;
}

.payment-divider--secondary::before,
.payment-divider--secondary::after {
  height: 1px;
  background: #e1e8ed;
}

/*
 * Single understated trust line under the payment controls. Replaces the
 * old floating amber padlock that sat beside PayPal and read as a broken
 * glyph; one centered lock + label is calmer and more credible.
 */
.payment-trust-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0.85rem 0 0;
  color: #6b7280;
  font-size: 12.5px;
  line-height: 1.4;
}

.payment-trust-line__lock {
  display: inline-block;
  width: 12px;
  height: 12px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath fill='%236b7280' d='M144 144v48H304V144c0-44.2-35.8-80-80-80s-80 35.8-80 80zM80 192V144C80 64.5 144.5 0 224 0s144 64.5 144 144v48h16c35.3 0 64 28.7 64 64V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V256c0-35.3 28.7-64 64-64H80z'/%3E%3C/svg%3E");
}

.donation-template--card-first .express-payment-buttons--card-first-wallets {
  margin-top: 0;
  margin-bottom: 0;
}

.donation-template--card-first .wallet-checkout-section.wallet-feedback-host > .express-checkout-hint {
  margin-bottom: 0.75rem;
}

.donation-template--card-first .wallet-checkout-options .express-payment-buttons {
  margin-bottom: 0;
}

/*
 * Card-first: full-width Pay with card on top, Link + PayPal below.
 * Reuses the wallet-first reveal panel for donor fields + card element.
 */
.donation-template--card-first {
  --wallet-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --wallet-transition-ms: 620ms;
}

.donation-template--card-first .wallet-first-payment-flow {
  width: 100%;
  max-width: none;
}

.donation-template--card-first .wallet-checkout-section {
  margin-top: 0.75rem;
  padding: 0;
  overflow: hidden;
  max-height: 420px;
  opacity: 1;
  transform: translateY(0) scale(1);
  transform-origin: top center;
  transition:
    opacity 0.55s var(--wallet-ease),
    transform 0.55s var(--wallet-ease),
    max-height 0.62s var(--wallet-ease),
    margin 0.62s var(--wallet-ease);
}

.donation-template--card-first .wallet-first-payment-flow.is-card-mode:not(.is-card-mode--instant) .wallet-checkout-section {
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px) scale(0.985);
  margin-top: 0;
  pointer-events: none;
}

.donation-template--card-first .wallet-first-payment-flow.is-card-mode--instant .wallet-checkout-section {
  display: none;
}

.donation-template--card-first .wallet-checkout-section.payment-section {
  background: transparent;
  border: none;
  padding: 0;
  margin-top: 0.75rem;
}

.donation-template--card-first .wallet-checkout-section .payment-section-overlay {
  border-radius: 0;
}

.donation-template--card-first .wallet-first-card-row {
  display: block;
  width: 100%;
  margin: 0 0 0.75rem;
}

/* Full-width prominent card CTA — mirrors wallet-first button polish */
.donation-template--card-first .wallet-first-card-btn,
.donation-template--card-first .wallet-first-card-btn--prominent {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  min-height: 52px;
  height: 52px;
  margin: 0;
  padding: 0 14px;
  background: #f1f4f7;
  border: 1.5px solid #c8d0da;
  border-radius: 4px;
  color: #1a2a3a;
  font-size: 15px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.donation-template--card-first .wallet-first-card-btn:hover:not(:disabled),
.donation-template--card-first .wallet-first-card-btn--prominent:hover:not(:disabled),
.donation-template--card-first .wallet-first-card-btn:focus-visible:not(:disabled),
.donation-template--card-first .wallet-first-card-btn--prominent:focus-visible:not(:disabled) {
  background: #e9edf2;
  border-color: #8898aa;
  outline: none;
}

.donation-template--card-first .wallet-first-card-btn:disabled,
.donation-template--card-first .wallet-first-card-btn--prominent:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  background: #f1f4f7;
}

.donation-template--card-first .wallet-first-card-btn__icon {
  display: inline-flex;
  flex-shrink: 0;
  color: #1a2a3a;
}

.donation-template--card-first .wallet-first-card-btn__label {
  white-space: nowrap;
}

.donation-template--card-first .wallet-first-card-btn--active {
  background: #f7f9fc;
  border-color: #1a2a3a;
  box-shadow: inset 0 0 0 1px #1a2a3a;
}

.donation-template--card-first .wallet-first-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 1rem;
  padding: 0.35rem 0.5rem 0.35rem 0.25rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #1a2a3a;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
}

.donation-template--card-first .wallet-first-back-btn[hidden] {
  display: none;
}

.donation-template--card-first .card-checkout-panel.is-open .wallet-first-back-btn:not([hidden]) {
  display: inline-flex;
}

.donation-template--card-first .card-checkout-panel {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.55s var(--wallet-ease),
    transform 0.55s var(--wallet-ease),
    max-height 0.62s var(--wallet-ease);
}

.donation-template--card-first .card-checkout-panel__content {
  padding-top: 0.25rem;
}

.donation-template--card-first .card-checkout-panel.is-open {
  max-height: 2400px;
  opacity: 1;
  transform: translateY(0);
}

.donation-template--card-first .card-checkout-panel[hidden]:not(.is-open) {
  display: none;
}

.donation-template--card-first .wallet-first-payment-flow.is-card-mode--instant .card-checkout-panel.is-open {
  display: block;
}

.donation-template--card-first .card-checkout-panel .donor-info-section,
.donation-template--card-first .card-checkout-panel .payment-section {
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.45s var(--wallet-ease) 0.08s,
    transform 0.45s var(--wallet-ease) 0.08s;
}

.donation-template--card-first .card-checkout-panel.is-open .donor-info-section {
  opacity: 1;
  transform: translateY(0);
}

.donation-template--card-first .card-checkout-panel.is-open .payment-section {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.14s;
}

.donation-template--card-first .card-checkout-panel:not(.is-open) .donor-info-section,
.donation-template--card-first .card-checkout-panel:not(.is-open) .payment-section,
.donation-template--card-first .card-checkout-panel:not(.is-open) .wallet-first-back-btn:not([hidden]) {
  pointer-events: none;
}

.donation-template--card-first .wallet-first-payment-flow.is-card-mode--instant .card-checkout-panel .donor-info-section,
.donation-template--card-first .wallet-first-payment-flow.is-card-mode--instant .card-checkout-panel .payment-section {
  opacity: 1;
  transform: none;
  transition: none;
}

@media (prefers-reduced-motion: reduce) {
  .donation-template--card-first .wallet-checkout-section,
  .donation-template--card-first .card-checkout-panel,
  .donation-template--card-first .card-checkout-panel .donor-info-section,
  .donation-template--card-first .card-checkout-panel .payment-section,
  .donation-template--card-first .wallet-first-back-btn {
    transition: none !important;
  }
}

/* Express Checkout Element (Apple Pay, Google Pay, Link) - 2/3 width */
/* Stripe controls inner iframes; do not clamp height — fixed 48px + overflow:hidden
 * clips Link/wallets when Stripe lays out 2 rows (more obvious in Chrome device toolbar). */
.express-checkout-container,
.express-checkout-column {
  flex: 2;
  min-height: 48px;
  border-radius: 4px;
  overflow: visible;
  padding: 0;
}

.express-checkout-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.wallet-feedback-host > .express-checkout-hint {
  flex: 1 1 100%;
  width: 100%;
}

.wallet-checkout-options {
  position: relative;
  width: 100%;
}

.express-checkout-blocker {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 3;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: not-allowed;
}

.wallet-feedback-host.is-disabled .wallet-checkout-options .express-checkout-blocker,
.wallet-feedback-host.is-disabled > .wallet-row-buttons .express-checkout-blocker {
  display: block;
}

.express-checkout-hint {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  margin: 0 0 0.625rem;
  border-radius: 8px;
  background: #fef3f2;
  border: 1px solid #fecdca;
  color: #912018;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.45;
  box-shadow: 0 1px 2px rgba(145, 32, 24, 0.08);
}

.express-checkout-hint::before {
  content: '!';
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  background: #f97066;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  margin-top: 0.1rem;
}

.express-checkout-hint:empty,
.express-checkout-hint[hidden] {
  display: none;
}

#express-checkout-element {
  min-height: 48px;
  width: 100%;
  border-radius: 4px;
}

/* PayPal Button Container - 1/3 width, match Stripe height and tight spacing */
.paypal-button-container {
  flex: 1;
  height: 48px;
  min-height: 48px;
  max-height: 48px;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 0;
  margin: 0;
}

/* Hide PayPal tagline (adds extra height) */
.paypal-button-container .paypal-button-tagline {
  display: none !important;
}

.paypal-button-container iframe {
  height: 48px !important;
  max-height: 48px !important;
  min-height: 48px !important;
  border-radius: 4px;
  margin: 0 !important;
}

.paypal-button-container > div {
  height: 48px !important;
  max-height: 48px !important;
  overflow: hidden;
  padding: 0 !important;
  margin: 0 !important;
}

/* Ensure PayPal button has same border radius */
.paypal-button-container div[data-funding-source] {
  border-radius: 4px !important;
}

/* ========================================
 * Notification Toast
 * ======================================== */

/* Overlay backdrop */
.notification-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.notification-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.notification-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  min-width: 380px;
  max-width: 480px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  border: 1px solid #e8e8e8;
  padding: 0;
  z-index: 10000;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.notification-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.notification-icon {
  display: none;
}

.notification-content {
  width: 100%;
  padding: 28px 32px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.notification-content::before {
  content: '';
  width: 4px;
  height: 48px;
  background: #dd230f;
  border-radius: 2px;
  flex-shrink: 0;
}

.notification-toast.error .notification-content::before {
  background: #dd230f;
}

.notification-toast.success .notification-content::before {
  background: #28a745;
}

.notification-toast.warning .notification-content::before {
  background: #ffc107;
}

.notification-toast.info .notification-content::before {
  background: #17a2b8;
}

.notification-title {
  display: none;
}

.notification-message {
  font-size: 16px;
  color: #2c3e50;
  line-height: 1.5;
  margin: 0;
  font-weight: 400;
  text-align: left;
  flex: 1;
}

.notification-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: #aaa;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-close:hover {
  background: #f5f5f5;
  color: #333;
}

/* Toast layout — must follow .notification-* bases; repeats 768px breakpoint used above */
@media (max-width: 768px) {
  .notification-toast {
    min-width: 300px;
    max-width: calc(100% - 32px);
  }

  .notification-content {
    padding: 24px 20px;
    gap: 12px;
  }

  .notification-content::before {
    height: 40px;
  }

  .notification-message {
    font-size: 15px;
  }

  .notification-toast.show {
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Card Element — match .form-control sizing site-wide */
.stripe-card-element {
  box-sizing: border-box;
  width: 100%;
  max-width: 325px;
  min-height: 48px;
  background: #f8fafb;
  border: 1px solid #cfd8dc;
  border-radius: 4px;
  padding: 11px 12px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.stripe-card-element > div,
.stripe-card-element iframe {
  width: 100% !important;
  min-width: 0 !important;
}

.stripe-card-element.StripeElement--focus {
  border-color: #dd230f;
  box-shadow: 0 0 0 2px rgba(221, 35, 15, 0.2);
  background: #fff;
}

.stripe-card-element.StripeElement--invalid {
  border-color: #dc3545;
}

.stripe-card-element.StripeElement--complete {
  border-color: #28a745;
}

/* Split card fields — mobile only; desktop keeps unified Card Element */
.stripe-card-mount {
  width: 100%;
}

@media (min-width: 769px) {
  .stripe-card-fields--split {
    display: none;
  }
}

@media (max-width: 768px) {
  .stripe-card-unified {
    display: none;
  }
}

.stripe-card-fields {
  width: 100%;
  max-width: none;
  margin: 0 0 1rem;
}

.stripe-card-fields .stripe-card-element {
  max-width: none;
  width: 100%;
  margin: 0 0 0.625rem;
}

.stripe-card-fields__expiry-cvc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(5.75rem, 7.5rem);
  gap: 0.625rem;
}

.stripe-card-fields__expiry-cvc .stripe-card-element {
  margin-bottom: 0;
}

@media (max-width: 380px) {
  .stripe-card-fields__expiry-cvc {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.card-element-row__main .stripe-card-mount,
.card-element-row__main .stripe-card-fields {
  flex: 1 1 auto;
  min-width: 0;
  margin-bottom: 1rem;
}

.card-element-row__main .stripe-card-mount .stripe-card-unified {
  margin-bottom: 1rem;
}

.card-element-row__main .stripe-card-fields .stripe-card-element {
  margin-bottom: 0.625rem;
}

.card-element-row__main .stripe-card-fields__expiry-cvc .stripe-card-element {
  margin-bottom: 0;
}

@keyframes ctf-card-donate-attention {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(221, 35, 15, 0);
    border-color: #cfd8dc;
  }
  35%, 65% {
    box-shadow: 0 0 0 3px rgba(221, 35, 15, 0.28);
    border-color: #dd230f;
  }
}

.card-element-row--donate-attention .stripe-card-element,
.stripe-card-element--donate-attention {
  animation: ctf-card-donate-attention 1.1s ease-in-out 2;
}

.wallet-first-card-btn--donate-attention {
  animation: ctf-card-donate-attention 1.1s ease-in-out 2;
  outline: 2px solid rgba(221, 35, 15, 0.35);
  outline-offset: 2px;
}

/* Card field matches donate button width inside the payment box */
.payment-section .card-element-row__main .stripe-card-element,
.payment-section .stripe-card-element,
.payment-section .stripe-card-mount,
.payment-section .stripe-card-fields {
  max-width: none;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.payment-section .card-element-row__main .stripe-card-element,
.payment-section .card-element-row__main .stripe-payment-element {
  margin-bottom: 0.5rem;
}

.payment-section .card-element-row__main .card-lock-icon {
  margin-bottom: 0.5rem;
}

.payment-section .card-errors {
  margin-top: 0.25rem;
  min-height: 10px;
}

.payment-section .card-errors:empty {
  margin-top: 0;
  min-height: 0;
}

.payment-section .donate-button {
  margin-top: 0.75rem;
}

.card-errors {
  color: #dc3545;
  font-size: 0.85rem;
  margin-top: 0.5rem;
  min-height: 20px;
}

/* Loading state for donate button */
.donate-button.processing {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.donate-button.processing::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 1rem;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border: 2px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  /* @keyframes spin is defined once in css/components.css (loaded before this file) */
  animation: spin 0.8s linear infinite;
}
