/**
 * Maavelus Mini Cart
 */

.maavelus-mini-cart-wrapper {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
}

.maavelus-mini-cart-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--maavelus-primary, #f97316);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.maavelus-mini-cart-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.5);
}

.maavelus-mini-cart-toggle:active {
    transform: scale(0.98);
}

.maavelus-mini-cart-toggle svg {
    width: 24px;
    height: 24px;
}

.maavelus-mini-cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    background: #1f2937;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

.maavelus-mini-cart-count:empty,
.maavelus-mini-cart-count[data-count="0"] {
    display: none;
}

/* Hide when count is 0 */
.maavelus-mini-cart-wrapper.empty .maavelus-mini-cart-count {
    display: none;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .maavelus-mini-cart-wrapper {
        bottom: 16px;
        right: 16px;
    }
    
    .maavelus-mini-cart-toggle {
        width: 52px;
        height: 52px;
    }
}

/* Animation for count update */
@keyframes cartBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.maavelus-mini-cart-count.updated {
    animation: cartBounce 0.3s ease;
}

/* =========================================================================
 * Sticky mobile basket bar
 * ========================================================================= */
.maavelus-basket-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    /* z-index: 999 keeps it above typical theme sticky headers
       (which usually sit in the high-hundreds) without entering
       the 9999+ band that creates awkward stacking conflicts.
       Still below the change-branch confirm (100000) and quick-
       view modal (100001). */
    z-index: 999;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
}
.maavelus-basket-bar.visible {
    transform: translateY(0);
}
.basket-bar-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    border: none;
    background: var(--maavelus-primary, #f97316);
    color: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s ease;
}
.basket-bar-button:hover { filter: brightness(0.95); }
.basket-bar-button:active { filter: brightness(0.9); }
.basket-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.basket-bar-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}
.basket-bar-icon svg {
    width: 22px;
    height: 22px;
    fill: #fff;
}
.basket-bar-count {
    position: absolute;
    top: -4px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #111827;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.basket-bar-total {
    font-weight: 600;
    font-size: 15px;
}
.basket-bar-cta {
    flex-shrink: 0;
    font-weight: 600;
    font-size: 14px;
}

/* Hide on desktop — basket bar is mobile-only. */
@media (min-width: 1024px) {
    .maavelus-basket-bar { display: none !important; }
}

/* Hide the floating cart button on mobile — the sticky basket bar replaces
   it. Targets both class names used across the plugin. */
@media (max-width: 1023px) {
    .maavelus-floating-cart,
    .maavelus-mini-cart-wrapper { display: none !important; }
}

/* Make room above the bar when it's visible so site footer / floating
   elements aren't clipped. */
@media (max-width: 1023px) {
    body.has-basket-bar { padding-bottom: 76px; }
}

/* =========================================================================
 * Side-cart loading skeleton — rendered into .side-cart-items by mini-cart.js
 * while ajaxGetSideCart is in flight. Three rows that roughly match the
 * footprint of a real .side-cart-item (name on top, qty + price below) so
 * the panel doesn't visually jump when real items replace the placeholders.
 * ========================================================================= */
.side-cart-item-skeleton {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}
.side-cart-item-skeleton .skel-name {
    height: 18px;
    width: 65%;
    margin-bottom: 12px;
}
.side-cart-item-skeleton .skel-row {
    height: 32px;
    width: 100%;
}

/* =========================================================================
 * Empty-cart state on the side cart's Checkout button. Mini-cart.js adds
 * `.is-disabled` + `aria-disabled="true"` whenever the cart count drops
 * to zero so the customer can't tap through to a Place Order they can't
 * complete. Pointer-events caught here for mouse; keyboard activation is
 * blocked by the click-time guard in mini-cart.js.
 * ========================================================================= */
.side-cart-checkout-btn.is-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.side-cart-empty-note {
    margin: 8px 0 0 0;
    font-size: 12px;
    color: #6b7280;
    text-align: center;
}
