/* Success page: trial items list (shortcode [wppa_paid_trial_items]) */
.wppa-paid-trial-items:empty {
    display: none;
}

.wppa-paid-trial-items {
    margin: 8px 0 12px;
    padding-left: 20px;
}

.wppa-paid-trial-item {
    margin: 4px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.wppa-paid-trial-item-cover {
    width: 45px;
    height: 58px;
    min-width: 45px;
    border-radius: 8px;
    object-fit: cover;
    display: inline-block;
}

.wppa-paid-trial-item-name {
    flex: 1 1 auto;
}

.wppa-paid-trial-item-amount {
    flex: 0 0 auto;
    margin-left: 0;
    text-align: right;
    white-space: nowrap;
}


/**
 * Frontend Styles for WP Payment Actions
 * 
 * @package WP_Payment_Actions
 */

/* Payment Form - Minimal styles, inherit from theme/Elementor */
/* .wppa-payment-form intentionally inherits from theme */

.wppa-form-row {
    margin-bottom: 15px;
}

.wppa-form-row label {
    display: block;
    margin-bottom: 5px;
}

.wppa-form-row input[type="text"],
.wppa-form-row input[type="email"],
.wppa-form-row select {
    width: 100%;
    max-width: 100% !important;
    display: block;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    margin: 0;
    font-size: 16px;
    line-height: 1.2;
    background: #fff !important;
    color: #000 !important;
}

/* Some themes style <select> with a darker/black border; lock it to the same tone as inputs. */
#wppa-payment-form .wppa-form-row select,
.wppa-currency-select {
    border: 1px solid #ddd !important;
    background-color: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
    -webkit-appearance: none;
    appearance: none;

    /* Add a consistent dropdown arrow */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23000' d='M1.41 0.59 6 5.17 10.59 0.59 12 2 6 8 0 2z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 12px 8px !important;
    padding-right: 36px;
}

/* Keep placeholder tone consistent with Stripe's default placeholder */
#wppa-payment-form .wppa-form-row input[type="text"]::placeholder,
#wppa-payment-form .wppa-form-row input[type="email"]::placeholder {
    color: #aab7c4;
}

.wppa-form-row input[type="text"]:focus,
.wppa-form-row input[type="email"]:focus,
.wppa-form-row select:focus {
    outline: none;
    border-color: #2271b1;
}

.wppa-form-row input[readonly] {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

/* Inline field validation (avoid native browser bubbles) */
.wppa-field-error {
    color: #dc3232;
    font-size: 13px;
    margin-top: 6px;
}

/* Informational note under a locked/readonly field (e.g. no_cc_user email lock) */
.wppa-field-note {
    color: #666;
    font-size: 13px;
    margin-top: 6px;
}

.wppa-renew-cta {
    margin-top: 12px;
}

.wppa-renew-cta-link {
    color: #2271b1;
    text-decoration: underline;
}

.wppa-renew-cta-button {
    display: inline-flex;
    text-decoration: none;
}

.wppa-renew-cta-button,
.wppa-renew-cta-button:visited,
.wppa-renew-cta-button:hover,
.wppa-renew-cta-button:focus {
    background: #2271b1 !important;
    color: #fff !important;
    border: none !important;
    text-decoration: none !important;
}

.wppa-renew-cta-button:hover,
.wppa-renew-cta-button:focus {
    background: #135e96 !important;
}

.wppa-renew-cta-button .wppa-btn-text,
.wppa-renew-cta-button .wppa-btn-text * {
    color: #fff !important;
}

/* Inline error under the pressed payment method button */
.wppa-method-error {
    color: #dc3232;
    font-size: 13px;
    margin-top: 10px;
}

.wppa-form-row.has-error input[type="text"],
.wppa-form-row.has-error input[type="email"],
.wppa-form-row.has-error select {
    border-color: #dc3232;
}

/* Email row - legacy placement (when rendered as a direct child of the form) */
#wppa-payment-form > .wppa-form-row.wppa-email-row {
    padding-left: 26px;
    padding-right: 26px;
    box-sizing: border-box;
    margin-bottom: 5px;
}

/* Shared email field (moved into the active method body via JS) */
#wppa-payment-form .wppa-shared-email {
    cursor: default;
}

#wppa-payment-form .wppa-email-row--shared {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 18px;
}

/* Some themes add padding to `.wppa-email-row` globally; ensure the shared email row never gets it. */
body #wppa-payment-form .wppa-shared-email {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Stripe Elements (Card fields) */
#wppa-card-element,
#wppa-card-number-element,
#wppa-card-expiry-element,
#wppa-card-cvc-element,
#wppa-postal-code-element {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff !important;
    box-sizing: border-box;
    min-height: 40px;
}

#wppa-payment-form[data-wppa-card-provider="chargebee"] #wppa-card-number-element,
#wppa-payment-form[data-wppa-card-provider="chargebee"] #wppa-card-expiry-element,
#wppa-payment-form[data-wppa-card-provider="chargebee"] #wppa-card-cvc-element {
    padding: 10px 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
}

#wppa-payment-form[data-wppa-card-provider="chargebee"] #wppa-card-number-element iframe,
#wppa-payment-form[data-wppa-card-provider="chargebee"] #wppa-card-expiry-element iframe,
#wppa-payment-form[data-wppa-card-provider="chargebee"] #wppa-card-cvc-element iframe {
    display: block;
    width: 100%;
    min-height: 20px;
}

/* Stripe Link (Autofill) button can overlap fields on mobile.
    Hide the Link button iframe inside our Elements containers. */
#wppa-card-element iframe[src*="elements-inner-link-button-for-card"],
#wppa-card-element iframe[name^="cardButton"],
#wppa-card-number-element iframe[src*="elements-inner-link-button"],
#wppa-card-number-element iframe[name^="cardButton"] {
    display: none !important;
}

#wppa-postal-code-label {
    margin-top: 16px;
    margin-bottom: 4px;
}

/* New card grid: do not add extra top spacing to the ZIP label */
.wppa-card-grid .wppa-card-postal-row #wppa-postal-code-label {
    margin-top: 0;
    margin-bottom: 5px;
}

#wppa-postal-code-element {
    margin-top: 0;
}

/* Payment Methods (radio-cards) */
.wppa-payment-methods {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 10px;
}

/* Robust hide: works even when wrapper is display: contents (horizontal template) */
[data-wppa-method].wppa-method-is-hidden > .wppa-payment-method-header,
[data-wppa-method].wppa-method-is-hidden > .wppa-payment-method-body {
    display: none !important;
}

/* Template: horizontal (cards on top + body below)
   Use flex-wrap + order so bodies always appear after all option cards
   (regardless of DOM order inside each method wrapper). */
#wppa-payment-form[data-wppa-template="horizontal"] .wppa-payment-methods {
    display: flex;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 16px;
    align-items: stretch;
    justify-content: flex-start;
}

/* Let header/body become grid items while keeping the wrapper for JS state. */
#wppa-payment-form[data-wppa-template="horizontal"] .wppa-payment-method-card {
    display: contents !important;
}

#wppa-payment-form[data-wppa-template="horizontal"] .wppa-payment-method-header {
    background: #FFFFFF;
    border: none;
    border-radius: 10px;
    padding: 18px 16px;
    box-shadow: 2px 4px 30px rgba(0, 0, 0, 0.08);
    position: relative;
    display: grid;
    grid-template-columns: auto auto 1fr;
    grid-template-rows: auto auto;
    align-items: center;
    justify-content: flex-start;
    column-gap: 12px;
    row-gap: 10px;
    order: 1;
    /* 2 per row (desktop + mobile): use available space without shrinking too much */
    flex: 1 1 calc((100% - 16px) / 2);
    min-width: 150px;
    width: auto !important;
    max-width: none;
}

#wppa-payment-form[data-wppa-template="horizontal"] .wppa-payment-method-header input[type="radio"] {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    justify-self: start;
}

#wppa-payment-form[data-wppa-template="horizontal"] .wppa-payment-method-header .wppa-method-logo {
    grid-column: 2;
    grid-row: 1;
    justify-self: start;
    align-self: center;
    max-width: 100%;
    height: 36px;
    object-fit: contain;
}

#wppa-payment-form[data-wppa-template="horizontal"] .wppa-payment-method-header .wppa-method-logo--cards {
    height: 36px;
    max-width: 100% !important;
}

#wppa-payment-form[data-wppa-template="horizontal"] .wppa-payment-method-title--option {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: start;
    text-align: left;
}

@media screen and (max-width: 760px) {
    #wppa-payment-form[data-wppa-template="horizontal"] .wppa-payment-method-header {
        flex: 1 1 calc((100% - 16px) / 2);
        min-width: 0;
    }
}

/* Selected card: neutral inside stroke at the top */
#wppa-payment-form[data-wppa-template="horizontal"] .wppa-payment-method-card.is-expanded .wppa-payment-method-header {
    border-top: none;
    box-shadow: 2px 4px 30px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

#wppa-payment-form[data-wppa-template="horizontal"] .wppa-payment-method-card.is-expanded .wppa-payment-method-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #000000;
}

/* Ensure the method body spans full width under the top cards */
#wppa-payment-form[data-wppa-template="horizontal"] .wppa-payment-method-body {
    order: 2;
    flex: 0 0 100%;
    margin-top: 0;
}

/* Option title shown only in horizontal template (keep current vertical look) */
.wppa-payment-method-title--option {
    display: none;
    font-weight: 700;
    text-align: center;
}

#wppa-payment-form[data-wppa-template="horizontal"] .wppa-payment-method-title--option {
    display: block;
}

.wppa-payment-method-card {
    background: #FFFFFF;
    border: none;
    border-radius: 16px;
    padding: 26px;
    box-shadow: 2px 4px 30px 3px rgba(0, 0, 0, 0.08);
    transition: transform 160ms ease, box-shadow 160ms ease;
}

/* In horizontal template, the wrapper doesn't render; keep vertical card look intact. */
#wppa-payment-form[data-wppa-template="horizontal"] .wppa-payment-method-card {
    padding: 0;
    box-shadow: none;
    background: transparent;
}

.wppa-payment-method-card.is-expanded {
    transform: scale(1.01);
}

.wppa-payment-method-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    cursor: pointer;
}

.wppa-payment-method-header input[type="radio"] {
    width: 24px;
    height: 24px;
    margin: 0;
    accent-color: #000;
}

.wppa-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.wppa-payment-method-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #23221e;
}

/* Method logos (SVG) */
.wppa-method-logo {
    display: inline-block;
    height: 36px;
    width: auto;
    max-width: 180px;
    vertical-align: middle;
}

.wppa-method-logo--cards {
    height: 36px;
    width: auto;
    max-width: 240px !important;
}

.wppa-accepted-cards {
    margin: 2px 0 14px;
}

.wppa-accepted-cards-logo {
    display: block;
    height: 32px;
    width: auto;
    max-width: 240px;
}

/* Shared email field inside the card: force full-width even under Elementor/theme overrides */
#wppa-payment-form .wppa-shared-email,
#wppa-payment-form .wppa-email-row--shared,
#wppa-payment-form .wppa-email-row--shared input#wppa-email {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

/* On some themes, front-end CSS targets input[type=email] differently than input[type=text].
   Lock the shared email field to the same sizing as our other form inputs. */
body #wppa-payment-form .wppa-email-row--shared input#wppa-email {
    display: block !important;
    padding: 10px !important;
    margin: 0 !important;
    font-size: 16px !important;
    line-height: 1.2 !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    height: auto !important;
    min-height: 40px;
    -webkit-appearance: none;
    appearance: none;
}

.wppa-method-logo--inline {
    height: 28px;
    max-width: 160px;
    margin-left: 6px;
}

/* Button text layout: allow wrapping and control mobile stacking */
.wppa-btn-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.wppa-btn-prefix,
.wppa-btn-logo {
    display: inline-flex;
    align-items: center;
}

/* Center content for the wallet/paypal submit buttons */
.wppa-method-button .wppa-btn-text {
    width: 100%;
    justify-content: center;
    text-align: center;
}

.wppa-payment-method-body {
    margin-top: 18px;
}

/* Shared email block: it is moved into the active method body via JS */
#wppa-payment-form [data-wppa-shared-email] {
    width: 100%;
}

/* Card layout grid (email sits above via JS) */
.wppa-card-grid {
    display: grid;
    /* Use fr units so column gaps don't push the grid wider than 100%.
       (With percentage columns + gap, the right column can overflow and look "longer".) */
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    column-gap: 12px;
    row-gap: 0;
    align-items: start;
}

/* Horizontal template + Stripe disabled: make left/right columns equal width.
   This keeps CVV/ZIP/Year aligned and prevents the right column from hugging the edge. */
#wppa-payment-form[data-wppa-template="horizontal"][data-wppa-stripe-enabled="0"] .wppa-card-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.wppa-card-grid .wppa-form-row {
    margin-bottom: 15px;
}

/* Place fields in a 2-col grid */
.wppa-card-number-row { grid-column: 1; }
.wppa-card-cvc-row { grid-column: 2; }
.wppa-cardholder-name-row { grid-column: 1; }
.wppa-card-postal-row { grid-column: 2; }
.wppa-card-expiry-row { grid-column: 1; }
.wppa-card-exp-month-row { grid-column: 1; }
.wppa-card-exp-year-row { grid-column: 2; }
.wppa-card-expiry-spacer { grid-column: 2; }

.wppa-card-expiry-spacer {
    margin-bottom: 15px;
}

@media screen and (max-width: 600px) {
    .wppa-card-grid {
        grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    }
}

.wppa-payment-method-card.is-collapsed .wppa-payment-method-body {
    display: none;
}

.wppa-payment-method-card.is-collapsed {
    cursor: pointer;
}

.wppa-payment-method-card.is-expanded {
    cursor: default;
}

.wppa-with {
    margin: 0 6px;
    font-weight: 500;
    opacity: 0.85;
}

#wppa-card-element.StripeElement--focus,
#wppa-card-number-element.StripeElement--focus,
#wppa-card-expiry-element.StripeElement--focus,
#wppa-card-cvc-element.StripeElement--focus,
#wppa-postal-code-element.StripeElement--focus {
    border-color: #2271b1;
}

#wppa-payment-form[data-wppa-card-provider="chargebee"] .wppa-chargebee-element.is-focus {
    border-color: #2271b1;
}

#wppa-card-element.StripeElement--invalid,
#wppa-card-number-element.StripeElement--invalid,
#wppa-card-expiry-element.StripeElement--invalid,
#wppa-card-cvc-element.StripeElement--invalid,
#wppa-postal-code-element.StripeElement--invalid {
    border-color: #dc3232;
}

#wppa-payment-form[data-wppa-card-provider="chargebee"] .wppa-chargebee-element.is-invalid {
    border-color: #dc3232;
}

#wppa-card-errors {
    color: #dc3232;
    font-size: 14px;
    margin-top: 8px;
    min-height: 20px;
}

/* Submit Button */
.button-submit-form,
#wppa-submit-button {
    width: 100%;
    max-width: 100% !important;
    display: block;
}

.wppa-submit-button {
    width: 100%;
    padding: 14px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

/* Capture first name shortcode ([wppa_capture_first_name]) */
.wppa-capture-first-name__actions {
    text-align: center;
}

.wppa-capture-first-name__actions .wppa-submit-button {
    width: auto;
    display: inline-block;
}

/* Spinner (shared between inline/external buttons) */
.wppa-btn-spinner {
    border: 3px solid rgba(255,255,255,0.35);
    border-top: 3px solid rgba(255,255,255,0.95);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    animation: wppa-spin 1s linear infinite;
    margin-left: 10px;
    display: none;
}

.button-submit-form.loading .wppa-btn-spinner,
.wppa-submit-button.loading .wppa-btn-spinner,
#wppa-submit-button.loading .wppa-btn-spinner {
    display: inline-block;
}

/* Success indicator: show a green check in the spinner area (used by sticky [wppa_payment_button]) */
.button-submit-form.wppa-success .wppa-btn-spinner,
.wppa-submit-button.wppa-success .wppa-btn-spinner,
#wppa-submit-button.wppa-success .wppa-btn-spinner {
    display: inline-block;
    animation: none;
    border: none;
    width: 18px;
    height: 18px;
    position: relative;
}

.button-submit-form.wppa-success .wppa-btn-spinner::before,
.wppa-submit-button.wppa-success .wppa-btn-spinner::before,
#wppa-submit-button.wppa-success .wppa-btn-spinner::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 11px;
    border-right: 3px solid #155724;
    border-bottom: 3px solid #155724;
    transform: rotate(45deg);
}

/* Optional method button styling */
.wppa-method-button--apple {
    background: #111 !important;
    color: #fff !important;
    border: none !important;
}

.wppa-method-button--google {
    background: #111 !important;
    color: #fff !important;
    border: none !important;
}

/* Dedicated PayPal class so themes don't override it */
.button-submit-form-paypal,
.button-submit-form-paypal.wppa-method-button,
.button-submit-form-paypal.wppa-method-button:hover,
.button-submit-form-paypal.wppa-method-button:focus {
    background: #FFC43A !important;
    color: #20272B !important;
    border: none !important;
}

.button-submit-form-paypal .wppa-btn-text,
.button-submit-form-paypal .wppa-btn-text * {
    color: #20272B !important;
}

.wppa-method-button--paypal .wppa-btn-spinner,
.button-submit-form-paypal .wppa-btn-spinner {
    border-color: rgba(17,17,17,0.25);
    border-top-color: rgba(17,17,17,0.85);
}

.wppa-submit-button:hover {
    background: #135e96;
}

.wppa-submit-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.wppa-apply-promotion-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.wppa-btn-icon {
    display: inline-flex;
    align-items: center;
    margin-right: 8px;
    line-height: 0;
}

.wppa-btn-icon-image {
    width: 18px;
    height: 18px;
    object-fit: contain;
    display: block;
}

/* Payment Messages */
.wppa-payment-message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 4px;
    font-size: 14px;
    display: none;
}

.wppa-payment-message.wppa-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.wppa-payment-message.wppa-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Cancellation (shortcode [wppa_cancel_subscription]) - public flow (authenticated="false") */
.wppa-cancel-subscription--public {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* Apply the cap to the actual controls so it works even if the wrapper is shrink-wrapped by a theme/builder. */
.wppa-cancel-subscription--public .wppa-cancel-email-row,
.wppa-cancel-subscription--public .wppa-cancel-subscription-public-button {
    width: 100% !important;
    max-width: var(--wppa-cancel-email-max-width, 100%) !important;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.wppa-cancel-subscription--public .wppa-cancel-email-row {
    margin-bottom: 10px;
}

.wppa-cancel-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.wppa-cancel-modal.is-open {
    display: flex;
}

.wppa-cancel-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
}

.wppa-cancel-modal__content {
    position: relative;
    width: 100%;
    max-width: 520px;
    background: #fff;
    border-radius: 8px;
    padding: 18px;
    box-sizing: border-box;
}

.wppa-cancel-modal__title {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
}

.wppa-cancel-modal__message {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}

.wppa-cancel-modal__actions {
    margin-top: 16px;
    display: flex;
    gap: 12px;
}

.wppa-cancel-modal__actions .wppa-submit-button {
    width: 100%;
    flex: 1 1 0;
    padding: 12px;
}

/* Button color customization via CSS variables */
.wppa-cancel-modal__btn--close {
    background: var(--wppa-cancel-modal-close-bg, #ccc);
    color: var(--wppa-cancel-modal-close-color, #000);
}

.wppa-cancel-modal__btn--close:hover {
    background: var(--wppa-cancel-modal-close-bg-hover, #b5b5b5);
}

.wppa-cancel-modal__btn--confirm {
    background: var(--wppa-cancel-modal-confirm-bg, #dc3232);
    color: var(--wppa-cancel-modal-confirm-color, #fff);
}

.wppa-cancel-modal__btn--confirm:hover {
    background: var(--wppa-cancel-modal-confirm-bg-hover, #b32d2e);
}

/* Loading Spinner */
.wppa-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    z-index: 10;
}

.wppa-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2271b1;
    border-radius: 50%;
    animation: wppa-spin 1s linear infinite;
}

@keyframes wppa-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.wppa-loading p {
    margin-top: 15px;
    color: #333;
    font-weight: 600;
}

/* Slightly larger message for the "already registered" redirect flow */
.wppa-loading.wppa-already-registered p {
    font-size: calc(1em + 1pt);
}

/* Currency Selector */
.wppa-currency-selector {
    display: inline-block;
}

.wppa-currency-select {
    padding: 8px 36px 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    /* Use background-color so we don't reset the arrow background-image */
    background-color: #fff;
    cursor: pointer;
    transition: border-color 0.3s;
}

.wppa-currency-select:focus {
    outline: none;
    border-color: #2271b1;
}

/* Display Elements */
.wppa-current-currency,
.wppa-trial-price,
.wppa-recurring-price,
.wppa-trial-days,
.wppa-access-description,
.wppa-billing-interval,
.wppa-plan-name,
.wppa-user-email,
.wppa-user-password,
.wppa-enrolled-courses,
.wppa-payment-total {
    display: inline;
}

.wppa-not-configured {
    color: #d63638;
    font-style: italic;
    font-size: 12px;
}

/* User Credentials Display */
/* .wppa-user-email/.wppa-user-password intentionally inherit from theme */

/* Notice Messages */
.wppa-notice {
    background: #fff3cd;
    border-left: 4px solid #856404;
    padding: 12px;
    margin: 15px 0;
    border-radius: 4px;
}

/* Floating banner for Stripe test mode (does not affect layout) */
.wppa-test-mode-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: #fff3cd;
    border-bottom: 1px solid rgba(133, 100, 4, 0.35);
    color: #856404;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.2;
    text-align: center;
}

/* Respect WordPress admin bar on the frontend */
body.admin-bar .wppa-test-mode-banner {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar .wppa-test-mode-banner {
        top: 46px;
    }
}

/* Responsive */
@media screen and (max-width: 600px) {
    .wppa-payment-form {
        padding: 20px;
    }
    
    .wppa-payment-form-container {
        max-width: 100%;
        padding: 0 15px;
    }

    /* Reduce card padding on mobile so the logo row has more horizontal room */
    .wppa-payment-method-card {
        padding: 14px 12px;
    }

    .wppa-payment-method-header {
        gap: 8px;
    }

    /* On mobile: button text on one line, logo on next */
    .wppa-btn-text {
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }

    .wppa-method-logo--inline {
        margin-left: 0;
    }
}

/* Apple Pay: hide by default to avoid initial flash before async availability check */
[data-wppa-method="apple_pay"].wppa-payment-method-card {
    display: none;
}

[data-wppa-method-button="apple_pay"] {
    display: none;
}

/* Elementor editor/preview: show enabled payment methods (UI-only) */
#wppa-payment-form[data-wppa-editor-preview="1"] [data-wppa-method="apple_pay"].wppa-payment-method-card,
#wppa-payment-form[data-wppa-editor-preview="1"] [data-wppa-method="google_pay"].wppa-payment-method-card,
#wppa-payment-form[data-wppa-editor-preview="1"] [data-wppa-method="paypal"].wppa-payment-method-card {
    display: block !important;
}

#wppa-payment-form[data-wppa-editor-preview="1"] [data-wppa-method-button="apple_pay"],
#wppa-payment-form[data-wppa-editor-preview="1"] [data-wppa-method-button="google_pay"],
#wppa-payment-form[data-wppa-editor-preview="1"] [data-wppa-method-button="paypal"] {
    display: inline-flex !important;
}

[data-wppa-external-buttons][data-wppa-editor-preview="1"] [data-wppa-method-button="apple_pay"],
[data-wppa-external-buttons][data-wppa-editor-preview="1"] [data-wppa-method-button="google_pay"],
[data-wppa-external-buttons][data-wppa-editor-preview="1"] [data-wppa-method-button="paypal"] {
    display: inline-flex !important;
}

body.elementor-editor-active [data-wppa-method="apple_pay"].wppa-payment-method-card,
body.elementor-editor-active [data-wppa-method="google_pay"].wppa-payment-method-card,
body.elementor-editor-active [data-wppa-method="paypal"].wppa-payment-method-card,
body.elementor-editor-preview [data-wppa-method="apple_pay"].wppa-payment-method-card,
body.elementor-editor-preview [data-wppa-method="google_pay"].wppa-payment-method-card,
body.elementor-editor-preview [data-wppa-method="paypal"].wppa-payment-method-card {
    display: block !important;
}

body.elementor-editor-active [data-wppa-method-button="apple_pay"],
body.elementor-editor-active [data-wppa-method-button="google_pay"],
body.elementor-editor-active [data-wppa-method-button="paypal"],
body.elementor-editor-preview [data-wppa-method-button="apple_pay"],
body.elementor-editor-preview [data-wppa-method-button="google_pay"],
body.elementor-editor-preview [data-wppa-method-button="paypal"] {
    display: inline-flex !important;
}

/* Sticky external payment button ([wppa_payment_button]) */
.wppa-payment-button-group--sticky[data-wppa-sticky="1"] {
    position: fixed;
    z-index: 99998;
    padding: 12px 14px;
    box-sizing: border-box;
    background: #fff;
    left: 0;
    right: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.wppa-payment-button-group--sticky[data-wppa-sticky="1"][data-wppa-sticky-position="bottom"] {
    left: 0;
    right: 0;
    bottom: 0;
    border-top: 1px solid #eee;
}

.wppa-payment-button-group--sticky[data-wppa-sticky="1"][data-wppa-sticky-position="top"] {
    left: 0;
    right: 0;
    top: 0;
    border-bottom: 1px solid #eee;
}

/* Respect WP admin bar when sticky at top */
body.admin-bar .wppa-payment-button-group--sticky[data-wppa-sticky="1"][data-wppa-sticky-position="top"] {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar .wppa-payment-button-group--sticky[data-wppa-sticky="1"][data-wppa-sticky-position="top"] {
        top: 46px;
    }
}

/* Width behavior */
.wppa-payment-button-group--sticky[data-wppa-sticky="1"][data-wppa-sticky-width="max"] {
    transform: none;
    max-width: none;
}

.wppa-payment-button-group--sticky[data-wppa-sticky="1"][data-wppa-sticky-width="full"] {
    transform: none;
    max-width: none;
}

/* Apply the width behavior to the button inside the full-width sticky bar */
.wppa-payment-button-group--sticky[data-wppa-sticky="1"][data-wppa-sticky-width="max"] > button {
    width: 100%;
    max-width: 574px;
}

/* Override global .button-submit-form { max-width: 100% !important; } for sticky max mode */
.wppa-payment-button-group--sticky[data-wppa-sticky="1"][data-wppa-sticky-width="max"] > button.button-submit-form {
    max-width: 574px !important;
}

.wppa-payment-button-group--sticky[data-wppa-sticky="1"] > .wppa-payment-message {
    order: 100;
    width: 100%;
    max-width: 574px;
    margin-top: 0;
    margin-bottom: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    text-align: center;
    line-height: 1.4;
}

.wppa-payment-button-group--sticky[data-wppa-sticky="1"] > .wppa-payment-message.wppa-error {
    background: transparent;
    border: 0;
    color: #b42318;
}

.wppa-payment-button-group--sticky[data-wppa-sticky="1"] > .wppa-payment-message.wppa-success {
    background: transparent;
    border: 0;
    color: #027a48;
}

.wppa-payment-button-group--sticky[data-wppa-sticky="1"][data-wppa-sticky-width="full"] > button {
    width: 100%;
    max-width: none;
}

.wppa-payment-button-group--sticky[data-wppa-sticky="1"][data-wppa-sticky-width="full"] > .wppa-payment-message {
    max-width: none;
}

@media screen and (max-width: 600px) {
    .wppa-payment-button-group--sticky[data-wppa-sticky="1"][data-wppa-sticky-mobile-width="max"] {
        transform: none;
        max-width: none;
    }

    .wppa-payment-button-group--sticky[data-wppa-sticky="1"][data-wppa-sticky-mobile-width="full"] {
        transform: none;
        max-width: none;
    }

    .wppa-payment-button-group--sticky[data-wppa-sticky="1"][data-wppa-sticky-mobile-width="max"] > button {
        width: 100%;
        max-width: 574px;
    }

    .wppa-payment-button-group--sticky[data-wppa-sticky="1"][data-wppa-sticky-mobile-width="max"] > button.button-submit-form {
        max-width: 574px !important;
    }

    .wppa-payment-button-group--sticky[data-wppa-sticky="1"][data-wppa-sticky-mobile-width="max"] > .wppa-payment-message {
        max-width: 574px;
    }

    .wppa-payment-button-group--sticky[data-wppa-sticky="1"][data-wppa-sticky-mobile-width="full"] > button {
        width: 100%;
        max-width: none;
    }

    .wppa-payment-button-group--sticky[data-wppa-sticky="1"][data-wppa-sticky-mobile-width="full"] > .wppa-payment-message {
        max-width: none;
    }
}

/* Ebooks shortcode */
.wppa-ebooks {
    --wppa-ebooks-max-width: 800px;
    --wppa-ebooks-shadow: 2px 4px 30px 3px rgba(0, 0, 0, 0.08);
    --wppa-ebooks-card-bg: #ffffff;
    --wppa-ebooks-title: #20272B;
    --wppa-ebooks-copy: #3C494E;
    --wppa-ebooks-border: #C2CECA;
    --wppa-ebooks-gap: 16px;
    max-width: var(--wppa-ebooks-max-width);
    margin: 0 auto;
    padding: 0 16px;
    box-sizing: border-box;
    font-family: Inter, sans-serif;
}

.wppa-ebooks__notice,
.wppa-ebooks__empty,
.wppa-ebooks__group-title {
    max-width: var(--wppa-ebooks-max-width);
}

.wppa-ebooks__notice {
    display: none;
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
}

.wppa-ebooks__notice.is-error {
    display: block;
    background: #FFF3F3;
    color: #8A2727;
}

.wppa-ebooks__notice.is-success {
    display: block;
    background: #F3F8F6;
    color: #1F5A43;
}

.wppa-ebooks__list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.wppa-ebooks__group-title {
    margin: 8px 0 0;
    color: var(--wppa-ebooks-title);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
}

.wppa-ebook-card {
    background: var(--wppa-ebooks-card-bg);
    border-radius: 16px;
    box-shadow: var(--wppa-ebooks-shadow);
    overflow: hidden;
}

.wppa-ebook-card__layout {
    display: grid;
    grid-template-columns: 45px minmax(0, 1fr) auto;
    gap: var(--wppa-ebooks-gap);
    align-items: center;
    padding: 32px;
}

.wppa-ebook-card__cover-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
}

.wppa-ebook-card__cover {
    display: block;
    width: 45px;
    min-width: 45px;
    height: 58px;
    min-height: 58px;
    object-fit: cover;
    background: #EEF2F1;
    border-radius: 8px;
}

.wppa-ebook-card__cover--empty {
    min-height: 58px;
}

.wppa-ebook-card__content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}

.wppa-ebook-card__title {
    color: var(--wppa-ebooks-title);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.wppa-ebook-card__description {
    color: var(--wppa-ebooks-copy);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
}

.wppa-ebook-card__meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 22px;
}

.wppa-ebooks[data-format="resources"] .wppa-ebook-card__meta {
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
}

.wppa-ebook-card__prices {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.wppa-ebooks[data-format="resources"] .wppa-ebook-card__prices {
    justify-content: flex-end;
}

.wppa-ebook-card__price {
    color: var(--wppa-ebooks-copy);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.2;
}

.wppa-ebook-card__price.is-base {
    text-decoration: line-through;
}

.wppa-ebook-card__price.is-current {
    color: var(--wppa-ebooks-title);
    font-size: 16px;
    font-weight: 700;
}

.wppa-ebook-card__purchased-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #508866;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    margin-left: 2px;
}

.wppa-ebooks .wppa-ebook-card__action {
    min-width: 110px;
    border: none;
    border-radius: 999px;
    background: #20272B;
    color: #ffffff;
    font-family: Inter, sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    padding: 10px 20px !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 160ms ease, transform 160ms ease, background 160ms ease, color 160ms ease;
    box-sizing: border-box;
    text-decoration: none;
}

.wppa-ebooks .wppa-ebook-card__action:hover,
.wppa-ebooks__footer-action:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.wppa-ebooks .wppa-ebook-card__action:disabled,
.wppa-ebooks .wppa-ebook-card__action.is-loading {
    cursor: wait;
    opacity: 0.9;
    padding: 10px 20px !important;
}

.wppa-ebooks .wppa-ebook-card__action.is-download,
.wppa-ebooks__footer-action.is-button {
    background: #ffffff;
    color: var(--wppa-ebooks-title);
    border: 1px solid var(--wppa-ebooks-border);
    text-decoration: none;
}

.wppa-ebooks__footer-action.is-link {
    min-width: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--wppa-ebooks-title);
    text-decoration: none;
}

.wppa-ebook-card__spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    animation: wppa-ebook-spin 0.8s linear infinite;
}

.wppa-ebooks .wppa-ebook-card__action.is-download .wppa-ebook-card__spinner,
.wppa-ebooks__footer-action.is-button .wppa-ebook-card__spinner {
    border-color: rgba(32, 39, 43, 0.22);
    border-top-color: #20272B;
}

.wppa-ebooks__footer {
    display: flex;
    justify-content: center;
    margin-top: 22px;
}

.wppa-ebooks__footer-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 128px;
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.2;
}

.wppa-ebooks__empty {
    padding: 20px 18px;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: var(--wppa-ebooks-shadow);
    color: var(--wppa-ebooks-copy);
    font-size: 14px;
}

@keyframes wppa-ebook-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@media screen and (max-width: 767px) {
    .wppa-ebooks {
        padding: 0 14px;
    }

    .wppa-ebook-card__layout {
        grid-template-columns: 45px minmax(0, 1fr);
        gap: 16px;
        align-items: start;
        padding: 20px;
    }

    .wppa-ebook-card__cover,
    .wppa-ebook-card__cover--empty {
        width: 45px;
        min-height: 58px;
        height: 58px;
        border-radius: 8px;
    }

    .wppa-ebook-card__content {
        gap: 6px;
        padding: 0;
    }

    .wppa-ebook-card__meta,
    .wppa-ebooks[data-format="resources"] .wppa-ebook-card__meta {
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 0;
    }

    .wppa-ebook-card__prices {
        flex-wrap: wrap;
        white-space: normal;
    }

    .wppa-ebooks[data-format="resources"] .wppa-ebook-card__meta {
        flex-direction: column;
        align-items: flex-end;
    }

    .wppa-ebooks .wppa-ebook-card__action {
        min-width: 96px;
        padding: 10px 20px !important;
    }
}
