/*!
 * Engoory Gpost — checkout styles, 3.0.0
 *
 * Token contract
 * --------------
 * Every value below reads an Engoory Checkout token first and falls back to the
 * same neutral default that Engoory Checkout ships. When both plugins are
 * active, Georgian Post inherits the merchant's chosen palette, radius and
 * motion automatically; when it runs alone under WoodMart or classic
 * WooCommerce, it renders in the identical house neutral.
 *
 * Scoping contract
 * ----------------
 * Only Georgian Post's own elements are styled. Rate-row geometry, radio
 * controls and spacing stay owned by WooCommerce, WoodMart, Engoory Checkout or
 * CheckoutWC. There are no !important declarations outside the two documented
 * third-party overrides at the end of this file.
 */

.gpost-label-inline,
.gpost-tip-popover {
    --gp-surface: var(--ec-surface, #ffffff);
    --gp-raised: var(--ec-page, #f7f7f5);
    --gp-text: var(--ec-text, #141414);
    --gp-muted: var(--ec-muted, #6e6e6e);
    --gp-border: var(--ec-border, #e6e6e2);
    --gp-accent: var(--ec-accent, #111111);
    --gp-accent-soft: var(--ec-accent-soft, rgba(17, 17, 17, .055));
    --gp-positive: var(--ec-positive, #0f7b4f);
    --gp-positive-soft: var(--ec-positive-soft, #e9f6ef);
    --gp-positive-border: var(--ec-positive-border, #cbe7d8);
    --gp-critical: var(--ec-critical, #b3261e);
    --gp-radius: var(--ec-input-radius, 10px);
    --gp-radius-lg: var(--ec-radius, 14px);
    --gp-ring: var(--ec-ring, rgba(17, 17, 17, .16));
    --gp-shadow: var(--ec-shadow, 0 1px 2px rgba(15, 15, 15, .04), 0 12px 32px -12px rgba(15, 15, 15, .14));
    --gp-fs-sm: var(--ec-fs-sm, 13px);
    --gp-fs-xs: var(--ec-fs-xs, 11.5px);
    --gp-dur: var(--ec-duration, .16s);
    --gp-ease: var(--ec-ease, cubic-bezier(.2, .6, .2, 1));
}

/* ==========================================================================
   1. Rate row
   ==========================================================================
   A wrapping flex row rather than a nowrap inline group. At narrow widths the
   badges drop to a second line instead of pushing the price out of the card.
   The typeface is inherited so the method never looks pasted in from another
   product; only the numeric alignment is standardised.
   ========================================================================== */

.gpost-label-inline {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    min-width: 0;
    max-width: 100%;
    color: inherit;
    font: inherit;
    line-height: inherit;
    vertical-align: middle;
}

.gpost-label-title {
    min-width: 0;
    overflow: hidden;
    color: inherit;
    font: inherit;
    font-weight: 600;
    letter-spacing: -.01em;
    text-overflow: ellipsis;
}

.gpost-label-price,
.gpost-label-price .woocommerce-Price-amount {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
    color: inherit;
    font: inherit;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.woocommerce-gpost-logo-mark {
    display: inline-block;
    flex: 0 0 38px;
    width: 38px;
    height: 18px;
    background: url('../gpost.svg') center/contain no-repeat;
}

.gpost-icon {
    display: block;
    flex: 0 0 auto;
}

/* Free state: the same single rate, with the real price struck through and a
   quiet status capsule. No duplicate shipping option, no oversized promo. */
.gpost-price-original,
.gpost-price-original .woocommerce-Price-amount {
    color: var(--gp-muted);
    font: inherit;
    font-weight: 500;
    text-decoration: line-through;
    text-decoration-thickness: 1.2px;
}

.gpost-free-badge,
.gpost-eta-badge {
    display: inline-flex;
    flex: 0 0 auto;
    box-sizing: border-box;
    align-items: center;
    gap: 5px;
    min-height: 27px;
    padding: 0 11px;
    border-radius: 999px;
    font-family: inherit;
    font-size: var(--gp-fs-xs);
    font-weight: 600;
    line-height: 1;
    letter-spacing: -.005em;
    white-space: nowrap;
}

.gpost-free-badge {
    border: 1px solid var(--gp-positive-border);
    background: var(--gp-positive-soft);
    color: var(--gp-positive);
}

.gpost-eta-badge {
    border: 1px solid var(--gp-border);
    background: var(--gp-surface);
    color: var(--gp-text);
}

.gpost-eta-badge .gpost-icon { color: var(--gp-muted); }

/* ==========================================================================
   2. Details trigger and popover
   ========================================================================== */

.gpost-help-tip {
    display: inline-flex;
    flex: 0 0 26px;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin: 0 -4px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--gp-muted);
    cursor: help;
    outline: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: color var(--gp-dur) var(--gp-ease), background-color var(--gp-dur) var(--gp-ease);
    vertical-align: middle;
}

.gpost-help-tip:hover,
.gpost-help-tip:focus-visible,
.gpost-help-tip.is-open {
    background: var(--gp-accent-soft);
    color: var(--gp-text);
}

.gpost-help-tip:focus-visible {
    box-shadow: 0 0 0 3px var(--gp-ring);
}

/* Rendered at body level and fixed to the viewport, so no checkout row overflow
   rule in WoodMart or CheckoutWC can clip it. */
.gpost-tip-popover {
    --gpost-tip-arrow-x: calc(100% - 26px);
    position: fixed;
    z-index: 2147483000;
    box-sizing: border-box;
    inline-size: min(288px, calc(100vw - 24px));
    padding: 13px 14px;
    border: 1px solid var(--gp-border);
    border-radius: var(--gp-radius-lg);
    background: var(--gp-surface);
    box-shadow: var(--gp-shadow);
    color: var(--gp-muted);
    font-family: inherit;
    white-space: normal;
    opacity: 0;
    transform: translateY(-3px) scale(.985);
    transform-origin: top right;
    transition: opacity var(--gp-dur) var(--gp-ease), transform var(--gp-dur) var(--gp-ease);
}

.gpost-tip-popover.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.gpost-tip-popover[data-placement="top"] {
    transform: translateY(3px) scale(.985);
    transform-origin: bottom right;
}

.gpost-tip-popover[data-placement="top"].is-open {
    transform: translateY(0) scale(1);
}

.gpost-tip-popover__title {
    color: var(--gp-text);
    font-size: 14px;
    font-weight: 650;
    letter-spacing: -.012em;
    line-height: 1.32;
}

.gpost-tip-popover__body,
.gpost-tip-popover__emphasis,
.gpost-tip-popover__note {
    font-size: var(--gp-fs-sm);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.gpost-tip-popover__body { margin-top: 5px; }
.gpost-tip-popover__emphasis { margin-top: 6px; color: var(--gp-text); font-weight: 600; }

.gpost-tip-popover__note {
    margin-top: 9px;
    padding-top: 9px;
    border-top: 1px solid var(--gp-border);
}

.gpost-tip-popover__arrow {
    position: absolute;
    top: -6px;
    left: var(--gpost-tip-arrow-x);
    box-sizing: border-box;
    width: 11px;
    height: 11px;
    border-top: 1px solid var(--gp-border);
    border-left: 1px solid var(--gp-border);
    background: var(--gp-surface);
    transform: translateX(-50%) rotate(45deg);
}

.gpost-tip-popover[data-placement="top"] .gpost-tip-popover__arrow {
    top: auto;
    bottom: -6px;
    border: 0;
    border-right: 1px solid var(--gp-border);
    border-bottom: 1px solid var(--gp-border);
}

/* ==========================================================================
   3. Third-party overrides
   ==========================================================================
   Both rules exist to defeat a specific vendor declaration. CheckoutWC sets the
   rate label to `display: block`, which collapses the flex row; WoodMart sets
   `white-space: nowrap` on shipping labels, which forces horizontal overflow on
   phones. Nothing else in this file uses !important.
   ========================================================================== */

.checkoutwc input.shipping_method[value^="gpost_courier_shipping_method"] + label,
main.checkoutwc input.shipping_method[value^="gpost_courier_shipping_method"] + label {
    display: flex !important;
    align-items: center !important;
    min-width: 0 !important;
}

.woodmart-checkout-shipping input.shipping_method[value^="gpost_courier_shipping_method"] + label,
.wd-checkout-shipping input.shipping_method[value^="gpost_courier_shipping_method"] + label {
    white-space: normal !important;
}

@media (max-width: 480px) {
    .woocommerce-gpost-logo-mark { flex-basis: 32px; width: 32px; height: 15px; }
    .gpost-free-badge,
    .gpost-eta-badge { min-height: 22px; padding-inline: 8px; }
    .gpost-tip-popover { inline-size: calc(100vw - 20px); }
}

@media (prefers-reduced-motion: reduce) {
    .gpost-city-search,
    .gpost-combo-list,
    .gpost-city-option,
    .gpost-combo-affordance,
    .gpost-help-tip,
    .gpost-tip-popover {
        transition: none;
    }

    .gpost-combo-spinner { animation-duration: 1.4s; }
}
