/* styles for FCA prototype */

/* variables */
:root {
    --border: #979797;
    --brand-primary: #51B9FB;
    --color: #333;
    --link-btn: #333;
    --transition: .2s ease-in-out;
}

.product-plan {
    padding: 32px 0;

    @media screen and (min-width: 768px) {
        padding: 48px 0;
    }

    @media screen and (min-width: 992px) {
        padding: 60px 0;
    }

    .product-plan-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 24px;
        margin-top: 48px;

        @media screen and (min-width: 768px) {
            gap: 80px;
            justify-content: center;
            grid-template-columns: minmax(0, 480px) minmax(0, 480px);
            margin-top: 76px;
        }

        + .product-plan-contact {
            margin-top: 140px;

            p {
                font-size: 20px;
                margin-bottom: 0;

                a {
                    color: var(--color);

                    &:hover {
                        text-decoration: solid 1px underline currentColor;
                    }
                }
            }
        }
    }

    h2 {
        display: flex;
        justify-content: center;
        font-size: 34px;
        line-height: 35px;

        span {
            display: block;
            text-align: center;

            &.product-plan--year {
                max-width: 12ch;
            }
            &.product-plan--rolling {
                max-width: 15ch;
            }
        }
    }

    h3 {
        color: var(--color);
        font-size: 24px;
        line-height: 35px;
        padding-top: 12px;
    }

    .product-plan__cost {
        align-items: center;
        display: flex;
        flex-direction: column;
        gap: 7px;
        margin-top: 20px;

        li {
            font-size: 20px;
        }
    }

    .product-plan__includes {
        display: flex;
        flex-direction: column;
        gap: 15px;
        margin-top: 17px;

        li {
            font-size: 16px;
            padding-left: 20px;
            position: relative;
            
            &::before {
                background-color: var(--brand-primary);
                border-radius: 50%;
                content: '';
                height: 8px;
                left: 0;
                position: absolute;
                top: 8px;
                width: 8px;
            }
        }
    }
    
    .link-btn {
        border-radius: 3px;
        background-color: var(--link-btn);
        color: #fff;
        display: inline-block;
        padding: 13px 16px;
        text-transform: uppercase;
        transition: background-color var(--transition);
        
        &:hover {
            background-color: var(--brand-primary);
        }

        .link-btn__arrow {
            height: 15px;
            margin-bottom: 2px;
            margin-left: 5px;
            width: auto;
        }
    }

    /* card styles */
    .card--plan {
        border: solid 2px rgb(from var(--border) r g b / .24);
        border-radius: 24px;
        margin: initial;
        padding: 17px 46px;

        > * + * {
            margin-block-start: 24px;
        }
        
        .card-link {
            display: flex;
            justify-content: center;
            width: 100%;
        }
    }

    /* modal styles */
    .plan-details {
        display: flex;
        justify-content: center;
        gap: 12px;

        button {
            appearance: none;
            background-color: transparent;
            border: none;

            &:hover {
                span:not(.plan-icon) {
                    text-decoration-thickness: 2px;
                }
            }

            span:not(.plan-icon) {
                color: var(--color);
                text-decoration: solid 1px underline currentColor;
            }
        }
    }
}

.plan-icon {
    border: solid 2px var(--color);
    border-radius: 50%;
    height: 20px !important;
    padding: 2px;
    width: 20px !important;
}

.modal {
    .modal-dialog {
        display: flex;
        align-items: center;
        height: 100vh;

        .modal-content {
            border: solid 2px rgb(from var(--border) r g b / .24);
            border-radius: 24px;
            box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
            margin: auto;
            max-width: 480px;
            padding: 20px 24px;

            /* make modal scroll instead of page */
            max-height: calc(100vh - (73px * 2));
            overflow: hidden;
            overflow-y: scroll;

            .modal-header,
            .modal-footer {
                border: none;
                display: flex;
                justify-content: center;
            }

            .modal-header {
                align-items: center;
                flex-direction: column;
                padding-bottom: 0;

                .plan-icon {
                    height: 32px !important;
                    width: 32px !important;

                    + h4 {
                        margin-top: 12px;
                    }
                }

                h4 {
                    color: var(--color);
                    font-size: 28px;
                    line-height: 35px;
                    text-align: center;
                }
            }

            .modal-body {
         
            }

            .modal-footer {
                .modal-close {
                    appearance: none;
                    background-color: transparent;
                    border: none;
                    color: var(--color);
                    font-size: 16px;
                    text-decoration: solid 1px underline currentColor;

                    &:hover {
                        text-decoration-thickness: 2px;
                    }
                }
            }
        }
    }
}

/* modal backdrop colour */
body {
    &:has(.product-plan),
    &.woocommerce-cart {
        &:has(.modal.in) {
            overflow: hidden;

            .modal.in {
                overflow: hidden;
            }
        }

        .modal-backdrop {
            background-color: #fff;
            opacity: .7;
        }
    }
}

/* cart overrides */
.woocommerce-cart {
    /* reset cart widths */
    .product-thumbnail,
    .product-name,
    .product-price,
    .product-subtotal,
    .product-remove,
    .product-quantity,
    .product-subtotal {
        border: none !important;
        height: initial !important;
        width: initial !important;
    }

    .cart-grid {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;

        @media screen and (min-width: 992px) {
            grid-template-columns: 1fr 1fr;
        }
    }

    div#autify-dopple-content {
        display: grid;
        justify-content: initial;

        @media screen and (min-width: 992px) {
            grid-template-columns: 1fr 1fr;

            iframe {
                grid-column-start: 2;
                grid-column-end: span 1;
            }
        }
    }

    .woocommerce .cart-collaterals, .woocommerce-page .cart-collaterals {
        display: grid;
        grid-template-columns: 1fr;

        @media screen and (min-width: 992px) {
            grid-template-columns: 1fr 1fr;

            .woocommerce .cart-collaterals .cart_totals, .woocommerce-page .cart-collaterals .cart_totals {
                float: none;
                grid-column-start: 2;
                grid-column-end: span 1;
            }
        }
    }

    .woocommerce .cart-collaterals .cart_totals, .woocommerce-page .cart-collaterals .cart_totals {
        float: none;
        width: 100% !important;

        h2.cart-total {
            margin-bottom: 4px;
        }

        h2 {
            font-size: 28px;
            margin-bottom: 16px;
        }

        .shop_table {
            *:not(.recurring-totals th) {
                color: var(--color) !important;
                font-family: VarelaRound-Regular !important;
                font-size: 16px !important;
            }
        }
    }

    .woocommerce {
        .product-thumbnail {
            display: block;
            padding: 0;

            .product-image {
                margin: auto !important;
                max-height: 340px !important;
            }
        }

        .product-details {
            h2 {
                border-bottom: solid 1px rgb(from var(--border) r g b / .24);
                font-size: 34px;
                line-height: 41px;
                margin-bottom: 15px;
                padding-bottom: 16px;
            }
        }

        #cart-items .product-name {
            border-bottom: solid 1px rgb(from var(--border) r g b / .24) !important;
            display: block;
            padding: 0 0 20px;
            width: 100% !important;

            a.product-title {
                color: var(--color);
                font-size: 16px;
                line-height: 150%;
                position: relative;
                z-index: 5;

                &::before {
                    content: 'Product';
                    color: var(--brand-primary);
                    display: inline-block;
                    font-size: 16px;
                    margin-right: 10px;
                    width: 6ch;
                }
            }

            .variation {
                margin-bottom: 0;
            }

            dt.variation-Color,
            dt.variation-SubscriptionType {
                display: none;
            }

            dd.variation-Color,
            dd.variation-SubscriptionType {
                color: var(--color);
                font-size: 16px;
                line-height: 150%;
                position: relative;

                p {
                    display: inline;
                }
            }

            dd.variation-Color {
                &::before {
                    content: '-';
                    margin: 0 10px;
                }
            }
            dd.variation-SubscriptionType {
                &::before {
                    content: 'Plan';
                    color: var(--brand-primary);
                    display: inline-block;
                    font-size: 16px;
                    margin-right: 10px;
                    width: 6ch;
                }
            }
        }

        #cart-items .product-price,
        /* #cart-items .product-quantity, */
        #cart-items .product-subtotal {
            display: block;
            margin: 10px 0 0;
            padding: 0;
            text-align: left !important;

            * {
                color: var(--color);
                font-size: 16px !important;
            }
        }

        #cart-items .product-quantity {
            margin: 20px 0;
            width: fit-content !important;

            .quantity {
                text-align: left !important;
            }
        }

        #cart-items .product-remove {
            margin: 20px 0;

            a {
                color: var(--color);
                left: 0 !important;
                text-decoration: solid 1px underline currentColor;
                padding: 10px 20px !important;
                position: relative;
                top: 0 !important;

                &:hover {
                    text-decoration-thickness: 2px;
                }
            }
        }

        .cart-amount {
            display: flex;
            flex-direction: row-reverse;
            justify-content: start;
            width: 100%;
        }

        .product-subtotal {
            display: none !important;
        }
    }

    .cart-what-happens {
        border-bottom: solid 1px rgb(from var(--border) r g b / .24);
        padding-bottom: 20px;

        button {
            appearance: none;
            background-color: transparent;
            border: none;
            font-size: 16px;
    
            &:hover {
                span:not(.plan-icon) {
                    text-decoration-thickness: 2px;
                }
            }
    
            span:not(.plan-icon) {
                color: var(--color);
                text-decoration: solid 1px underline currentColor;
            }
        }

        ol {
            li {
                &:not(:first-child) {
                    margin-top: 16px;
                }
            }
        }
    }

    /* confirmation list */
    .cart-confirmation {
        .cart-confirmation-list {
            list-style: none;
            padding-left: 0;

            li {
                &:not(:first-child) {
                    margin-top: 15px;
                }
            }

            .cart-confirmation-check {
                position: relative;
                
                input[type=checkbox] {
                    cursor: pointer;
                    height: 0;
                    opacity: 0;
                    position: absolute;
                    width: 0;
    
                    + label {
                        cursor: pointer;
                        font-weight: 400;
                        padding-left: 34px;
    
                        &::before,
                        &::after {
                            position: absolute;
                            height: 20px;
                            width: 20px;
                        }
    
                        &::before {
                            background-color: #fff;
                            border: 1px solid var(--color);
                            content: '';
                            left: 6px;
                            top: 0;
                            transition: background-color .2s ease-in-out, box-shadow .2s ease-in-out;
                        }
    
                        &::after {
                            border: solid var(--color);
                            border-width: 0 2px 2px 0;
                            content: none;
                            height: 13px;
                            left: 12px;
                            top: 2px;
                            transform: rotate(45deg);
                            width: 8px;
                        }
    
                        &:focus::before {
                            box-shadow: 0px 0px 0px 2px var(--color);
                        }
    
                        &:hover {
                            &::before {
                                background-color: rgba(0, 0, 0, .05);
                                box-shadow: inset 0px 0px 0px .5px var(--color);
                            }
    
                            &:not(.user-is-tabbing):focus {
                                box-shadow: inset 0px 0px 0px 1px var(--color);
                            }
                        }
                    }
    
                    &:checked {
                        + label {
                            &::before {
                                background-color: #fff;
                                border-color: var(--color);
                            }
                
                            &::after {
                                content: '';
                            }
                        }
                    }
                }
            }
        }
    }

    /* checkout button */
    .wc-proceed-to-checkout {
        right: initial;
        width: 100%;

        a#checkbotton {
            background-color: #A7A7A8;
            float: left;
            font-size: 16px;
            padding: 15px;
            text-transform: uppercase;
            transition: background-color .2s ease-in-out;

            &:not(.active) {
                cursor: not-allowed;
            }

            &.active {
                background-color: var(--brand-primary);

                &:hover {
                    background-color: var(--color);
                }
            }
            
            .link-btn__arrow {
                height: 15px;
                margin-bottom: 2px;
                margin-left: 5px;
                width: auto;
            }
        }
    }
}

/* checkout styles */
.woocommerce-checkout {
    .woocommerce form .form-row .input-text, .woocommerce form .form-row select,
    input[type=text],
    input[type=url],
    input[type=tel],
    input[type=number],
    input[type=color],
    input[type=email],
    textarea,
    select,
    .select2-selection {
        border: 1px solid rgb(from var(--border) r g b / .24) !important;
        border-radius: 4px !important;
        color: var(--color) !important;
        padding: 15px 20px;
        transition: background-color .2s ease-in-out, box-shadow .2s ease-in-out;

        &:hover {
            background-color:rgb(from var(--border) r g b / .02);
        }
    }

    label,
    label + .woocommerce-input-wrapper {
        font-size: 18px;

        span,
        strong {
            color: var(--color);
        }
    }

    select {
        -webkit-appearance: none;
        -moz-appearance: none;
    }

    .select2-selection.select2-selection--single,
    .hear-about-us-field .woocommerce-input-wrapper:has(select) {
        position: relative;

        &::before {
            background-image: url('../images/chevron-down.svg');
            background-position: center;
            background-repeat: no-repeat;
            background-size: contain;
            content: '';
            height: 24px;
            position: absolute;
            right: 16px;
            top: 50%;
            transform: translateY(-50%);
            width: 24px;
        }
    }

    .select2-container .select2-selection--single .select2-selection__rendered {
        margin-bottom: 0;
        padding: 0;
    }

    .select2-selection {
        padding-bottom: 40px;
        padding-top: 10px;
    }
    .select2-container--default .select2-selection--single .select2-selection__arrow {
        display: none;
    }
    .woocommerce form .form-row select {
        background-image: none !important;
    }

    .woocommerce-checkout {
        h3 {
            font-size: 34px;
            line-height: 41px;
            margin-bottom: 30px;
        }
    }

    .woocommerce form .form-row {
        &:not(:first-child) {
            margin-top: 20px;
        }
        &:not(.form-row-first):not(.form-row-last) {
        }

        &.form-row-last,
        &.form-row-first {
            float: none;
            width: 100% !important;
        }
    }

    span.subscription-details {
        color: var(--color);
    }

    #ship-to-different-address {
        margin-left: 0 !important;
        position: relative;

        &::before {
            content: 'Delivery details';
            color: var(--brand-primary);
            display: block;
        }

        label {
            padding-left: 50px;

            &::before,
            &::after {
                translate: 0 10px;
            }
        }
    }
}

.woocommerce-checkout-review-order,
.cart_totals .shop_table.shop_table_responsive {
    *:not(.recurring-totals th) {
        color: var(--color);
        font-family: VarelaRound-Regular !important;
        font-size: 16px !important;
        font-weight: 400 !important;
    }

    thead .product-name,
    thead .product-total,
    .recurring-totals th {
        font-size: 20px !important;
    }

    .recurring-totals {
        display: block;
        margin-top: 10px;

        th {
            border-top: none;
        }
    }
}

.product-fca-summary {
    @media screen and (min-width: 992px) {
        width: 50%;
    }

    + .product-fca-summary {
        .product-fca-plan {
            border-top: none;
        }
    }

    + .woocommerce-checkout-review-order-table {
        margin-top: 32px !important;
    }

    * {
        color: var(--color) !important;
        font-family: VarelaRound-Regular !important;
    }
    
    .product-fca-plan,
    .product-fca-details {
        span {
            display: inline-block;
            font-size: 16px;

            &:first-child {
                width: 64px;
            }
        }
    }

    .product-fca-details {
        display: flex;
        gap: 12px;
    }

    .product-fca-plan,
    .product-fca-payment {
        border-top: solid 1px rgb(from var(--border) r g b / .24);
        padding-top: 16px;
    }

    .product-fca-plan {
        padding-bottom: 16px;
    }

    .product-fca-payment {
        display: flex;

        * {
            font-size: 14px;
        }

        span {
            display: inline-block;
            width: 156px;
        }

        ul {
            list-style-type: none;
            padding-left: 0;
        }
    }

    .product-fca-total,
    .product-fca-recurring {
        display: flex;
        row-gap: 12px;

        span {
            &:first-child {
                display: inline-block;
                width: 156px;
            }
        }
    }

    .product-fca-total {
        padding-bottom: 12px;

        * {
            font-size: 20px;
        }
    }

    .product-fca-recurring {
        border-bottom: solid 1px rgb(from var(--border) r g b / .24);
        padding-bottom: 16px;
    }
}

.woocommerce-checkout-review-order-table {
    @media screen and (min-width: 992px) {
        width: 50% !important;
    }

    * {& #ship-to-different-address
        color: var(--color) !important;
        font-size: 16px !important;
    }
}

.woocommerce-checkout {
    label:has(input[type=checkbox]) {
        cursor: pointer;
        font-weight: 400;
        padding-left: 24px;
        position: relative;

        &::before,
        &::after {
            position: absolute;
            height: 20px;
            width: 20px;
        }

        &::before {
            background-color: #fff;
            border: 1px solid var(--color);
            content: '';
            left: 6px;
            top: 0;
            transition: background-color .2s ease-in-out, box-shadow .2s ease-in-out;
        }

        &::after {
            border: solid var(--color);
            border-width: 0 2px 2px 0;
            content: none;
            height: 13px;
            left: 12px;
            top: 2px;
            transform: rotate(45deg);
            width: 8px;
        }
        
        input[type=checkbox] {
            cursor: pointer;
            height: 0;
            opacity: 0;
            position: absolute;
            width: 0;
        }
    }

    label:has(input[type=checkbox]:focus) {
        &::before {
            box-shadow: 0px 0px 0px 2px var(--color);
        }
    }

    label:has(input[type=checkbox]:hover) {
        &::before {
            background-color: rgba(0, 0, 0, .05);
            box-shadow: inset 0px 0px 0px .5px var(--color);
        }

        &:not(.user-is-tabbing):focus {
            box-shadow: inset 0px 0px 0px 1px var(--color);
        }
    }

    label:has(input[type=checkbox]:checked) {
        &::before {
            background-color: #fff;
            border-color: var(--color);
        }

        &::after {
            content: '';
        }
    }
}