/* ── WooCommerce Overrides ────────────────────────────────────────────────── */
/*
 * Loaded on all WooCommerce pages (shop, product, cart, checkout).
 * Targets WooCommerce markup that FSE presets can't reach or where
 * theme.json font-size clamp() caps are too restrictive.
 */

/* ── Price — all pages ───────────────────────────────────────────────────── */

.wc-block-components-product-price {
    font-size: clamp(1.25rem, 1.25rem + 0.5vw, 1.625rem);
    font-weight: 400;
}

/* ── Product archive cards — price + button alignment ────────────────────── */

.wc-block-product-template li.product {
    display: flex;
    flex-direction: column;
}

.wc-block-product-template li.product .wp-block-post-title {
    flex-grow: 1;
}

.wc-block-product-template li.product .wc-block-components-product-button {
    margin-top: auto;
}

/* ── LP Express / Unisend — checkout shipping option fixes ─────────────── */
/*
 * The woo-lithuaniapost plugin injects an <img> logo directly inside each
 * shipping <label>.  WC's default label is display:block, so the image
 * takes its own line and pushes the text down ~35 px.  When the terminal
 * picker (<select> + Select2) is also injected, the extra height causes
 * visible layout shift and — via Select2's body-level dropdown — can push
 * whitespace above the sticky header.
 *
 * Fix: make the label a flex container so the logo sits inline with the
 * text, and contain the terminal picker on a wrapped row beneath them.
 */

/* 1. Label → flex so logo + text share one row */
.wc-block-components-shipping-rates-control .wc-block-components-radio-control__option {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
}

/* 2. Injected logo — inline flex item, not a block line */
.wc-block-components-shipping-rates-control .wc-block-components-radio-control__option > img {
    flex-shrink: 0 !important;
    display: block !important;
    margin-right: 8px !important;
    order: 0;
}

/* 3. Option-layout (label text + price) fills the rest of the row */
.wc-block-components-shipping-rates-control .wc-block-components-radio-control__option-layout {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    order: 1;
}

/* 4. Terminal picker wraps to its own row beneath logo + text */
.wc-block-components-shipping-rates-control .woo_lithuaniapost_lpexpress_terminal_label,
.wc-block-components-shipping-rates-control .woo_lithuaniapost_lpexpress_terminal_select_container {
    flex-basis: 100% !important;
    order: 2;
    margin-top: 8px;
}

/* 5. Terminal select — full width inside its container */
.wc-block-components-shipping-rates-control #woo_lithuaniapost_lpexpress_terminal_city,
.wc-block-components-shipping-rates-control #woo_lithuaniapost_lpexpress_terminal_id,
.wc-block-components-shipping-rates-control .woo_lithuaniapost_lpexpress_terminal_id {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

/* 5b. Select2 replacement — full width, proper text alignment */
.woo_lithuaniapost_lpexpress_terminal_select_container .select2-container {
    width: 100% !important;
    box-sizing: border-box;
}

.woo_lithuaniapost_lpexpress_terminal_select_container .select2-selection {
    height: auto !important;
    min-height: 38px;
    display: flex !important;
    align-items: center !important;
    border: 1px solid #8c8f94 !important;
    border-radius: 4px !important;
    padding: 0 8px !important;
}

.woo_lithuaniapost_lpexpress_terminal_select_container .select2-selection__rendered {
    line-height: normal !important;
    padding: 6px 0 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.woo_lithuaniapost_lpexpress_terminal_select_container .select2-selection__arrow {
    position: static !important;
    flex-shrink: 0;
    height: auto !important;
}

/* 6. Select2 dropdown — stays on top, no layout shift */
body > .select2-container--open {
    z-index: 10000 !important;
}

/* 7. Prevent Select2 from affecting page layout in any state */
body.select2-container--open,
body.select2-container--below,
body.select2-container--above {
    overflow: visible !important;
    padding-top: 0 !important;
    margin-top: 0 !important;
    position: static !important;
}

/* 7b. Select2 body-level dropdown — no layout push, keep absolute positioning */
body > .select2-container {
    position: absolute !important;
}

/* 7c. Hidden root container — clean up after terminal-block.js moves the label */
#woa-lpexpress-terminal-root:empty {
    display: none !important;
}

/* 7d. Kill stray <br> the plugin's classic template dumps at <body> root */
body > br:first-child {
    display: none !important;
}

/* 7e. Hide any plugin-injected elements at body root (hidden inputs, labels) */
body > .woo_lithuaniapost_shipping_method_terminal,
body > .woo_lithuaniapost_delivery_time_label {
    display: none !important;
}

/* ── Customer details — phone & email font-size fix ─────────────────────── */
/*
 * WooCommerce renders phone/email as <p> tags inside <address>.
 * The theme's core/paragraph block sets all <p> to --font-size--large (1.25rem)
 * via :root :where(p), but the surrounding address text inherits the body
 * font at --font-size--medium (1rem).  Reset these <p> tags to match.
 */

/* Classic templates — My Account order view, thank-you page */
.woocommerce-customer-details address p {
    font-size: inherit;
    line-height: inherit;
}

/* WC Blocks — order confirmation addresses */
.wc-block-order-confirmation-shipping-address p,
.wc-block-order-confirmation-billing-address p,
.wc-block-order-confirmation-order-note p {
    font-size: inherit;
    line-height: inherit;
}
