/*
 * Pally Mobile Commerce Bar
 * Visibility is controlled by JS using the breakpoint configured in WordPress.
 */

body.pally-mobile-commerce-enabled {
    --pmb-height: 68px;
    --pmb-bg: #ffffff;
    --pmb-text: #071f46;
    --pmb-accent: #245b3a;
    --pmb-badge: #071f46;
    --pmb-shadow: 0 -8px 28px rgba(7, 31, 70, 0.10);
}

.pally-mobile-commerce-bar {
    display: none;
}

body.pally-mobile-commerce-enabled.pally-mobile-commerce-visible {
    padding-bottom: calc(var(--pmb-height) + 8px + env(safe-area-inset-bottom, 0px));
}

body.pally-mobile-commerce-visible .pally-mobile-commerce-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    align-items: stretch;
    min-height: var(--pmb-height);
    padding: 7px max(10px, env(safe-area-inset-left, 0px)) calc(7px + env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-right, 0px));
    background: color-mix(in srgb, var(--pmb-bg) 97%, transparent);
    border-top: 1px solid color-mix(in srgb, var(--pmb-text) 10%, transparent);
    box-shadow: var(--pmb-shadow);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

@supports not (background: color-mix(in srgb, white 50%, black)) {
    body.pally-mobile-commerce-visible .pally-mobile-commerce-bar {
        background: var(--pmb-bg);
        border-top-color: rgba(7, 31, 70, 0.10);
    }
}

.pally-mobile-commerce-item {
    position: relative;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px 8px;
    color: var(--pmb-text);
    text-decoration: none !important;
    border-radius: 10px;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.pally-mobile-commerce-item:hover,
.pally-mobile-commerce-item:focus-visible,
.pally-mobile-commerce-item.is-active {
    color: var(--pmb-accent);
    background: color-mix(in srgb, var(--pmb-accent) 7%, transparent);
}

.pally-mobile-commerce-item:active {
    transform: translateY(1px);
}

.pally-mobile-commerce-label {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    font-size: 10px;
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.pally-mobile-commerce-icon {
    position: relative;
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    color: currentColor;
}

.pally-mobile-commerce-icon svg {
    width: 24px;
    height: 24px;
    display: block;
}

.pally-mobile-commerce-checkout {
    color: var(--pmb-accent);
}

.pally-mobile-cart-count {
    position: absolute;
    top: -7px;
    right: -11px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--pmb-badge);
    color: #fff;
    border: 2px solid var(--pmb-bg);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    font-size: 9px;
    line-height: 1;
    font-weight: 800;
    box-shadow: 0 2px 6px rgba(7, 31, 70, 0.18);
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 150ms ease, transform 150ms ease;
}

.pally-mobile-cart-count.has-items {
    opacity: 1;
    transform: scale(1);
}

@media (max-width: 480px) {
    body.pally-mobile-commerce-visible .pally-mobile-commerce-bar {
        padding-top: 6px;
    }

    .pally-mobile-commerce-item {
        gap: 3px;
        padding-left: 4px;
        padding-right: 4px;
    }

    .pally-mobile-commerce-label {
        font-size: 9px;
        letter-spacing: 0.09em;
    }

    .pally-mobile-commerce-icon,
    .pally-mobile-commerce-icon svg {
        width: 23px;
        height: 23px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pally-mobile-commerce-item,
    .pally-mobile-cart-count {
        transition: none !important;
    }
}
