/* WeDeliver floating cart + checkout-flow helpers.
   Local worktree only until Ras approves a deploy. */
#wd-floating-cart {
    font-family: var(--font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);
}

#wd-floating-cart-btn {
    position: fixed;
    left: 18px;
    right: auto;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    z-index: 9997;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: var(--brand-accent, #F97316);
    color: #fff;
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    line-height: 1;
    padding: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

#wd-floating-cart-btn:hover,
#wd-floating-cart-btn:focus {
    transform: scale(1.05);
    background: var(--brand-accent-hover, #ea580c);
    box-shadow: 0 8px 24px rgba(234, 88, 12, 0.45);
    outline: none;
}

#wd-floating-cart-btn:focus-visible {
    outline: 3px solid var(--brand-accent, #F97316);
    outline-offset: 3px;
}

#wd-floating-cart-btn.wd-fc-pulse {
    animation: wd-fc-pulse 0.6s ease;
}

@keyframes wd-fc-pulse {
    0% { transform: scale(1); }
    40% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

#wd-floating-cart .wd-fc-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 9999px;
    background: var(--brand-accent, #F97316);
    color: #fff;
    border: 2px solid #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    display: none;
}

#wd-floating-cart.has-items .wd-fc-badge {
    display: block;
}

/* Sit above the budtender launcher when both are on screen. */
body:has(#budtender-launcher) #wd-floating-cart-btn {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

/* Don't cover the item modal "Add to Cart" bar, login/signup, or the age gate. */
body:has(.fi-footer) #wd-floating-cart,
body:has(.auth-v3) #wd-floating-cart,
body:has(.age-restriction-wrap) #wd-floating-cart {
    display: none !important;
}

#wd-floating-cart-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 9996;
}

#wd-floating-cart.is-open #wd-floating-cart-backdrop {
    display: block;
}

#wd-floating-cart-panel {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: auto;
    width: min(400px, 100vw);
    height: 100%;
    background: var(--surface-color, #fff);
    color: var(--text-main, #0f172a);
    z-index: 9998;
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.18);
    flex-direction: column;
}

#wd-floating-cart.is-open #wd-floating-cart-panel {
    display: flex;
}

.wd-fc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-light, #e2e8f0);
    flex-shrink: 0;
}

.wd-fc-header h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main, #0f172a);
}

#wd-floating-cart-close {
    background: transparent;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
}

#wd-floating-cart-close:hover,
#wd-floating-cart-close:focus {
    color: var(--text-main, #0f172a);
    background: var(--bg-main, #f8fafc);
    outline: none;
}

#wd-floating-cart-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px 18px 8px;
}

#wd-floating-cart-body .wd-fc-empty {
    text-align: center;
    color: var(--text-muted, #64748b);
    padding: 28px 8px;
    margin: 0;
}

.wd-fc-footer {
    flex-shrink: 0;
    padding: 14px 18px calc(16px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border-light, #e2e8f0);
    background: var(--surface-color, #fff);
}

.wd-fc-checkout,
.wd-fc-browse {
    display: block;
    width: 100%;
    text-align: center;
    text-decoration: none !important;
    border-radius: 9999px;
    padding: 14px 20px;
    font-weight: 700;
    font-size: 1rem;
}

.wd-fc-checkout {
    background: var(--brand-accent, #F97316) !important;
    color: #fff !important;
}

.wd-fc-checkout:hover,
.wd-fc-checkout:focus {
    background: var(--brand-accent-hover, #ea580c) !important;
    color: #fff !important;
}

.wd-fc-browse {
    background: transparent;
    color: var(--brand-accent, #F97316) !important;
    border: 1.5px solid var(--brand-accent, #F97316);
}

#wd-floating-cart.is-empty .wd-fc-checkout { display: none; }
#wd-floating-cart:not(.is-empty) .wd-fc-browse { display: none; }
#wd-floating-cart.is-empty .wd-fc-items { display: none; }
#wd-floating-cart:not(.is-empty) .wd-fc-empty { display: none; }

body.wd-fc-locked {
    overflow: hidden;
}

/* Shorter checkout stepper used on cart / sign-in / place-order pages. */
.wd-checkout-steps {
    background: var(--surface-color, #fff);
    border-bottom: 1px solid var(--border-light, #e2e8f0);
    padding: 12px 0 14px;
}

.wd-checkout-steps .wd-cs-track {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: flex-start;
}

.wd-checkout-steps .wd-cs-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1 1 0;
    min-width: 0;
    position: relative;
    text-decoration: none;
}

.wd-checkout-steps .wd-cs-step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 15px;
    left: calc(50% + 20px);
    right: calc(-50% + 20px);
    height: 2px;
    background: var(--border-light, #e2e8f0);
}

.wd-checkout-steps .wd-cs-step.wd-cs-done:not(:last-child)::after {
    background: var(--brand-primary, #047857);
}

.wd-checkout-steps .wd-cs-dot {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--bg-main, #fff);
    border: 2px solid var(--border-light, #cbd5e1);
    color: var(--text-muted, #64748b);
    z-index: 1;
}

.wd-checkout-steps .wd-cs-step.wd-cs-done .wd-cs-dot {
    background: var(--brand-primary, #047857);
    border-color: var(--brand-primary, #047857);
    color: #fff;
}

.wd-checkout-steps .wd-cs-step.wd-cs-current .wd-cs-dot {
    border-color: var(--brand-primary, #047857);
    color: var(--brand-primary, #047857);
}

.wd-checkout-steps .wd-cs-label {
    margin-top: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    text-align: center;
}

.wd-checkout-steps .wd-cs-step.wd-cs-current .wd-cs-label {
    color: var(--text-main, #0f172a);
}

/* Sticky checkout button on the cart page so the next step is always in reach. */
.cart-page-v2 .wd-cart-sticky-checkout {
    position: sticky;
    bottom: 0;
    background: var(--surface-color, #fff);
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
    margin-top: 8px;
    box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.08);
    z-index: 20;
}

[data-theme="dark"] .cart-page-v2 .wd-cart-sticky-checkout {
    box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.4);
}

@media (max-width: 480px) {
    #wd-floating-cart-btn {
        width: 44px;
        height: 44px;
        left: 14px;
        right: auto;
        font-size: 1.25rem;
    }
}

#wd-floating-cart.is-empty .wd-fc-summary { display: none; }
#wd-floating-cart:not(.is-empty) .wd-fc-items:empty + .wd-fc-summary { display: block; text-align: center; color: var(--text-muted, #64748b); padding: 12px 8px 20px; margin: 0; }
#wd-floating-cart:not(.is-empty) .wd-fc-items:not(:empty) + .wd-fc-summary { display: none; }
