/**
 * Payment Fees Manager - Frontend CSS v3.0.0
 * Premium card layout — polished, structured, modern.
 */

/* ============================================================
   BASE RESET FOR PAYMENT LIST
   ============================================================ */

.wc_payment_methods {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

/* ============================================================
   CARD — each payment method
   ============================================================ */

.wc_payment_methods .wc_payment_method {
    position: relative;
    border: 1.5px solid #e8eaed;
    border-radius: 14px;
    padding: 18px 20px 16px;
    margin: 0 !important;
    background: #ffffff;
    transition: border-color 0.22s ease, box-shadow 0.22s ease, transform 0.18s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.wc_payment_methods .wc_payment_method::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    opacity: 0;
    transition: opacity 0.22s ease;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(100, 200, 110, 0.03) 0%, transparent 60%);
}

.wc_payment_methods .wc_payment_method:hover:not(.pfm-method-disabled) {
    border-color: #c8cbd0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.wc_payment_methods .wc_payment_method:hover:not(.pfm-method-disabled)::before {
    opacity: 1;
}

/* ── SELECTED state ── */
.wc_payment_methods .wc_payment_method:has(input[type="radio"]:checked) {
    border-color: #22c55e;
    border-width: 2px;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.10), 0 4px 20px rgba(34, 197, 94, 0.08);
    transform: translateY(-1px);
}

.wc_payment_methods .wc_payment_method:has(input[type="radio"]:checked)::before {
    opacity: 1;
}

/* ── Label row ── */
.wc_payment_methods .wc_payment_method label {
    font-weight: 600;
    font-size: 0.97em;
    color: #1a1d23;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    letter-spacing: -0.01em;
}

/* ── Radio button styling ── */
.wc_payment_methods .wc_payment_method input[type="radio"] {
    accent-color: #22c55e;
    width: 17px;
    height: 17px;
    cursor: pointer;
    flex-shrink: 0;
}

/* ============================================================
   FEE INFO BLOCK
   ============================================================ */

.pfm-fee-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 12px 0 0 26px;
}

/* ── Total price ── */
.pfm-method-total {
    font-size: 1.55em;
    font-weight: 800;
    color: #0f1117;
    line-height: 1.2;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

/* ── Tags row ── */
.pfm-fee-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* ── Base tag ── */
.pfm-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.775em;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    line-height: 1.4;
    white-space: nowrap;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
}

/* No fees */
.pfm-tag-free {
    background: #f0fdf4;
    color: #15803d;
    border-color: #bbf7d0;
}

/* Commission */
.pfm-tag-commission {
    background: #fff7ed;
    color: #c2410c;
    border-color: #fed7aa;
}

/* Discount */
.pfm-tag-discount {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

/* Processing fee */
.pfm-tag-processing {
    background: #fefce8;
    color: #92400e;
    border-color: #fde68a;
}

/* Custom badge */
.pfm-tag-badge {
    background: #faf5ff;
    color: #6d28d9;
    border-color: #ddd6fe;
}

/* ── Description ── */
.pfm-description {
    font-size: 0.82em;
    color: #9ca3af;
    margin-top: 0;
    font-style: italic;
    letter-spacing: 0.005em;
}

/* ============================================================
   RECOMMENDED BADGE
   ============================================================ */

.pfm-badge-recommended {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: #fff;
    font-size: 0.62em;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 3px 9px;
    border-radius: 20px;
    text-transform: uppercase;
    vertical-align: middle;
    margin-left: 8px;
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.3);
    flex-shrink: 0;
}

.wc_payment_methods .pfm-recommended {
    border-color: #22c55e !important;
    border-width: 2px !important;
}

/* Accent bar on recommended card (classic checkout only — the block
   option uses its own inset box-shadow accent further down) */
.wc_payment_methods .pfm-recommended::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #22c55e, #16a34a);
    border-radius: 14px 0 0 14px;
}

/* ============================================================
   DISABLED STATE
   ============================================================ */

/* Classic checkout only — the !important overrides must not leak into the
   block option, which has its own dim (opacity 0.65) further down. */
.wc_payment_methods .pfm-method-disabled {
    opacity: 1 !important;
    background: #f9fafb !important;
    border-color: #e5e7eb !important;
    border-width: 1.5px !important;
    transform: none !important;
    box-shadow: none !important;
}

.pfm-method-disabled label {
    cursor: not-allowed;
    color: #9ca3af;
}

.pfm-method-disabled input[type="radio"] {
    pointer-events: none;
    opacity: 0.25;
}

.pfm-method-disabled .pfm-method-total {
    color: #d1d5db;
    text-decoration: line-through;
    text-decoration-color: #d1d5db;
    text-decoration-thickness: 2px;
}

.pfm-method-disabled .pfm-badge-recommended {
    background: linear-gradient(135deg, #9ca3af, #d1d5db);
    box-shadow: none;
}

.wc_payment_methods .pfm-method-disabled.pfm-recommended {
    border-color: #d1d5db !important;
    border-width: 1.5px !important;
}

.wc_payment_methods .pfm-method-disabled.pfm-recommended::after {
    background: linear-gradient(180deg, #d1d5db, #9ca3af);
}

.pfm-method-disabled .pfm-fee-tags .pfm-tag {
    opacity: 0.5;
}

/* ============================================================
   MINIMUM AMOUNT — premium "unlock" card
   ============================================================ */

.pfm-unlock {
    margin: 13px 0 2px 26px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #fffef9 0%, #fffbeb 100%);
    border: 1px solid #fde68a;
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.06);
    transition: all 0.3s ease;
}

.pfm-unlock:hover {
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.1);
    transform: translateY(-1px);
}

.pfm-unlock__row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pfm-unlock__ic {
    flex: none;
    width: 52px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.25), inset 0 1px 0 rgba(255,255,255,0.3);
    color: #ffffff;
    overflow: visible;
}

/* Card + lock composite icon */
.pfm-card-lock-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pfm-card-svg {
    display: block;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.18));
}

/* Lock badge — bottom-right corner of the card */
.pfm-lock-badge {
    position: absolute;
    bottom: -6px;
    right: -8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d97706, #b45309);
    box-shadow: 0 2px 6px rgba(180, 83, 9, 0.55), 0 0 0 2px #fde68a;
    animation: pfm-badge-pulse 2s ease-in-out infinite;
}

.pfm-lock-svg {
    display: block;
    width: 9px;
    height: 10px;
}

/* Shackle bounce: moves the shackle path up to simulate open→close */
.pfm-lock-shackle {
    animation: pfm-shackle-bounce 2s ease-in-out infinite;
    transform-origin: center bottom;
}

/* Transform-only (GPU-composited): .pfm-lock-badge keeps its static box-shadow, so this infinite
   animation no longer repaints a box-shadow every frame on the checkout. */
@keyframes pfm-badge-pulse {
    0%, 100% { transform: scale(1); }
    40%      { transform: scale(1.18); }
    60%      { transform: scale(0.95); }
}

@keyframes pfm-shackle-bounce {
    0%, 30%, 100% { transform: translateY(0); }
    15%            { transform: translateY(-2px); }
    45%            { transform: translateY(0); }
}

.pfm-unlock__txt {
    flex: 1;
    min-width: 0;
}

.pfm-unlock__title {
    font-size: 0.95em;
    font-weight: 700;
    color: #78350f;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.pfm-unlock__title strong {
    color: #ea580c;
    font-weight: 800;
}

.pfm-unlock__sub {
    font-size: 0.78em;
    color: #b45309;
    margin-top: 2px;
    opacity: 0.85;
    font-variant-numeric: tabular-nums;
}

.pfm-unlock__pct {
    flex: none;
    font-size: 0.95em;
    font-weight: 800;
    color: #d97706;
    font-variant-numeric: tabular-nums;
}

.pfm-unlock__bar {
    height: 8px;
    border-radius: 6px;
    background: #fef3c7;
    overflow: hidden;
    margin-top: 12px;
    box-shadow: inset 0 1px 2px rgba(180, 83, 9, 0.18);
}

.pfm-unlock__bar > span {
    display: block;
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.6);
    position: relative;
    overflow: hidden;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.pfm-unlock__bar > span::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    transform: translateX(-120%);
    animation: pfm-sheen 2.1s ease-in-out infinite;
}

@keyframes pfm-sheen {
    60%, 100% { transform: translateX(120%); }
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes pfm-fade-in {
    from { opacity: 0; transform: translateY(3px); }
    to   { opacity: 1; transform: translateY(0); }
}

.pfm-fee-info,
.pfm-unlock {
    animation: pfm-fade-in 0.22s ease both;
}

@media (prefers-reduced-motion: reduce) {
    .pfm-unlock__bar > span { transition: none; }
    .pfm-unlock__bar > span::after { animation: none; }
    .pfm-fee-info, .pfm-unlock { animation: none; }
    .pfm-lock-badge { animation: none; }
    .pfm-lock-shackle { animation: none; }
    .pfm-step-active .pfm-step-number-icon { animation: none; }
}

/* ============================================================
   BLOCK-CHECKOUT DESKTOP DEFAULTS (declared before RESPONSIVE so the
   max-width media queries below can override them at equal specificity)
   ============================================================ */

/* When the option uses a left radio + label group, indent the info to align under the label */
.wc-block-components-radio-control__option .pfm-fee-info--block {
    margin-left: 28px;
}
.wc-block-components-radio-control__option .pfm-unlock {
    margin-left: 28px;
}
.pfm-fee-info--block .pfm-method-total {
    font-size: 1.35em;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .wc_payment_methods .wc_payment_method {
        padding: 15px 16px 14px;
        border-radius: 12px;
    }

    .pfm-fee-info {
        margin-left: 22px;
        gap: 7px;
    }

    .pfm-method-total {
        font-size: 1.3em;
    }

    .pfm-tag {
        font-size: 0.74em;
        padding: 3px 9px;
    }

    .pfm-unlock {
        margin-left: 22px;
        font-size: 0.82em;
        padding: 10px 12px;
    }

    /* Block checkout — match the classic mobile reductions (the base block
       rules out-specify the bare selectors above, so repeat them scoped). */
    .pfm-fee-info--block .pfm-method-total {
        font-size: 1.3em;
    }
    .wc-block-components-radio-control__option .pfm-fee-info--block,
    .wc-block-components-radio-control__option .pfm-unlock {
        margin-left: 22px;
    }
}

@media (max-width: 480px) {
    .wc_payment_methods .wc_payment_method {
        padding: 12px 14px 12px;
        border-radius: 10px;
    }

    .pfm-fee-info {
        margin-left: 18px;
    }

    .pfm-method-total {
        font-size: 1.2em;
    }

    .pfm-tag {
        font-size: 0.72em;
        padding: 3px 8px;
    }

    .pfm-unlock {
        margin-left: 18px;
    }

    /* Block checkout — same reductions as classic at this width. */
    .pfm-fee-info--block .pfm-method-total {
        font-size: 1.2em;
    }
    .wc-block-components-radio-control__option .pfm-fee-info--block,
    .wc-block-components-radio-control__option .pfm-unlock {
        margin-left: 18px;
    }
}

/* ============================================================
   BLOCK CHECKOUT (WooCommerce Checkout/Cart blocks)
   The same fee info, adapted to .wc-block-components-radio-control__option.
   ============================================================ */

.wc-block-components-radio-control__option.pfm-recommended {
    box-shadow: inset 4px 0 0 0 #22c55e;
}
.wc-block-components-radio-control__option.pfm-method-disabled {
    opacity: 0.65;
}
.wc-block-components-radio-control__option.pfm-method-disabled .pfm-method-total {
    color: #d1d5db;
    text-decoration: line-through;
    text-decoration-color: #d1d5db;
    text-decoration-thickness: 2px;
}
.wc-block-components-radio-control__option .pfm-badge-recommended {
    margin-left: 8px;
}

.pfm-fee-info--block {
    margin: 10px 0 4px 0;
    padding-left: 0;
}

/* ============================================================
   PAYMENT STEPPER — TWO-STEP VERIFICATION
   ============================================================ */

.pfm-instructions-stepper {
    margin: 12px 0 4px 0;
    padding: 4px 0;
}

.pfm-instructions-intro {
    font-size: 0.9em;
    font-weight: 600;
    color: #4b5563;
    margin: 0 0 14px 0 !important;
    line-height: 1.4;
}

.pfm-stepper-container {
    display: flex;
    flex-direction: column;
    position: relative;
    gap: 16px;
}

/* Vertical connector line */
.pfm-stepper-container::before {
    content: '';
    position: absolute;
    left: 17px;
    top: 28px;
    bottom: 28px;
    width: 2px;
    background: linear-gradient(180deg, #22c55e 0%, #e5e7eb 100%);
    z-index: 1;
}

.pfm-stepper-step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    position: relative;
    z-index: 2;
}

.pfm-step-number-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    transition: all 0.3s ease;
    align-self: flex-start;
    margin-top: 4px;
}

@keyframes pfm-pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Active Step Style */
.pfm-step-active .pfm-step-number-icon {
    background-color: #22c55e;
    color: #ffffff;
    animation: pfm-pulse-ring 2s infinite;
}

.pfm-step-active .pfm-step-heading {
    color: #111827;
}

/* Pending Step Style */
.pfm-step-pending .pfm-step-number-icon {
    background-color: #f3f4f6;
    color: #9ca3af;
    border: 2px solid #e5e7eb;
}

.pfm-step-pending .pfm-step-heading {
    color: #6b7280;
}

.pfm-step-text-content {
    flex-grow: 1;
    background: #ffffff;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    transition: all 0.25s ease;
}

.pfm-step-active .pfm-step-text-content {
    border-color: #22c55e;
    background: linear-gradient(135deg, #ffffff 0%, #f6fdf9 100%);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.03);
}

.pfm-step-text-content:hover {
    transform: translateY(-2px);
}

.pfm-step-active .pfm-step-text-content:hover {
    border-color: #22c55e;
    box-shadow: 0 12px 24px -4px rgba(34, 197, 94, 0.12), 0 8px 12px -6px rgba(34, 197, 94, 0.04);
}

.pfm-step-pending .pfm-step-text-content:hover {
    border-color: #cbd5e1;
    box-shadow: 0 12px 24px -4px rgba(0, 0, 0, 0.06), 0 8px 12px -6px rgba(0, 0, 0, 0.02);
}

.pfm-step-svg {
    width: 16px;
    height: 16px;
    display: block;
}

.pfm-paypal-logo-svg {
    width: 14px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.pfm-step-heading {
    margin: 0 0 5px 0 !important;
    font-size: 0.95em;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    line-height: 1.3;
}

.pfm-step-badge-price {
    font-size: 0.85em;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 12px;
}

.pfm-step-active .pfm-step-badge-price {
    background-color: #ecfdf5;
    color: #15803d;
}

.pfm-step-pending .pfm-step-badge-price {
    background-color: #f3f4f6;
    color: #6b7280;
}

.pfm-step-description {
    margin: 0 !important;
    font-size: 0.82em;
    color: #6b7280;
    line-height: 1.45;
}

/* Adjustments when rendered inside .payment_box (classic) */
.payment_box .pfm-instructions-stepper {
    margin-top: 0;
}

@media (max-width: 768px) {
    .pfm-stepper-container::before {
        left: 14px;
        top: 20px;
        bottom: 20px;
    }
    .pfm-step-number-icon {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    .pfm-step-text-content {
        padding: 10px 12px;
    }
}

/* Card brands inside step 2 */
.pfm-card-brands {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

.pfm-card-brand-svg {
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    display: block;
}

/* FAQ Accordion Section */
.pfm-stepper-faq {
    margin-top: 16px;
    border-top: 1px dashed #e5e7eb;
    padding-top: 12px;
}

.pfm-faq-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    color: #4b5563;
    font-size: 0.82em;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: color 0.2s ease;
}

.pfm-faq-toggle:hover {
    color: #111827;
}

.pfm-faq-toggle:focus {
    outline: none;
    box-shadow: none;
}

.pfm-faq-chevron {
    width: 14px;
    height: 14px;
    color: #9ca3af;
    transition: transform 0.2s ease, color 0.2s ease;
}

.pfm-faq-toggle:hover .pfm-faq-chevron {
    color: #4b5563;
}

.pfm-faq-content {
    margin-top: 8px;
    color: #6b7280;
    font-size: 0.78em;
    line-height: 1.5;
}

.pfm-faq-content p {
    margin: 0 !important;
    padding: 0 !important;
}

/* Open State of FAQ Accordion */
.pfm-faq-active .pfm-faq-chevron {
    transform: rotate(180deg);
    color: #111827;
}

.pfm-faq-active .pfm-faq-toggle {
    color: #111827;
}

/* Mobile optimizations (< 480px) */
@media (max-width: 480px) {
    .pfm-stepper-container {
        gap: 12px;
    }
    .pfm-stepper-container::before {
        left: 12px;
        top: 24px;
        bottom: 24px;
    }
    .pfm-stepper-step {
        gap: 10px;
    }
    .pfm-step-number-icon {
        width: 24px;
        height: 24px;
        font-size: 10px;
        margin-top: 6px;
    }
    .pfm-step-svg {
        width: 12px;
        height: 12px;
    }
    .pfm-step-text-content {
        padding: 8px 10px;
    }
    .pfm-step-heading {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .pfm-step-badge-price {
        align-self: flex-start;
        margin-top: 2px;
        font-size: 0.8em;
        padding: 1px 6px;
    }
    .pfm-card-brands {
        margin-left: 0;
    }
    .pfm-paypal-logo-svg {
        width: 12px;
        height: 14px;
    }
}


/* Accessibility + performance: honour the visitor's "reduce motion" OS preference by stopping the
   looping checkout animations (badge pulse, shackle bounce, sheen, step pulse-ring) — no infinite
   repaints for those visitors, and no motion for users who get distracted/sick by it. */
@media (prefers-reduced-motion: reduce) {
    [class*="pfm-"], [class*="pfm-"]::before, [class*="pfm-"]::after { animation: none !important; }
}
