/* ============================================================
   BibleSoul — Unified Card Payment Modal
   Mobile-first, works on 320px → desktop
   ============================================================ */

/* Overlay */
.bsp-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(10, 15, 30, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.bsp-overlay.bsp-open {
    display: flex;
}

/* Modal box */
.bsp-modal {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 460px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0,0,0,0.22);
    position: relative;
    animation: bspSlideUp 0.28s cubic-bezier(0.34,1.56,0.64,1);
    scrollbar-width: thin;
}
.bsp-modal::-webkit-scrollbar { width: 4px; }
.bsp-modal::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }

@keyframes bspSlideUp {
    from { opacity: 0; transform: translateY(32px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

/* Header */
.bsp-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff;
    padding: 22px 24px 18px;
    border-radius: 20px 20px 0 0;
    position: relative;
}
.bsp-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.bsp-title {
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}
.bsp-close {
    background: rgba(255,255,255,0.18);
    border: none;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.bsp-close:hover { background: rgba(255,255,255,0.32); }

/* Order summary in header */
.bsp-order {
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: 10px;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.bsp-order-name {
    font-size: 0.85rem;
    opacity: 0.92;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bsp-order-amount {
    font-size: 1.3rem;
    font-weight: 800;
    white-space: nowrap;
}

/* Security badges */
.bsp-badges {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.bsp-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    opacity: 0.85;
    background: rgba(255,255,255,0.12);
    padding: 3px 8px;
    border-radius: 20px;
}

/* Body */
.bsp-body {
    padding: 22px 24px;
}

/* Section label */
.bsp-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #6b7280;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 10px;
    margin-top: 18px;
}
.bsp-label:first-child { margin-top: 0; }

/* Card preview */
.bsp-card-preview {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 60%, #4338ca 100%);
    border-radius: 14px;
    padding: 20px 22px;
    color: #fff;
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
    min-height: 120px;
}
.bsp-card-preview::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 160px; height: 160px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
}
.bsp-card-preview::after {
    content: '';
    position: absolute;
    bottom: -30px; left: -30px;
    width: 120px; height: 120px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
}
.bsp-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}
.bsp-card-chip {
    width: 36px;
    height: 28px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.3);
}
.bsp-card-type-logo {
    font-size: 0.72rem;
    font-weight: 700;
    opacity: 0.85;
    text-align: right;
}
.bsp-card-number-display {
    font-size: clamp(1rem, 3.5vw, 1.22rem);
    font-family: 'Courier New', monospace;
    letter-spacing: 0.18em;
    margin-bottom: 10px;
    opacity: 0.95;
    word-break: break-all;
}
.bsp-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 10px;
}
.bsp-card-meta-lbl { font-size: 0.6rem; opacity: 0.6; text-transform: uppercase; letter-spacing: 0.08em; }
.bsp-card-meta-val { font-size: 0.82rem; font-weight: 600; margin-top: 2px; }

/* Form fields */
.bsp-field { margin-bottom: 14px; }
.bsp-field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}
.bsp-input {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    color: #111827;
    background: #f9fafb;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
    outline: none;
    font-family: inherit;
}
.bsp-input::placeholder { color: #9ca3af; }
.bsp-input:focus {
    border-color: #4f46e5;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}
.bsp-input.bsp-error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
}
.bsp-input.bsp-valid {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16,185,129,0.1);
}

/* Card number with icon */
.bsp-card-input-wrap {
    position: relative;
}
.bsp-card-input-wrap .bsp-input {
    padding-right: 48px;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.12em;
}
.bsp-card-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.3rem;
    color: #9ca3af;
    pointer-events: none;
    transition: color 0.2s;
}
.bsp-card-icon.visa      { color: #1a1f71; }
.bsp-card-icon.mastercard{ color: #eb001b; }
.bsp-card-icon.amex      { color: #007bc1; }
.bsp-card-icon.discover  { color: #f76f20; }

/* Two-column row */
.bsp-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 360px) { .bsp-row { grid-template-columns: 1fr; } }

/* Field error message */
.bsp-field-error {
    font-size: 0.75rem;
    color: #ef4444;
    margin-top: 4px;
    display: none;
}
.bsp-field-error.bsp-show { display: block; }

/* Pay button */
.bsp-pay-btn {
    width: 100%;
    padding: 15px 20px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
    min-height: 52px;
    box-shadow: 0 4px 16px rgba(79,70,229,0.3);
}
.bsp-pay-btn:hover:not(:disabled) {
    opacity: 0.93;
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(79,70,229,0.36);
}
.bsp-pay-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

/* Processing state */
.bsp-processing {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
    gap: 16px;
}
.bsp-processing.bsp-show { display: flex; }
.bsp-spinner {
    width: 56px;
    height: 56px;
    border: 5px solid #e5e7eb;
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: bspSpin 0.8s linear infinite;
}
@keyframes bspSpin { to { transform: rotate(360deg); } }
.bsp-processing-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
}
.bsp-processing-sub {
    font-size: 0.87rem;
    color: #6b7280;
}

/* Success state */
.bsp-success {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 36px 24px 28px;
    text-align: center;
    gap: 12px;
}
.bsp-success.bsp-show { display: flex; }
.bsp-success-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #fff;
    animation: bspPop 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes bspPop {
    from { transform: scale(0.5); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}
.bsp-success-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: #065f46;
}
.bsp-success-sub { font-size: 0.88rem; color: #6b7280; }
.bsp-txn-box {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 12px 18px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.bsp-txn-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    gap: 8px;
    flex-wrap: wrap;
}
.bsp-txn-row span:first-child { color: #6b7280; }
.bsp-txn-row span:last-child  { font-weight: 700; color: #065f46; word-break: break-all; }
.bsp-done-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 13px 28px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 6px;
    min-height: 48px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.2s, transform 0.15s;
}
.bsp-done-btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* Error state */
.bsp-error-msg {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 10px;
    color: #b91c1c;
    padding: 12px 14px;
    font-size: 0.85rem;
    margin-top: 12px;
    display: none;
    align-items: flex-start;
    gap: 8px;
}
.bsp-error-msg.bsp-show { display: flex; }

/* Security note */
.bsp-security {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.74rem;
    color: #9ca3af;
    margin-top: 14px;
}

/* Mobile tweaks */
@media (max-width: 480px) {
    .bsp-modal { border-radius: 16px; }
    .bsp-header { padding: 18px 16px 14px; border-radius: 16px 16px 0 0; }
    .bsp-body { padding: 16px; }
    .bsp-card-preview { padding: 16px 18px; min-height: 100px; }
    .bsp-card-number-display { font-size: 0.95rem; letter-spacing: 0.14em; }
    .bsp-pay-btn { font-size: 0.98rem; padding: 14px 16px; }
}
@media (max-width: 360px) {
    .bsp-overlay { padding: 8px; }
    .bsp-order-amount { font-size: 1.1rem; }
}

/* ================================================================
   Separate Payment Success Modal  (.bsp-sm-*)
   ================================================================ */

.bsp-sm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100001;
    background: rgba(6, 12, 28, 0.80);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.32s ease;
}
.bsp-sm-overlay.bsp-sm-open {
    display: flex;
    opacity: 1;
}

.bsp-sm-modal {
    background: #fff;
    border-radius: 24px;
    width: 100%;
    max-width: 430px;
    padding: 44px 32px 36px;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(16,185,129,0.15),
        0 24px 64px rgba(16,185,129,0.22),
        0 8px 32px rgba(0,0,0,0.16);
    transform: scale(0.88) translateY(30px);
    transition: transform 0.38s cubic-bezier(0.34,1.56,0.64,1), opacity 0.32s ease;
    opacity: 0;
}
.bsp-sm-open .bsp-sm-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Animated top gradient bar */
.bsp-sm-modal::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #10b981, #34d399, #059669, #10b981);
    background-size: 300% 100%;
    animation: bspSmBar 2.4s linear infinite;
}
@keyframes bspSmBar {
    0%   { background-position: 0 0; }
    100% { background-position: 300% 0; }
}

/* Decorative background circle */
.bsp-sm-modal::after {
    content: '';
    position: absolute;
    top: -80px; right: -80px;
    width: 220px; height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(16,185,129,0.08) 0%, transparent 70%);
    pointer-events: none;
}

/* Icon with pulsing rings */
.bsp-sm-icon-wrap {
    position: relative;
    width: 96px;
    height: 96px;
    margin: 0 auto 24px;
}
.bsp-sm-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2.5px solid rgba(16,185,129,0.5);
    animation: bspSmRing 2.2s ease-out infinite;
    opacity: 0;
}
.bsp-sm-ring2 { animation-delay: 1.0s; }
@keyframes bspSmRing {
    0%   { transform: scale(0.85); opacity: 0.9; }
    100% { transform: scale(1.8);  opacity: 0; }
}
.bsp-sm-check {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    color: #fff;
    box-shadow: 0 10px 32px rgba(16,185,129,0.42);
    animation: bspSmCheckPop 0.45s 0.1s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes bspSmCheckPop {
    from { transform: scale(0.4); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

/* Title & subtitle */
.bsp-sm-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: #064e3b;
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}
.bsp-sm-sub {
    font-size: 0.88rem;
    color: #6b7280;
    margin: 0 0 22px;
    line-height: 1.6;
}

.bsp-sm-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #a7f3d0, transparent);
    margin: 0 0 20px;
}

/* Transaction detail box */
.bsp-sm-txn {
    background: #f0fdf4;
    border: 1.5px solid #a7f3d0;
    border-radius: 14px;
    padding: 6px 18px;
    margin-bottom: 24px;
    text-align: left;
}
.bsp-sm-txn-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 0;
    font-size: 0.84rem;
    border-bottom: 1px solid rgba(167,243,208,0.6);
    gap: 8px;
    flex-wrap: wrap;
}
.bsp-sm-txn-row:last-child { border-bottom: none; }
.bsp-sm-lbl {
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 6px;
}
.bsp-sm-lbl i { color: #10b981; font-size: 0.78rem; width: 14px; }
.bsp-sm-val {
    font-weight: 700;
    color: #065f46;
    word-break: break-all;
    text-align: right;
}
.bsp-sm-amount {
    font-size: 1.05rem;
    color: #059669;
}

/* Continue button */
.bsp-sm-btn {
    width: 100%;
    padding: 16px 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1.02rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 54px;
    box-shadow: 0 6px 20px rgba(16,185,129,0.36);
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
}
.bsp-sm-btn:hover {
    opacity: 0.92;
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(16,185,129,0.44);
}
.bsp-sm-btn:active { transform: translateY(0); }

/* Mobile */
@media (max-width: 480px) {
    .bsp-sm-modal  { padding: 36px 20px 28px; border-radius: 20px; }
    .bsp-sm-title  { font-size: 1.3rem; }
    .bsp-sm-icon-wrap { width: 80px; height: 80px; }
    .bsp-sm-check  { font-size: 2rem; }
    .bsp-sm-txn    { padding: 4px 14px; }
}
