/* ─── Cart widget in header (compact icon + overlapping sum chip) ─
   Wszystkie font-size, spacing i icon/avatar sizes z theme.json. */

.nk-cart-widget {
    display: inline-flex;
    align-items: center;
    padding: var(--wp--preset--spacing--xs) var(--wp--preset--spacing--xs) var(--wp--preset--spacing--md);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    line-height: 1.2;
    transition: background 160ms ease;
}

.nk-cart-widget:hover,
.nk-cart-widget:focus {
    background: rgba(10, 22, 40, 0.04);
    color: inherit;
}

.nk-cart-widget__icon-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--wp--custom--size--avatar--md);
    height: var(--wp--custom--size--avatar--md);
    border-radius: 12px;
    background: rgba(10, 22, 40, 0.06);
    color: var(--wp--preset--color--primary, #0a1628);
    transition: background 160ms ease, color 160ms ease;
    flex-shrink: 0;
    overflow: visible;
}

.nk-cart-widget:hover .nk-cart-widget__icon-wrap {
    background: var(--wp--preset--color--accent, #171234);
    color: #fff;
}

.nk-cart-widget__icon {
    width: var(--wp--custom--size--icon--md);
    height: var(--wp--custom--size--icon--md);
    display: block;
}

.nk-cart-widget__count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    padding: 0 var(--wp--preset--spacing--xs);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--wp--preset--color--accent-2, #dc2626);
    color: #fff;
    font-size: var(--wp--preset--font-size--eyebrow);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    box-shadow: 0 0 0 var(--wp--custom--size--border--default) var(--wp--preset--color--background, #f4f1ec);
    pointer-events: none;
    z-index: 2;
}

.nk-cart-widget[data-count="0"] .nk-cart-widget__count {
    display: none;
}

/* Sum chip — overlaps the bottom of the icon */
.nk-cart-widget__sum {
    position: absolute;
    left: 50%;
    bottom: -10px;
    transform: translateX(-50%);
    padding: 3px var(--wp--preset--spacing--sm);
    border-radius: 999px;
    background: var(--wp--preset--color--accent, #171234);
    color: #fff;
    font-size: var(--wp--preset--font-size--eyebrow);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    white-space: nowrap;
    box-shadow:
        0 0 0 var(--wp--custom--size--border--default) var(--wp--preset--color--background, #f4f1ec),
        0 4px 10px -4px rgba(10, 22, 40, 0.35);
    pointer-events: none;
    letter-spacing: 0.01em;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 1;
}

.nk-cart-widget__sum[hidden] {
    display: none;
}

.nk-cart-widget[data-count="0"] .nk-cart-widget__sum {
    display: none;
}

/* Pulse animation when count changes */
@keyframes kordit-cart-pulse {
    0% {
        transform: scale(1);
    }

    40% {
        transform: scale(1.22);
    }

    100% {
        transform: scale(1);
    }
}

.nk-cart-widget__count.is-pulsing {
    animation: kordit-cart-pulse 380ms cubic-bezier(.16, 1, .3, 1);
}
