/**
 * Keap Payment Modal Styles
 * Modern, clean modal design for payment form
 */

/* Modal Overlay */
.iw-keap-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999999;
    animation: iwFadeIn 0.2s ease-out;
}

.iw-keap-modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal Container */
.iw-keap-modal {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    animation: iwSlideUp 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

/* Modal Header */
.iw-keap-modal-header {
    padding: 24px 24px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(to bottom, #ffffff 0%, #fafafa 100%);
}

.iw-keap-modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.iw-keap-modal-title svg {
    width: 24px;
    height: 24px;
    color: #10b981;
}

.iw-keap-modal-close {
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    transition: all 0.2s;
}

.iw-keap-modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Modal Body */
.iw-keap-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Order Summary */
.iw-keap-order-summary {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.iw-keap-order-summary h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.iw-keap-order-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
}

.iw-keap-order-email {
    margin-top: 8px;
    font-size: 14px;
    color: #6b7280;
}

.iw-keap-order-email strong {
    color: #374151;
}

/* Payment Form Container */
.iw-keap-payment-form {
    margin-top: 20px;
}

.iw-keap-payment-form keap-payment-method {
    display: block;
    margin: 0 auto;
}

/* Loading State */
.iw-keap-loading {
    text-align: center;
    padding: 40px 20px;
}

.iw-keap-loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top-color: #10b981;
    border-radius: 50%;
    animation: iwSpin 0.8s linear infinite;
}

.iw-keap-loading-text {
    margin-top: 16px;
    font-size: 14px;
    color: #6b7280;
}

/* Error Messages */
.iw-keap-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    color: #991b1b;
    font-size: 14px;
    display: none;
}

.iw-keap-error.active {
    display: block;
    animation: iwShake 0.5s;
}

.iw-keap-error strong {
    display: block;
    margin-bottom: 4px;
}

/* Modal Footer */
.iw-keap-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: #fafafa;
}

.iw-keap-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.iw-keap-btn-cancel {
    background: #ffffff;
    color: #374151;
    border: 1px solid #d1d5db;
}

.iw-keap-btn-cancel:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.iw-keap-btn-pay {
    background: #10b981;
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.3);
}

.iw-keap-btn-pay:hover {
    background: #059669;
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.4);
}

.iw-keap-btn-pay:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    box-shadow: none;
}

/* Pay Button on Checkout Page */
.payment_method_infusionsoft_cc .iw-keap-pay-button,
.iw-keap-pay-button {
    margin-top: 12px;
    width: 100%;
    padding: 16px;
    background: #00C176; /* Keap brand green */
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0, 193, 118, 0.3);
    line-height: 1;
}

.payment_method_infusionsoft_cc .iw-keap-pay-button svg,
.iw-keap-pay-button svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.payment_method_infusionsoft_cc .iw-keap-pay-button:hover,
.iw-keap-pay-button:hover:not(:disabled) {
    background: #00A863; /* Slightly darker on hover */
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 193, 118, 0.4);
}

.iw-keap-pay-button:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.payment_method_infusionsoft_cc .iw-keap-pay-button svg {
    width: 20px;
    height: 20px;
}

.payment_method_infusionsoft_cc .iw-keap-payment-ready {
    margin-top: 12px;
    padding: 12px 16px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    color: #065f46;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.payment_method_infusionsoft_cc .iw-keap-payment-ready svg {
    width: 20px;
    height: 20px;
    color: #10b981;
}

/* Animations */
@keyframes iwFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes iwSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes iwSpin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes iwShake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .iw-keap-modal {
        width: 95%;
        max-height: 95vh;
        border-radius: 12px 12px 0 0;
        align-self: flex-end;
        animation: iwSlideUpMobile 0.3s ease-out;
    }

    .iw-keap-modal-header {
        padding: 20px 16px 16px;
    }

    .iw-keap-modal-title {
        font-size: 18px;
    }

    .iw-keap-modal-body {
        padding: 16px;
    }

    .iw-keap-modal-footer {
        padding: 12px 16px;
        flex-direction: column-reverse;
    }

    .iw-keap-btn {
        width: 100%;
        justify-content: center;
    }

    .iw-keap-order-total {
        font-size: 20px;
    }
}

@keyframes iwSlideUpMobile {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Accessibility */
.iw-keap-modal:focus {
    outline: 2px solid #10b981;
    outline-offset: 2px;
}

.iw-keap-btn:focus {
    outline: 2px solid #10b981;
    outline-offset: 2px;
}

/* Always use light mode for consistency */

/* Hide WooCommerce's default "Add payment method" button when modal is active */
.woocommerce-MyAccount-content form#add_payment_method .button {
    display: none !important;
}
