/**
 * Stripe Checkout Loading States
 * Matches NextGen.run design system with gradient animations
 */

/* Spinner Animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Spinner Icon */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

/* Button Loading State */
.btn-loading {
    opacity: 0.85;
    cursor: wait !important;
    position: relative;
    animation: pulse 1.5s ease-in-out infinite;
}

.btn-loading:hover {
    transform: none !important;
}

/* Button Success State */
.btn-success {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    opacity: 1 !important;
    animation: none !important;
}

.btn-success .checkmark {
    display: inline-block;
    font-size: 18px;
    margin-right: 8px;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Button Error State */
.btn-error {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    opacity: 1 !important;
    animation: shake 0.5s ease !important;
}

.btn-error .error-icon {
    display: inline-block;
    font-size: 18px;
    margin-right: 8px;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Checkout Subtext */
.checkout-subtext {
    font-size: 0.875rem;
    margin-top: 0.5rem;
    text-align: center;
    font-weight: 500;
    animation: slideUp 0.3s ease;
}

.checkout-subtext.info {
    color: var(--color-accent-cyan, #06b6d4);
}

.checkout-subtext.success {
    color: #10b981;
}

.checkout-subtext.error {
    color: #ef4444;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .spinner {
        width: 14px;
        height: 14px;
    }
    
    .checkout-subtext {
        font-size: 0.8125rem;
    }
}

/* Ensure button text is visible during loading */
.btn-loading,
.btn-success,
.btn-error {
    color: white !important;
}

/* Prevent layout shift when subtext appears */
.stripe-checkout-button {
    margin-bottom: 0;
}

.stripe-checkout-button + .checkout-subtext {
    min-height: 1.5rem;
}

.checkout-consent {
    display: grid;
    grid-template-columns: 1.2rem minmax(0, 1fr);
    gap: .65rem;
    align-items: start;
    margin: .9rem 0;
    padding: .85rem;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    background: #f8fafc;
    color: #475569;
    font-size: .78rem;
    line-height: 1.45;
    text-align: left;
}

.checkout-consent__input {
    width: 1.15rem;
    height: 1.15rem;
    margin: .12rem 0 0;
    accent-color: #0f766e;
}

.checkout-consent__input:focus-visible {
    outline: 3px solid rgba(20, 184, 166, .35);
    outline-offset: 3px;
}

.checkout-consent a {
    color: #0f766e;
    font-weight: 800;
}
