.woocommerce {
    --wtb-background: #fff;
    --wtb-padding: 40px;
    --wtb-border-radius: 12px;

    @media(max-width: 1024px) {
        --wtb-padding: 20px;
    }

    * {
        font-family: var(--e-global-typography-primary-font-family), sans-serif;
    }

    /* Notices (WooCommerce core styles are disabled site-wide) */
    .woocommerce-notices-wrapper {
        &:empty {
            display: none;
        }
    }

    .woocommerce-error,
    .woocommerce-message,
    .woocommerce-info {
        display: flex;
        flex-direction: column;
        gap: 8px;
        list-style: none;
        margin: 0 0 24px;
        padding: 16px 20px;
        border-radius: var(--wtb-border-radius);
        background: var(--wtb-background);
        box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, .1);
        border-left: 4px solid var(--e-global-color-39dd569);

        li {
            margin: 0;
            list-style: none;
        }
    }

    .woocommerce-error {
        border-left-color: #d9534f;
    }

    /* Shared form field styling */
    .form-row {
        margin: 0 0 16px;

        label {
            display: inline-flex;
            font-size: 16px;
            font-weight: 500;

            span,
            a {
                font-size: 16px;
                font-weight: 500;
                color: var(--e-global-color-28ee1f3);
            }

            a {
                text-decoration: underline;
            }

            .required {
                color: #d9534f;
                text-decoration: none;
            }

            .optional {
                font-weight: 400;
                opacity: .6;
            }

            input {
                margin-right: 8px;
            }
        }

        .woocommerce-input-wrapper {
            display: block;
            width: 100%;
        }

        input.input-text,
        select,
        textarea,
        .select2-container .select2-selection {
            width: 100%;
            height: 46px;
            border: 1px solid var(--e-global-color-fc69647, #e2e2e2);
            border-radius: 10px;
            padding: 0 14px;
            background: #fff;
            font-family: var(--e-global-typography-primary-font-family), Sans-serif;
            font-size: 14px;
            transition: border-color .2s ease;
            box-sizing: border-box;

            &:focus {
                outline: none;
                border-color: var(--e-global-color-39dd569);
            }
        }

        .select2-container .select2-selection {
            display: flex;
            align-items: center;

            .select2-selection__arrow {
                height: 44px;
            }
        }

        textarea {
            height: auto;
            min-height: 100px;
            padding: 12px 14px;
            resize: vertical;
        }

        &.woocommerce-invalid input.input-text,
        &.woocommerce-invalid select {
            border-color: #d9534f;
        }

        &.woocommerce-validated input.input-text,
        &.woocommerce-validated select {
            border-color: var(--e-global-color-39dd569);
        }
    }

    /* Custom checkbox */
    .woocommerce-form__label-for-checkbox.checkbox {
        display: flex;
        align-items: flex-start;
        gap: 10px;
        margin: 0;
        font-size: 14px;
        font-weight: 400;
        cursor: pointer;
    }

    input.woocommerce-form__input-checkbox,
    input.input-checkbox {
        appearance: none;
        -webkit-appearance: none;
        flex-shrink: 0;
        width: 20px;
        height: 20px;
        margin: 2px 0 0;
        border: 1.5px solid var(--e-global-color-7dbdc8e, #ccc);
        border-radius: 5px;
        background: #fff;
        position: relative;
        cursor: pointer;

        &:checked {
            background-color: var(--e-global-color-39dd569);
            border-color: var(--e-global-color-39dd569);

            &::after {
                content: "";
                position: absolute;
                inset: 3px;
                background-color: #fff;
                -webkit-mask: url('/wp-content/themes/WTB-Theme/assets/media/icons/woocommerce/checkout/checkbox-checked.svg') center / contain no-repeat;
                mask: url('/wp-content/themes/WTB-Theme/assets/media/icons/woocommerce/checkout/checkbox-checked.svg') center / contain no-repeat;
            }
        }
    }

    /* Generic pill button reused across the account area */
    .wtb-account-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: none !important;
        border-radius: 50px;
        padding: 13px 26px;
        background-color: var(--e-global-color-39dd569) !important;
        font-family: var(--e-global-typography-0bf6c45-font-family), Sans-serif;
        font-size: var(--e-global-typography-0bf6c45-font-size) !important;
        font-weight: var(--e-global-typography-0bf6c45-font-weight);
        text-transform: none !important;
        line-height: var(--e-global-typography-0bf6c45-line-height);
        color: #fff !important;
        text-decoration: none;
        cursor: pointer;

        &:hover {
            background-color: var(--e-global-color-3a93af1) !important;
            color: #fff;
        }

        &.wtb-account-button--cancel,
        &.wtb-account-button--trash {
            background-color: transparent;
            color: #d9534f;
            border: 1.5px solid #d9534f;

            &:hover {
                background-color: #d9534f;
                color: #fff;
            }
        }
    }

    /* Account layout: sidebar navigation + content */
    .wtb-account {
        display: grid;
        grid-template-columns: 280px 1fr;
        gap: 40px;
        align-items: start;

        @media(max-width: 1024px) {
            grid-template-columns: 1fr;
            gap: 24px;
        }

        .woocommerce-MyAccount-navigation {
            width: 100% !important;
        }

        .woocommerce-MyAccount-content-wrapper {
            background: none !important;
        }

    }

    .wtb-account-nav {
        background: var(--wtb-background);
        padding: 24px;
        border-radius: var(--wtb-border-radius);
        position: sticky;
        top: 20px;

        @media(max-width: 1024px) {
            position: static;
        }

        .wtb-account-nav-list {
            list-style: none;
            margin: 0;
            padding: 0;
            display: flex;
            flex-direction: column;
            gap: 4px;

        }


        .wtb-account-nav-item.woocommerce-MyAccount-navigation-link--customer-logout {
            margin-top: 12px;
            padding-top: 12px;
            border-top: 1px solid rgba(0, 0, 0, .08);
        }

        .wtb-account-nav-link {
            display: block;
            padding: 12px 16px;
            border-radius: 50px;
            color: inherit;
            text-decoration: none;
            font-weight: 500;
            font-size: 14px;
            transition: background-color .2s ease, color .2s ease;

            &:hover {
                background: rgba(0, 0, 0, .05);
            }
        }

        .wtb-account-nav-item.is-active .wtb-account-nav-link,
        .wtb-account-nav-link[aria-current="page"] {
            background: var(--e-global-color-39dd569);
            color: #fff;
        }
    }

    .wtb-account-content {
        background: var(--wtb-background);
        padding: 0 !important;
        border-radius: var(--wtb-border-radius);
        min-width: 0;
    }

    /* Dashboard */
    .wtb-account-dashboard {
        padding: var(--wtb-padding);

        p {
            margin: 0 0 12px;
            font-size: 14px;
            line-height: 1.6;

            &:last-child {
                margin-bottom: 0;
            }
        }

        a {
            color: var(--e-global-color-39dd569);
            font-weight: 600;
        }

        .wtb-account-dashboard-greeting {
            font-size: 16px;
        }
    }

    /* Login / register / lost password */
    .wtb-account-auth {
        &.u-columns.col2-set {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 40px;

            @media(max-width: 767px) {
                grid-template-columns: 1fr;
                gap: 24px;
            }
        }

        &.wtb-account-auth--single-col {
            display: flex;
            max-width: 480px;

            .wtb-account-auth-col {
                width: 100%;
            }
        }

        .wtb-account-auth-col {
            background: var(--wtb-background);
            padding: var(--wtb-padding);
            border-radius: var(--wtb-border-radius);
        }

        .wtb-account-auth-title {
            margin: 0 0 20px;
            font-size: 20px;
            font-weight: 600;
            color: var(--e-global-color-a34d29c);
        }

        .wtb-account-auth-intro {
            margin: 0 0 20px;
            font-size: 14px;
            line-height: 1.6;
        }

        .wtb-account-auth-row {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
        }

        .woocommerce-LostPassword {
            margin: 12px 0 0;
            font-size: 13px;

            a {
                color: var(--e-global-color-39dd569);
            }
        }
    }

    /* Generic content card (edit account, edit address, downloads, payment methods, view order) */
    .wtb-account-card {
        background: var(--wtb-background);
        border-radius: var(--wtb-border-radius);
        display: flex;
        flex-direction: column;
        gap: 24px;
        padding: var(--wtb-padding);
    }

    .wtb-account-card-title {
        margin: 0;
        font-size: 20px;
        font-weight: 600;
        color: var(--e-global-color-a34d29c);
    }

    .woocommerce-form-login,
    .wtb-account-card-fields {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        column-gap: 20px;
        row-gap: 12px;


        .form-row,
        .woocommerce-form-row {
            position: relative;
            display: flex;
            flex-direction: column;
            justify-content: end;
            margin: 0;
            width: calc(50% - 10px);
            gap: 8px;

            @media(max-width: 767px) {
                width: 100%;
            }

            &.form-row-wide,
            &.woocommerce-form-row--wide {
                width: 100%;
            }

            input:not([type="checkbox"]) {
                border-radius: 50px !important;
            }

            button.show-password-input {
                position: absolute;
                right: 20px;
                bottom: 12px;
                background: var(--e-global-color-39dd569);
                border: none;
                padding: 0;

                &:after {
                    content: "";
                    display: flex;
                    font-size: 12px;
                    width: 30px;
                    height: 20px;
                    background-image: url('/wp-content/themes/WTB-Theme/assets/media/icons/woocommerce/show.svg');
                    background-position: center;
                    background-size: 16px;
                    background-repeat: no-repeat;
                }

                &.display-password {
                    &:after {
                        background-image: url('/wp-content/themes/WTB-Theme/assets/media/icons/woocommerce/hide.svg');

                    }
                }
            }
        }

        .form-row-wide {
            grid-column: 1 / -1;
            position: relative;
        }

        .wtb-account-auth-row {
            align-items: start;
        }
    }

    .wtb-account-fieldset {
        margin: 0;
        padding: 20px 0 0;
        border: none;
        border-top: 1px solid rgba(0, 0, 0, .08);

        legend {
            width: 100%;
            padding: 0 0 16px;
        }
    }

    .wtb-account-field-hint {
        display: block;
        margin-top: 6px;
        font-size: 12px;
        opacity: .7;

        em {
            font-style: normal;
        }
    }

    .wtb-account-card-actions {
        margin: 0;
        display: flex;
        align-items: center;
        gap: 12px;
        flex-wrap: wrap;
    }

    /* Addresses */
    .wtb-account-section-intro {
        margin: 0 0 24px;
        font-size: 14px;
        opacity: .8;
        padding: 20px;
    }

    .wtb-account-addresses {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 24px;
    }

    .wtb-account-address {
        background: var(--wtb-background);
        padding: var(--wtb-padding);
        border-radius: var(--wtb-border-radius);
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .wtb-account-address-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        position: relative;
    }

    .wtb-account-address-title {
        margin: 0;
        font-size: 18px;
        font-weight: 600;
        color: var(--e-global-color-a34d29c);
    }

    .wtb-account-address-edit {
        font-size: 13px;
        font-weight: 600;
        color: var(--e-global-color-39dd569);
        text-decoration: underline;
        white-space: nowrap;
    }

    .wtb-account-address-body {
        font-style: normal;
        font-size: 14px;
        line-height: 1.7;
        padding: 20px !important;
        box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, .2);
        border-radius: 12px;
    }

    /* Orders / payment methods tables */
    table.wtb-account-orders-table {
        width: 100%;
        border-collapse: collapse;
        border: none;

        * {
            border: none;
        }

        thead th {
            text-align: left;
            padding: 0 16px 12px;
            font-size: 12px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: .02em;
            opacity: .6;
            border: none !important;
        }

        tbody tr {

            &:last-child {
                border-bottom: none;
            }
        }

        tbody td,
        tbody th {
            padding: 16px;
            font-size: 14px;
            font-weight: 400;
            text-align: left;
        }

        .woocommerce-orders-table__cell-order-actions,
        td.payment-method-actions {
            text-align: right;

            .wtb-account-button {
                margin-left: 8px;
            }
        }

        @media(max-width: 767px) {
            thead {
                display: none;
            }

            tbody,
            tr,
            td,
            th {
                display: block;
                width: 100%;
            }

            tbody tr {
                padding: 16px 0;
            }

            tbody td,
            tbody th {
                display: flex;
                align-items: center;
                justify-content: space-between;
                gap: 12px;
                padding: 6px 0;
                text-align: right;

                &::before {
                    content: attr(data-title);
                    margin-right: auto;
                    padding-right: 12px;
                    font-weight: 600;
                    text-align: left;
                    opacity: .6;
                }
            }

            .woocommerce-orders-table__cell-order-actions {
                justify-content: flex-start;
                flex-wrap: wrap;


                &::before {
                    display: none;
                }

                .wtb-account-button {
                    margin: 0 8px 8px 0;

                }
            }
        }
    }

    .wtb-account-pagination {
        display: flex;
        justify-content: center;
        gap: 12px;
        margin-top: 24px;
    }

    .wtb-account-pagination-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50px;
        padding: 10px 22px;
        border: 1.5px solid var(--e-global-color-fc69647, #e2e2e2);
        color: inherit;
        text-decoration: none;
        font-size: 13px;
        font-weight: 600;

        &:hover {
            border-color: var(--e-global-color-39dd569);
        }
    }

    /* Downloads */
    .wtb-account-downloads-list {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .wtb-account-download {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        flex-wrap: wrap;
        padding: 14px 16px;
        border-radius: 12px;
        box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, .1);
    }

    .wtb-account-download-link {
        font-weight: 600;
        color: var(--e-global-color-a34d29c);
        text-decoration: none;

        &:hover {
            color: var(--e-global-color-39dd569);
        }
    }

    .wtb-account-download-count {
        font-size: 12px;
        opacity: .7;
    }

    /* Add payment method */
    .wtb-payment-methods {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .wtb-payment-method {
        border: 1.5px solid var(--e-global-color-fc69647, #e2e2e2);
        border-radius: 12px;
        padding: 14px 16px;
        transition: border-color .2s ease;

        &:has(.input-radio:checked) {
            border-color: var(--e-global-color-39dd569);
        }
    }

    .wtb-payment-method-label {
        display: flex;
        align-items: center;
        gap: 12px;
        margin: 0;
        cursor: pointer;

        input.input-radio {
            appearance: none;
            -webkit-appearance: none;
            flex-shrink: 0;
            width: 20px;
            height: 20px;
            margin: 0;
            border-radius: 50%;
            border: 1.5px solid var(--e-global-color-7dbdc8e, #ccc);
            position: relative;

            &:checked {
                border-color: var(--e-global-color-39dd569);

                &::after {
                    content: "";
                    position: absolute;
                    inset: 4px;
                    border-radius: 50%;
                    background: var(--e-global-color-39dd569);
                }
            }
        }

        .wtb-payment-method-title {
            font-size: 14px;
            font-weight: 600;
        }

        img {
            margin-left: auto;
            max-height: 24px;
        }
    }

    .wtb-payment-method-box {
        margin: 12px 0 0 32px;
        padding-top: 12px;
        border-top: 1px solid rgba(0, 0, 0, .08);
        font-size: 13px;
    }

    /* View order */
    .wtb-account-view-order {
        display: flex;
        flex-direction: column;
        gap: 24px;

        .wtb-account-order-status {
            margin: 0;
            font-size: 14px;

            mark {
                background: none;
                color: inherit;
                font-weight: 600;
            }
        }

        .wtb-account-order-updates {
            list-style: none;
            margin: 0;
            padding: 0;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .wtb-account-order-update {
            padding: 16px;
            border-radius: 12px;
            box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, .1);

            .woocommerce-OrderUpdate-meta {
                margin: 0 0 6px;
                font-size: 12px;
                opacity: .6;
            }

            .woocommerce-OrderUpdate-description p {
                margin: 0;
                font-size: 14px;
            }
        }

        .woocommerce-order-details {
            border-radius: 12px;

            table {

                * {
                    border: none;
                }

                thead,
                tbody {
                    tr {

                        td,
                        th {
                            &:first-of-type {
                                text-align: start;
                            }

                            &:last-of-type {
                                text-align: end;

                                .product-tax {
                                    text-align: end;
                                }
                            }
                        }
                    }
                }

                tfoot {
                    th {
                        text-align: start;
                    }

                    td {
                        text-align: end;
                    }
                }
            }
        }

        .woocommerce-customer-details {
            display: flex;
            width: 100%;

            .woocommerce-columns {
                display: flex;
                width: 100%;
                gap: 40px;

                @media(max-width: 1024px) {
                    flex-direction: column;
                    gap: 24px;
                }

                .woocommerce-column {
                    flex: 1;
                    padding: 20px;
                    border-radius: 12px;
                    box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, .1);
                }
            }
        }
    }
}