/* KGO Cart Badge. Follows the existing icon color; no theme/Divi files changed. */
/*
 * Critical for Divi: never force a menu cart link to position:relative with
 * !important. Divi/custom headers may position that link absolutely at the
 * far right. Overriding it moves the icon into the middle of the menu.
 *
 * :where() has zero specificity, so any Divi/custom position rule wins,
 * while otherwise-static links get a positioning context for the badge.
 */
:where(a.kgo-cart-badge-host) {
    position: relative;
    overflow: visible;
}

.kgo-cart-count-badge {
    position: absolute !important;
    /* Keep the circle outside the cart glyph, at its upper-right. */
    top: -11px !important;
    right: -18px !important;
    z-index: 9;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    margin: 0 !important;
    box-sizing: border-box;
    border-radius: 999px;
    background: var(--kgo-cart-badge-bg, #2d2d2d) !important;
    color: var(--kgo-cart-badge-color, #fff) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    letter-spacing: 0 !important;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
    text-decoration: none !important;
    text-shadow: none !important;
}

/* Respect show_zero="no" on shortcodes. */
.kgo-cart-count-badge[hidden],
.kgo-cart-count-number[hidden] {
    display: none !important;
}

/* Do not show Divi's separate "0 items" label when our compact badge is active.
   The original :before icon in the legacy Divi span stays visible. */
a.et-cart-info.kgo-cart-badge-host > span:not(.kgo-cart-count-badge) {
    font-size: 0 !important;
}
a.et-cart-info.kgo-cart-badge-host > span:not(.kgo-cart-count-badge)::before {
    font-size: 18px !important;
}

/* Standalone shortcode: a circular counter but no extra cart icon. */
.kgo-cart-badge-inline {
    position: static !important;
    vertical-align: middle;
}

.kgo-cart-count-number {
    font: inherit;
    color: inherit;
}

/* Optional [kgo_cart_icon] shortcode: minimal line icon and small badge. */
a.kgo-cart-shortcode {
    display: inline-flex !important;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    color: inherit;
    text-decoration: none;
    vertical-align: middle;
    line-height: 1;
}
a.kgo-cart-shortcode .kgo-cart-svg {
    display: block;
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
}
a.kgo-cart-shortcode:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 4px;
    border-radius: 3px;
}
