/**
 * Copyright Â© 2021 O2TI. All rights reserved.
 * @author  Bruno Elisei <brunoelisei@o2ti.com>
 * See LICENSE.txt for license details.
 */

//
//  Common
//  _____________________________________________

& when (@media-common = true) {
    .full-checkout {
        .form-login {
            .fieldset {
                &.hidden-fields {
                    margin: 0;
                    .actions-toolbar {
                        margin-left: @indent__xs;
                        margin-right: @indent__xs;
                    }
                }
            }
        }
        .checkout-payment-method {
            .step-title {
                &:extend(.abs-theme-full-checkout-title-sessions all);
            }

            .payment-method {
                &._active {
                    .payment-method-content {
                        display: block;
                    }
                }

                .payment-method-title {
                    &:extend(.abs-theme-full-checkout-sub-title-methods);

                    &.choice {
                        .lib-css(padding-top, 0);
                        .lib-css(padding-bottom, 0);

                        display: table;
                        line-height: 4;

                        .label {
                            display: table-cell;
                            .lib-css(cursor, pointer);

                            line-height: 2;
                            padding-left: @indent__s;
                            vertical-align: middle;
                            width: 95%;
                        }

                        .radio {
                            display: table-cell;
                            vertical-align: middle;
                            width: 100%;
                        }
                    }
                }

                .fieldset {
                    margin-left: 0;
                    margin-right: 0;
                }

                form {
                    &.form-purchase-order {
                        margin-bottom: 15px;
                    }
                }

                + .payment-method .payment-method-title {
                    &:extend(.abs-theme-full-checkout-sub-title-methods);
                }
            }

            .payment-method-content {
                > .actions-toolbar {
                    > .primary {
                        .action {
                            &.primary {
                                &:extend(.abs-button-l all);
                            }
                        }
                    }
                }

                /**
				 * @codingStandardsIgnoreStart
				 */
				#po_number {
					margin-bottom: 20px;
				}
				//  @codingStandardsIgnoreEnd
			}

			.payment-method-title {
				&:first-child {
					border-top: 0;
				}

				.payment-icon {
					display: inline-block;
					margin-right: @indent__xs;
					vertical-align: middle;
				}

				.action-help {
					display: inline-block;
					margin-left: @indent__xs;
				}
			}

			.billing-address-form {
				&:extend(.abs-add-box-sizing-desktop-m all);
			}

			.forms-payment-methods {
				&:extend(.abs-add-box-sizing-desktop-m all);

				.payment-method {
					border-left: @theme-full-checkout__border;
					border-right: @theme-full-checkout__border;
					.lib-css(background-color, @theme-full-checkout-step-content-mobile__background);

					&:first-child {
						border-top: @theme-full-checkout__border;
						border-top-right-radius: @theme-full-checkout__border-radius;
						border-top-left-radius: @theme-full-checkout__border-radius;
					}

					&:last-child {
						border-bottom: @theme-full-checkout__border;
						border-bottom-right-radius: @theme-full-checkout__border-radius;
						border-bottom-left-radius: @theme-full-checkout__border-radius;
					}

					&._active {
						.payment-method-title {
							border-bottom: @theme-full-checkout__border;
						}
					}
				}
			}

			.payment-method-content {
				display: none;
				.lib-css(background-color, @theme-full-checkout-step-content-mobile-light__background);
				.lib-css(padding, @theme-full-checkout-payment-method-content__padding);
				.lib-css(margin, @theme-full-checkout-payment-method-content__margin);

				.fieldset {
					&:not(:last-child) {
						margin: @theme-full-checkout-payment-method-content__margin;
					}
				}

				.checkout-billing-address {
					.lib-css(margin, unset);
				}
			}

			.payment-group {
				.lib-css(margin-bottom, @theme-full-checkout-step-content-mobile__margin-s);

				& + .payment-group {
					.step-title {
						&:extend(.abs-theme-full-checkout-title-sessions all);
					}
				}
			}

			.field-select-billing,
			.billing-address-form {
				.lib-css(max-width, @theme-full-checkout-billing-address-form__max-width);
			}

			.billing-address-same-as-shipping-block {
				margin: 0 0 @indent__s;
			}

			.checkout-billing-address {
				.primary {
					.action-update {
						margin-bottom: 20px;
						margin-right: 0;
					}
				}

				.action-cancel {
					&:extend(.abs-action-button-as-link all);
				}

				.billing-address-details {
					.lib-css(line-height, @theme-full-checkout-billing-address-details__line-height);
					.lib-css(padding, @theme-full-checkout-billing-address-details__padding);
				}

				input[type="checkbox"] {
					vertical-align: top;
				}
			}

			.payment-method-note {
				& + .checkout-billing-address {
					margin-top: @indent__s;
				}
			}

			.field-select-billing {
				> .label {
					&:extend(.abs-visually-hidden all);
				}
			}

			.payment-method-iframe {
				background-color: transparent;
				display: none;
				width: 100%;
			}

			.no-payments-block {
				margin: @indent__base 0;
			}

			.payments {
				.legend {
					&:extend(.abs-visually-hidden all);
				}
			}
		}
	}
}

//
//	Mobile
//	_____________________________________________

.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
	.full-checkout {
		.checkout-payment-method {
			.checkout-billing-address,
			.forms-payment-methods {
				.lib-css(background, @theme-full-checkout-step-content-mobile__background);
				.lib-css(margin, @theme-full-checkout-step-content-mobile__margin);
				.lib-css(padding, 0 @theme-full-checkout-step-content-mobile__margin-s);
			}

			.payment-methods {
				.lib-css(margin, unset);

				.fieldset {
					.lib-css(margin, unset);
					.lib-css(padding, 0);
				}
			}
		}

		.opc-wrapper {
			.checkout-payment-method {
				.step-title {
					.lib-css(margin, @theme-full-checkout-step-content-mobile__margin);
				}
			}
		}
	}

	#checkout {
		&.full-checkout {
			.theme-full-checkout-payment-additional {
				.lib-css(margin-bottom,  @indent__base);
			}
		}
	}
}

//
//	Desktop
//	_____________________________________________

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
	.full-checkout {
		.checkout-payment-method {
			.payment-group {
				.step-title {
					&:extend(.abs-theme-full-checkout-title-session-payment-desktop-margin all);
				}
			}

			.payment-method-content {
				.lib-css(padding, @theme-full-checkout-payment-method-content-desktop__padding);
			}

			.fieldset {
				> .field-select-billing {
					> .control {
						float: none;
						width: 100%;
					}
				}
			}

			.actions-toolbar {
				.primary {
					float: right;
					margin: 0;
				}
			}
		}

		.checkout-billing-address {
			.action-update {
				float: right;
			}

			.actions-toolbar {
				.action-cancel {
					margin: 6px @indent__base 0 0;
				}
			}
		}
	}
}
