.wsef-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    padding: 1.5rem;
}

.wsef-modal-content {
    background-color: #ffffff;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    padding: 2rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    position: relative;
    border: 1px solid #e2e8f0;
    animation: wsef_modal_slide_up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    /* Payment Element can grow tall (Link, bank redirects, saved-info fields),
       so the modal itself scrolls instead of being clipped by the viewport. */
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Keep the close button reachable/visible above scrolling content */
.wsef-modal-close {
    z-index: 2;
}

/* Slim, unobtrusive scrollbar for the modal itself */
.wsef-modal-content::-webkit-scrollbar {
    width: 8px;
}

.wsef-modal-content::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}

.wsef-modal-close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    background: none;
    border: none;
    font-size: 1.75rem;
    font-weight: 300;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.15s ease;
    padding: 0.25rem;
}

.wsef-modal-close:hover {
    color: #475569;
}

.wsef-modal-header {
    margin-bottom: 1.25rem;
}

.wsef-payment-header {
    margin: 0 0 0.25rem 0 !important;
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    color: #0f172a !important;
}

.wsef-payment-subheader {
    font-size: 0.85rem !important;
    color: #64748b !important;
    margin: 0 !important;
    line-height: 1.4 !important;
}

.wsef-payment-summary {
    margin: 1.25rem 0;
    padding: 0.85rem 1rem;
    background-color: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #475569;
}

.wsef-payment-summary strong {
    color: #2563eb;
    font-size: 1rem;
}

#wsef-elements-form {
    margin-bottom: 1.25rem;
    min-height: 120px;
    background-color: #ffffff;
}

#wsef-submit-button {
    width: 100%;
    background-color: #2563eb !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    border: none !important;
    border-radius: 8px !important;
    height: 48px;
    cursor: pointer;
    transition: background-color 0.2s ease !important;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.95rem !important;
}

#wsef-submit-button:hover:not(:disabled) {
    background-color: #1d4ed8 !important;
}

#wsef-submit-button:disabled {
    background-color: #cbd5e1 !important;
    color: #94a3b8 !important;
    cursor: not-allowed;
}

.wsef-error-text {
    color: #ef4444;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    display: none;
    padding: 0.75rem;
    background-color: #fef2f2;
    border-left: 4px solid #ef4444;
    border-radius: 4px;
}

.wsef-error-text.show {
    display: block;
    animation: wsef_shake 0.4s ease-in-out;
}

.wsef-secure-badge {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
}

.wsef-lock-icon {
    margin-right: 2px;
}

/* Spinner Icon CSS */
.wsef-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: wsef_spin 1s ease-in-out infinite;
    margin-right: 8px;
}

/* Animations */
@keyframes wsef_spin {
    to { transform: rotate(360deg); }
}

@keyframes wsef_shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.wsef-fade-in {
    animation: wsef_fade_in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes wsef_fade_in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes wsef_modal_slide_up {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Express Checkout (Apple Pay / Google Pay) */
.wsef-express-wrapper {
    margin-bottom: 1rem;
}

#wsef-express-checkout {
    min-height: 44px;
}

.wsef-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 1rem 0 0.75rem;
    color: #94a3b8;
    font-size: 0.8rem;
}

.wsef-divider::before,
.wsef-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}
