/* copied styles from Stripe Embedded Checkout */

:root {
    --shimmer-width: 150%;
    --shimmer-duration: 3s;
}

body.modal-open .faq {
    overflow: hidden;
}

/* shimmer effect on the submit button in complete state */
@keyframes shimmer-move {
    0% {
        transform: translateX(calc(var(--shimmer-width) * -1));
    }
    to {
        transform: translateX(var(--shimmer-width));
    }
}

/* spinner animation on the submit button in processing state */
@keyframes spinner-spin {
    to {
        transform: rotate(1turn);
    }
}

.payment-modal {
    /* variables */

    --checkout-white: #ffffff;
    --checkout-gray50: hsla(0, 0%, 10%, 0.1);
    --checkout-gray300: hsla(0, 0%, 10%, 0.4);
    --checkout-gray400: hsla(0, 0%, 10%, 0.5);
    --checkout-gray600: hsla(0, 0%, 10%, 0.7);
    --checkout-gray800: hsla(0, 0%, 10%, 0.9);
    --checkout-red: #dc2727;

    --checkout-font-size-16: 16px;
    --checkout-font-size-14: 14px;
    --checkout-font-size-13: 13px;
    --checkout-font-size-12: 12px;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-6: 32px;

    --default-transition: 0.2s ease;

    --rounded: 6px;

    --checkout-lg-input-font-size: var(--checkout-font-size-16);
    --checkout-lg-input-height: 36px;
    --checkout-input-color: var(--checkout-gray800);
    --checkout-input-background-color: white;
    --checkout-input-line-height: 1.5;
    --checkout-input-padding-vertical: var(--space-2);
    --checkout-input-padding-horizontal: var(--space-3);
    --checkout-input-transition: box-shadow 0.08s ease-in, color 0.08s ease-in,
        filter 50000s;
    --checkout-z-index-input-is-invalid: 1;
    --checkout-z-index-input-is-focused: 2;
    --border-box-shadow: inset 0 1px 1px rgba(124, 124, 127, 0.1),
        0 1px 0 rgba(255, 255, 255, 0.7), 0 0 4px rgba(86, 149, 219, 0);
    --focus-border-box-shadow: inset 0 1px 1px rgba(76, 107, 153, 0.15),
        0 1px 0 rgba(255, 255, 255, 0), 0 0 6px #326cc0;
    --error-border-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0),
        0 1px 0 rgba(255, 255, 255, 0), 0 0 2px 0 rgba(255, 0, 0, 0.5);
    --checkout-input-invalid-color: var(--checkout-red);

    --checkout-text-font-size: var(--checkout-font-size-16);
    --checkout-text-font-color: var(--checkout-gray800);

    --checkout-icon-md: 16px;

    --button-height: 37px;
    --button-hover-shadow: inset 0 0 0 1px rgba(50, 50, 93, 0.1),
        0 6px 15px 0 rgba(50, 50, 93, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1);
    --button-success-background-color: #24b47e;

    --spinner-width: 20px;
    --success-spinner-move-duration: 0.3s;

    /* styles */

    line-height: 1.3;
    color: var(--checkout-text-font-color);
    font-size: var(--checkout-text-font-size);

    /* style overrides for the fullscreen mode (on mobile) */
    &.modal-fullscreen {
        .payment-modal-header-logo {
            margin-top: 0;
        }

        .payment-modal__header {
            height: 180px;
            background: rgb(43, 43, 43);
            .payment-modal__app-label {
                color: white;
            }
            .payment-modal__plan-label {
                color: white;
            }
        }

        .payment-modal__close-btn {
            color: white;
        }

        .payment-modal__body {
            padding: 0;
        }

        .payment-modal__content {
            background: white;
        }

        .payment-method-divider {
            .payment-method-divider__text {
                background: white;
            }
        }

        .payment-form {
            .payment-form__express-checkout-container {
                padding: 0 1rem;
            }

            .payment-form__input {
                border-radius: 0;
                box-shadow: none;
                border-top-color: #dededf;
                border-bottom-color: #dededf;
            }

            .payment-form__input:not(.StripeElement),
            .payment-form__card-number-input {
                border-left: none;
                border-right: none;
            }

            .payment-form__card-expiry-input {
                border-left: none;
            }

            .payment-form__card-cvc-input {
                border-right: none;
            }

            .payment-form__footer {
                .submit-button {
                    height: 100px;
                    font-size: 21px;
                    border-radius: 0;
                }
            }

            .payment-form__error-container--generic {
                padding: 0 1rem;
            }
        }
    }

    .payment-modal__header {
        gap: 0.5rem;
    }

    .payment-modal-header-logo {
        height: 70px;
        aspect-ratio: 1/1;
        margin-top: -67px;

        .payment-modal-header-logo__img {
            border-radius: 50%;
            border: 1px solid rgba(0, 0, 0, 0.2);
            width: 100%;
        }

        .payment-modal-header-logo__border {
            border: 3px solid white;
            box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18),
                0 2px 2px 0 rgba(0, 0, 0, 0.08);
            border-radius: 50%;
            background: white;
        }
    }

    .payment-form__express-checkout-container {
        gap: 8px;
    }

    .payment-modal__app-label {
        font-size: 1.1rem;
        font-weight: bold;
        color: black;
    }

    .payment-modal__plan-label {
        font-size: 0.85rem;
        font-weight: normal;
        color: #5b5b65;
    }

    .payment-modal__dialog {
        max-width: 300px;
    }

    .payment-modal__content {
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
        border: 1px solid rgba(0, 0, 0, 0.8);
        border-radius: 6px;
        background: #f5f5f7;
    }

    .payment-modal__body {
        display: flex;
        flex-direction: column;
        padding: 2rem;
        position: relative;
    }

    .payment-modal__close-btn {
        position: absolute;
        top: 8px;
        left: 8px;
        line-height: 1rem;
    }

    .payment-form__footer {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        justify-content: end;
    }

    label {
        /* override materialize.css */
        color: var(--checkout-text-font-color) !important;
        font-size: var(--checkout-text-font-size) !important;
    }

    input {
        margin: 0 !important;
    }

    * {
        /* override materialize.css */
        box-sizing: border-box !important;
    }

    /* background: var(--checkout-white); */

    .payment-method-divider {
        position: relative;
        padding: var(--space-2) 0;
        /* margin: var(--space-2) 0; */

        .payment-method-divider__text {
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);

            padding: 0 var(--space-2);

            white-space: nowrap;
            color: var(--checkout-gray400);
            background: #f5f5f7;
            font-size: var(--checkout-font-size-14);
            font-weight: 400;
        }
    }

    .payment-form {
        flex: 1;
        display: flex;
        flex-direction: column;
        margin-top: 1rem;
        gap: 1rem;

        .form-group {
            margin-bottom: 0;
        }

        .payment-form__error-container {
            transition: all 0.3s ease;
            transform-origin: top left;
            margin-top: var(--space-1);
            display: none;

            .payment-form__error {
                color: var(--checkout-red);
                font-size: var(--checkout-font-size-13);
                pointer-events: none;
            }

            &.payment-form__error-container_visible {
                display: block;
            }
        }

        /* label styles */
        .payment-form__label {
            margin-bottom: var(--space-1);

            .payment-form__label-text {
                color: var(--checkout-gray600);
                font-weight: 500;
                font-size: var(--checkout-font-size-13);
            }
        }

        /* input styles */
        .payment-form__input {
            box-shadow: var(--border-box-shadow);
            border: 1px solid #cececf;
            border-top-color: #b5b5b6;
            border-bottom-color: #dededf;
            border-radius: 4px;

            appearance: none;
            background: var(--checkout-input-background-color);
            color: var(--checkout-input-color);
            font-size: var(--checkout-lg-input-font-size);
            height: var(--checkout-lg-input-height);
            line-height: var(--checkout-input-line-height);
            padding: var(--checkout-input-padding-vertical)
                var(--checkout-input-padding-horizontal);
            position: relative;
            transition: var(--checkout-input-transition);
            width: 100%;

            &.invisible {
                height: 0px;
                padding: 0px;
                margin: 0px;
                border: 0px;
            }

            &.StripeElement {
                > div {
                    flex-grow: 1;
                }
            }

            &.touched:invalid,
            &.StripeElement--invalid {
                outline: 0;
                border-color: #ff7076;
                border-top-color: #ff5c61;
                box-shadow: var(--error-border-box-shadow);
                color: var(--checkout-input-invalid-color);
                z-index: var(--checkout-z-index-input-is-invalid);

                /* show errors on :invalid inputs, the content of those errors is controlled by JS */
                + .payment-form__error-container {
                    opacity: 1;
                    height: auto;
                    margin-top: var(--space-1);
                }
            }

            &:focus,
            &.StripeElement--focus {
                /* use !important to override materialize.css */
                outline: 0 !important;
                border-color: #7caadd !important;
                box-shadow: var(--focus-border-box-shadow) !important;
                z-index: var(--checkout-z-index-input-is-focused);
            }

            &.payment-form__card-number-input {
                border-bottom-left-radius: 0;
                border-bottom-right-radius: 0;
            }

            &.payment-form__card-expiry-input {
                border-top-left-radius: 0;
                border-top-right-radius: 0;
                border-bottom-right-radius: 0;
            }

            &.payment-form__card-cvc-input {
                border-top-left-radius: 0;
                border-bottom-left-radius: 0;
                border-top-right-radius: 0;
            }
        }

        /* submit button styles */
        .submit-button {
            font-family: inherit;
            font-size: 17px;

            text-shadow: 0 -1px 0 rgba(46, 86, 153, 0.3);
            box-shadow: 0 1px 0 rgba(46, 86, 153, 0.15),
                0 0 4px rgba(86, 149, 219, 0),
                inset 0 2px 0 rgba(41, 102, 20, 0);

            border: 0;
            padding: 0;
            outline: none;

            border-radius: var(--rounded);
            color: var(--checkout-white);
            cursor: pointer;
            height: var(--button-height);

            width: 100%;

            background-color: #45b1e8;
            background-image: linear-gradient(#45b1e8, #3097de);
            color: rgb(255, 255, 255);

            transition: all 0.3s ease;
            
            .submit-button__icon-checkmark {
                height: 24px;
            }
            
            .submit-button__icon-spinner {
                height: 24px;
                width: 24px;

                svg ellipse {
                    stroke-width: 1;
                    stroke-linecap: round;
                    stroke-dasharray: 70;
                    stroke-dashoffset: 30;
                    fill: transparent;
                    animation: spinner-spin 0.6s linear infinite;
                    transform-origin: center;
                    stroke: white;
                }
            }

            &:disabled {
            }

            &.submit-button_incomplete {
                .submit-button__label-text-initial {
                    display: flex;
                }
            }

            &:hover {
            }

            &.submit-button_complete {
                .submit-button__label-text-initial {
                    display: flex;
                }
            }

            &.submit-button_processing {
                background-image: none;
                .submit-button__label-text-processing {
                    display: flex;
                }
            }

            &.submit-button_success {
                background-image: none;
                background-color: var(--button-success-background-color);
                .submit-button__label-text-success {
                    display: flex;
                }
            }

            /* submit button label styles */
            .submit-button__label-text {
                font-weight: 500;
                line-height: var(--button-height);
                text-align: center;
                width: 100%;
                display: none;
                align-items: center;
                justify-content: center;
                gap: 8px;
            }
        }
    }

    /* .powered-by {
        color: var(--checkout-gray400);
        font-weight: 400;
        font-size: var(--checkout-font-size-12);
        text-align: center;
        display: inline-block;
        width: 100%;

        .powered-by__icon {
            fill: var(--checkout-gray300);
            vertical-align: middle;
        }
    } */

    /* base icon styles */
    /* .icon {
        transform: translate(0);

        &.icon_md {
            height: var(--checkout-icon-md);
        }

        &.icon_square {
            width: var(--checkout-icon-md);
        }
    } */
}
