/**
 * QuickShipper Delivery — frontend icon styles for checkout rate labels.
 *
 * Each icon is a 14px square inline-block with a data-URI SVG
 * background-image. Color is baked into the SVG (#111827, a neutral
 * dark gray) to keep the icons readable across light + dark themes.
 * Icons are decorative — RateDecorator marks them `aria-hidden="true"`.
 */

.qsd-rate {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    line-height: 1.3;
}

.qsd-rate-text {
    display: inline;
}

/*
 * Every rate icon — speed, transport, brand — renders as a uniform
 * 28px square badge with a light rounded background. Aspect-preserving
 * (background-size: contain + background-origin: content-box), so a
 * wide logo like the Georgian Post swoosh fits inside without
 * squashing, while square icons (zap, rocket, package) fill the
 * badge nicely.
 *
 * Change the dimension in one place — no per-icon width overrides.
 */
.qsd-icon {
    display: inline-block;
    box-sizing: border-box;
    width: 28px;
    height: 28px;
    padding: 5px;
    border-radius: 6px;
    background-color: #f3f4f6;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    background-origin: content-box;
    flex: 0 0 auto;
    vertical-align: middle;
}

/* Express — lightning bolt (Lucide "zap", solid fill).  */
.qsd-icon-express {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23111827'><path d='M13 2 3 14h9l-1 8 10-12h-9z'/></svg>");
}

/* Same-day — rocket (Lucide-style, stroked, filled dark). */
.qsd-icon-today {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23111827'><path d='M14.5 2c-1.6 0-4 1.6-5.3 3.2-.6.8-1 1.5-1.2 2l-2.6.3c-.6.1-1.1.5-1.4 1l-1.6 2.7c-.2.4.1.9.6.9h4.3c.1 0 .2 0 .3-.1l1.5-.8 2.1 2.1-.8 1.5c-.1.1-.1.2-.1.3v4.3c0 .5.5.8.9.6l2.7-1.6c.5-.3.9-.8 1-1.4l.3-2.6c.5-.2 1.2-.6 2-1.2C20.4 10.5 22 8.1 22 6.5 22 4 20 2 17.5 2zm2 6.5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z'/><path d='M4 15l-2 4 4-2'/></svg>");
}

/* Car — Material "directions_car" solid fill. Chunky silhouette,
   reads clearly at the 18×18 content-box size inside our 28×28 badge. */
.qsd-icon-car {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23111827'><path d='M18.92 6.01C18.72 5.42 18.16 5 17.5 5h-11c-.66 0-1.21.42-1.42 1.01L3 12v8c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1h12v1c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-8l-2.08-5.99zM6.5 16c-.83 0-1.5-.67-1.5-1.5S5.67 13 6.5 13s1.5.67 1.5 1.5S7.33 16 6.5 16zm11 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM5 11l1.5-4.5h11L19 11H5z'/></svg>");
}

/* Scooter — Material "two_wheeler" solid fill. Clear two-wheeler
   silhouette with handlebar + rider-style geometry — obviously NOT
   a car at glance. */
.qsd-icon-scooter {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23111827'><path d='M19.44 9.03L15.41 5H11v2h3.59l2.01 2.01C14.23 9.58 12.5 11.71 12.5 14h-3.1A4.99 4.99 0 0 0 4.5 10c-2.76 0-5 2.24-5 5s2.24 5 5 5c2.46 0 4.51-1.78 4.92-4.1h3.1c.4 2.32 2.45 4.1 4.92 4.1 2.76 0 5-2.24 5-5 0-2.45-1.77-4.49-4.1-4.91L17 8l2.44 1.03zM7.82 15.9A3.007 3.007 0 0 1 4.5 18C2.84 18 1.5 16.66 1.5 15s1.34-3 3-3c1.48 0 2.71 1.08 2.95 2.5H5v1.4h2.82zM17.5 18c-1.48 0-2.71-1.08-2.95-2.5H19V14.1h-4.45A2.99 2.99 0 0 1 17.5 12c1.66 0 3 1.34 3 3s-1.34 3-3 3z'/></svg>");
}

/* Next-day — delivery truck, mono fill. */
.qsd-icon-next-day {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23111827'><path d='M3 6a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v2h2.5c.5 0 1 .2 1.4.6l2.1 2.1c.4.4.6.9.6 1.4V15a2 2 0 0 1-2 2h-1c0 1.7-1.3 3-3 3s-3-1.3-3-3H9c0 1.7-1.3 3-3 3s-3-1.3-3-3H2V6zm13 4v4h4v-1.6L18.1 10H16zM6 18a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm11 0a1 1 0 1 0 0-2 1 1 0 0 0 0 2z'/></svg>");
}

/* Standard / multi-day — package box, mono fill. */
.qsd-icon-standard {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23111827'><path d='M12 2 3 7v10l9 5 9-5V7l-9-5zm0 2.3 6.5 3.6L12 11.5 5.5 7.9 12 4.3zM5 9.5l6 3.3v7L5 16.5v-7zm14 7-6 3.3v-7l6-3.3v7z'/></svg>");
}

/*
 * Per-provider brand icons. Aspect ratios vary by brand, so each one
 * sets its own width (height stays at 14px). Brand colour is
 * preserved so the logo is instantly recognisable to merchants.
 */

/* Georgian Post — swoosh/ribbon mark, wordmark stripped, brand blue.
   Size handled by the shared .qsd-icon rule above (28×28 square). */
.qsd-icon-gp {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 216 100'><path fill='%230075AC' d='M0,21.173l43.083,13.412c-9.823,3.402-16.416,5.501-16.416,5.501C91.324,33.867,153.612,18.007,216,0c-29.512,24.792-70.038,45.66-105.642,63.875c5.713-1.535,14.87-4.041,26.263-7.299L216,63.733l-72.09,11.53L216,75.611C158.08,93.243,79.183,99.677,35.479,100C16.957,58.847,9.204,41.587,9.204,41.587C7.312,37.545,0,21.173,0,21.173'/></svg>");
}

/* Brand icons served from assets/img/ as 128×128 PNGs — downscaled
   into the shared 28×28 qsd-icon frame via background-size: contain. */
.qsd-icon-onway {
    background-image: url("../img/onway.png");
}
.qsd-icon-glovo {
    background-image: url("../img/glovo.png");
}
.qsd-icon-wolt {
    background-image: url("../img/wolt.png");
}
.qsd-icon-godelivery {
    background-image: url("../img/go-delivery.png");
}

/* Easy Way — two-colour lockup (dark + teal). */
.qsd-icon-easyway {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 419.686 316.46'><g fill='%23212B37'><path d='M186.211,167.498h-4.356c-13.972,0-21.667,7.608-23.092,22.822l-1.22,13.07h15.975l1.258-13.486c0.557-5.947,2.979-8.921,7.268-8.921h1.245c4.285,0,6.153,2.974,5.596,8.921l-2.502,26.764c-3.177-1.522-6.289-2.283-9.33-2.283c-14.387,0-22.276,7.47-23.675,22.406l-3.814,40.665c-1.101,11.757,2.912,17.635,12.041,17.635c7.329,0,13.504-3.181,18.529-9.545l-0.194,8.714h15.353l9.658-103.113C206.427,175.381,200.18,167.498,186.211,167.498z M180.995,274.136c-2.437,3.874-5.387,5.809-8.843,5.809c-4.428,0-6.381-2.764-5.862-8.299l3.347-35.683c0.544-5.809,3.65-8.714,9.323-8.714c2.075,0,4.165,0.555,6.276,1.659L180.995,274.136z'/><path d='M239.631,274.966c-1.79,1.384-3.93,2.075-6.419,2.075c-5.81,0-8.371-3.663-7.684-10.995l9.114-97.304h-15.976l-9.483,101.245c-1.335,14.247,4.016,21.369,16.048,21.369c5.116,0,9.686-1.52,13.705-4.563l-0.486,5.187c-0.674,7.188-5.092,10.787-13.251,10.787c-5.809,0-10.899-1.799-15.263-5.393l-1.03,10.995c0.937,1.797,3.119,3.596,6.548,5.395c3.427,1.795,7.492,2.697,12.196,2.697c7.469,0,13.58-2.111,18.332-6.327c4.752-4.222,7.523-10.55,8.313-18.984l11.466-122.407H249.58L239.631,274.966z'/><path d='M86.658,164.937l-65.912,0.001c0,8.823,7.153,15.976,15.976,15.976l48.44,0.001L86.658,164.937z'/><path d='M89.282,136.93H0c0,8.823,7.153,15.976,15.976,15.976l71.81-0.001L89.282,136.93z'/><path d='M126.751,233.057c-1.581,16.877-4.736,29.876-9.462,39.004l-1.575,3.527h-1.245l-1.121-3.527c-2.77-8.85-3.315-22.2-1.644-40.041l8.907-95.09h-16.183l-9.003,96.128c-1.62,17.29-4.705,30.29-9.255,39.004l-1.783,3.527h-1.037l-1.121-3.527c-2.919-8.714-3.568-21.713-1.949-39.004l3.757-40.11l-42.541-0.001c0,8.823,7.153,15.976,15.976,15.976h8.887l-0.939,10.028c-1.853,19.781-2.196,34.129-1.025,43.05c1.169,8.921,4.537,18.36,10.107,28.318l2.121,3.943h10.373l2.84-3.734c4.414-5.809,7.707-11.411,9.873-16.806c1.518,5.949,3.763,11.484,6.744,16.598l2.12,3.943h10.373l2.632-3.734c7.585-10.096,12.797-19.606,15.639-28.527c2.84-8.921,5.188-23.269,7.041-43.05l4.703-50.208h-16.183L126.751,233.057z'/></g><g fill='%2328B8A7'><polygon points='163.255,15.56 180.475,15.56 181.933,0 148.53,0 134.247,152.49 168.272,152.49 169.729,136.93 151.887,136.93 157.503,76.97 173.27,76.97 174.708,61.619 158.941,61.619'/><path d='M216.243,25.727h-4.356c-13.972,0-21.667,7.608-23.092,22.822l-1.22,13.07h15.975l1.259-13.486c0.557-5.946,2.979-8.921,7.267-8.921h1.245c4.285,0,6.153,2.974,5.596,8.921l-2.502,26.764c-3.177-1.522-6.289-2.283-9.33-2.283c-14.387,0-22.277,7.47-23.676,22.406l-3.813,40.665c-1.101,11.757,2.912,17.635,12.041,17.635c7.329,0,13.504-3.181,18.529-9.545l-0.194,8.714h15.353l9.658-103.113C236.459,33.61,230.212,25.727,216.243,25.727z M211.027,132.365c-2.438,3.874-5.388,5.809-8.843,5.809c-4.428,0-6.381-2.764-5.862-8.299l3.347-35.683c0.544-5.809,3.65-8.714,9.323-8.714c2.075,0,4.165,0.555,6.276,1.659L211.027,132.365z'/><path d='M273.919,25.727h-4.357c-13.832,0-21.485,7.883-22.962,23.65l-0.913,9.751c-0.453,4.842-0.151,8.611,0.912,11.307c1.06,2.697,3.317,5.57,6.766,8.609l14.297,13.486c3.31,3.045,4.733,7.055,4.267,12.035l-2.487,26.556c-0.531,5.673-3.079,8.505-7.643,8.505h-1.245c-4.704,0-6.789-2.832-6.257-8.505l3.576-38.175h-15.976l-3.382,36.1c-1.516,16.182,4.848,24.274,19.095,24.274h4.357c14.384,0,22.334-8.082,23.848-24.252l2.485-26.533c0.466-4.972,0.07-8.911-1.188-11.812c-1.259-2.901-3.687-5.942-7.282-9.123l-14.294-13.486c-2.775-2.496-3.951-5.961-3.535-10.396l0.896-9.567c0.558-5.957,2.912-8.939,7.061-8.939h1.245c4.149,0,5.945,2.974,5.389,8.921l-1.827,19.501h16.182l1.71-18.257C294.135,33.61,287.888,25.727,273.919,25.727z'/><path d='M327.34,133.196c-1.79,1.384-3.93,2.075-6.419,2.075c-5.81,0-8.371-3.663-7.684-10.995l9.114-97.304h-15.976l-9.483,101.245c-1.335,14.247,4.016,21.369,16.048,21.369c5.116,0,9.686-1.52,13.705-4.563l-0.486,5.187c-0.673,7.188-5.092,10.787-13.251,10.787c-5.809,0-10.899-1.799-15.263-5.393l-1.03,10.995c0.937,1.797,3.119,3.596,6.548,5.395c3.427,1.795,7.492,2.697,12.196,2.697c7.469,0,13.58-2.111,18.332-6.327c4.753-4.222,7.523-10.55,8.313-18.984l4.722-50.415h15.488c8.823,0,15.976-7.153,15.976-15.976l-46.149,0.001L327.34,133.196z'/><path d='M333.17,70.956l49.794-0.001c8.823,0,15.976-7.153,15.976-15.976h-64.272L333.17,70.956z'/><path d='M337.29,26.971l-1.496,15.976h67.917c8.823,0,15.976-7.153,15.976-15.976H337.29z'/></g></svg>");
}

/*
 * Custom shipping-method list style — gated by the `qsd-custom-rate-style`
 * class which checkout-rates.js applies directly to the shipping-methods
 * UL (not <body>). Mutating body.className wakes up theme / third-party
 * JS that observes body-class changes, which has been seen to relocate
 * widgets at checkout. Scoping the flag to the UL keeps it contained.
 *
 * Visual treatment mirrors Codeon Payments v0.2.14 so merchants who
 * run both plugins see a consistent row layout at checkout.
 *
 * Specificity: `ul#shipping_method.qsd-custom-rate-style` is id + class
 * + class — usually enough to win over theme defaults without
 * `!important`. We keep !important ONLY on the `display: flex` rule
 * that must override themes applying `display: list-item`.
 */
ul#shipping_method.qsd-custom-rate-style,
ul.woocommerce-shipping-methods.qsd-custom-rate-style,
ul.wc-block-components-shipping-rates-control.qsd-custom-rate-style {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: block;
}

ul#shipping_method.qsd-custom-rate-style > li,
ul.woocommerce-shipping-methods.qsd-custom-rate-style > li {
    display: flex !important;
    align-items: center;
    gap: 10px;
    margin: 0 0 6px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    list-style: none;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    cursor: pointer;
    position: relative;
    min-height: 44px;
}

ul#shipping_method.qsd-custom-rate-style > li::before,
ul#shipping_method.qsd-custom-rate-style > li::marker,
ul.woocommerce-shipping-methods.qsd-custom-rate-style > li::before,
ul.woocommerce-shipping-methods.qsd-custom-rate-style > li::marker {
    content: none;
    display: none;
}

ul#shipping_method.qsd-custom-rate-style > li:hover,
ul.woocommerce-shipping-methods.qsd-custom-rate-style > li:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

/* Selected row — minimalist tonal step from hover. Browsers without
   :has() just miss the selected-state tint — acceptable degradation. */
ul#shipping_method.qsd-custom-rate-style > li:has(input[type="radio"]:checked),
ul.woocommerce-shipping-methods.qsd-custom-rate-style > li:has(input[type="radio"]:checked) {
    border-color: #94a3b8;
    background: #f1f5f9;
}

ul#shipping_method.qsd-custom-rate-style > li > input[type="radio"],
ul.woocommerce-shipping-methods.qsd-custom-rate-style > li > input[type="radio"] {
    order: 99;
    /* -5px top margin nudges the radio up off the row baseline so it
       reads as aligned with the title text. align-self: center alone
       leaves it visually low because the radio renders on the text
       baseline, not its visual centre. */
    margin: -5px 0 0 auto;
    padding: 0;
    width: 14px;
    height: 14px;
    min-width: 14px;
    min-height: 14px;
    accent-color: #2563eb;
    flex: 0 0 auto;
    align-self: center;
    vertical-align: middle;
    line-height: 1;
    cursor: pointer;
}

ul#shipping_method.qsd-custom-rate-style > li > label,
ul.woocommerce-shipping-methods.qsd-custom-rate-style > li > label {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 0;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    color: #1f2937;
    min-width: 0;
}

ul#shipping_method.qsd-custom-rate-style .qsd-rate,
ul.woocommerce-shipping-methods.qsd-custom-rate-style .qsd-rate {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

ul#shipping_method.qsd-custom-rate-style .qsd-rate-text,
ul.woocommerce-shipping-methods.qsd-custom-rate-style .qsd-rate-text {
    flex: 1;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    font-size: 14px;
    color: #374151;
    letter-spacing: 0;
}

ul#shipping_method.qsd-custom-rate-style .qsd-rate-text .woocommerce-Price-amount,
ul.woocommerce-shipping-methods.qsd-custom-rate-style .qsd-rate-text .woocommerce-Price-amount {
    font-weight: 600;
    color: #111827;
    font-size: 14px;
    white-space: nowrap;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    ul#shipping_method.qsd-custom-rate-style > li,
    ul.woocommerce-shipping-methods.qsd-custom-rate-style > li {
        padding: 9px 10px;
    }
    ul#shipping_method.qsd-custom-rate-style .qsd-rate-text,
    ul.woocommerce-shipping-methods.qsd-custom-rate-style .qsd-rate-text {
        font-size: 13px;
    }
}

/*
 * "Powered by QuickShipper" — gated by `qsd-show-logo` applied to the
 * same shipping-methods UL by checkout-rates.js. :has() targets only
 * lists that actually contain QS rates; browsers without :has() silently
 * skip the footer.
 */
ul#shipping_method.qsd-show-logo:has(.qsd-rate)::after,
ul.woocommerce-shipping-methods.qsd-show-logo:has(.qsd-rate)::after,
ul.wc-block-components-shipping-rates-control.qsd-show-logo:has(.qsd-rate)::after {
    content: "Powered by QuickShipper";
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 2px 2px;
    margin-top: 6px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    color: #6b7280;
    font-size: 12px;
    font-weight: 500;
}
