/* ph-checkout.css — PainHunting custom WooCommerce checkout (classic + legacy block tweaks) */

body.woocommerce-checkout .site-main,
body.woocommerce-checkout .woocommerce {
    max-width: 1200px;
    margin: 0 auto;
}

body.woocommerce-checkout .woocommerce {
    padding: 0px 16px 56px;
}

/* Native #billing_* anchor jumps + scrollIntoView — offset sticky header (matches certifications catalog pattern) */
html:has(body.woocommerce-checkout:not(.admin-bar)) {
    scroll-padding-top: calc(80px + 1.25rem);
}

html:has(body.admin-bar.woocommerce-checkout) {
    scroll-padding-top: calc(80px + 32px + 1.25rem);
}

@media screen and (max-width: 782px) {
    html:has(body.admin-bar.woocommerce-checkout) {
        scroll-padding-top: calc(80px + 46px + 1.25rem);
    }
}

body.woocommerce-checkout .woocommerce-checkout h3,
body.woocommerce-checkout #order_review_heading {
    color: var(--ph-black);
    letter-spacing: -0.01em;
}

/*
 * Classic checkout: form must have exactly two grid areas — details (left) and order sidebar (right).
 * Do not place #order_review_heading as its own grid child or the layout breaks into three columns.
 */
body.woocommerce-checkout .ph-classic-checkout form.checkout {
    max-width: 1000px;
    margin: 0 auto;
}

body.woocommerce-checkout .ph-classic-checkout #customer_details.col2-set::before,
body.woocommerce-checkout .ph-classic-checkout #customer_details.col2-set::after {
    content: none;
    display: none;
}

body.woocommerce-checkout .ph-classic-checkout #customer_details .col-1,
body.woocommerce-checkout .ph-classic-checkout #customer_details .col-2 {
    width: 100% !important;
    float: none !important;
    margin: 0 0 14px 0 !important;
}

body.woocommerce-checkout .ph-classic-checkout .ph-checkout-order-sidebar {
    background: var(--ph-white);
    border: 1px solid var(--ph-border);
    border-radius: 18px;
    box-shadow: var(--ph-shadow-sm);
    padding: 16px 20px;
    width: 100%;
}

body.woocommerce-checkout .ph-classic-checkout .ph-checkout-order-sidebar #order_review_heading {
    margin: 0 0 16px;
    padding: 0;
    display: block;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

body.woocommerce-checkout .ph-classic-checkout .ph-checkout-order-sidebar__heading .ph-checkout-accordion__title {
    font-size: clamp(1.125rem, 2.5vw, 1.35rem);
    font-weight: var(--ph-fw-bold);
    letter-spacing: -0.02em;
}

body.woocommerce-checkout .ph-classic-checkout .ph-checkout-order-sidebar #order_review {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    position: static;
}

body.woocommerce-checkout .ph-classic-checkout .woocommerce-billing-fields > h3,
body.woocommerce-checkout .ph-classic-checkout .woocommerce-shipping-fields > h3,
body.woocommerce-checkout .ph-classic-checkout .woocommerce-additional-fields > h3,
body.woocommerce-checkout .ph-classic-checkout .ph-checkout-accordion__summary {
    margin-top: 0;
    position: relative;
}

/* Billing + Additional: <details> accordions — panel height animated in ph-checkout-accordion.js */
body.woocommerce-checkout .ph-checkout-accordion {
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    box-shadow: none;
    background: transparent;
}

body.woocommerce-checkout .ph-checkout-accordion > .ph-checkout-accordion__body {
    overflow: hidden;
}

body.woocommerce-checkout .ph-checkout-accordion > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 0 0;
}

body.woocommerce-checkout .ph-checkout-accordion > summary::-webkit-details-marker {
    display: none;
}

body.woocommerce-checkout .ph-checkout-accordion__heading-start {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

body.woocommerce-checkout .ph-checkout-accordion__icon {
    flex-shrink: 0;
    color: var(--ph-green);
    line-height: 0;
}

body.woocommerce-checkout .ph-checkout-accordion__icon svg {
    display: block;
}

body.woocommerce-checkout .ph-checkout-accordion__title {
    font-size: clamp(1.125rem, 2.5vw, 1.35rem);
    font-weight: var(--ph-fw-bold);
    color: var(--ph-black);
    letter-spacing: -0.02em;
}

body.woocommerce-checkout .ph-checkout-accordion__chevron {
    flex-shrink: 0;
    color: var(--ph-black);
    line-height: 0;
    opacity: 1;
    background: var(--ph-green);
    color: white;
    padding: 3px;
    border-radius: 25px;
    transition: transform 0.42s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}

body.woocommerce-checkout .ph-checkout-accordion__chevron svg {
    display: block;
}

body.woocommerce-checkout .ph-checkout-accordion[open] .ph-checkout-accordion__chevron {
    transform: rotate(180deg);
    opacity: 1;
    background: var(--ph-green);
    color: white;
    padding: 3px;
    border-radius: 25px;
}

body.woocommerce-checkout .ph-checkout-accordion__body {
    padding-top: 0;
}

body.woocommerce-checkout .ph-checkout-accordion--additional {
    margin-top: 24px;
}

@media (prefers-reduced-motion: reduce) {
    body.woocommerce-checkout .ph-checkout-accordion__chevron {
        transition: none;
    }
}

body.woocommerce-checkout .ph-classic-checkout .ph-checkout-panel {
    margin-top: 0;
}

body.woocommerce-checkout .ph-classic-checkout .woocommerce form .form-row label {
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: manual;
}

body.woocommerce-checkout .ph-classic-checkout .woocommerce-billing-fields__field-wrapper,
body.woocommerce-checkout .ph-classic-checkout .woocommerce-shipping-fields__field-wrapper {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
}

/* Tighten space between page title / notices and the form */
body.woocommerce-checkout .woocommerce .woocommerce-notices-wrapper {
    margin-bottom: 12px;
}

.woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) #respond input#submit.alt, .woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) a.button.alt, .woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) button.button.alt, .woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) input.button.alt, :where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce #respond input#submit.alt, :where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce a.button.alt, :where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce button.button.alt, :where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce input.button.alt{
    background-color: var(--ph-green) !important;
}

body.woocommerce-checkout #customer_details > div,
body.woocommerce-checkout #order_review {
    background: var(--ph-white);
    border: 1px solid var(--ph-border);
    border-radius: 18px;
    box-shadow: var(--ph-shadow-sm);
    padding: 16px 20px;
}

body.woocommerce-checkout #order_review {
    position: sticky;
    top: 24px;
}

/* Classic: card + sticky live on .ph-checkout-order-sidebar; inner #order_review is flush */
body.woocommerce-checkout .ph-classic-checkout .ph-checkout-order-sidebar #order_review {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    position: static;
}

body.woocommerce-checkout .woocommerce-billing-fields__field-wrapper,
body.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
}

body.woocommerce-checkout .woocommerce-billing-fields__field-wrapper .form-row-wide,
body.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper .form-row-wide {
    grid-column: 1 / -1;
}

body.woocommerce-checkout .woocommerce form .form-row {
    margin-bottom: 0;
    width: auto;
    padding: 0 !important;
}

/* Classic: Woo default .form-row-first/last use float + % width — breaks theme field grid */
body.woocommerce-checkout .ph-classic-checkout .woocommerce form .form-row {
    float: none !important;
    width: auto !important;
    max-width: none !important;
}

body.woocommerce-checkout .woocommerce form .form-row label {
    color: var(--ph-gray);
    font-weight: var(--ph-fw-medium);
    margin-bottom: 8px;
}

body.woocommerce-checkout .woocommerce form .form-row input.input-text,
body.woocommerce-checkout .woocommerce form .form-row textarea,
body.woocommerce-checkout .woocommerce form .form-row select,
body.woocommerce-checkout .select2-container--default .select2-selection--single {
    border: 1px solid var(--ph-green);
    border-radius: 12px;
    min-height: 48px;
    padding: 10px 14px;
    background: #fff;
    transition: border-color var(--ph-transition), box-shadow var(--ph-transition);
}

body.woocommerce-checkout .select2-container--default .select2-selection--single {
    display: flex;
    align-items: center;
}

body.woocommerce-checkout .woocommerce form .form-row input.input-text:focus,
body.woocommerce-checkout .woocommerce form .form-row textarea:focus,
body.woocommerce-checkout .woocommerce form .form-row select:focus,
body.woocommerce-checkout .select2-container--default.select2-container--focus .select2-selection--single {
    border-color: var(--ph-green);
    box-shadow: 0 0 0 3px rgba(70, 159, 16, 0.14);
    outline: none;
}

body.woocommerce-checkout table.shop_table {
    border: 1px solid var(--ph-border);
    border-radius: 12px;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
}

body.woocommerce-checkout table.shop_table th,
body.woocommerce-checkout table.shop_table td {
    border-top: 1px solid var(--ph-border);
    padding: 12px 10px;
}

body.woocommerce-checkout table.shop_table tr:first-child th,
body.woocommerce-checkout table.shop_table tr:first-child td {
    border-top: 0;
}

/* Order review: product type icon + title (registry image from Products → Product Types). */
body.woocommerce-checkout table.shop_table .ph-checkout-order-product {
    display: flex;
    align-items: center;
    gap: 16px;
}

body.woocommerce-checkout table.shop_table .ph-checkout-order-product__icon {
    flex-shrink: 0;
    width: 88px;
    height: 88px;
    border-radius: 16px;
    overflow: hidden;
    background: #f4faed;
    border: 1px solid #dceacb;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.woocommerce-checkout table.shop_table .ph-checkout-order-product__icon img.ph-checkout-order-product__img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    padding: 10px;
}

body.woocommerce-checkout table.shop_table .ph-checkout-order-product__text {
    flex: 1;
    min-width: 0;
}

@media (max-width: 680px) {
    body.woocommerce-checkout table.shop_table .ph-checkout-order-product {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    body.woocommerce-checkout table.shop_table .ph-checkout-order-product__icon {
        width: 72px;
        height: 72px;
    }
}

body.woocommerce-checkout .woocommerce-checkout-payment {
    background: #f9fcf5;
    border: 1px solid #dceacb;
    border-radius: 12px;
    padding: 30px 15px;
}

body.woocommerce-checkout #payment div.payment_box {
    background: var(--ph-white);
    border: 1px solid var(--ph-border);
    border-radius: 10px;
}

body.woocommerce-checkout #payment div.payment_box::before {
    border-bottom-color: var(--ph-border);
}

/* Payment method radios: theme green + stable row (radio + label inline, box below). */
body.woocommerce-checkout #payment ul.payment_methods {
    padding: 0;
    margin: 0 0 14px;
    border-bottom: 1px solid var(--ph-border);
}

body.woocommerce-checkout #payment ul.payment_methods li.wc_payment_method {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 10px;
    row-gap: 6px;
    margin: 0 0 14px;
    line-height: 1.35;
    font-weight: normal;
}

body.woocommerce-checkout #payment ul.payment_methods li.wc_payment_method:last-child {
    margin-bottom: 0;
}

body.woocommerce-checkout #payment ul.payment_methods li.wc_payment_method::before,
body.woocommerce-checkout #payment ul.payment_methods li.wc_payment_method::after {
    content: none;
    display: none;
}

body.woocommerce-checkout #payment ul.payment_methods li input.input-radio {
    float: none;
    flex: 0 0 auto;
    width: 1.125rem;
    height: 1.125rem;
    margin: 0;
    accent-color: var(--ph-green);
    cursor: pointer;
    vertical-align: middle;
    display: block !important;
}

body.woocommerce-checkout #payment ul.payment_methods li input.input-radio:focus-visible {
    outline: 2px solid var(--ph-green);
    outline-offset: 2px;
}

body.woocommerce-checkout #payment ul.payment_methods li > label {
    float: none;
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin: 0;
    line-height: 1.35;
    font-weight: var(--ph-fw-medium);
    color: var(--ph-black);
    cursor: pointer;
}

body.woocommerce-checkout #payment ul.payment_methods li > .payment_box {
    flex: 1 1 100%;
    width: 100%;
    float: none;
    clear: both;
    margin: 8px 0 0;
    box-sizing: border-box;
}

body.woocommerce-checkout #payment ul.payment_methods li.payment_method_paypal > label img {
    float: none;
    margin: 0;
}

/* Robokassa: card marks appended via woocommerce_gateway_icon */
body.woocommerce-checkout #payment ul.payment_methods li.payment_method_robokassa > label .ph-checkout-card-icons {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-left: 2px;
}

body.woocommerce-checkout #payment ul.payment_methods li.payment_method_robokassa > label .ph-checkout-card-icons__mark {
    display: block;
    height: 22px;
    width: auto;
    flex-shrink: 0;
    border-radius: 4px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

/* Robokassa payment_box: secure lock + description text (woocommerce_gateway_description) */
body.woocommerce-checkout #payment .payment_box.payment_method_robokassa .ph-robokassa-checkout-desc__inner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

body.woocommerce-checkout #payment .payment_box.payment_method_robokassa .ph-robokassa-checkout-desc__icon {
    flex-shrink: 0;
    color: var(--ph-green);
    line-height: 0;
}

body.woocommerce-checkout #payment .payment_box.payment_method_robokassa .ph-robokassa-checkout-desc__icon svg {
    display: block;
}

body.woocommerce-checkout #payment .payment_box.payment_method_robokassa .ph-robokassa-checkout-desc__text {
    flex: 1;
    min-width: 0;
    font-size: 0.95em;
    line-height: 1.45;
    color: var(--ph-black);
}

body.woocommerce-checkout .button.alt,
body.woocommerce-checkout button.button.alt,
body.woocommerce-checkout #place_order {
    width: 100%;
    min-height: 52px;
    border: 1px solid var(--ph-green);
    border-radius: 999px;
    background: var(--ph-green);
    color: var(--ph-white);
    font-size: 17px;
    font-weight: var(--ph-fw-bold);
    letter-spacing: 0.01em;
    transition: background var(--ph-transition), border-color var(--ph-transition), transform var(--ph-transition);
    margin: 20px auto 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

body.woocommerce-checkout #place_order .ph-checkout-place-order__arrow .ph-related-arrow-svg {
    display: block;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

body.woocommerce-checkout #place_order .ph-checkout-place-order__arrow .ph-related-arrow-svg path {
    fill: currentColor;
}

body.woocommerce-checkout .button.alt:hover,
body.woocommerce-checkout button.button.alt:hover,
body.woocommerce-checkout #place_order:hover {
    background: var(--ph-green-dark);
    border-color: var(--ph-green-dark);
    transform: translateY(-1px);
}

body.woocommerce-checkout .woocommerce-info,
body.woocommerce-checkout .woocommerce-message {
    border-top-color: var(--ph-green);
    background: #f4faed;
    border-radius: 10px;
}

body.woocommerce-checkout .woocommerce-error {
    border-top-color: #d53f3f;
    border-radius: 10px;
}

@media (max-width: 980px) {
    body.woocommerce-checkout .ph-classic-checkout form.checkout {
        grid-template-columns: 1fr;
    }

    body.woocommerce-checkout .ph-classic-checkout .ph-checkout-order-sidebar {
        grid-column: 1;
        grid-row: auto;
        position: static;
    }

    body.woocommerce-checkout #order_review {
        position: static;
    }
}

@media (max-width: 680px) {
    body.woocommerce-checkout .woocommerce {
        padding: 16px 12px 40px;
    }

    body.woocommerce-checkout #customer_details > div,
    body.woocommerce-checkout #order_review {
        border-radius: 14px;
        padding: 16px;
    }

    body.woocommerce-checkout .woocommerce-billing-fields__field-wrapper,
    body.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* WooCommerce Checkout Block support (new block-based checkout markup) */
body.woocommerce-checkout .wp-block-woocommerce-checkout,
body.woocommerce-checkout .wc-block-checkout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 16px 56px;
}

/* Step panels — same card language as Profile & settings (.ph-edit-account__panel--profile). */
body.woocommerce-checkout .wc-block-checkout__main .wc-block-components-checkout-step,
body.woocommerce-checkout .wc-block-components-form .wc-block-components-checkout-step {
    background: var(--ph-white);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    box-shadow: var(--ph-shadow-sm);
    padding: 24px 22px;
    margin-bottom: 20px;
}

body.woocommerce-checkout .wc-block-checkout__sidebar .wc-block-components-totals-wrapper,
body.woocommerce-checkout .wc-block-checkout__sidebar .wc-block-components-order-summary {
    background: var(--ph-white);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    box-shadow: var(--ph-shadow-sm);
    padding: 18px 16px;
}

body.woocommerce-checkout .wc-block-components-checkout-step__heading {
    padding: 0 0 12px;
    margin: 0 0 18px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

body.woocommerce-checkout .wc-block-components-title,
body.woocommerce-checkout .wc-block-components-checkout-step__heading-title {
    font-size: clamp(17px, 2vw, 19px);
    font-weight: var(--ph-fw-bold);
    color: var(--ph-black);
    letter-spacing: -0.01em;
    line-height: 1.25;
    margin: 0;
}

/*
 * WooCommerce puts <input> before <label> and uses position:absolute for “floating” labels.
 * position:static alone makes labels sit *below* the field. Fix: flex column + label order:-1 on __wrapper,
 * and override .is-active / :-webkit-autofill padding Woo adds for the float layout.
 */
body.woocommerce-checkout .wc-block-components-text-input,
body.woocommerce-checkout .wc-block-components-form .wc-block-components-text-input {
    line-height: normal;
    white-space: normal;
    margin-top: 0;
}

body.woocommerce-checkout .wc-block-components-text-input .wc-block-components-text-input__wrapper {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    line-height: normal;
}

body.woocommerce-checkout .wc-block-components-text-input .wc-block-components-text-input__wrapper > label {
    order: -1;
    position: static !important;
    transform: none !important;
    top: auto !important;
    left: auto !important;
    display: block;
    max-width: none !important;
    overflow: visible;
    text-overflow: unset;
    white-space: normal;
    font-size: 15px !important;
    font-weight: var(--ph-fw-medium) !important;
    color: var(--ph-black) !important;
    margin: 0 0 10px !important;
    letter-spacing: 0.01em;
    line-height: 1.35 !important;
    cursor: default;
    transition: none;
}

body.woocommerce-checkout .wc-block-components-text-input.is-active .wc-block-components-text-input__wrapper > label,
body.woocommerce-checkout .wc-block-components-text-input input:-webkit-autofill + label {
    transform: none !important;
    top: auto !important;
}

body.woocommerce-checkout .wc-block-components-text-input input[type="email"],
body.woocommerce-checkout .wc-block-components-text-input input[type="tel"],
body.woocommerce-checkout .wc-block-components-text-input input[type="text"],
body.woocommerce-checkout .wc-block-components-text-input input[type="number"],
body.woocommerce-checkout .wc-block-components-text-input input[type="url"],
body.woocommerce-checkout .wc-block-components-text-input input[type="password"],
body.woocommerce-checkout .wc-block-components-text-input select {
    width: 100%;
    box-sizing: border-box;
    height: 52px;
    min-height: 52px;
    padding: 0 22px !important;
    border: 1px solid #d1d5db !important;
    border-radius: var(--ph-border-radius-pill) !important;
    background: #f5f5f7 !important;
    font-size: 16px !important;
    color: var(--ph-black) !important;
    transition: border-color var(--ph-transition), box-shadow var(--ph-transition), background var(--ph-transition) !important;
}

body.woocommerce-checkout .wc-block-components-text-input.is-active input[type="email"],
body.woocommerce-checkout .wc-block-components-text-input.is-active input[type="tel"],
body.woocommerce-checkout .wc-block-components-text-input.is-active input[type="text"],
body.woocommerce-checkout .wc-block-components-text-input.is-active input[type="number"],
body.woocommerce-checkout .wc-block-components-text-input.is-active input[type="url"],
body.woocommerce-checkout .wc-block-components-text-input.is-active input[type="password"],
body.woocommerce-checkout .wc-block-components-text-input input[type="email"]:-webkit-autofill,
body.woocommerce-checkout .wc-block-components-text-input input[type="tel"]:-webkit-autofill,
body.woocommerce-checkout .wc-block-components-text-input input[type="text"]:-webkit-autofill,
body.woocommerce-checkout .wc-block-components-text-input input[type="number"]:-webkit-autofill,
body.woocommerce-checkout .wc-block-components-text-input input[type="url"]:-webkit-autofill,
body.woocommerce-checkout .wc-block-components-text-input input[type="password"]:-webkit-autofill,
body.woocommerce-checkout .wc-block-components-text-input.is-active input[type="email"]:focus,
body.woocommerce-checkout .wc-block-components-text-input.is-active input[type="tel"]:focus,
body.woocommerce-checkout .wc-block-components-text-input.is-active input[type="text"]:focus,
body.woocommerce-checkout .wc-block-components-text-input.is-active input[type="number"]:focus,
body.woocommerce-checkout .wc-block-components-text-input.is-active input[type="url"]:focus,
body.woocommerce-checkout .wc-block-components-text-input.is-active input[type="password"]:focus,
body.woocommerce-checkout .wc-block-components-text-input input[type="email"]:-webkit-autofill:focus,
body.woocommerce-checkout .wc-block-components-text-input input[type="tel"]:-webkit-autofill:focus,
body.woocommerce-checkout .wc-block-components-text-input input[type="text"]:-webkit-autofill:focus,
body.woocommerce-checkout .wc-block-components-text-input input[type="number"]:-webkit-autofill:focus,
body.woocommerce-checkout .wc-block-components-text-input input[type="url"]:-webkit-autofill:focus,
body.woocommerce-checkout .wc-block-components-text-input input[type="password"]:-webkit-autofill:focus {
    padding: 0 22px !important;
}

body.woocommerce-checkout .wc-block-components-text-input input::placeholder {
    color: var(--ph-gray-mid);
    opacity: 1;
}

body.woocommerce-checkout .wc-block-components-text-input input:-webkit-autofill,
body.woocommerce-checkout .wc-block-components-text-input input:-webkit-autofill:hover {
    -webkit-box-shadow: 0 0 0 40px #f5f5f7 inset;
}

body.woocommerce-checkout .wc-block-components-text-input input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 40px #fff inset;
}

body.woocommerce-checkout .wc-block-components-text-input input:hover,
body.woocommerce-checkout .wc-block-components-text-input select:hover {
    border-color: #c4c8d0 !important;
}

body.woocommerce-checkout .wc-block-components-text-input input:focus,
body.woocommerce-checkout .wc-block-components-text-input select:focus {
    outline: none !important;
    border-color: var(--ph-green) !important;
    box-shadow: 0 0 0 3px rgba(70, 159, 16, 0.15) !important;
    background: var(--ph-white) !important;
}

/* Select (country / state) — WC uses .wc-blocks-components-select__label (absolute inside field), not <label>. */
body.woocommerce-checkout .wc-blocks-components-select {
    margin-top: 0;
    line-height: normal;
}

body.woocommerce-checkout .wc-blocks-components-select .wc-blocks-components-select__container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: transparent;
    border-radius: var(--ph-border-radius-pill);
    line-height: normal;
    position: relative;
}

body.woocommerce-checkout .wc-blocks-components-select .wc-blocks-components-select__label {
    order: -1;
    position: static !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    display: block;
    max-width: none !important;
    overflow: visible;
    text-overflow: unset;
    white-space: normal !important;
    z-index: auto !important;
    font-size: 15px !important;
    font-weight: var(--ph-fw-medium) !important;
    color: var(--ph-black) !important;
    margin: 0 0 10px !important;
    letter-spacing: 0.01em;
    line-height: 1.35 !important;
    cursor: default;
}

body.woocommerce-checkout .wc-blocks-components-select label,
body.woocommerce-checkout .wc-block-components-select-wrapper label {
    display: block;
    font-size: 15px;
    font-weight: var(--ph-fw-medium);
    color: var(--ph-black);
    margin: 0 0 10px;
    letter-spacing: 0.01em;
}

body.woocommerce-checkout .wc-blocks-components-select .wc-blocks-components-select__select {
    width: 100%;
    box-sizing: border-box;
    min-height: 52px;
    height: 52px;
    padding: 0 44px 0 22px !important;
    margin: 0;
    border: 1px solid #d1d5db !important;
    border-radius: var(--ph-border-radius-pill) !important;
    background-color: #f5f5f7 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    background-size: 12px 12px;
    font-size: 16px !important;
    font-weight: var(--ph-fw-regular);
    color: var(--ph-black) !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: border-color var(--ph-transition), box-shadow var(--ph-transition), background-color var(--ph-transition);
}

body.woocommerce-checkout .wc-blocks-components-select .wc-blocks-components-select__select:hover {
    border-color: #c4c8d0 !important;
}

body.woocommerce-checkout .wc-blocks-components-select .wc-blocks-components-select__select:focus {
    outline: none !important;
    border-color: var(--ph-green) !important;
    box-shadow: 0 0 0 3px rgba(70, 159, 16, 0.15) !important;
    background-color: var(--ph-white) !important;
    padding: 0 44px 0 22px !important;
}

/* Combobox (searchable country / region) — same DOM issue: control often precedes label. */
body.woocommerce-checkout .wc-block-components-combobox {
    display: flex;
    flex-direction: column;
    line-height: normal;
    white-space: normal;
    margin-top: 0;
}

body.woocommerce-checkout .wc-block-components-combobox label {
    order: -1;
    position: static !important;
    transform: none !important;
    display: block;
    font-size: 15px !important;
    font-weight: var(--ph-fw-medium) !important;
    color: var(--ph-black) !important;
    margin: 0 0 10px !important;
    cursor: default;
}

body.woocommerce-checkout .wc-block-components-combobox .wc-block-components-combobox-control input.components-combobox-control__input,
body.woocommerce-checkout .wc-block-components-combobox .wc-block-components-combobox-control input {
    height: 52px !important;
    min-height: 52px !important;
    padding: 0 22px !important;
    border: 1px solid #d1d5db !important;
    border-radius: var(--ph-border-radius-pill) !important;
    background: #f5f5f7 !important;
    font-size: 16px !important;
    color: var(--ph-black) !important;
    transition: border-color var(--ph-transition), box-shadow var(--ph-transition), background var(--ph-transition) !important;
}

body.woocommerce-checkout .wc-block-components-combobox .wc-block-components-combobox-control input:hover {
    border-color: #c4c8d0 !important;
}

body.woocommerce-checkout .wc-block-components-combobox .wc-block-components-combobox-control input:focus {
    border-color: var(--ph-green) !important;
    box-shadow: 0 0 0 3px rgba(70, 159, 16, 0.15) !important;
    outline: none !important;
    background: var(--ph-white) !important;
}

/* “+ Add apartment…” — text control, not a chunky button */
body.woocommerce-checkout .wc-block-components-address-form__address_2-toggle {
    width: auto;
    min-height: 0;
    margin: 4px 0 12px;
    padding: 6px 0;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 15px;
    font-weight: var(--ph-fw-semi);
    color: var(--ph-green) !important;
    text-align: left;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color var(--ph-transition);
}

body.woocommerce-checkout .wc-block-components-address-form__address_2-toggle:hover {
    color: var(--ph-green-dark) !important;
    transform: none;
}

/* Consistent vertical rhythm inside address / contact groups */
body.woocommerce-checkout .wc-block-components-address-form .wc-block-components-text-input,
body.woocommerce-checkout .wc-block-components-address-form .wc-blocks-components-select,
body.woocommerce-checkout .wc-block-components-address-form .wc-block-components-combobox,
body.woocommerce-checkout .wc-block-components-address-form .wc-block-components-select-wrapper {
    margin-top: 0 !important;
    margin-bottom: 16px;
}

body.woocommerce-checkout .wc-block-components-address-form > *:last-child,
body.woocommerce-checkout .wc-block-components-address-form .wc-block-components-text-input:last-child {
    margin-bottom: 0;
}

body.woocommerce-checkout .wc-block-checkout__form .wc-block-components-checkout-step .wc-block-components-text-input + .wc-block-components-text-input {
    margin-top: 0;
}

/* Optional note textarea (order notes / terms) */
body.woocommerce-checkout .wc-block-components-textarea {
    border: 1px solid #d1d5db !important;
    border-radius: 14px !important;
    background: #f5f5f7 !important;
    font-size: 16px !important;
    color: var(--ph-black) !important;
    padding: 14px 18px !important;
    line-height: 1.45;
    transition: border-color var(--ph-transition), box-shadow var(--ph-transition), background var(--ph-transition);
}

body.woocommerce-checkout .wc-block-components-textarea:focus {
    outline: none !important;
    border-color: var(--ph-green) !important;
    box-shadow: 0 0 0 3px rgba(70, 159, 16, 0.15) !important;
    background: var(--ph-white) !important;
}

/* Checkboxes — order note, ship to different address, etc. */
body.woocommerce-checkout .wc-block-components-checkbox .wc-block-components-checkbox__label,
body.woocommerce-checkout .wc-block-components-checkbox > label {
    font-size: 16px;
    font-weight: var(--ph-fw-medium);
    color: var(--ph-black);
    line-height: 1.35;
}

body.woocommerce-checkout .wc-block-components-checkbox .wc-block-components-checkbox__input[type="checkbox"] {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    accent-color: var(--ph-green);
}

body.woocommerce-checkout .wc-block-components-validation-error {
    color: #b91c1c;
    font-size: 14px;
    padding-top: 6px;
}

body.woocommerce-checkout .wc-block-components-button,
body.woocommerce-checkout .wc-block-checkout__actions_row .wc-block-components-button {
    width: 100%;
    min-height: 52px;
    border: 1px solid var(--ph-green);
    border-radius: 999px;
    background: var(--ph-green);
    color: var(--ph-white);
    font-size: 17px;
    font-weight: var(--ph-fw-bold);
    letter-spacing: 0.01em;
    transition: background var(--ph-transition), border-color var(--ph-transition), transform var(--ph-transition);
}

body.woocommerce-checkout .wc-block-components-button:hover,
body.woocommerce-checkout .wc-block-checkout__actions_row .wc-block-components-button:hover {
    background: var(--ph-green-dark);
    border-color: var(--ph-green-dark);
    transform: translateY(-1px);
}

body.woocommerce-checkout .wc-block-components-checkbox .wc-block-components-checkbox__mark {
    border-color: var(--ph-green);
}

/* Shipping / local pickup rates only — pill cards (avoid restyling payment-method accordions). */
body.woocommerce-checkout .wc-block-components-shipping-rates-control .wc-block-components-radio-control__option,
body.woocommerce-checkout .wp-block-woocommerce-checkout-pickup-options-block .wc-block-components-radio-control__option {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--ph-border-radius-pill);
    padding: 12px 16px;
    margin-bottom: 10px;
    background: #f5f5f7;
    transition: border-color var(--ph-transition), background var(--ph-transition);
}

body.woocommerce-checkout .wc-block-components-shipping-rates-control .wc-block-components-radio-control__option:has(input:checked),
body.woocommerce-checkout .wp-block-woocommerce-checkout-pickup-options-block .wc-block-components-radio-control__option:has(input:checked),
body.woocommerce-checkout .wc-block-components-shipping-rates-control .wc-block-components-radio-control__option:focus-within,
body.woocommerce-checkout .wp-block-woocommerce-checkout-pickup-options-block .wc-block-components-radio-control__option:focus-within {
    border-color: rgba(70, 159, 16, 0.45);
    background: var(--ph-white);
}

body.woocommerce-checkout .wc-block-components-shipping-rates-control .wc-block-components-radio-control__label,
body.woocommerce-checkout .wc-block-components-shipping-rates-control .wc-block-components-radio-control__label-group,
body.woocommerce-checkout .wp-block-woocommerce-checkout-pickup-options-block .wc-block-components-radio-control__label {
    font-size: 16px;
    color: var(--ph-black);
}

/* Coupon row: keep button inline with field */
body.woocommerce-checkout .wc-block-components-totals-coupon__form .wc-block-components-button {
    width: auto;
    min-width: 110px;
    flex: 0 0 auto;
    min-height: 48px;
    padding-left: 22px;
    padding-right: 22px;
}

body.woocommerce-checkout .wc-block-components-totals-coupon__form .wc-block-components-text-input input {
    min-height: 48px;
    height: 48px;
}

@media (min-width: 981px) {
    body.woocommerce-checkout .wc-block-checkout__sidebar {
        position: sticky;
        top: 24px;
        align-self: start;
    }
}
body.woocommerce-checkout .wc-block-components-checkout-order-summary__content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 8px 4px 4px;
}

body.woocommerce-checkout .wp-block-woocommerce-checkout-order-summary-totals-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
}

/* Hide empty discount/fee cards in checkout totals. */
body.woocommerce-checkout .wp-block-woocommerce-checkout-order-summary-totals-block > *:empty,
body.woocommerce-checkout .wp-block-woocommerce-checkout-order-summary-discount-block:empty,
body.woocommerce-checkout .wp-block-woocommerce-checkout-order-summary-fee-block:empty,
body.woocommerce-checkout .wp-block-woocommerce-checkout-order-summary-fees-block:empty {
    display: none !important;
}

body.woocommerce-checkout .wp-block-woocommerce-checkout-order-summary-discount-block:not(:has(.wc-block-components-totals-item)),
body.woocommerce-checkout .wp-block-woocommerce-checkout-order-summary-fee-block:not(:has(.wc-block-components-totals-item)),
body.woocommerce-checkout .wp-block-woocommerce-checkout-order-summary-fees-block:not(:has(.wc-block-components-totals-item)) {
    display: none !important;
}

/*
 * Block checkout: shipping-method + pickup inner blocks SSR as empty wrappers (often only a &nbsp; text node).
 * :not(:has(*)) matches no *element* children, so whitespace-only placeholders collapse; real UI adds elements and shows.
 */
body.woocommerce-checkout .wp-block-woocommerce-checkout-shipping-method-block:not(:has(*)),
body.woocommerce-checkout .wp-block-woocommerce-checkout-pickup-options-block:not(:has(*)) {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
}

body.woocommerce-checkout #add_payment_method #payment, .woocommerce-cart #payment, .woocommerce-checkout #payment{
    background: var(--ph-green-bg);
    padding: 30px 15px;
}
body.woocommerce-checkout #payment div.payment_box::before{
    display: none;
}
body.woocommerce-checkout .woocommerce-terms-and-conditions-wrapper{
    display: none;
}
