/* Checkout redesign — Order Summary (left) / Complete Checkout (right). */

.apex-checkout {
    --apex-navy: #00378B;
    --apex-text: #1E2A3B;
    --apex-muted: #5B6475;
    --apex-border: #DDE1E7;
    --apex-line: #E6E8EC;
    --apex-soft: #EEF2FA;
    --apex-offer: #FF6B3D;
    --apex-radius: 8px;

    max-width: 1410px;
    margin: 0 auto;
    padding: 24px 16px 56px;
    font-family: "Open Sans", sans-serif;
    color: var(--apex-text);
}

/* Page chrome carried over from the previous checkout */
.woocommerce-checkout footer,
.woocommerce-checkout section#title,
.woocommerce-checkout #content .container > h2 {
    display: none !important;
}

.woocommerce-checkout .blockOverlay {
    background: rgba(255, 255, 255, .55) !important;
}
.woocommerce-checkout #payment{
    border: none !important;
}
/* Elements replaced by the new layout */
.apex-checkout .woocommerce-form-login-toggle,
.apex-checkout .woocommerce-form-coupon-toggle,
.apex-checkout form.checkout_coupon,
.apex-checkout table.woocommerce-checkout-review-order-table,
.apex-checkout .woocommerce-privacy-policy-text,
.apex-checkout .woocommerce-billing-fields > h3 {
    display: none !important;
}

.apex-checkout h2,
.apex-checkout h3,
.apex-checkout h4 {
    font-family: inherit;
    color: var(--apex-text);
    letter-spacing: 0;
}

.apex-checkout a {
    color: var(--apex-navy);
}

/* Notices + login form above the grid */
.apex-checkout__notices form.woocommerce-form-login {
    max-width: 640px;
    margin: 0 0 24px auto;
    padding: 24px;
    background: #fff;
    border: 1px solid var(--apex-border);
    border-radius: var(--apex-radius);
}

/* Grid */
.apex-checkout__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

.apex-card {
    background: #fff;
    border: 1px solid var(--apex-border);
    border-radius: var(--apex-radius);
    padding: 24px;
}

.apex-checkout .apex-card__title {
    margin: 0 0 24px;
    font-size: 24px;
    line-height: 1.3;
    font-weight: 700;
}

/* ---------- Order Summary ---------- */

.apex-summary {
    transition: opacity .2s;
}

.apex-summary.is-loading {
    opacity: .6;
    pointer-events: none;
}

.apex-item {
    display: grid;
    grid-template-columns: 85px minmax(0, 1fr) auto;
    gap: 20px;
    padding: 0 0 20px;
    margin: 0 0 20px;
    border-bottom: 1px solid var(--apex-line);
}

.apex-item__thumb img {
    display: block;
    width: 85px !important;
    height: 85px !important;
    object-fit: cover;
    border-radius: 6px;
    background: var(--apex-soft);
}

.apex-item__name {
    font-size: 15px;
    line-height: 1.45;
    font-weight: 600;
    margin: 2px 0 12px;
}

.apex-item__name dl.variation {
    margin: 4px 0 0;
    font-size: 13px;
    font-weight: 400;
    color: var(--apex-muted);
}

.apex-item__actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.apex-qty {
    display: inline-flex;
    align-items: center;
    height: 30px;
    border: 1px solid var(--apex-border);
    border-radius: 3px;
}

.apex-checkout .apex-qty__btn {
    width: 30px;
    height: 28px;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    color: var(--apex-text);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.apex-checkout .apex-qty__btn:disabled {
    opacity: .35;
    cursor: default;
}

.apex-qty__val {
    min-width: 40px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    font-size: 14px;
    border-left: 1px solid var(--apex-border);
    border-right: 1px solid var(--apex-border);
}

.apex-checkout .apex-item__remove {
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    color: var(--apex-muted);
    font-size: 12px;
    text-decoration: underline;
    cursor: pointer;
}

.apex-item__price,
.apex-item__price .amount {
    font-size: 20px;
    font-weight: 700;
    color: var(--apex-navy);
    white-space: nowrap;
}

.apex-item__price del {
    display: none;
}

/* Exclusive Offer */
.apex-offer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 20px;
    margin: 0 0 24px;
    border: 1px solid #C9D2E6;
    border-radius: var(--apex-radius);
    background: linear-gradient(180deg, #fff 35%, #E9EEFB 100%);
}

.apex-checkout .apex-offer h4 {
    margin: 0 0 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--apex-offer);
}

.apex-offer p {
    margin: 0 0 12px;
    font-size: 15px;
    line-height: 1.7;
}

.apex-offer p strong,
.apex-offer p .amount {
    color: var(--apex-text);
    font-weight: 700;
}

.apex-offer a {
    font-size: 15px;
    font-weight: 600;
    text-decoration: underline;
}

.apex-checkout .apex-offer__add,
.apex-checkout .apex-btn-outline {
    flex-shrink: 0;
    margin: 0;
    padding: 0 16px;
    height: 44px;
    background: #fff;
    border: 1px solid var(--apex-navy);
    border-radius: 4px;
    color: var(--apex-navy);
    font-size: 16px;
    font-weight: 600;
    line-height: 42px;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.apex-checkout .apex-offer__add:hover,
.apex-checkout .apex-btn-outline:hover {
    background: var(--apex-navy);
    color: #fff;
}

/* Discount code */
.apex-coupon {
    padding: 24px 0;
    border-top: 1px solid var(--apex-line);
    border-bottom: 1px solid var(--apex-line);
}

.apex-checkout .apex-coupon__toggle {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    color: var(--apex-text);
    font-size: 16px;
    font-weight: 400;
    cursor: pointer;
}

.apex-chevron {
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-left: 1.5px solid currentColor;
    border-top: 1.5px solid currentColor;
    transform: rotate(45deg);
    transition: transform .2s;
}

.apex-coupon__toggle[aria-expanded="false"] .apex-chevron {
    transform: rotate(225deg);
}

.apex-coupon__body {
    padding-top: 20px;
}

.apex-coupon__row {
    display: flex;
    gap: 20px;
}

.apex-checkout .apex-coupon__row input {
    flex: 1;
    min-width: 0;
    height: 50px;
    margin: 0;
    padding: 0 16px;
    border: 1px solid var(--apex-border);
    border-radius: 4px;
    box-shadow: none;
    font-size: 15px;
}

.apex-checkout .apex-coupon__apply {
    width: 126px;
    height: 50px;
    line-height: 48px;
}

.apex-coupon__msg:empty {
    display: none;
}

.apex-coupon__msg {
    margin-top: 12px;
}

.apex-checkout .apex-coupon__msg ul,
.apex-checkout .apex-coupon__msg div {
    margin: 0 !important;
    padding: 10px 14px !important;
    font-size: 14px;
}

/* Totals */
.apex-summary-totals {
    padding-top: 24px;
}

.apex-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    font-size: 16px;
}

.apex-row > span:last-child,
.apex-row .amount {
    font-weight: 700;
    color: var(--apex-text);
    text-align: right;
}

.apex-row.cart-discount > span:last-child,
.apex-row.cart-discount .amount {
    color: #1A8D3F;
}

.apex-row .woocommerce-remove-coupon {
    margin-left: 6px;
    font-size: 13px;
    font-weight: 400;
}

.apex-row.order-total {
    margin: 10px 0 0;
    padding-top: 24px;
    border-top: 1px solid var(--apex-line);
    font-size: 20px;
    font-weight: 700;
}

.apex-row.order-total > span:last-child,
.apex-row.order-total .amount {
    color: var(--apex-navy);
}

.apex-row.order-total small,
.apex-row.order-total .off_textcart {
    display: block;
    margin: 4px 0 0;
    font-size: 13px;
    font-weight: 400;
    color: var(--apex-muted);
}

.apex-row.order-total .off_textcart .amount,
.apex-row.order-total small .amount {
    font-weight: 400;
    color: var(--apex-muted);
}

/* ---------- Complete Checkout ---------- */

.apex-checkout form.checkout {
    margin: 0;
}

/* Express buttons: only show the heading once Stripe renders buttons */
.apex-express .apex-card__title {
    display: none;
}

.apex-express:has(#wc-stripe-express-checkout-element[style*="block"]) .apex-card__title {
    display: block;
}

.apex-checkout #wc-stripe-express-checkout-element {
    margin-top: 0 !important;
}

.apex-checkout #wc-stripe-express-checkout-button-separator {
    position: relative;
    margin: 24px 0 32px !important;
    font-size: 0;
    line-height: 1;
    text-align: center;
}

.apex-checkout #wc-stripe-express-checkout-button-separator::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    border-top: 1px solid var(--apex-border);
}

.apex-checkout #wc-stripe-express-checkout-button-separator::after {
    content: "or pay by Card";
    position: relative;
    padding: 0 24px;
    background: #fff;
    font-size: 16px;
    color: var(--apex-text);
}

.apex-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.apex-checkout .apex-section-title {
    margin: 0 0 20px;
    font-size: 24px;
    line-height: 1.3;
    font-weight: 700;
}

.apex-login-link {
    font-size: 15px;
}

.apex-login-link a {
    margin-left: 4px;
    font-weight: 700;
    text-decoration: underline;
}

/* Billing fields */
.apex-checkout #customer_details,
.apex-checkout #customer_details .col-1 {
    width: 100%;
    float: none;
    max-width: none;
    padding: 0;
    margin: 0;
}

.apex-checkout .woocommerce-billing-fields__field-wrapper,
.apex-checkout .woocommerce-account-fields {
    display: block;
}

.apex-checkout form.checkout .form-row {
    float: none;
    width: 100%;
    padding: 0;
    margin: 0 0 20px;
}

.apex-checkout form.checkout .form-row label {
    display: block;
    margin: 0 0 12px;
    font-size: 17px;
    line-height: 1.3;
    font-weight: 400;
    color: var(--apex-text);
}

.apex-checkout form.checkout .form-row label.checkbox,
.apex-checkout form.checkout .form-row label.woocommerce-form__label-for-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
}

.apex-checkout form.checkout .form-row .required {
    color: inherit;
    text-decoration: none;
    border: 0;
}

.apex-checkout form.checkout .form-row input.input-text,
.apex-checkout form.checkout .form-row select,
.apex-checkout form.checkout .select2-container .select2-selection--single {
    width: 100%;
    height: 50px;
    margin: 0;
    padding: 0 16px;
    border: 1px solid var(--apex-border);
    border-radius: 4px;
    background: #fff;
    box-shadow: none;
    font-size: 15px;
    color: var(--apex-text);
}

.apex-checkout form.checkout .form-row input.input-text:focus {
    border-color: var(--apex-navy);
    outline: none;
}

.apex-checkout form.checkout .woocommerce-invalid input.input-text {
    border-color: #D63638;
}

.apex-checkout .select2-container .select2-selection--single .select2-selection__rendered {
    padding: 0;
    line-height: 48px;
    color: var(--apex-text);
}

.apex-checkout .select2-container--default .select2-selection--single .select2-selection__arrow {
    top: 11px;
    right: 14px;
}

.apex-checkout #woo_ml_subscribe_field {
    margin: 0 0 20px;
}

/* Payment methods — tab bar built by checkout.js; Stripe renders the
   Card Number / Expiry / Security Code fields inside the selected box and
   takes its input styling from the inputs above. */
.apex-checkout #payment {
    background: transparent;
    border-radius: 0;
}

.apex-pm-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 0 0 28px;
}

.apex-checkout .apex-pm-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-width: 200px;
    height: 48px;
    margin: 0;
    padding: 0 24px;
    background: #E8EEF8;
    border: 2px solid transparent;
    border-radius: 3px;
    box-shadow: none;
    color: var(--apex-navy);
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    text-transform: none;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.apex-checkout .apex-pm-tab:hover {
    background: #DCE5F4;
}

.apex-checkout .apex-pm-tab.is-active {
    background: #fff;
    border-color: var(--apex-navy);
}

.apex-pm-tab__paypal {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 18px;
    font-weight: 800;
    font-style: italic;
    color: #002991;
}

.apex-pm-tab__paypal img {
    display: block;
    width: 20px;
    height: 20px;
    margin: 0 !important;
}

.apex-pm-tab__paypal span {
    letter-spacing: -.2px;
}

.apex-checkout #payment ul.payment_methods {
    margin: 0 0 24px;
    padding: 0;
    border: 0;
    list-style: none;
}

.apex-checkout #payment ul.payment_methods > li {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* The tab bar replaces the radio + label of each gateway */
.apex-checkout #payment ul.apex-pm-tabbed > li > input[name="payment_method"],
.apex-checkout #payment ul.apex-pm-tabbed > li > label {
    display: none !important;
}

/* Without JS (or before it runs) the plain list still works */
.apex-checkout #payment ul.payment_methods:not(.apex-pm-tabbed) > li {
    margin: 0 0 12px;
}

.apex-checkout #payment ul.payment_methods:not(.apex-pm-tabbed) > li > label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--apex-text);
    cursor: pointer;
}

.apex-checkout #payment ul.payment_methods > li > label img {
    max-height: 24px;
    margin: 0 0 0 4px;
}

.apex-checkout #payment div.payment_box {
    margin: 0;
    padding: 0;
    background: transparent;
    font-size: 14px;
    color: var(--apex-muted);
}

.apex-checkout #payment ul.payment_methods:not(.apex-pm-tabbed) div.payment_box {
    margin-top: 12px;
}

.apex-checkout #payment div.payment_box::before {
    display: none;
}

.apex-checkout #payment div.payment_box > p:first-child {
    margin-top: 0;
}

.apex-checkout #payment div.payment_box fieldset {
    padding: 0;
    margin: 0;
    border: 0;
}

.apex-checkout #payment .wc-stripe-upe-element {
    min-height: 0;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
}

.apex-checkout #payment .payment_box .testmode-info {
    margin: 0 0 16px;
    font-size: 13px;
}

.apex-checkout #payment .woocommerce-SavedPaymentMethods-saveNew {
    margin: 16px 0 0;
}

.apex-checkout #payment .form-row.place-order {
    padding: 0;
    margin: 0;
}

.apex-checkout .apex-terms {
    margin: 0 0 20px;
    padding: 0 12px;
    font-size: 14px;
    color: var(--apex-text);
}

.apex-checkout .apex-terms a {
    margin-left: 4px;
    font-weight: 600;
    text-decoration: underline;
}

.apex-checkout #payment #place_order,
.apex-checkout #place_order {
    display: block;
    float: none;
    width: 100%;
    height: 58px;
    margin: 0;
    padding: 0 16px;
    background: var(--apex-navy) !important;
    border: 1px solid var(--apex-navy) !important;
    border-radius: 4px;
    color: #fff !important;
    font-size: 22px;
    font-weight: 700;
    line-height: 56px;
    text-transform: none;
    transition: filter .15s;
}

.apex-checkout #place_order:hover {
    filter: brightness(1.15);
}

/* Place Order: button state + full-screen processing overlay (checkout.js) */
.apex-checkout form.checkout.processing #place_order {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.apex-checkout form.checkout.processing #place_order::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: apex-spin .8s linear infinite;
}

/* Our overlay replaces WooCommerce's grey block on the form while submitting */
.apex-is-processing form.checkout .blockOverlay {
    opacity: 0 !important;
}

.apex-is-processing,
.apex-is-processing body {
    overflow: hidden;
}

.apex-processing {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 27, 51, .55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: apex-fade .2s ease-out;
}

.apex-processing[hidden] {
    display: none;
}

.apex-processing__box {
    width: 100%;
    max-width: 400px;
    padding: 36px 28px 30px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .2);
    text-align: center;
    font-family: "Open Sans", sans-serif;
    animation: apex-pop .25s ease-out;
}

.apex-processing__spinner {
    position: relative;
    width: 64px;
    height: 64px;
    margin: 0 auto 22px;
    border: 4px solid #E3E9F5;
    border-top-color: #00378B;
    border-radius: 50%;
    animation: apex-spin .9s linear infinite;
}

/* Lock in the middle (counter-rotated so it stays upright) */
.apex-processing__spinner span {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 14px;
    margin: -4px 0 0 -9px;
    background: #00378B;
    border-radius: 3px;
    animation: apex-spin .9s linear infinite reverse;
}

.apex-processing__spinner span::before {
    content: "";
    position: absolute;
    left: 3px;
    top: -9px;
    width: 12px;
    height: 12px;
    border: 3px solid #00378B;
    border-bottom: 0;
    border-radius: 7px 7px 0 0;
    box-sizing: border-box;
}

.apex-processing__box h3 {
    margin: 0 0 8px;
    font-family: inherit;
    font-size: 21px;
    font-weight: 700;
    color: #1E2A3B;
}

.apex-processing__step {
    min-height: 22px;
    margin: 0 0 18px;
    font-size: 15px;
    color: #00378B;
    font-weight: 600;
}

.apex-processing__note {
    margin: 0;
    padding-top: 16px;
    border-top: 1px solid #E6E8EC;
    font-size: 13px;
    color: #5B6475;
}

@keyframes apex-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes apex-fade {
    from {
        opacity: 0;
    }
}

@keyframes apex-pop {
    from {
        opacity: 0;
        transform: translateY(8px) scale(.97);
    }
}

@media (prefers-reduced-motion: reduce) {
    .apex-processing,
    .apex-processing__box,
    .apex-processing__spinner,
    .apex-processing__spinner span,
    .apex-checkout form.checkout.processing #place_order::after {
        animation-duration: 2.4s;
    }

    .apex-processing,
    .apex-processing__box {
        animation: none;
    }
}

/* Trust badges + help */
.apex-trust {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 32px;
    margin: 20px 0 16px;
    font-size: 14px;
    color: var(--apex-muted);
}

.apex-trust span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.apex-help {
    margin: 0;
    text-align: center;
    font-size: 16px;
    color: var(--apex-text);
}

.apex-help a {
    margin-left: 4px;
    text-decoration: underline;
}

/* Checkout error notices (prepended to the form by WooCommerce) */
.apex-checkout .woocommerce-NoticeGroup-checkout {
    margin-bottom: 20px;
}

/* ---------- Responsive ---------- */

@media (max-width: 991px) {
    .apex-checkout__grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
    }
}

@media (max-width: 575px) {
    .apex-checkout {
        padding: 16px 16px 40px;
    }

    .apex-card {
        padding: 20px 16px;
    }

    .apex-checkout .apex-card__title,
    .apex-checkout .apex-section-title {
        font-size: 20px;
    }

    .apex-item {
        grid-template-columns: 64px minmax(0, 1fr) auto;
        gap: 12px;
    }

    .apex-item__thumb img {
        width: 64px !important;
        height: 64px !important;
    }

    .apex-item__price,
    .apex-item__price .amount {
        font-size: 17px;
    }

    .apex-offer {
        flex-direction: column;
        align-items: stretch;
        padding: 20px 16px;
    }

    .apex-checkout .apex-offer__add {
        width: 100%;
    }

    .apex-coupon__row {
        gap: 12px;
    }

    .apex-checkout .apex-coupon__apply {
        width: 100px;
    }

    .apex-row.order-total {
        font-size: 18px;
    }

    .apex-checkout #place_order {
        font-size: 19px;
    }

    .apex-pm-tabs {
        gap: 12px;
    }

    .apex-checkout .apex-pm-tab {
        flex: 1 1 0;
        min-width: 0;
        padding: 0 12px;
        font-size: 15px;
    }
}
