/* ==========================================================================
   Checkers Sixty60-Style Cart Steppers & Storefront Controls
   Adheres strictly to AGENTS.md tokens and semantic styling.
   ========================================================================== */

/* ── 1. Quick-Tap Sixty60 Stepper & Button ────────────────────────────── */
.quick-tap-action-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
    min-width: 104px;
}

.sixty60-btn-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 700;
    background: var(--btn-primary-bg, #4285f4);
    color: var(--btn-primary-text, #ffffff);
    border: none;
    cursor: pointer;
    touch-action: manipulation;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    white-space: nowrap;
}

.sixty60-btn-add:hover:not(:disabled) {
    background: var(--btn-primary-hover, #357ae8);
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.35);
}

.sixty60-btn-add:active:not(:disabled) {
    transform: scale(0.96);
}

.sixty60-btn-add:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* The Sixty60 active stepper pill */
.sixty60-stepper {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    background: var(--input-bg, #1e1f20);
    border: 1.5px solid var(--accent-solid, #4285f4);
    border-radius: 12px;
    padding: 2px;
    box-sizing: border-box;
    box-shadow: 0 2px 10px rgba(66, 133, 244, 0.2);
    min-width: 104px;
    user-select: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sixty60-stepper-btn {
    background: transparent;
    border: none;
    color: var(--text-primary, #e3e3e3);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 8px;
    font-size: 0.85rem;
    touch-action: manipulation;
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.sixty60-stepper-btn:hover:not(:disabled) {
    background: var(--btn-icon-hover, rgba(255, 255, 255, 0.08));
    color: var(--accent-solid, #4285f4);
}

.sixty60-stepper-btn:active:not(:disabled) {
    transform: scale(0.9);
}

.sixty60-stepper-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.sixty60-stepper-btn--minus:hover:not(:disabled) {
    color: #ef4444;
}

.sixty60-stepper-count {
    flex: 1;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary, #e3e3e3);
    font-variant-numeric: tabular-nums;
    padding: 0 0.25rem;
    min-width: 28px;
}

.sixty60-stepper-input {
    width: 42px;
    text-align: center;
    border: none;
    background: transparent;
    color: var(--text-primary, #e3e3e3);
    font-size: 0.95rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    padding: 0.2rem 0;
    margin: 0;
    outline: none;
    cursor: text;
    -moz-appearance: textfield;
}

.sixty60-stepper-input::-webkit-inner-spin-button,
.sixty60-stepper-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.sixty60-stepper-input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
}

/* ── 2. Card View Mode Stepper & Add Button ───────────────────────────── */
.card-action-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: auto;
    width: 100%;
}

.sixty60-card-btn-add {
    width: 100%;
    padding: 0.65rem 1rem;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 700;
    background: var(--btn-primary-bg, #4285f4);
    color: var(--btn-primary-text, #ffffff);
    border: none;
    cursor: pointer;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.15s ease, transform 0.1s ease;
}

.sixty60-card-btn-add:hover:not(:disabled) {
    background: var(--btn-primary-hover, #357ae8);
}

.sixty60-card-btn-add:active:not(:disabled) {
    transform: scale(0.97);
}

.sixty60-card-btn-add:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.sixty60-card-stepper {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--input-bg, #1e1f20);
    border: 1.5px solid var(--accent-solid, #4285f4);
    border-radius: 12px;
    padding: 4px;
    box-sizing: border-box;
    box-shadow: 0 4px 14px rgba(66, 133, 244, 0.2);
}

.sixty60-card-stepper .sixty60-stepper-btn {
    width: 36px;
    height: 36px;
    font-size: 0.95rem;
}

.sixty60-card-stepper .sixty60-stepper-count-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
}

.sixty60-card-stepper .sixty60-stepper-count {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--accent-solid, #4285f4);
}

.sixty60-card-stepper-input {
    width: 50px;
    text-align: center;
    border: none;
    background: transparent;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--accent-solid, #4285f4);
    font-variant-numeric: tabular-nums;
    padding: 0.15rem 0;
    margin: 0;
    outline: none;
    cursor: text;
    -moz-appearance: textfield;
}

.sixty60-card-stepper-input::-webkit-inner-spin-button,
.sixty60-card-stepper-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.sixty60-card-stepper-input:focus {
    background: rgba(66, 133, 244, 0.12);
    border-radius: 6px;
}

.sixty60-card-stepper .sixty60-stepper-sublabel {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary, #b4b4b4);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── 3. Veg Box Card Stepper Active State ─────────────────────────────── */
.sf-box-card.is-in-basket {
    border-color: var(--accent-solid, #4285f4);
    box-shadow: 0 8px 24px rgba(66, 133, 244, 0.25);
}

/* ── 4. Trading Mobile Bottom Navigation Bar (Footer) ── */
.trading-mobile-bottom-nav {
    display: none;
}

.trading-category-drawer-backdrop {
    display: none;
}

@media (max-width: 767px) {
    .trading-mobile-bottom-nav {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #ffffff;
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        padding: 0.45rem 0.75rem calc(0.45rem + env(safe-area-inset-bottom, 0px)) 0.75rem;
        z-index: 145; /* Lower than sidebar backdrop (150) and sidebars/drawers (160-180) so menus cover everything */
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
        transform: translateY(0);
        opacity: 1;
        transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.25s ease;
        will-change: transform, opacity;
        box-sizing: border-box;
    }

    .trading-mobile-bottom-nav__inner {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        align-items: center;
        width: 100%;
        max-width: 460px;
        margin: 0 auto;
        gap: 0.25rem;
    }

    .trading-mobile-bottom-nav.is-hidden,
    #trading-mobile-bottom-nav.is-hidden {
        transform: translateY(calc(100% + 20px)) !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    .trading-mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.2rem;
        color: #5f6368;
        background: transparent;
        border: none;
        text-decoration: none;
        font-size: 0.72rem;
        font-weight: 600;
        letter-spacing: 0.01em;
        padding: 0.25rem 0.5rem;
        border-radius: 12px;
        text-align: center;
        touch-action: manipulation;
        transition: color 0.2s cubic-bezier(0.25, 1, 0.5, 1), transform 0.15s ease;
        cursor: pointer;
        font-family: inherit;
        -webkit-tap-highlight-color: transparent;
        position: relative;
    }

    .trading-mobile-nav-icon-wrap {
        width: 48px;
        height: 28px;
        border-radius: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #5f6368;
        transition: background-color 0.25s cubic-bezier(0.25, 1, 0.5, 1), transform 0.2s ease, color 0.2s ease;
    }

    .trading-mobile-nav-icon-wrap i {
        font-size: 1.15rem;
        line-height: 1;
        transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1);
    }

    .trading-mobile-nav-label {
        font-size: 0.72rem;
        font-weight: 600;
        color: #5f6368;
        transition: color 0.2s ease, font-weight 0.2s ease;
    }

    /* Active Amazon-style State on White Bar */
    .trading-mobile-nav-item.is-active {
        color: var(--accent-solid, #1a73e8);
    }

    .trading-mobile-nav-item.is-active .trading-mobile-nav-icon-wrap {
        background: rgba(26, 115, 232, 0.12);
        color: var(--accent-solid, #1a73e8);
        transform: translateY(-1px);
    }

    .trading-mobile-nav-item.is-active .trading-mobile-nav-icon-wrap i {
        transform: scale(1.08);
    }

    .trading-mobile-nav-item.is-active .trading-mobile-nav-label {
        color: var(--accent-solid, #1a73e8);
        font-weight: 700;
    }

    .trading-mobile-nav-item:active {
        transform: scale(0.92);
    }

    /* Cart Count Badge on Footer Nav */
    .trading-nav-cart-badge {
        position: absolute;
        top: -4px;
        right: 4px;
        background: #22c55e;
        color: #ffffff;
        font-size: 0.65rem;
        font-weight: 800;
        min-width: 17px;
        height: 17px;
        border-radius: 9px;
        padding: 0 4px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
        border: 2px solid #ffffff;
        box-sizing: border-box;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
        pointer-events: none;
    }

    /* ── Amazon Mobile App Star Sparkle Flash Animation on Add to Cart ── */
    .cart-sparkle-star {
        position: absolute;
        top: 50%;
        left: 50%;
        margin-top: -6px;
        margin-left: -6px;
        font-size: 11px;
        line-height: 1;
        color: #f59e0b; /* Golden Amazon sparkle */
        text-shadow: 0 0 4px rgba(245, 158, 11, 0.95), 0 0 8px rgba(251, 191, 36, 0.7);
        opacity: 0;
        pointer-events: none;
        z-index: 15;
        will-change: transform, opacity;
    }

    @keyframes amazonStarBurst1 {
        0% {
            opacity: 0;
            transform: translate(0, 0) scale(0) rotate(0deg);
        }
        30% {
            opacity: 1;
            transform: translate(14px, -14px) scale(1.4) rotate(45deg);
        }
        70% {
            opacity: 0.9;
            transform: translate(20px, -20px) scale(1) rotate(90deg);
        }
        100% {
            opacity: 0;
            transform: translate(24px, -24px) scale(0.2) rotate(135deg);
        }
    }

    @keyframes amazonStarBurst2 {
        0% {
            opacity: 0;
            transform: translate(0, 0) scale(0) rotate(0deg);
        }
        30% {
            opacity: 1;
            transform: translate(-14px, -15px) scale(1.5) rotate(-30deg);
        }
        70% {
            opacity: 0.9;
            transform: translate(-20px, -22px) scale(1.1) rotate(-70deg);
        }
        100% {
            opacity: 0;
            transform: translate(-24px, -26px) scale(0.2) rotate(-110deg);
        }
    }

    @keyframes amazonStarBurst3 {
        0% {
            opacity: 0;
            transform: translate(0, 0) scale(0) rotate(0deg);
        }
        30% {
            opacity: 1;
            transform: translate(0px, -18px) scale(1.6) rotate(60deg);
        }
        70% {
            opacity: 0.9;
            transform: translate(2px, -25px) scale(1.2) rotate(120deg);
        }
        100% {
            opacity: 0;
            transform: translate(3px, -29px) scale(0.2) rotate(180deg);
        }
    }

    @keyframes amazonCartPop {
        0% {
            transform: scale(1);
        }
        25% {
            transform: scale(1.35) rotate(-8deg);
        }
        50% {
            transform: scale(0.92) rotate(4deg);
        }
        75% {
            transform: scale(1.12) rotate(-2deg);
        }
        100% {
            transform: scale(1) rotate(0deg);
        }
    }

    .trading-mobile-nav-item.is-sparkling .cart-sparkle-star--1 {
        animation: amazonStarBurst1 0.75s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    }

    .trading-mobile-nav-item.is-sparkling .cart-sparkle-star--2 {
        animation: amazonStarBurst2 0.75s cubic-bezier(0.25, 1, 0.5, 1) 0.05s forwards;
    }

    .trading-mobile-nav-item.is-sparkling .cart-sparkle-star--3 {
        animation: amazonStarBurst3 0.75s cubic-bezier(0.25, 1, 0.5, 1) 0.1s forwards;
    }

    .trading-mobile-nav-item.is-sparkling .trading-mobile-nav-icon-wrap {
        animation: amazonCartPop 0.65s cubic-bezier(0.25, 1, 0.5, 1) !important;
        background: rgba(245, 158, 11, 0.18) !important;
    }

    .trading-mobile-nav-item.is-sparkling .trading-mobile-nav-icon-wrap i {
        color: #f59e0b !important;
    }

    .trading-mobile-nav-item.is-sparkling .trading-nav-cart-badge {
        animation: amazonCartPop 0.65s cubic-bezier(0.25, 1, 0.5, 1) !important;
        background: #f59e0b !important;
        box-shadow: 0 0 8px rgba(245, 158, 11, 0.8) !important;
    }

    /* Keep relative inside dock wrapper */
    .trading-mobile-dock-wrapper .trading-mobile-bottom-nav {
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        box-shadow: none !important;
    }
}

/* ── 5. Trading Desktop Header Navigation Dock (Shop, Search, Order on PC/wider screens >=768px) ── */
.trading-desktop-nav-slot {
    display: none;
}

@media (min-width: 768px) {
    .trading-desktop-nav-slot {
        display: flex;
        align-items: center;
        flex: 1 1 auto;
        margin: 0 1rem;
        min-width: 0;
    }

    .trading-desktop-nav-slot .trading-mobile-bottom-nav {
        display: flex !important;
        position: static !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        transform: none !important;
        opacity: 1 !important;
        width: auto !important;
        max-width: none !important;
        pointer-events: auto !important;
    }

    .trading-desktop-nav-slot .trading-mobile-bottom-nav__inner {
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
        width: auto !important;
        max-width: none !important;
        margin: 0 !important;
    }

    .trading-desktop-nav-slot .trading-mobile-nav-item {
        display: inline-flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 0.45rem !important;
        padding: 0.45rem 1rem !important;
        border-radius: 20px !important;
        font-size: 0.82rem !important;
        font-weight: 700 !important;
        background: var(--btn-secondary-bg, #2e3032) !important;
        color: var(--text-primary, #e3e3e3) !important;
        border: 1px solid var(--border-color, #2e3032) !important;
        white-space: nowrap !important;
        line-height: 1 !important;
        text-decoration: none !important;
        transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, color 0.15s ease !important;
    }

    .trading-desktop-nav-slot .trading-mobile-nav-item:hover {
        background: var(--btn-secondary-hover, #3a3c3e) !important;
        border-color: var(--accent-solid, #4285f4) !important;
        color: var(--accent-solid, #4285f4) !important;
        transform: translateY(-1px) !important;
    }

    .trading-desktop-nav-slot .trading-mobile-nav-item:active {
        transform: scale(0.97) !important;
    }

    .trading-desktop-nav-slot .trading-mobile-nav-item.is-active {
        background: var(--accent-solid, #4285f4) !important;
        color: #ffffff !important;
        border-color: var(--accent-solid, #4285f4) !important;
    }

    .trading-desktop-nav-slot .trading-mobile-nav-icon-wrap {
        width: auto !important;
        height: auto !important;
        border-radius: 0 !important;
        background: transparent !important;
        color: inherit !important;
        transform: none !important;
    }

    .trading-desktop-nav-slot .trading-mobile-nav-icon-wrap i {
        font-size: 0.9rem !important;
        color: inherit !important;
        transform: none !important;
    }

    .trading-desktop-nav-slot .trading-mobile-nav-label {
        font-size: 0.82rem !important;
        font-weight: 700 !important;
        color: inherit !important;
    }

    /* On PC/desktop >=768px, hide the dock's cart button because #sf-desktop-cart-pill is already displayed on the right of Zone 1 */
    .trading-desktop-nav-slot #trading-mobile-nav-cart {
        display: none !important;
    }
}


/* ═════════════════════════════════════════════════════════════════════════
   3. Mobile-First Community Veg Box Quick-Tap Cards
   ═════════════════════════════════════════════════════════════════════════ */
.sf-vegbox-tap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 0.85rem;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 640px) {
    .sf-vegbox-tap-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

.sf-vegbox-tap-card {
    background: var(--bg-surface, #1e1f20);
    border: 2px solid color-mix(in srgb, var(--box-colour, #4285f4) 40%, var(--border-color, #2e3032));
    border-radius: 14px;
    padding: 0.75rem 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    transition: transform 0.15s ease, border-color 0.15s ease;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.sf-vegbox-tap-card:hover {
    border-color: var(--box-colour, #4285f4);
}

.sf-vegbox-tap-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--box-colour, #4285f4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
    font-size: 1.2rem;
}

.sf-vegbox-tap-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.sf-vegbox-tap-title {
    font-weight: 700;
    color: var(--text-primary, #e3e3e3);
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sf-vegbox-tap-meta {
    font-size: 0.8rem;
    color: var(--text-secondary, #b4b4b4);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    overflow: hidden;
}

.sf-vegbox-tap-price {
    font-weight: 800;
    color: var(--box-colour, #4285f4);
}

.sf-vegbox-tap-stock {
    color: var(--text-secondary, #b4b4b4);
    font-size: 0.75rem;
}

/* ── 8. macOS / WebKit Trackpad Scroll Fix ─────────────────────────────────
   Prevents WebKit nested overflow containment from capturing trackpad gestures
   and trapping vertical scrolling on MacBook / Safari browsers on Trading pages.
   Desktop only (≥768px): at mobile widths master-layout.css switches to
   document scroll (html overflows), so overscroll-behavior-y: contain would
   trap scroll in the zero-height #app-content and break DevTools simulation.
   ────────────────────────────────────────────────────────────────────────── */
@media (min-width: 768px) {
    #app-content.app-main-viewport {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }
}

@media (max-width: 767px) {
    #app-content.app-main-viewport {
        overscroll-behavior-y: auto;
        -webkit-overflow-scrolling: auto;
    }
}

#app-content > .container {
    overflow-x: visible !important;
}

.trading-surface {
    overflow: visible !important;
}

/* ── 9. Agent POS Dispatch Options Panel ─────────────────────────────────── */
#agent-pos-panel label input[type="radio"],
#agent-pos-panel label input[type="checkbox"] {
    accent-color: var(--accent-solid);
    cursor: pointer;
}



