/**
 * 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;
    /* WCAG AA on the white method card: #9ca3af was 2.54:1, #6b7280 is 4.84:1. */
    color: #6b7280;
    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;
    /* Absolute: this pill sits inside the 0.97em method label, so an em value
       compounds down to ~9.6px. */
    font-size: 11px;
    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 {
    /* Absolute + opaque: .pfm-unlock drops to 0.82em at <=768px, which used to
       compound this to ~10.2px, and #b45309 at .85 opacity measured 3.74:1 on
       the amber card. #92400e opaque is 6.8:1. */
    font-size: 12px;
    color: #92400e;
    margin-top: 2px;
    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
   ============================================================ */

@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; }
}

/* ============================================================
   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: 12px;
        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: 12px;
        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;
}

/* ============================================================
   VERIFICATION PANEL — FAQ DISCLOSURE
   The only part of the old vertical stepper that survived: the boarding-pass
   renderer (renderBoardingPass in assets/js/phantomshield-payfees.js) still
   emits .pfm-stepper-faq / .pfm-faq-*. Everything else it draws is styled by
   the <style id="pfm-bp-style"> block that same file injects.
   ============================================================ */

.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;
}

/* Keyboard focus must stay visible. The :focus rule above only suppresses the
   ring for pointer users; without this, a keyboard shopper tabbing through the
   payment panel had no indicator at all from this sheet. Mirrors the
   .pfm-st-faq:focus-visible rule that assets/js/phantomshield-payfees.js injects
   at runtime, so the ring survives even if that <style> never lands.
   #16a34a is 3.3:1 on the white method card (WCAG 1.4.11). */
.pfm-faq-toggle:focus-visible {
    outline: 2px solid #16a34a;
    outline-offset: 2px;
}

.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;
}

/* 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; }
}

/* ============================================================
   ENTRY — injected UI eases in instead of popping
   The fee info, brand marks, badges and unlock card are added
   by JS after first paint; a 220ms fade/slide makes that
   arrival feel intentional. Plays once per element (the JS
   signature-skip guarantees nodes are not rebuilt on idle
   passes). The prefers-reduced-motion block above disables it.
   ============================================================ */
.pfm-fee-info,
.pfm-brand-marks,
.pfm-badge-recommended,
.pfm-unlock {
    animation: pfm-in .22s cubic-bezier(.2, .7, .2, 1) both;
}

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