/* FinancialOPD Checkout Auth Modal — v2.0 */

/* ── Hide LearnPress auth blocks on checkout ── */
.learn-press-checkout #checkout-account-login,
.learn-press-checkout #checkout-account-register,
.learn-press-checkout #checkout-account-guest,
.learn-press-checkout .lp-checkout-form-account,
.learn-press-checkout [for="checkout-account-switch-to-login"],
.learn-press-checkout [for="checkout-account-switch-to-register"],
.learn-press-checkout [for="checkout-account-switch-to-guest"],
.learn-press-checkout input[name="checkout-account-switch-form"],
.learn-press-checkout .lp-checkout-account-block,
#learn-press-checkout .lp-checkout-form-account { display: none !important; }

/* ── Overlay ── */
#fnd-auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px 20px;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms cubic-bezier(0.23, 1, 0.32, 1);
}
#fnd-auth-overlay.is-open {
    opacity: 1;
    pointer-events: all;
}
#fnd-auth-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.52);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* ── Panel ── */
#fnd-auth-panel {
    position: relative;
    background: #fff;
    border-radius: 24px;
    padding: 36px 32px 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.06), 0 24px 80px rgba(0,0,0,0.18);
    transform: translateY(18px) scale(0.97);
    transition: transform 280ms cubic-bezier(0.23, 1, 0.32, 1);
    margin: auto;
}
#fnd-auth-overlay.is-open #fnd-auth-panel {
    transform: translateY(0) scale(1);
}

/* ── Close button ── */
#fnd-auth-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 140ms ease, transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}
#fnd-auth-close:hover { background: #e5e7eb; }
#fnd-auth-close:active { transform: scale(0.90); }

/* ── Logo ── */
#fnd-auth-logo {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
}
#fnd-auth-logo img {
    height: 28px;
    width: auto;
    display: block;
    object-fit: contain;
}

/* ── Step enter animation ── */
.fnd-step.is-entering {
    animation: fnd-step-in 260ms cubic-bezier(0.23, 1, 0.32, 1) both;
}
@keyframes fnd-step-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Typography ── */
.fnd-step h2 {
    font-size: 1.35rem;
    font-weight: 800;
    color: #111827;
    letter-spacing: -0.03em;
    margin: 0 0 6px;
    line-height: 1.2;
}
.fnd-sub {
    font-size: 0.84rem;
    color: #6b7280;
    margin: 0 0 20px;
    line-height: 1.5;
}

/* ── Phone field ── */
.fnd-field-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid #d1d5db;
    border-radius: 14px;
    overflow: hidden;
    transition: border-color 160ms ease, box-shadow 160ms ease;
    margin-bottom: 8px;
}
.fnd-field-wrap:focus-within {
    border-color: #009356;
    box-shadow: 0 0 0 3px rgba(0, 147, 86, 0.12);
}
.fnd-prefix {
    padding: 15px 12px 15px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
    background: #f9fafb;
    border-right: 0;
    white-space: nowrap;
}
.fnd-field-wrap input {
    flex: 1;
    border: 0 !important;
    outline: 0 !important;
    padding: 15px 16px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #111827;
    background: #fff;
    font-family: inherit;
    min-width: 0;
    letter-spacing: 0.05em;
}
.fnd-field-wrap input:focus,
.fnd-field-wrap input:focus-visible {
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
}
.fnd-field-wrap input::placeholder {
    color: #9ca3af;
    font-weight: 400;
    letter-spacing: 0;
}

/* ── OTP boxes ── */
.fnd-otp-boxes {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}
.fnd-otp-box {
    aspect-ratio: 1;
    border: 1.5px solid #d1d5db;
    border-radius: 12px;
    font-size: 1.45rem;
    font-weight: 700;
    color: #111827;
    text-align: center;
    background: #fff;
    font-family: inherit;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease, transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
    width: 100%;
    padding: 0;
    caret-color: transparent;
    -webkit-appearance: none;
    appearance: none;
}
.fnd-otp-box:focus {
    border-color: #009356;
    box-shadow: 0 0 0 3px rgba(0, 147, 86, 0.12);
    background: #f0fdf8;
    transform: scale(1.05);
}
.fnd-otp-box.is-filled {
    border-color: #009356;
    background: #f0fdf8;
}

/* ── Standalone inputs (profile panel) ── */
.fnd-step input:not(.fnd-field-wrap input):not(.fnd-otp-box) {
    display: block;
    width: 100%;
    border: 1.5px solid #d1d5db;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #111827;
    background: #fff;
    font-family: inherit;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease;
    margin-bottom: 10px;
    box-sizing: border-box;
}
.fnd-step input:not(.fnd-field-wrap input):not(.fnd-otp-box):focus {
    border-color: #009356;
    box-shadow: 0 0 0 3px rgba(0, 147, 86, 0.12);
}

/* ── Primary button ── */
.fnd-btn-primary {
    display: block !important;
    width: 100% !important;
    padding: 15px 24px !important;
    background: #009356 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 12px !important;
    font-size: 0.93rem !important;
    font-weight: 700 !important;
    font-family: inherit !important;
    cursor: pointer !important;
    margin-top: 16px !important;
    transition: background 140ms ease, transform 160ms cubic-bezier(0.23, 1, 0.32, 1), box-shadow 160ms ease !important;
    line-height: 1 !important;
    letter-spacing: 0.01em !important;
    box-shadow: none !important;
    text-transform: none !important;
}
.fnd-btn-primary:hover:not(:disabled) {
    background: #007d49 !important;
    box-shadow: 0 4px 18px rgba(0, 147, 86, 0.28) !important;
}
.fnd-btn-primary:active:not(:disabled) { transform: scale(0.97) !important; }
.fnd-btn-primary:focus-visible {
    outline: 2.5px solid #009356 !important;
    outline-offset: 3px !important;
}
.fnd-btn-primary:disabled {
    background: #e5e7eb !important;
    cursor: not-allowed !important;
    color: #9ca3af !important;
    box-shadow: none !important;
}

/* ── Back link ── */
.fnd-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    font-size: 0.78rem;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    margin-bottom: 18px;
    font-family: inherit;
    transition: color 120ms ease, transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}
.fnd-back:hover { color: #111827; }
.fnd-back:active { transform: translateX(-3px); opacity: 0.7; }

/* ── Link button ── */
.fnd-link {
    display: block;
    background: none;
    border: none;
    font-size: 0.82rem;
    font-weight: 600;
    color: #009356;
    cursor: pointer;
    text-align: center;
    margin-top: 12px;
    font-family: inherit;
    padding: 0;
    transition: color 120ms ease;
}
.fnd-link:hover { color: #007d49; }
.fnd-link:active { opacity: 0.6; }

/* ── Error + shake ── */
.fnd-error {
    font-size: 0.78rem;
    color: #ef4444;
    min-height: 18px;
    margin-bottom: 4px;
    line-height: 1.4;
}
.fnd-error.is-shaking {
    animation: fnd-shake 320ms cubic-bezier(0.23, 1, 0.32, 1);
}
@keyframes fnd-shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-3px); }
    80%       { transform: translateX(3px); }
}

/* ── Timer ── */
.fnd-timer {
    font-size: 0.76rem;
    color: #9ca3af;
    text-align: center;
    margin: 8px 0 4px;
    min-height: 18px;
}

/* ── Success ── */
.fnd-success-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(0, 147, 86, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 8px auto 20px;
    animation: fnd-pop 380ms cubic-bezier(0.23, 1, 0.32, 1) both;
}
@keyframes fnd-pop {
    from { transform: scale(0.5); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}
.fnd-success-icon svg polyline {
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
    animation: fnd-draw 380ms cubic-bezier(0.23, 1, 0.32, 1) 220ms forwards;
}
@keyframes fnd-draw { to { stroke-dashoffset: 0; } }

#fnd-step-success { text-align: center; }
#fnd-step-success h2 { justify-content: center; }

/* ── Loading spinner ── */
.fnd-btn-primary.is-loading {
    position: relative;
    color: transparent !important;
}
.fnd-btn-primary.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: fnd-spin 0.6s linear infinite;
}
@keyframes fnd-spin { to { transform: rotate(360deg); } }

/* ── Autobuy loading screen ── */
#fnd-autobuy-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 14px;
    animation: fnd-fade-in 200ms ease both;
}
@keyframes fnd-fade-in { from { opacity: 0; } to { opacity: 1; } }
#fnd-autobuy-overlay .fnd-ab-spin {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: #009356;
    border-radius: 50%;
    animation: fnd-spin 0.65s linear infinite;
}
#fnd-autobuy-overlay p {
    font-size: 0.84rem;
    color: #6b7280;
    margin: 0;
    font-family: inherit;
}

/* ── Profile panel ── */
#fnd-profile-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms cubic-bezier(0.23, 1, 0.32, 1);
}
#fnd-profile-overlay.is-open {
    opacity: 1;
    pointer-events: all;
}
#fnd-profile-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.52);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
#fnd-profile-panel {
    position: relative;
    background: #fff;
    border-radius: 24px;
    padding: 36px 32px 32px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.06), 0 24px 80px rgba(0,0,0,0.18);
    animation: fnd-panel-in 320ms cubic-bezier(0.23, 1, 0.32, 1) both;
    overflow: visible;
}
@keyframes fnd-panel-in {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Labels ── */
.fnd-label {
    display: block;
    font-size: 0.70rem;
    font-weight: 700;
    color: #9ca3af;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 14px 0 5px;
}
.fnd-label:first-of-type { margin-top: 4px; }

/* ── State picker ── */
#fnd-state {
    display: none !important;
}
.fnd-state-picker {
    position: relative;
    z-index: 4;
}
.fnd-state-picker.is-open {
    z-index: 100001;
}
.fnd-state-button {
    display: block;
    width: 100%;
    border: 1.5px solid #d1d5db;
    border-radius: 12px;
    padding: 14px 42px 14px 16px;
    min-height: 52px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #111827;
    background: #fff;
    font-family: inherit;
    outline: none;
    background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    cursor: pointer;
    transition: border-color 160ms ease, box-shadow 160ms ease;
    box-sizing: border-box;
    text-align: left;
    line-height: 1.35;
    margin-bottom: 10px;
}
.fnd-state-picker.is-open .fnd-state-button {
    background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='18 15 12 9 6 15'/%3E%3C/svg%3E");
}
.fnd-state-button:focus {
    border-color: #009356;
    box-shadow: 0 0 0 3px rgba(0, 147, 86, 0.12);
}
.fnd-state-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 100002;
    display: none;
    max-height: 210px;
    overflow-y: auto;
    padding: 6px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    box-shadow: 0 18px 45px rgba(17, 24, 39, 0.18);
}
.fnd-state-picker.is-open .fnd-state-menu {
    display: block;
}
.fnd-state-menu button {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #111827;
    font: inherit;
    font-size: 0.88rem;
    text-align: left;
    cursor: pointer;
}
.fnd-state-menu button:hover,
.fnd-state-menu button:focus,
.fnd-state-menu button.is-selected {
    background: #ecfdf5;
    color: #007d49;
    outline: none;
}

/* ── Order received ── */
.fnd-lp-order-native {
    display: none !important;
}
.fnd-order-received {
    min-height: 62vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 72px 20px 80px;
    background:
        linear-gradient(180deg, #f8faf9 0%, #ffffff 100%);
}
.fnd-order-shell {
    width: 100%;
    max-width: 720px;
    padding: 36px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 18px 55px rgba(17, 24, 39, 0.08);
    animation: fnd-order-in 260ms cubic-bezier(0.23, 1, 0.32, 1) both;
}
@keyframes fnd-order-in {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.fnd-order-mark {
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #008f55;
    background: #eafaf2;
    box-shadow: inset 0 0 0 1px rgba(0, 143, 85, 0.12);
}
.fnd-order-eyebrow {
    margin: 24px 0 8px;
    color: #6b7280;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.fnd-order-shell h1 {
    margin: 0;
    color: #111827;
    font-size: clamp(2rem, 5vw, 3.25rem);
    line-height: 1.02;
    font-weight: 850;
    letter-spacing: 0;
}
.fnd-order-copy {
    max-width: 580px;
    margin: 14px 0 28px;
    color: #4b5563;
    font-size: 1.05rem;
    line-height: 1.6;
}
.fnd-order-course {
    display: grid;
    gap: 5px;
    padding: 18px 0;
    border-top: 1px solid #edf0f2;
    border-bottom: 1px solid #edf0f2;
}
.fnd-order-course span {
    color: #6b7280;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.fnd-order-course strong {
    color: #111827;
    font-size: 1.05rem;
    line-height: 1.4;
}
.fnd-order-actions {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 28px;
    flex-wrap: wrap;
}
.fnd-order-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 0 24px;
    border-radius: 8px;
    background: #009356;
    color: #ffffff !important;
    font-size: 0.95rem;
    font-weight: 800;
    text-decoration: none !important;
    transition: background 140ms ease, transform 150ms cubic-bezier(0.23, 1, 0.32, 1), box-shadow 150ms ease;
}
.fnd-order-primary:hover {
    background: #007d49;
    box-shadow: 0 10px 28px rgba(0, 147, 86, 0.22);
}
.fnd-order-primary:active {
    transform: scale(0.97);
}
.fnd-order-primary:focus-visible {
    outline: 3px solid rgba(0, 147, 86, 0.22);
    outline-offset: 3px;
}
.fnd-order-note {
    color: #6b7280;
    font-size: 0.92rem;
    font-weight: 600;
}

/* ── Mobile ── */
@media (max-width: 480px) {
    #fnd-auth-panel,
    #fnd-profile-panel {
        padding: 28px 20px 24px;
        border-radius: 20px;
    }
    .fnd-otp-boxes { gap: 6px; }
    .fnd-otp-box { font-size: 1.2rem; border-radius: 10px; }
    .fnd-order-received {
        align-items: flex-start;
        padding: 34px 16px 48px;
    }
    .fnd-order-shell {
        padding: 26px 20px;
    }
    .fnd-order-copy {
        font-size: 0.98rem;
    }
    .fnd-order-actions {
        display: grid;
        gap: 12px;
    }
    .fnd-order-primary {
        width: 100%;
    }
}
