/* =============================================================================
   Rixden Quote Builder — Public/Frontend Styles
   Uses theme font (inherits body font-family)
============================================================================= */

#rqb-fw {
    --rqb-accent: #6366f1;
    --rqb-accent-text: #ffffff;
    --rqb-accent-rgb: 99, 102, 241;
    --rqb-text: #0f172a;
    --rqb-text-soft: #64748b;
    --rqb-text-muted: #94a3b8;
    --rqb-border: #e2e8f0;
    --rqb-bg: #ffffff;
    --rqb-bg-soft: #f8fafc;
    --rqb-radius: 14px;
    --rqb-radius-sm: 10px;
    --rqb-shadow: 0 1px 3px rgba(0,0,0,0.06);
    --rqb-shadow-lg: 0 8px 24px rgba(0,0,0,0.08);

    color: var(--rqb-text);
    line-height: 1.5;
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 16px 100px;
    box-sizing: border-box;
}

#rqb-fw *, #rqb-fw *::before, #rqb-fw *::after { box-sizing: border-box; }

/* =============================================================================
   HEADER
============================================================================= */
#rqb-fw .rqb-header { margin-bottom: 24px; text-align: left; }
#rqb-fw .rqb-page-title    { font-size: 28px; font-weight: 700; margin: 0 0 6px; color: var(--rqb-text); letter-spacing: -0.02em; }
#rqb-fw .rqb-page-subtitle { font-size: 15px; color: var(--rqb-text-soft); margin: 0; }

/* =============================================================================
   TOOLBAR (pills + view toggle + sort)
============================================================================= */
#rqb-fw .rqb-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 28px;
    padding-bottom: 0;
}

#rqb-fw .rqb-filters-section {
    flex: 1;
    min-width: 0;
    position: relative;
    display: flex;
    align-items: center;
}

/* Pill scroll arrows (desktop only, shown when overflow) */
#rqb-fw .rqb-pill-arrow {
    flex-shrink: 0;
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1.5px solid var(--rqb-border);
    background: #ffffff;
    color: var(--rqb-text);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    padding: 0;
    z-index: 3;
}
#rqb-fw .rqb-pill-arrow:hover { background: var(--rqb-bg-soft); border-color: #cbd5e1; }
#rqb-fw .rqb-pill-arrow svg { width: 16px; height: 16px; }
#rqb-fw .rqb-pill-arrow-left.visible,
#rqb-fw .rqb-pill-arrow-right.visible { display: flex; }
#rqb-fw .rqb-pill-arrow-left { margin-right: 6px; }
#rqb-fw .rqb-pill-arrow-right { margin-left: 6px; }

/* Pill wrap with fade masks on edges */
#rqb-fw .rqb-filters-wrap {
    flex: 1;
    min-width: 0;
    position: relative;
    overflow: hidden;
}
#rqb-fw .rqb-filters-wrap::before,
#rqb-fw .rqb-filters-wrap::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 24px;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}
#rqb-fw .rqb-filters-wrap::before { left: 0;  background: linear-gradient(to right, #ffffff, transparent); }
#rqb-fw .rqb-filters-wrap::after  { right: 0; background: linear-gradient(to left,  #ffffff, transparent); }
#rqb-fw .rqb-filters-wrap.fade-left::before  { opacity: 1; }
#rqb-fw .rqb-filters-wrap.fade-right::after  { opacity: 1; }

#rqb-fw .rqb-filters {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    user-select: none;
    cursor: grab;
}
#rqb-fw .rqb-filters.dragging { cursor: grabbing; scroll-behavior: auto; }
#rqb-fw .rqb-filters::-webkit-scrollbar { display: none; }

#rqb-fw .rqb-pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 50px;
    background: #ffffff;
    border: 1.5px solid var(--rqb-border);
    color: var(--rqb-text);
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
    font-family: inherit;
    height: 36px;
}
#rqb-fw .rqb-pill:hover:not(.active) { background: var(--rqb-bg-soft); border-color: #cbd5e1; }
#rqb-fw .rqb-pill.active {
    background: var(--rqb-text);
    color: #ffffff;
    border-color: var(--rqb-text);
}

/* Toolbar right: view toggle + sort */
#rqb-fw .rqb-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* View toggle */
#rqb-fw .rqb-view-toggle {
    display: inline-flex;
    background: #ffffff;
    border: 1.5px solid var(--rqb-border);
    border-radius: 10px;
    padding: 3px;
    height: 36px;
}
#rqb-fw .rqb-view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--rqb-text-soft);
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    padding: 0;
}
#rqb-fw .rqb-view-btn svg { width: 15px; height: 15px; }
#rqb-fw .rqb-view-btn:hover { color: var(--rqb-text); }
#rqb-fw .rqb-view-btn.active {
    background: var(--rqb-text);
    color: #ffffff;
}

/* Sort button */
#rqb-fw .rqb-sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 16px;
    height: 36px;
    border-radius: 10px;
    background: #ffffff;
    border: 1.5px solid var(--rqb-border);
    color: var(--rqb-text);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
#rqb-fw .rqb-sort-btn:hover { background: var(--rqb-bg-soft); border-color: #cbd5e1; }
#rqb-fw .rqb-sort-btn svg { width: 14px; height: 14px; }

/* =============================================================================
   BODY LAYOUT — products + sticky quote panel
============================================================================= */
#rqb-fw .rqb-body {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 32px;
    align-items: start;
}

#rqb-fw .rqb-products-col { min-width: 0; }

/* =============================================================================
   PRODUCT GRID
============================================================================= */
#rqb-fw .rqb-product-grid {
    display: grid;
    gap: 16px;
}

/* Grid mode (default desktop) */
#rqb-fw .rqb-product-grid.rqb-view-grid-mode {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

/* List mode */
#rqb-fw .rqb-product-grid.rqb-view-list-mode {
    grid-template-columns: 1fr;
    gap: 12px;
}

/* =============================================================================
   PRODUCT CARD — GRID VERSION
============================================================================= */
#rqb-fw .rqb-card {
    background: var(--rqb-bg);
    border: 1.5px solid var(--rqb-border);
    border-radius: var(--rqb-radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
}
#rqb-fw .rqb-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--rqb-shadow-lg);
    border-color: #cbd5e1;
}

#rqb-fw .rqb-card-img {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--rqb-bg-soft);
    overflow: hidden;
}
#rqb-fw .rqb-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
#rqb-fw .rqb-card-img-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #cbd5e1;
}
#rqb-fw .rqb-card-img-placeholder svg { width: 40px; height: 40px; }

#rqb-fw .rqb-card-add {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ffffff;
    color: var(--rqb-text);
    border: 1.5px solid var(--rqb-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    z-index: 2;
    padding: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
#rqb-fw .rqb-card-add:hover {
    transform: scale(1.08);
    background: var(--rqb-accent);
    color: var(--rqb-accent-text);
    border-color: var(--rqb-accent);
}
#rqb-fw .rqb-card-add svg { width: 18px; height: 18px; }

/* Count badge — shown when item is in the quote (top-left of image) */
#rqb-fw .rqb-card-count-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    min-width: 26px;
    height: 26px;
    padding: 0 8px;
    border-radius: 13px;
    background: var(--rqb-accent);
    color: var(--rqb-accent-text);
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    line-height: 1;
    pointer-events: none;
    animation: rqb-badge-pop 0.2s ease-out;
}
@keyframes rqb-badge-pop {
    from { transform: scale(0.6); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

#rqb-fw .rqb-card-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
#rqb-fw .rqb-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--rqb-text);
    margin: 0 0 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
#rqb-fw .rqb-card-desc {
    font-size: 13px;
    color: var(--rqb-text-soft);
    margin: 0 0 10px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}
#rqb-fw .rqb-card-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--rqb-text);
    margin-top: auto;
}
#rqb-fw .rqb-card-unit { font-size: 12px; color: var(--rqb-text-muted); font-weight: 500; }

/* =============================================================================
   PRODUCT CARD — LIST VERSION (image on right, matches Uber Eats list view)
============================================================================= */
#rqb-fw .rqb-view-list-mode .rqb-card {
    flex-direction: row;
    align-items: stretch;
    min-height: 110px;
}
#rqb-fw .rqb-view-list-mode .rqb-card-body {
    order: 1;
    flex: 1;
    padding: 16px 18px;
    justify-content: center;
}
#rqb-fw .rqb-view-list-mode .rqb-card-img {
    order: 2;
    width: 130px;
    min-width: 130px;
    aspect-ratio: auto;
    flex-shrink: 0;
}
#rqb-fw .rqb-view-list-mode .rqb-card-title {
    font-size: 15.5px;
    -webkit-line-clamp: 1;
}
#rqb-fw .rqb-view-list-mode .rqb-card-desc {
    font-size: 13px;
    -webkit-line-clamp: 2;
    margin: 4px 0 8px;
}
#rqb-fw .rqb-view-list-mode .rqb-card-add {
    right: 10px;
    bottom: 10px;
}

/* No products */
#rqb-fw .rqb-no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 40px;
    color: var(--rqb-text-muted);
    background: var(--rqb-bg-soft);
    border-radius: var(--rqb-radius);
}
#rqb-fw .rqb-no-products svg { width: 48px; height: 48px; margin-bottom: 14px; stroke: #cbd5e1; }
#rqb-fw .rqb-no-products h3 { margin: 0 0 6px; font-size: 16px; font-weight: 600; color: var(--rqb-text-soft); }
#rqb-fw .rqb-no-products p  { margin: 0; font-size: 14px; }

/* =============================================================================
   QUOTE PANEL (sticky sidebar on desktop)
============================================================================= */
#rqb-fw .rqb-quote-col { position: sticky; top: 20px; }

#rqb-fw .rqb-quote-panel {
    background: var(--rqb-bg);
    border: 1.5px solid var(--rqb-border);
    border-radius: var(--rqb-radius);
    overflow: hidden;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

#rqb-fw .rqb-quote-head { padding: 18px 20px; border-bottom: 1px solid var(--rqb-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#rqb-fw .rqb-quote-head-left { min-width: 0; flex: 1; }
#rqb-fw .rqb-quote-head h3 { margin: 0 0 3px; font-size: 15px; font-weight: 700; color: var(--rqb-text); }
#rqb-fw .rqb-quote-head p  { margin: 0; font-size: 12.5px; color: var(--rqb-text-muted); }
#rqb-fw .rqb-clear-all {
    background: none;
    border: none;
    padding: 4px 0;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--rqb-text-muted);
    cursor: pointer;
    font-family: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.15s;
    flex-shrink: 0;
}
#rqb-fw .rqb-clear-all:hover { color: #ef4444; }

#rqb-fw .rqb-quote-items { flex: 1; overflow-y: auto; padding: 12px 16px; max-height: 50vh; }

#rqb-fw .rqb-quote-empty { padding: 40px 20px; text-align: center; color: var(--rqb-text-muted); }
#rqb-fw .rqb-quote-empty svg { width: 42px; height: 42px; margin-bottom: 10px; stroke: #cbd5e1; }
#rqb-fw .rqb-quote-empty-title { font-size: 14px; font-weight: 600; color: var(--rqb-text-soft); margin-bottom: 4px; }
#rqb-fw .rqb-quote-empty-sub   { font-size: 12.5px; color: var(--rqb-text-muted); }

#rqb-fw .rqb-quote-item {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--rqb-border);
}
#rqb-fw .rqb-quote-item:last-child { border-bottom: none; }
#rqb-fw .rqb-qi-img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: var(--rqb-bg-soft);
    overflow: hidden;
    flex-shrink: 0;
}
#rqb-fw .rqb-qi-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
#rqb-fw .rqb-qi-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
}
#rqb-fw .rqb-qi-img-placeholder svg { width: 18px; height: 18px; }

#rqb-fw .rqb-qi-body { flex: 1; min-width: 0; }
#rqb-fw .rqb-qi-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--rqb-text);
    margin: 0 0 3px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#rqb-fw .rqb-qi-price { font-size: 12.5px; color: var(--rqb-text-soft); margin-bottom: 6px; }

#rqb-fw .rqb-qi-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
#rqb-fw .rqb-qi-qty {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1.5px solid var(--rqb-border);
    border-radius: 50px;
    padding: 1px 3px;
}
#rqb-fw .rqb-qi-qty-btn {
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    color: var(--rqb-text);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
#rqb-fw .rqb-qi-qty-btn:hover { background: var(--rqb-bg-soft); }
#rqb-fw .rqb-qi-qty-btn svg { width: 12px; height: 12px; }
#rqb-fw .rqb-qi-qty-num { font-size: 13px; font-weight: 600; min-width: 18px; text-align: center; }
#rqb-fw .rqb-qi-remove {
    background: transparent;
    border: none;
    color: var(--rqb-text-muted);
    cursor: pointer;
    font-size: 11px;
    text-decoration: underline;
    padding: 2px 4px;
}
#rqb-fw .rqb-qi-remove:hover { color: #ef4444; }

#rqb-fw .rqb-quote-foot { padding: 14px 18px; border-top: 1px solid var(--rqb-border); background: var(--rqb-bg-soft); }

/* Subtotal row (shown above total when delivery is active) */
#rqb-fw .rqb-subtotal-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
    font-size: 13px;
}
#rqb-fw .rqb-subtotal-lbl { color: var(--rqb-text-soft); font-weight: 500; }
#rqb-fw .rqb-subtotal-val { color: var(--rqb-text); font-weight: 600; }

/* Delivery row */
#rqb-fw .rqb-delivery-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--rqb-border);
    font-size: 13px;
}
#rqb-fw .rqb-delivery-lbl { color: var(--rqb-text-soft); font-weight: 500; }
#rqb-fw .rqb-delivery-val { color: var(--rqb-text); font-weight: 600; }
#rqb-fw .rqb-delivery-free .rqb-delivery-val {
    color: #16a34a;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.04em;
}

#rqb-fw .rqb-total-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
}
#rqb-fw .rqb-total-lbl { font-size: 13px; color: var(--rqb-text-soft); font-weight: 500; }
#rqb-fw .rqb-total-val { font-size: 20px; font-weight: 700; color: var(--rqb-text); letter-spacing: -0.02em; }

#rqb-fw .rqb-submit-quote {
    width: 100%;
    padding: 12px;
    background: var(--rqb-accent);
    color: var(--rqb-accent-text);
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    font-family: inherit;
}
#rqb-fw .rqb-submit-quote:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(var(--rqb-accent-rgb), 0.35); }
#rqb-fw .rqb-submit-quote:disabled { background: var(--rqb-border); color: var(--rqb-text-muted); cursor: not-allowed; }

/* =============================================================================
   MOBILE STICKY BAR
============================================================================= */
#rqb-fw .rqb-mobile-bar {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    padding: 12px 16px;
    align-items: center;
    justify-content: space-between;
    z-index: 90;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    border-top: 1px solid var(--rqb-border);
}
/* Mobile bar is mobile/tablet-only — never show on desktop (matches 1024px layout breakpoint) */
@media (min-width: 1025px) {
    #rqb-fw .rqb-mobile-bar,
    #rqb-fw .rqb-mobile-bar.visible { display: none !important; }
}
#rqb-fw .rqb-mobile-bar.visible { display: flex; }
#rqb-fw .rqb-mb-left { display: flex; align-items: center; gap: 10px; color: var(--rqb-text); }
#rqb-fw .rqb-mb-count-wrap { display: flex; align-items: center; gap: 6px; }
#rqb-fw .rqb-mb-count-wrap svg { width: 18px; height: 18px; color: var(--rqb-text); }
#rqb-fw .rqb-mb-count { font-size: 14px; font-weight: 700; color: var(--rqb-text); }
#rqb-fw .rqb-mb-total { font-size: 15px; font-weight: 700; color: var(--rqb-text); }
#rqb-fw .rqb-mb-btn {
    background: var(--rqb-accent);
    color: var(--rqb-accent-text);
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

/* =============================================================================
   MODAL OVERLAYS
============================================================================= */
#rqb-fw .rqb-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: rqb-fade 0.2s ease-out;
}
#rqb-fw .rqb-overlay.open { display: flex; }
@keyframes rqb-fade { from { opacity: 0; } to { opacity: 1; } }

#rqb-fw .rqb-modal-box {
    background: #ffffff;
    border-radius: 16px;
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: rqb-slide-up 0.25s ease-out;
}
@keyframes rqb-slide-up { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

#rqb-fw .rqb-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.95);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    color: var(--rqb-text);
    backdrop-filter: blur(8px);
    padding: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
#rqb-fw .rqb-close-btn:hover { background: #ffffff; }
#rqb-fw .rqb-close-btn svg { width: 16px; height: 16px; }

/* =============================================================================
   PRODUCT DETAIL MODAL
============================================================================= */
#rqb-fw .rqb-pm-box { max-width: 520px; overflow: hidden; }
#rqb-fw .rqb-pm-image-wrap { width: 100%; aspect-ratio: 5/3; background: var(--rqb-bg-soft); overflow: hidden; }
#rqb-fw .rqb-pm-image { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
#rqb-fw .rqb-pm-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
#rqb-fw .rqb-pm-image-placeholder { color: #cbd5e1; }
#rqb-fw .rqb-pm-image-placeholder svg { width: 56px; height: 56px; }

#rqb-fw .rqb-pm-content { padding: 24px; }
#rqb-fw .rqb-pm-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--rqb-text);
    line-height: 1.2;
    letter-spacing: -0.02em;
}
#rqb-fw .rqb-pm-price {
    font-size: 15px;
    font-weight: 600;
    color: var(--rqb-text);
    margin-bottom: 12px;
}
#rqb-fw .rqb-pm-price-unit { color: var(--rqb-text-muted); font-weight: 500; }
#rqb-fw .rqb-pm-desc {
    font-size: 14px;
    color: var(--rqb-text-soft);
    line-height: 1.55;
    margin: 0 0 20px;
    white-space: pre-wrap;
}

#rqb-fw .rqb-pm-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* =============================================================================
   QTY CONTROL — FIX: vertical alignment of "1" with +/-
============================================================================= */
#rqb-fw .rqb-qty-ctrl {
    display: inline-flex;
    align-items: center;
    border: 1.5px solid var(--rqb-border);
    border-radius: 50px;
    padding: 2px;
    height: 44px;
}
#rqb-fw .rqb-qty-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rqb-text);
    padding: 0;
}
#rqb-fw .rqb-qty-btn:hover { background: var(--rqb-bg-soft); }
#rqb-fw .rqb-qty-btn svg { width: 14px; height: 14px; }

/* The qty input — centered both horizontally AND vertically */
#rqb-fw .rqb-qty-input {
    width: 44px;
    height: 38px;
    border: none;
    background: transparent;
    font-size: 15px;
    font-weight: 600;
    color: var(--rqb-text);
    text-align: center;
    -moz-appearance: textfield;
    padding: 0;
    margin: 0;
    font-family: inherit;
    line-height: 38px;
    vertical-align: middle;
    display: flex;
    align-items: center;
    justify-content: center;
}
#rqb-fw .rqb-qty-input::-webkit-outer-spin-button,
#rqb-fw .rqb-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
#rqb-fw .rqb-qty-input:focus { outline: none; }

#rqb-fw .rqb-add-btn {
    flex: 1;
    min-width: 140px;
    padding: 12px 20px;
    background: var(--rqb-accent);
    color: var(--rqb-accent-text);
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    font-family: inherit;
    height: 44px;
}
#rqb-fw .rqb-add-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(var(--rqb-accent-rgb), 0.35); }

/* =============================================================================
   SORT MODAL
============================================================================= */
#rqb-fw .rqb-overlay-sm { align-items: flex-start; padding-top: 60px; }
#rqb-fw .rqb-sort-box { max-width: 380px; }
#rqb-fw .rqb-sort-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--rqb-border);
}
#rqb-fw .rqb-sort-header h3 { margin: 0; font-size: 16px; font-weight: 700; }
#rqb-fw .rqb-sort-header .rqb-close-btn { position: static; background: transparent; box-shadow: none; width: 32px; height: 32px; }
#rqb-fw .rqb-sort-header .rqb-close-btn:hover { background: var(--rqb-bg-soft); }
#rqb-fw .rqb-sort-options { padding: 8px; }
#rqb-fw .rqb-sort-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    color: var(--rqb-text);
    text-align: left;
    transition: background 0.1s;
    font-family: inherit;
}
#rqb-fw .rqb-sort-option:hover { background: var(--rqb-bg-soft); }
#rqb-fw .rqb-sort-check {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    color: var(--rqb-accent);
    flex-shrink: 0;
}
#rqb-fw .rqb-sort-check svg { width: 16px; height: 16px; }
#rqb-fw .rqb-sort-option.active { color: var(--rqb-accent); font-weight: 600; }
#rqb-fw .rqb-sort-option.active .rqb-sort-check { opacity: 1; }

/* =============================================================================
   QUOTE REQUEST MODAL
============================================================================= */
#rqb-fw .rqb-qm-box { max-width: 560px; }
#rqb-fw .rqb-qm-header { padding: 28px 28px 16px; }
#rqb-fw .rqb-qm-header h3 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--rqb-text);
    letter-spacing: -0.02em;
}
#rqb-fw .rqb-qm-header p { font-size: 14px; color: var(--rqb-text-soft); margin: 0; }

#rqb-fw .rqb-quote-form { padding: 0 28px 28px; }

/* Honeypot field — hidden from humans */
#rqb-fw .rqb-hp-field {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    opacity: 0 !important;
}

#rqb-fw .rqb-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 18px;
}
#rqb-fw .rqb-form-field-full { grid-column: 1 / -1; }

#rqb-fw .rqb-form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--rqb-text);
    margin-bottom: 5px;
}
#rqb-fw .rqb-form-req { color: #ef4444; }
#rqb-fw .rqb-form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--rqb-border);
    border-radius: 10px;
    font-size: 14px;
    color: var(--rqb-text);
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
    background: #ffffff;
}
#rqb-fw .rqb-form-input:focus {
    outline: none;
    border-color: var(--rqb-accent);
    box-shadow: 0 0 0 3px rgba(var(--rqb-accent-rgb), 0.12);
}
#rqb-fw .rqb-form-input.error { border-color: #ef4444; }
#rqb-fw .rqb-form-textarea { resize: vertical; min-height: 70px; }

#rqb-fw .rqb-qm-summary {
    background: var(--rqb-bg-soft);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 16px;
}
#rqb-fw .rqb-qm-summary-title {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--rqb-text-soft);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}
#rqb-fw .rqb-qm-summary-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
    color: var(--rqb-text);
}
#rqb-fw .rqb-qm-summary-free span:last-child {
    color: #16a34a;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.04em;
}
#rqb-fw .rqb-qm-summary-total {
    display: flex;
    justify-content: space-between;
    padding-top: 10px;
    margin-top: 10px;
    border-top: 1px solid var(--rqb-border);
    font-weight: 700;
    font-size: 15px;
    color: var(--rqb-text);
}

/* SUBMIT BUTTON + SPINNER — FIX: spinner hidden by default via CSS */
#rqb-fw .rqb-submit-btn {
    position: relative;
    width: 100%;
    padding: 14px;
    background: var(--rqb-accent);
    color: var(--rqb-accent-text);
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    font-family: inherit;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#rqb-fw .rqb-submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(var(--rqb-accent-rgb), 0.35);
}
#rqb-fw .rqb-submit-btn:disabled { opacity: 0.7; cursor: wait; }

#rqb-fw .rqb-submit-text { display: inline-flex; align-items: center; }

/* ===== SPINNER FIX ===== */
/* Default state: spinner hidden, only text visible */
#rqb-fw .rqb-submit-spinner {
    display: none;
    align-items: center;
    gap: 8px;
}
#rqb-fw .rqb-submit-spinner svg { width: 16px; height: 16px; }
/* When button is loading, hide text, show spinner */
#rqb-fw .rqb-submit-btn.loading .rqb-submit-text { display: none; }
#rqb-fw .rqb-submit-btn.loading .rqb-submit-spinner { display: inline-flex; }

.rqb-spin { animation: rqb-spin-anim 0.8s linear infinite; transform-origin: center; }
@keyframes rqb-spin-anim { to { transform: rotate(360deg); } }

/* =============================================================================
   SUCCESS MODAL
============================================================================= */
#rqb-fw .rqb-success-box { max-width: 440px; text-align: center; padding: 44px 36px 36px; }
#rqb-fw .rqb-success-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 22px;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: #16a34a;
}
#rqb-fw .rqb-checkmark { width: 56px; height: 56px; }
#rqb-fw .rqb-checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: rqb-draw-circle 0.6s ease forwards;
}
#rqb-fw .rqb-checkmark-check {
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: rqb-draw-check 0.4s 0.6s ease forwards;
}
@keyframes rqb-draw-circle { to { stroke-dashoffset: 0; } }
@keyframes rqb-draw-check  { to { stroke-dashoffset: 0; } }

#rqb-fw .rqb-success-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--rqb-text);
    margin: 0 0 10px;
    letter-spacing: -0.02em;
}
#rqb-fw .rqb-success-msg { font-size: 14px; color: var(--rqb-text-soft); margin: 0 0 18px; line-height: 1.5; white-space: pre-wrap; }
#rqb-fw .rqb-success-email-note { font-size: 13px; color: var(--rqb-text-muted); margin: 0 0 26px; }
#rqb-fw .rqb-success-email-note strong { color: var(--rqb-text-soft); font-weight: 600; }
#rqb-fw .rqb-success-close-btn {
    padding: 11px 36px;
    background: var(--rqb-accent);
    color: var(--rqb-accent-text);
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s;
}
#rqb-fw .rqb-success-close-btn:hover { transform: translateY(-1px); }

/* =============================================================================
   MOBILE DRAWER
============================================================================= */
#rqb-fw .rqb-drawer-overlay {
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}
/* Drawer is mobile/tablet-only — never show on desktop (matches 1024px layout breakpoint) */
@media (min-width: 1025px) {
    #rqb-fw .rqb-drawer-overlay,
    #rqb-fw .rqb-drawer-overlay.open { display: none !important; }
}
#rqb-fw .rqb-drawer {
    background: #ffffff;
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: rqb-slide-drawer 0.3s ease-out;
    position: relative;
    touch-action: pan-y;
}
#rqb-fw .rqb-drawer.swiping { transition: none; }
@keyframes rqb-slide-drawer { from { transform: translateY(100%); } to { transform: translateY(0); } }

#rqb-fw .rqb-drawer-handle-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px 8px;
    position: relative;
    flex-shrink: 0;
}
#rqb-fw .rqb-drawer-handle {
    width: 38px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 2px;
}
#rqb-fw .rqb-drawer-close {
    position: absolute;
    top: 10px;
    right: 14px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: var(--rqb-bg-soft);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rqb-text);
    padding: 0;
}
#rqb-fw .rqb-drawer-close:hover { background: #e2e8f0; }
#rqb-fw .rqb-drawer-close svg { width: 16px; height: 16px; }

#rqb-fw .rqb-drawer-content { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

/* =============================================================================
   RESPONSIVE — TABLET
============================================================================= */
@media (max-width: 1024px) {
    #rqb-fw .rqb-body { grid-template-columns: 1fr; }
    #rqb-fw .rqb-quote-col { display: none; }
    #rqb-fw .rqb-mobile-bar.visible { display: flex; }
    #rqb-fw .rqb-product-grid.rqb-view-grid-mode { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

/* =============================================================================
   RESPONSIVE — MOBILE (2-column grid, hide view toggle)
============================================================================= */
@media (max-width: 600px) {
    #rqb-fw { padding: 16px 12px 100px; }
    #rqb-fw .rqb-page-title    { font-size: 22px; }
    #rqb-fw .rqb-page-subtitle { font-size: 14px; }

    #rqb-fw .rqb-toolbar { flex-wrap: nowrap; gap: 8px; }

    /* Hide arrow buttons on mobile (touch scroll only) */
    #rqb-fw .rqb-pill-arrow { display: none !important; }

    /* Hide view toggle on mobile - grid 2-col is fine */
    #rqb-fw .rqb-view-toggle { display: none; }

    #rqb-fw .rqb-sort-btn { padding: 0 12px; }
    #rqb-fw .rqb-sort-btn-label { display: none; }

    /* MOBILE: force 2-column grid regardless of mode */
    #rqb-fw .rqb-product-grid,
    #rqb-fw .rqb-product-grid.rqb-view-grid-mode,
    #rqb-fw .rqb-product-grid.rqb-view-list-mode {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* Reset list mode styles for mobile — force grid card layout */
    #rqb-fw .rqb-view-list-mode .rqb-card {
        flex-direction: column;
        min-height: 0;
    }
    #rqb-fw .rqb-view-list-mode .rqb-card-body { order: 2; padding: 10px 12px 12px; }
    #rqb-fw .rqb-view-list-mode .rqb-card-img {
        order: 1;
        width: 100%;
        min-width: 0;
        aspect-ratio: 4/3;
    }

    /* Tighter 2-col card styling */
    #rqb-fw .rqb-card-body { padding: 10px 12px 12px; }
    #rqb-fw .rqb-card-title { font-size: 13.5px; -webkit-line-clamp: 1; }
    #rqb-fw .rqb-card-desc  { font-size: 12px; -webkit-line-clamp: 2; margin-bottom: 8px; }
    #rqb-fw .rqb-card-price { font-size: 13px; }
    #rqb-fw .rqb-card-unit  { font-size: 11px; }
    #rqb-fw .rqb-card-add {
        width: 30px;
        height: 30px;
        right: 8px;
        bottom: 8px;
    }
    #rqb-fw .rqb-card-add svg { width: 15px; height: 15px; }

    #rqb-fw .rqb-pm-content { padding: 20px; }
    #rqb-fw .rqb-pm-title { font-size: 19px; }
    #rqb-fw .rqb-qm-header { padding: 22px 22px 12px; }
    #rqb-fw .rqb-qm-header h3 { font-size: 19px; }
    #rqb-fw .rqb-quote-form { padding: 0 22px 22px; }
    #rqb-fw .rqb-form-grid { grid-template-columns: 1fr; gap: 12px; }
    #rqb-fw .rqb-success-box { padding: 36px 24px 28px; }
}

@media (max-width: 380px) {
    #rqb-fw { padding: 14px 10px 100px; }
    #rqb-fw .rqb-product-grid,
    #rqb-fw .rqb-product-grid.rqb-view-grid-mode,
    #rqb-fw .rqb-product-grid.rqb-view-list-mode { gap: 10px; }
    #rqb-fw .rqb-card-body { padding: 8px 10px 10px; }
    #rqb-fw .rqb-card-title { font-size: 13px; }
    #rqb-fw .rqb-card-desc  { font-size: 11.5px; }
}

/* =========================================================================
   THEME COMPATIBILITY OVERRIDES
   Placed last for highest cascade priority. Protects the plugin UI from
   aggressive theme styles (uppercase transforms, z-index stacking, etc.)
   ========================================================================= */

/* 1. Normalise text-transform / letter-spacing — some themes force uppercase
   or capitalize on buttons, pills, links, etc. Force these to defaults so the
   plugin renders the same on every theme. */
#rqb-fw,
#rqb-fw *,
#rqb-fw button,
#rqb-fw a,
#rqb-fw span,
#rqb-fw label,
#rqb-fw input,
#rqb-fw select,
#rqb-fw textarea,
#rqb-fw .rqb-pill,
#rqb-fw .rqb-sort-btn,
#rqb-fw .rqb-view-btn,
#rqb-fw .rqb-card-title,
#rqb-fw .rqb-card-cat,
#rqb-fw .rqb-add-btn,
#rqb-fw .rqb-submit-btn,
#rqb-fw .rqb-pm-title,
#rqb-fw .rqb-form-label {
    text-transform: none !important;
    letter-spacing: normal !important;
}

/* 2. Stacking — guarantee plugin overlays always sit above theme headers.
   2147483646 is one below the max safe 32-bit signed integer (avoids edge
   cases). Use !important to defeat theme stylesheets. */
#rqb-fw .rqb-overlay {
    z-index: 2147483646 !important;
}
#rqb-fw .rqb-floating-summary {
    z-index: 2147483640 !important;
}

/* 3. Prevent #rqb-fw itself from creating an unintended containing block
   for fixed-position descendants (some custom theme CSS may inadvertently
   add transforms or filters that turn ancestors into containing blocks
   and trap our fixed overlays). */
#rqb-fw {
    transform: none;
    filter: none;
    perspective: none;
}
