/* trading_search.css */

.trading-surface {
    width: 100%;
    padding: 1.5rem;
    box-sizing: border-box;
}
@media (min-width: 768px) {
    .trading-surface {
        padding: 1.5rem 1.5rem 1.5rem 1rem;
    }
}
@media (max-width: 767px) {
    .trading-surface {
        padding: 0.5rem 0.5rem calc(80px + env(safe-area-inset-bottom, 0px)) 0.5rem;
    }
}

/* Namespaced Trading Search Input Controls */
.app-trading-search__control {
  position: relative;
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  border-radius: 16px;
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.app-trading-search__control:focus-within {
  border-color: var(--input-focus-border);
  box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
}

.app-trading-search__icon-wrapper {
  color: var(--text-secondary);
  font-size: 1rem;
  padding: 0 0 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.app-trading-search__input {
  display: block;
  flex: 1;
  box-sizing: border-box;
  height: 40px;
  padding: 0 14px 0 10px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.25;
  touch-action: manipulation;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.app-trading-search__input::placeholder {
  color: var(--text-secondary);
}

.app-trading-search__input:focus {
  outline: none;
}

/* ============================================================
   DESKTOP: Always-visible inline search bar (≥ 768px)
   ============================================================ */
@media (min-width: 768px) {
    /* The toggle button (magnifying glass icon) is hidden on desktop */
    #app-trading-search-toggle {
        display: none !important;
    }

    /* The dropdown wrapper is always shown — override [hidden] attribute */
    #app-trading-search-dropdown {
        display: block !important;
        position: static !important;
        visibility: visible !important;
        pointer-events: auto !important;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        z-index: auto !important;
        box-shadow: none !important;
        background: none !important;
        border: none !important;
    }

    /* Inner form wrapper — flat and inline */
    .app-trading-search-dropdown__inner {
        display: flex !important;
        flex-direction: column !important;
        transform: none !important;
        opacity: 1 !important;
        background-color: transparent !important;
        border: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        overflow: visible !important;
        width: 100% !important;
    }

    .app-trading-search-dropdown__inner form {
        padding: 0 !important;
        background: none !important;
        width: 100% !important;
        max-width: 420px !important;
    }

    /* Autocomplete suggestions on desktop */
    .app-trading-search-autocomplete-dropdown {
        position: absolute !important;
        top: calc(100% + 6px) !important;
        left: 0 !important;
        right: 0 !important;
        max-height: 320px !important;
        overflow-y: auto !important;
        background-color: var(--bg-surface) !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 12px !important;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25) !important;
        z-index: 300 !important;
    }
    .app-trading-search-autocomplete-dropdown[hidden] {
        display: none !important;
    }

    /* Ensure the search container is positioned for the autocomplete */
    #app-trading-search {
        position: relative !important;
        display: flex !important;
        align-items: center !important;
        flex: 1 !important;
        max-width: 420px !important;
    }
}

/* ============================================================
   MOBILE: Slide-down search panel (< 768px)
   ============================================================ */
@media (max-width: 767px) {
    .app-trading-search-dropdown {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        top: calc(var(--app-header-height, 60px) + env(safe-area-inset-top, 0px)) !important;
        width: auto !important;
        height: 80vh !important;
        max-height: 80vh !important;
        z-index: 220 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transition: visibility 0.3s ease !important;
    }
    .app-trading-search-dropdown__inner {
        height: 100% !important;
        max-height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        transform: translateY(-100%) !important;
        opacity: 0 !important;
        transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.22s ease !important;
        will-change: transform, opacity !important;
        background-color: var(--bg-surface) !important;
        border-bottom: 1px solid var(--border-color) !important;
        border-radius: 0 0 16px 16px !important;
        box-shadow: 0 8px 24px rgba(0,0,0,0.3) !important;
        overflow: hidden !important;
    }
    
    /* Open states triggered by is-open class on parent #app-trading-search */
    #app-trading-search.is-open .app-trading-search-dropdown {
        visibility: visible !important;
        pointer-events: auto !important;
    }
    #app-trading-search.is-open .app-trading-search-dropdown__inner {
        transform: translateY(0) !important;
        opacity: 1 !important;
    }

    .app-trading-search-dropdown__inner form {
        flex: 0 0 auto !important;
        padding: 0.75rem 1rem !important;
        background-color: var(--bg-surface) !important;
    }
    /* Suggestion dropdown below the input fits the rest of the height */
    .app-trading-search-autocomplete-dropdown {
        position: relative !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        flex: 1 1 auto !important;
        max-height: none !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        border-top: 1px solid var(--border-color) !important;
        overflow-y: auto !important;
        display: block !important;
        background-color: var(--bg-surface) !important;
    }
    .app-trading-search-autocomplete-dropdown[hidden] {
        display: none !important;
    }
}

/* Autocomplete suggestion item styles */
.search-autocomplete-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.25rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: background-color 0.12s ease;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    box-sizing: border-box;
}
.search-autocomplete-option:hover, .search-autocomplete-option.is-selected {
    background-color: var(--table-row-hover);
}
.search-autocomplete-option i {
    color: var(--text-secondary);
    font-size: 0.88rem;
    width: 16px;
    text-align: center;
}
.search-autocomplete-option-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-autocomplete-no-results {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* produce-grid and produce-card styles (reused from storefront) */
.produce-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}
.produce-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.produce-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}
.produce-card-img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    padding: 8px;
    background: var(--table-row-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 2rem;
    box-sizing: border-box;
}
.produce-card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.produce-card-title {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.produce-card-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}
.produce-card-price-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.produce-card-price {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
}
.produce-card-comm {
    color: var(--accent-solid);
    font-size: 0.85rem;
    font-weight: 500;
}
.produce-card-delivery-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    color: #fff;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
}
.produce-card-stock {
    color: var(--text-secondary);
    font-size: 0.85rem;
    background: var(--table-row-bg);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

/* sf-box-grid and sf-box-card styles (reused from storefront) */
.sf-box-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}
.sf-box-card {
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 2px solid color-mix(in srgb, var(--box-colour) 40%, transparent);
    background: var(--bg-surface);
    box-shadow: 0 4px 20px color-mix(in srgb, var(--box-colour) 15%, transparent);
    transition: transform 0.2s ease, box-shadow 0.25s ease;
}
.sf-box-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px color-mix(in srgb, var(--box-colour) 28%, transparent);
}
.sf-box-card-header {
    background: var(--box-colour);
    padding: 1.1rem 1.25rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
}
.sf-box-icon-wrap {
    background: rgba(255,255,255,0.18);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sf-box-icon {
    color: #fff;
    font-size: 1.1rem;
}
.sf-box-tier-label {
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    flex: 1;
}
.sf-box-lug-badge {
    background: rgba(255,255,255,0.22);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    white-space: nowrap;
}
.sf-box-card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.sf-box-title {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}
.sf-box-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0 0 0.9rem 0;
    flex: 1;
}
.sf-box-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.9rem;
}
.sf-box-meta span { display: flex; align-items: center; gap: 0.3rem; }
.sf-box-price-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 0.75rem 0;
    margin-bottom: 1rem;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}
.sf-box-price {
    font-size: 2rem;
    font-weight: 800;
    color: var(--box-colour);
    line-height: 1;
}
.sf-box-comm {
    color: var(--accent-solid);
    font-size: 0.85rem;
    font-weight: 500;
}
.sf-box-order-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.sf-box-stepper {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background: var(--input-bg);
}
.sf-stepper-btn {
    background: transparent;
    border: none;
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.8rem;
}
.sf-stepper-input {
    width: 40px;
    text-align: center;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    outline: none;
    -moz-appearance: textfield;
}
.sf-stepper-input::-webkit-inner-spin-button,
.sf-stepper-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.sf-box-add-btn {
    flex: 1;
    background: var(--box-colour);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    touch-action: manipulation;
}
.sf-box-add-btn:hover:not(:disabled) { opacity: 0.88; }
.sf-box-add-btn:active:not(:disabled) { transform: scale(0.98); }
.sf-box-add-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.sf-empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    grid-column: 1 / -1;
}

/* steppers and details links for produce-card */
.sf-box-details-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    margin-top: 0.6rem;
    padding: 0.55rem 1rem;
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    box-sizing: border-box;
    transition: background 0.15s, color 0.15s;
    touch-action: manipulation;
}
.sf-box-details-link:hover { background: var(--btn-secondary-hover); color: var(--text-primary); }

.trading-btn {
    display: inline-block;
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    box-sizing: border-box;
    transition: background 0.15s;
}
.trading-btn:hover:not(:disabled) {
    background: var(--btn-primary-hover);
}
.trading-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 900px) {
    .sf-box-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
    .sf-box-grid { grid-template-columns: 1fr; }
}



@media (max-width: 767px) {
    .container.app-page-surface {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    .produce-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    .sf-box-grid {
        gap: 0.5rem !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    /* Add padding to text sections in search page so they don't touch screen edge */
    .container.app-page-surface > div:first-child,
    .sf-vegbox-heading,
    section > div:first-child {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    .produce-card-img {
        height: 130px;
    }
    .produce-card-content {
        padding: 0.75rem;
    }
    .produce-card-title {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .produce-card-desc {
        font-size: 0.75rem;
        margin-bottom: 0.5rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .produce-card-price-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        margin-bottom: 0.75rem;
        padding-bottom: 0.5rem;
    }
    .produce-card-price {
        font-size: 1.1rem;
    }
    .produce-card-comm {
        font-size: 0.75rem;
    }
    .produce-card-stock {
        font-size: 0.75rem;
        padding: 0.15rem 0.4rem;
    }
}

/* Produce Catalog Layout */
.produce-catalog-layout {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-top: 1rem;
}

/* Sidebar rail on desktop */
.produce-catalog-filters {
    flex: 0 0 220px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem;
    position: sticky;
    top: calc(var(--app-header-height, 60px) + 20px);
    align-self: flex-start;
    box-sizing: border-box;
}

.produce-catalog-main {
    flex: 1;
    min-width: 0;
}

/* Filter controls */
.produce-catalog-filters__section {
    margin-bottom: 1.25rem;
}

.produce-catalog-filters__label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.produce-catalog-filters__select {
    width: 100%;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    padding: 0.65rem 0.75rem;
    border-radius: 12px;
    font-size: 0.9rem;
    cursor: pointer;
    box-sizing: border-box;
    transition: border-color 0.15s ease;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23b4b4b4' viewBox='0 0 16 16'><path fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/></svg>");
    background-repeat: no-repeat;
    background-position: calc(100% - 12px) center;
    padding-right: 32px;
}

.produce-catalog-filters__select:focus {
    border-color: var(--input-focus-border);
}

.produce-catalog-filters__clear {
    display: block;
    text-align: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    margin-top: 1rem;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.produce-catalog-filters__clear:hover {
    background-color: var(--btn-secondary-hover);
    color: var(--text-primary);
}

/* Mobile Trigger and Panel */
.produce-mobile-filters-trigger-wrapper {
    display: none;
    margin-bottom: 1.5rem;
    padding: 0 0.5rem;
}

.produce-mobile-filters-trigger {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    touch-action: manipulation;
}

.produce-mobile-filters-apply-btn {
    background-color: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    transition: background-color 0.15s ease;
}

.produce-mobile-filters-apply-btn:hover {
    background-color: var(--btn-primary-hover);
}

.produce-mobile-filters-clear-btn {
    display: inline-block;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    box-sizing: border-box;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.produce-mobile-filters-clear-btn:hover {
    background-color: var(--btn-secondary-hover);
    color: var(--text-primary);
}

/* Smooth Dropdown Animation Standard for mobile filter panel */
.produce-mobile-filters-panel-wrapper {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: grid-template-rows;
    overflow: hidden;
    margin-bottom: 1rem;
}
.produce-mobile-filters-panel-inner {
    min-height: 0;
    opacity: 0;
    transition: opacity 0.2s ease;
    will-change: opacity;
    padding: 0.5rem 1rem 1rem 1rem;
}
.produce-mobile-filters-panel-wrapper.is-open {
    grid-template-rows: 1fr;
}
.produce-mobile-filters-panel-wrapper.is-open .produce-mobile-filters-panel-inner {
    opacity: 1;
}

/* Responsiveness overrides */
@media (max-width: 1023px) {
    .produce-catalog-layout {
        flex-direction: column;
        gap: 0;
    }
    .produce-catalog-filters {
        display: none;
    }
    .produce-mobile-filters-trigger-wrapper {
        display: block;
    }
}

/* ═══════════ UNIFIED MOBILE DOCK WRAPPER (Cart Bar + Nav Dock joined as ONE entity) ═══════════ */
.trading-mobile-dock-wrapper {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    z-index: 1400;
    transform: translateY(0);
    opacity: 1;
    transition: transform 0.32s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.25s ease;
    will-change: transform, opacity;
    pointer-events: auto;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
}

.trading-mobile-dock-wrapper.is-hidden {
    transform: translateY(105%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ═══════════ CART BOTTOM BAR (Mobile only - Ultra-compact / Half-size) ═══════════ */
#cart-bottom-bar {
    position: relative;
    width: 100%;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 0.35rem 0.85rem;
    min-height: 44px;
    display: flex;
    flex-direction: column;
    z-index: 1;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
}

/* Fallback if rendered outside dock wrapper */
body.no-dock-wrapper #cart-bottom-bar {
    position: fixed;
    bottom: calc(54px + env(safe-area-inset-bottom, 0px));
    left: 0;
    right: 0;
}

/* Slide up entrance animation when cart bar becomes visible */
@keyframes cartBottomBarSlideIn {
    0% {
        transform: translateY(100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.cart-bar-slide-in {
    animation: cartBottomBarSlideIn 0.32s cubic-bezier(0.25, 1, 0.5, 1) forwards !important;
}

@media (min-width: 768px) {
    .trading-mobile-dock-wrapper:not(.has-visible-cart) {
        box-shadow: none !important;
        pointer-events: none !important;
    }
}

/* Micro progress track hugging the top edge */
.cart-bottom-bar-track {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

#cart-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #357ae8, #22c55e);
    transition: width 0.3s ease;
}

.cart-bottom-bar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.65rem;
    padding-top: 1px;
}

.cart-bottom-bar-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.cart-bottom-bar-title {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.cart-title-text {
    color: var(--text-primary);
    font-weight: 800;
    font-size: 0.95rem;
}

.cart-title-dot {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.cart-title-total {
    color: var(--accent-solid);
    font-weight: 800;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}

.cart-bottom-bar-sub {
    font-size: 0.68rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
    margin-top: 1px;
}

.cart-bottom-bar-action {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.cart-bottom-bar-action .trading-btn {
    padding: 0.4rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 700;
    border-radius: 999px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    line-height: 1;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.cart-bottom-bar-action .trading-btn i {
    font-size: 0.72rem;
    transition: transform 0.2s ease;
}

.cart-bottom-bar-action .trading-btn:hover i {
    transform: translateX(2px);
}

/* ── Desktop: hide the bottom bar, show the top nav pills ── */
@media (min-width: 768px) {
    #cart-bottom-bar {
        display: none !important;
    }
    /* Remove the bottom padding the bottom bar used to need */
    .trading-surface {
        padding-bottom: 1.5rem;
    }
    /* Sidebar shift for content wrapper */
    .app-sidebar-open .content-wrapper {
        margin-left: calc(var(--sidebar-width, 280px) + 16px) !important;
    }
}

/* ═══════════ DESKTOP NAV CART + CUSTOMER PILLS ═══════════ */

/*
 * .sf-desktop-nav-actions — wraps the header__alerts div on the storefront.
 * Adds horizontal flex layout so pills sit neatly before the icon.
 */
.sf-desktop-nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/*
 * Base pill style — hidden on mobile, visible on desktop.
 */
.sf-nav-pill {
    display: none; /* hidden mobile-first */
    align-items: center;
    gap: 0.45rem;
    border: none;
    border-radius: 20px;
    padding: 0.45rem 1rem;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    transition: opacity 0.15s ease, transform 0.1s ease;
    white-space: nowrap;
    line-height: 1;
    font-family: inherit;
}
.sf-nav-pill:active { transform: scale(0.97); }

/* Cart pill — filled blue (primary action) */
.sf-nav-pill--cart {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
}
.sf-nav-pill--cart:hover { background: var(--btn-primary-hover); }

/* Separator dot between count and total */
.sf-nav-pill__sep {
    opacity: 0.5;
    font-weight: 400;
}

/* Total amount — slightly bolder */
.sf-nav-pill__total {
    font-variant-numeric: tabular-nums;
    opacity: 0.92;
}

/* Customer pill — secondary style */
.sf-nav-pill--customer {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border: 1px solid var(--border-color);
    max-width: 180px;
}
.sf-nav-pill--customer:hover { background: var(--btn-secondary-hover); }
.sf-nav-pill--customer span { overflow: hidden; text-overflow: ellipsis; max-width: 120px; }

/* Chevron rotates when customer modal is open (optional enhancement) */
.sf-nav-pill__chevron {
    font-size: 0.65rem;
    opacity: 0.6;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

/* Prices pill — clean bridge back to Market Prices app */
.sf-nav-pill--prices {
    background: var(--btn-secondary-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    text-decoration: none !important;
}
.sf-nav-pill--prices:hover {
    background: var(--btn-secondary-hover);
    border-color: var(--accent-solid);
    color: var(--accent-solid);
}

/* ── Show pills only on desktop ── */
@media (min-width: 768px) {
    .sf-nav-pill {
        display: inline-flex;
    }
}

/* ── WeBuyVeg Brand Mark & Responsive Header ── */
.we-buy-veg-mark {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
    display: block;
    border-radius: 6px;
    transition: transform 0.2s ease;
}

@media (max-width: 480px) {
    .we-buy-veg-mark {
        width: 28px;
        height: 28px;
    }
}

/* ── Ultra-narrow screen header protection (< 360px) ── */
@media (max-width: 359px) {
    .we-buy-veg-mark {
        width: 24px;
        height: 24px;
    }
    .app-header__brand .app-header__brand-text {
        font-size: 0.98rem !important;
    }
    .app-header__brand .app-header__tagline {
        display: none !important;
    }
    .app-header__inner {
        gap: 2px !important;
        padding-left: 4px !important;
        padding-right: 4px !important;
    }
}

/* ═════════════════════════════════════════════════════════════════════════
   DEDICATED AMAZON-STYLE PRICE SEARCH PAGE
   ═════════════════════════════════════════════════════════════════════════ */
.amazon-search-hero {
    background: var(--bg-surface, #1e1f20);
    border: 1px solid var(--border-color, #2e3032);
    border-radius: 20px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    box-sizing: border-box;
}

.amazon-search-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.amazon-search-input-wrap {
    position: relative;
    flex: 1 1 0%;
    min-width: 0;
    display: flex;
    align-items: center;
    background: var(--input-bg, #131314);
    border: 1.5px solid var(--input-border, #2e3032);
    border-radius: 16px;
    padding: 0 0.85rem;
    height: 48px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.amazon-search-input-wrap:focus-within {
    border-color: var(--accent-solid, #4285f4);
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.2);
}

.amazon-search-icon {
    color: var(--accent-solid, #4285f4);
    font-size: 1.15rem;
    margin-right: 0.65rem;
    flex-shrink: 0;
}

.amazon-search-input {
    flex: 1 1 0%;
    min-width: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary, #e3e3e3);
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    box-sizing: border-box;
}

.amazon-search-input::placeholder {
    color: var(--text-secondary, #b4b4b4);
    font-weight: 400;
}

.amazon-search-clear-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary, #b4b4b4);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
}

.amazon-search-clear-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.amazon-search-submit-btn {
    background: var(--btn-primary-bg, #4285f4);
    color: var(--btn-primary-text, #ffffff);
    border: none;
    border-radius: 14px;
    height: 48px;
    padding: 0 1.25rem;
    font-weight: 600;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.15s;
    touch-action: manipulation;
    white-space: nowrap;
    flex-shrink: 0;
    box-sizing: border-box;
}

.amazon-search-submit-btn:hover {
    background: var(--btn-primary-hover, #357ae8);
}

.amazon-search-submit-btn:active {
    transform: scale(0.97);
}

/* Quick Filter Pills Scroller */
.amazon-search-tags-scroller {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.amazon-search-tags-scroller::-webkit-scrollbar {
    display: none;
}

.amazon-search-tag {
    background: var(--table-row-bg, #131314);
    border: 1px solid var(--border-color, #2e3032);
    border-radius: 20px;
    padding: 0.4rem 0.85rem;
    color: var(--text-secondary, #b4b4b4);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    touch-action: manipulation;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    text-decoration: none;
    font-family: inherit;
}

.amazon-search-tag:hover,
.amazon-search-tag:active {
    border-color: var(--accent-solid, #4285f4);
    color: var(--text-primary, #e3e3e3);
    transform: scale(0.98);
}

.amazon-search-tag.is-active {
    background: var(--accent-solid, #4285f4);
    border-color: var(--accent-solid, #4285f4);
    color: #ffffff;
}

/* Results Meta Row (Live Count + Sort Dropdown) */
.amazon-search-meta-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding: 0.25rem 0.25rem;
}

.amazon-search-meta-count {
    color: var(--text-secondary, #b4b4b4);
    font-size: 0.92rem;
    font-weight: 500;
}

.amazon-search-meta-count strong {
    color: var(--text-primary, #e3e3e3);
    font-weight: 700;
}

.amazon-search-sort-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.amazon-search-sort-select {
    background: var(--input-bg, #1e1f20);
    border: 1px solid var(--input-border, #2e3032);
    color: var(--text-primary, #e3e3e3);
    border-radius: 12px;
    padding: 0.45rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
}

.amazon-search-sort-select:focus {
    border-color: var(--accent-solid, #4285f4);
}

/* Empty State */
.amazon-search-empty {
    text-align: center;
    padding: 4rem 1.5rem;
    background: var(--bg-surface, #1e1f20);
    border: 1px solid var(--border-color, #2e3032);
    border-radius: 20px;
    margin-top: 1.5rem;
}

.amazon-search-empty-icon {
    font-size: 3rem;
    color: var(--text-secondary, #b4b4b4);
    margin-bottom: 1rem;
    opacity: 0.7;
}

.amazon-search-empty-title {
    color: var(--text-primary, #e3e3e3);
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
}

.amazon-search-empty-desc {
    color: var(--text-secondary, #b4b4b4);
    max-width: 440px;
    margin: 0 auto 1.5rem auto;
    font-size: 0.92rem;
    line-height: 1.5;
}

.amazon-search-suggestions-wrap {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* ============================================================
   RESPONSIVE MOBILE OPTIMIZATIONS (< 768px)
   ============================================================ */
@media (max-width: 767px) {
    .amazon-search-hero {
        padding: 0.75rem 0.85rem;
        border-radius: 16px;
        margin-bottom: 1rem;
        gap: 0.75rem;
    }
    .amazon-search-form {
        gap: 0.45rem;
        width: 100%;
    }
    .amazon-search-input-wrap {
        height: 44px;
        padding: 0 0.65rem;
        border-radius: 12px;
    }
    .amazon-search-icon {
        font-size: 0.95rem;
        margin-right: 0.45rem;
    }
    .amazon-search-input {
        font-size: 0.88rem;
    }
    .amazon-search-submit-btn {
        height: 44px;
        padding: 0 0.95rem;
        border-radius: 12px;
        font-size: 0.88rem;
        gap: 0.35rem;
    }
    .amazon-search-tags-scroller {
        gap: 0.4rem;
        padding-bottom: 0.2rem;
    }
    .amazon-search-tag {
        padding: 0.35rem 0.7rem;
        font-size: 0.78rem;
        border-radius: 16px;
    }
    .amazon-search-meta-bar {
        padding: 0 0.25rem;
        margin-bottom: 1rem;
        gap: 0.6rem;
    }
    .amazon-search-meta-count {
        font-size: 0.85rem;
    }
    .view-mode-btn {
        padding: 0.35rem 0.75rem !important;
        font-size: 0.78rem !important;
    }
    .amazon-search-sort-control {
        font-size: 0.78rem;
    }
    .amazon-search-sort-select {
        padding: 0.35rem 0.65rem;
        font-size: 0.78rem;
    }
}

@media (max-width: 420px) {
    .amazon-search-hero {
        padding: 0.65rem 0.65rem;
    }
    .amazon-search-input-wrap {
        padding: 0 0.5rem;
    }
    .amazon-search-input {
        font-size: 0.85rem;
    }
    .amazon-search-submit-btn {
        padding: 0 0.75rem;
    }
    .amazon-search-submit-btn span {
        display: none;
    }
}




/* Hide bottom nav and cart when mobile keypad is open */
body.is-typing-mobile .landing-mobile-quick-nav,
body.is-typing-mobile .trading-mobile-bottom-nav,
body.is-typing-mobile .trading-mobile-dock-wrapper,
body.is-typing-mobile .agent-cart-drawer,
body.is-typing-mobile #cart-bottom-bar {
    display: none !important;
}


/* Hide native webkit search cancel button to prevent double X */
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
    -webkit-appearance: none;
    display: none;
}

/* Autocomplete Dropdown */
.trading-autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    z-index: 100;
    overflow: hidden;
    display: none;
}
.trading-autocomplete-dropdown.is-active {
    display: block;
}
.trading-autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}
.trading-autocomplete-item:last-child {
    border-bottom: none;
}
.trading-autocomplete-item:hover, .trading-autocomplete-item.is-selected {
    background: var(--table-row-hover);
}

