/* AP Multi-Carrier Shipping Frontend */

.ap-customer-shipping-card-data[hidden],
.apship-rate-card-data[hidden] {
    display: none !important;
}

.ap-customer-shipping-card-host,
.apship-shipping-card-host {
    display: block;
    width: 100%;
    max-width: none;
    min-width: 0;
    clear: both;
    margin: 12px 0 10px;
    box-sizing: border-box;
}

.ap-customer-shipping-card-host[hidden],
.apship-shipping-card-host[hidden] {
    display: none !important;
}

.apship-shipping-card {
    --apship-primary: #4d148c;
    --apship-accent: #ff6600;
    --apship-bg: #fbf8ff;
    --apship-notice: #8a3b68;
    --apship-notice-size: 12px;
    --apship-font: inherit;

    position: relative;
    display: block;
    width: 100%;
    max-width: none;
    min-width: 0;
    padding: 15px 16px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--apship-primary) 22%, transparent);
    border-radius: 16px;
    background: linear-gradient(135deg, var(--apship-bg) 0%, #ffffff 100%);
    box-shadow: 0 8px 24px rgba(26, 20, 35, 0.07);
    color: #28232d;
    font-family: var(--apship-font);
    line-height: 1.45;
    text-align: start;
    box-sizing: border-box;
}

/* Fallback for browsers without color-mix(). */
@supports not (color: color-mix(in srgb, #000 50%, #fff)) {
    .apship-shipping-card {
        border-color: rgba(77, 20, 140, 0.18);
    }

    .apship-shipping-card--dhl {
        border-color: rgba(212, 5, 17, 0.18);
    }

    .apship-shipping-card--smsa {
        border-color: rgba(191, 79, 141, 0.22);
    }
}

.apship-shipping-card::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: linear-gradient(180deg, var(--apship-primary), var(--apship-accent));
}

.apship-shipping-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 9px;
}

.apship-shipping-card__identity {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.apship-shipping-card__carrier {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border: 2px solid var(--apship-accent);
    border-radius: 999px;
    background: var(--apship-primary);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.01em;
    line-height: 1.1;
    box-sizing: border-box;
}

.apship-shipping-card--dhl .apship-shipping-card__carrier {
    color: #fff;
}

.apship-shipping-card__service {
    display: inline-block;
    min-width: 0;
    color: #5d5662;
    font-size: 12px;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.apship-shipping-card__icon {
    flex: 0 0 auto;
    font-size: 22px;
    line-height: 1;
}

.apship-shipping-card__headline {
    margin-bottom: 8px;
    color: var(--apship-primary);
    font-size: 14px;
    font-weight: 800;
}

.apship-shipping-card__numbers {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
}

.apship-shipping-card__numbers strong {
    color: #211b25;
    font-size: 20px;
    font-weight: 850;
    line-height: 1.1;
}

.apship-shipping-card__numbers span {
    color: #6b6370;
    font-size: 12px;
    text-align: end;
}

.apship-shipping-card__bar {
    display: block;
    width: 100%;
    height: 9px;
    margin-bottom: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(27, 20, 31, 0.09);
}

.apship-shipping-card__bar > span {
    display: block;
    height: 100%;
    min-width: 2px;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--apship-primary), var(--apship-accent));
    transition: width 220ms ease;
}

.apship-shipping-card__hint {
    color: #4e4752;
    font-size: 12px;
    font-weight: 600;
}

.apship-shipping-card__notice {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin-top: 10px;
    padding-top: 9px;
    border-top: 1px dashed color-mix(in srgb, var(--apship-primary) 20%, transparent);
    color: var(--apship-notice);
    font-size: var(--apship-notice-size);
    font-weight: 650;
}

.apship-shipping-card__notice > span:first-child {
    flex: 0 0 auto;
    line-height: 1.3;
}

.apship-shipping-card__pricing-note {
    margin-top: 7px;
    color: #7b747e;
    font-size: 10px;
    line-height: 1.35;
}

/* Keep the single shared card full-width in common classic cart/checkout layouts. */
.woocommerce .cart_totals .ap-customer-shipping-card-host,
.woocommerce .cart_totals .apship-shipping-card-host,
.woocommerce .woocommerce-checkout-review-order-table .ap-customer-shipping-card-host,
.woocommerce .woocommerce-checkout-review-order-table .apship-shipping-card-host,
.woocommerce-checkout-review-order .ap-customer-shipping-card-host,
.woocommerce-checkout-review-order .apship-shipping-card-host {
    align-self: stretch;
    flex: 0 0 100%;
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box;
}

.woocommerce .cart_totals ul#shipping_method,
.woocommerce .cart_totals ul.woocommerce-shipping-methods,
.woocommerce .woocommerce-checkout-review-order-table ul#shipping_method,
.woocommerce .woocommerce-checkout-review-order-table ul.woocommerce-shipping-methods {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

body.rtl .apship-shipping-card {
    direction: rtl;
    text-align: right;
}

body.rtl .apship-shipping-card__numbers span {
    text-align: left;
}


/*
 * Classic cart and checkout tables place the Shipping/Shipment heading in a
 * separate column. A tall carrier card then leaves a large empty column beside
 * it. The shared hub adds one reversible class and moves a copy of the native
 * heading above the methods on desktop only.
 */
.ap-customer-shipping-heading,
.apship-shipping-heading,
.ap-customer-cart-shipping-heading,
.apship-cart-shipping-heading,
.ap-customer-checkout-shipping-heading,
.apship-checkout-shipping-heading {
    display: none;
}

@media (min-width: 769px) {
    .woocommerce tr.ap-customer-shipping-stacked,
    .woocommerce tr.apship-shipping-stacked,
    .woocommerce tr.ap-customer-cart-shipping-stacked,
    .woocommerce tr.apship-cart-shipping-stacked,
    .woocommerce tr.ap-customer-checkout-shipping-stacked,
    .woocommerce tr.apship-checkout-shipping-stacked {
        display: table-row !important;
        width: auto !important;
    }

    .woocommerce tr.ap-customer-shipping-stacked > th,
    .woocommerce tr.apship-shipping-stacked > th,
    .woocommerce tr.ap-customer-cart-shipping-stacked > th,
    .woocommerce tr.apship-cart-shipping-stacked > th,
    .woocommerce tr.ap-customer-checkout-shipping-stacked > th,
    .woocommerce tr.apship-checkout-shipping-stacked > th {
        display: none !important;
    }

    .woocommerce tr.ap-customer-shipping-stacked > td,
    .woocommerce tr.apship-shipping-stacked > td,
    .woocommerce tr.ap-customer-cart-shipping-stacked > td,
    .woocommerce tr.apship-cart-shipping-stacked > td,
    .woocommerce tr.ap-customer-checkout-shipping-stacked > td,
    .woocommerce tr.apship-checkout-shipping-stacked > td {
        display: table-cell !important;
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        vertical-align: top !important;
        text-align: start !important;
        padding-left: var(--ap-shipping-content-inset-left, 0px) !important;
        padding-right: var(--ap-shipping-content-inset-right, 0px) !important;
        box-sizing: border-box !important;
    }

    .woocommerce tr.ap-customer-shipping-stacked > td::before,
    .woocommerce tr.apship-shipping-stacked > td::before,
    .woocommerce tr.ap-customer-cart-shipping-stacked > td::before,
    .woocommerce tr.apship-cart-shipping-stacked > td::before,
    .woocommerce tr.ap-customer-checkout-shipping-stacked > td::before,
    .woocommerce tr.apship-checkout-shipping-stacked > td::before {
        display: none !important;
        content: none !important;
    }

    .woocommerce tr.ap-customer-shipping-stacked .ap-customer-shipping-heading,
    .woocommerce tr.ap-customer-shipping-stacked .apship-shipping-heading,
    .woocommerce tr.apship-shipping-stacked .ap-customer-shipping-heading,
    .woocommerce tr.apship-shipping-stacked .apship-shipping-heading,
    .woocommerce tr.ap-customer-cart-shipping-stacked .ap-customer-cart-shipping-heading,
    .woocommerce tr.ap-customer-cart-shipping-stacked .apship-cart-shipping-heading,
    .woocommerce tr.apship-cart-shipping-stacked .ap-customer-cart-shipping-heading,
    .woocommerce tr.apship-cart-shipping-stacked .apship-cart-shipping-heading,
    .woocommerce tr.ap-customer-checkout-shipping-stacked .ap-customer-checkout-shipping-heading,
    .woocommerce tr.ap-customer-checkout-shipping-stacked .apship-checkout-shipping-heading,
    .woocommerce tr.apship-checkout-shipping-stacked .ap-customer-checkout-shipping-heading,
    .woocommerce tr.apship-checkout-shipping-stacked .apship-checkout-shipping-heading {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 0 12px !important;
        padding: 0 !important;
        color: inherit;
        font: inherit;
        font-size: 16px;
        font-weight: 600;
        line-height: 1.35;
        text-align: start !important;
        box-sizing: border-box !important;
    }

    .woocommerce tr.ap-customer-shipping-stacked ul#shipping_method,
    .woocommerce tr.ap-customer-shipping-stacked ul.woocommerce-shipping-methods,
    .woocommerce tr.apship-shipping-stacked ul#shipping_method,
    .woocommerce tr.apship-shipping-stacked ul.woocommerce-shipping-methods,
    .woocommerce tr.ap-customer-cart-shipping-stacked ul#shipping_method,
    .woocommerce tr.ap-customer-cart-shipping-stacked ul.woocommerce-shipping-methods,
    .woocommerce tr.apship-cart-shipping-stacked ul#shipping_method,
    .woocommerce tr.apship-cart-shipping-stacked ul.woocommerce-shipping-methods,
    .woocommerce tr.ap-customer-checkout-shipping-stacked ul#shipping_method,
    .woocommerce tr.ap-customer-checkout-shipping-stacked ul.woocommerce-shipping-methods,
    .woocommerce tr.apship-checkout-shipping-stacked ul#shipping_method,
    .woocommerce tr.apship-checkout-shipping-stacked ul.woocommerce-shipping-methods,
    .woocommerce tr.ap-customer-shipping-stacked ul#shipping_method > li,
    .woocommerce tr.ap-customer-shipping-stacked ul.woocommerce-shipping-methods > li,
    .woocommerce tr.apship-shipping-stacked ul#shipping_method > li,
    .woocommerce tr.apship-shipping-stacked ul.woocommerce-shipping-methods > li {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        text-align: start !important;
        box-sizing: border-box !important;
    }

    .woocommerce tr.ap-customer-shipping-stacked > td > ul#shipping_method,
    .woocommerce tr.ap-customer-shipping-stacked > td > ul.woocommerce-shipping-methods,
    .woocommerce tr.apship-shipping-stacked > td > ul#shipping_method,
    .woocommerce tr.apship-shipping-stacked > td > ul.woocommerce-shipping-methods,
    .woocommerce tr.ap-customer-shipping-stacked > td > .ap-customer-shipping-card-host,
    .woocommerce tr.ap-customer-shipping-stacked > td > .apship-shipping-card-host,
    .woocommerce tr.apship-shipping-stacked > td > .ap-customer-shipping-card-host,
    .woocommerce tr.apship-shipping-stacked > td > .apship-shipping-card-host {
        margin-inline-start: 0 !important;
        margin-inline-end: 0 !important;
    }

    body.rtl .woocommerce tr.ap-customer-shipping-stacked > td,
    body.rtl .woocommerce tr.apship-shipping-stacked > td,
    body.rtl .woocommerce tr.ap-customer-shipping-stacked .ap-customer-shipping-heading,
    body.rtl .woocommerce tr.apship-shipping-stacked .apship-shipping-heading,
    body.rtl .woocommerce tr.ap-customer-shipping-stacked ul#shipping_method > li,
    body.rtl .woocommerce tr.apship-shipping-stacked ul#shipping_method > li {
        text-align: right !important;
    }
}

@media (max-width: 768px) {
    .ap-customer-shipping-card-host,
    .apship-shipping-card-host {
        margin-top: 10px;
    }

    .apship-shipping-card {
        padding: 13px 13px 13px 15px;
        border-radius: 14px;
    }

    body.rtl .apship-shipping-card {
        padding: 13px 15px 13px 13px;
    }

    .apship-shipping-card__top {
        gap: 8px;
    }

    .apship-shipping-card__numbers {
        display: block;
    }

    .apship-shipping-card__numbers span {
        display: block;
        margin-top: 3px;
        text-align: start;
    }

    body.rtl .apship-shipping-card__numbers span {
        text-align: right;
    }
}

@media (prefers-reduced-motion: reduce) {
    .apship-shipping-card__bar > span {
        transition: none;
    }
}
