/* ===== RESET & BASE ===== */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { -webkit-text-size-adjust:100%; scroll-behavior:smooth; }
body.ssb2b-app {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: #f5f5f5;
    color: #333;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    padding-bottom: 70px;
}
#wpadminbar { display:none !important; }
html { margin-top:0 !important; }
body.admin-bar { margin-top:0 !important; }
.et_pb_section, #main-content, #page-container, #et-main-area { display:none !important; }

/* ===== HEADER ===== */
.ssb2b-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #d32f2f;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.header-inner {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    max-width: 1200px;
    margin: 0 auto;
    gap: 12px;
}
.header-left { flex-shrink:0; }
.logo-link { text-decoration:none; color:#fff; display:flex; align-items:center; gap:8px; }
.logo-link img { height:32px; width:auto; }
.logo-text { font-size:18px; font-weight:700; white-space:nowrap; }
.header-search { flex:1; min-width:0; }
.search-wrapper {
    position: relative;
    width: 100%;
}
.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}
#ssb2b-search {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    background: rgba(255,255,255,0.95);
    color: #333;
    outline: none;
}
#ssb2b-search::placeholder { color:#999; }
#ssb2b-search:focus { box-shadow: 0 0 0 2px rgba(255,255,255,0.5); }
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1001;
}
.search-results.active { display:block; }
.search-result-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    gap: 10px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    color: #333;
}
.search-result-item:hover { background:#f9f9f9; }
.search-result-item img { width:40px; height:40px; object-fit:cover; border-radius:6px; }
.search-result-info { flex:1; min-width:0; }
.search-result-info .name { font-size:14px; font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.search-result-info .sku { font-size:12px; color:#888; }
.search-result-info .price { font-size:14px; font-weight:600; color:#d32f2f; }
.search-result-add { flex-shrink:0; }
.search-result-add button {
    padding: 6px 14px;
    background: #d32f2f;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.header-right { display:flex; align-items:center; gap:8px; flex-shrink:0; }
.cart-btn {
    position: relative;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 6px;
}
.cart-count {
    position: absolute;
    top: -2px;
    right: -4px;
    background: #fff;
    color: #d32f2f;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.user-menu { position:relative; }
.user-btn { background:none; border:none; color:#fff; cursor:pointer; padding:6px; }
.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    min-width: 200px;
    display: none;
    overflow: hidden;
    z-index: 1002;
}
.user-dropdown.active { display:block; }
.user-info { padding:14px 16px; border-bottom:1px solid #eee; }
.user-info strong { display:block; font-size:14px; color:#333; }
.user-info small { font-size:12px; color:#888; }
.user-dropdown a {
    display: block;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    border-bottom: 1px solid #f5f5f5;
}
.user-dropdown a:hover { background:#f9f9f9; }
.user-dropdown a:last-child { color:#d32f2f; border-bottom:none; }

/* ===== CATEGORIES ===== */
.ssb2b-categories {
    position: fixed;
    top: 105px;
    left: 0;
    right: 0;
    z-index: 997;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
}
.cat-tabs {
    display: flex;
    overflow-x: auto;
    padding: 0 12px;
    gap: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    max-width: 1200px;
    margin: 0 auto;
}
.cat-tabs::-webkit-scrollbar { display:none; }
.cat-tab {
    flex-shrink: 0;
    padding: 12px 18px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    white-space: nowrap;
    transition: all .2s;
}
.cat-tab.active { color:#d32f2f; border-bottom-color:#d32f2f; font-weight:600; }
.cat-tab:hover { color:#d32f2f; }

/* ===== MAIN CONTENT ===== */
.ssb2b-main {
    padding-top: 154px;
    min-height: calc(100vh - 70px);
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 12px;
    padding-right: 12px;
}
.ssb2b-main.tab-frequent { padding-top: 106px; }

/* ===== PRODUCT LIST ===== */
.ssb2b-products { padding:4px 0; }
.product-row {
    display: flex;
    align-items: center;
    background: #fff;
    padding: 12px 14px;
    margin-bottom: 1px;
    gap: 12px;
    border-bottom: 1px solid #f0f0f0;
}
.product-row:first-child { border-radius:10px 10px 0 0; }
.product-row:last-child { border-radius:0 0 10px 10px; border-bottom:none; }
.product-row:only-child { border-radius:10px; }
.product-image {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f5f5f5;
}
.product-info { flex:1; min-width:0; }
.product-name { font-size:14px; font-weight:600; color:#333; line-height:1.3; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.product-meta { font-size:12px; color:#888; margin-top:2px; }
.product-meta span { margin-right:8px; }
.product-price { font-size:15px; font-weight:700; color:#333; margin-top:2px; }
.product-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.qty-control {
    display: flex;
    align-items: center;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}
.qty-btn {
    width: 34px;
    height: 34px;
    background: #f5f5f5;
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-weight: 600;
}
.qty-btn:hover { background:#e8e8e8; }
.qty-input {
    width: 40px;
    height: 34px;
    text-align: center;
    border: none;
    border-left: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
    font-size: 14px;
    font-weight: 600;
    outline: none;
    -moz-appearance: textfield;
}
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button { -webkit-appearance:none; margin:0; }
.add-to-cart-btn {
    padding: 8px 16px;
    background: #d32f2f;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s;
}
.add-to-cart-btn:hover { background:#b71c1c; }
.add-to-cart-btn.added { background:#2e7d32; }
.add-to-cart-btn:disabled { background:#ccc; cursor:not-allowed; }

/* ===== LOADING ===== */
.products-loading { text-align:center; padding:40px 20px; color:#888; }
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0e0;
    border-top-color: #d32f2f;
    border-radius: 50%;
    animation: spin .8s linear infinite;
    margin: 0 auto 12px;
}
@keyframes spin { to { transform:rotate(360deg); } }
.load-more-btn {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 16px auto;
    padding: 12px;
    background: #fff;
    border: 1.5px solid #d32f2f;
    color: #d32f2f;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.load-more-btn:hover { background:#fff5f5; }

/* ===== CART DRAWER ===== */
.ssb2b-cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 2000;
    display: none;
    opacity: 0;
    transition: opacity .3s;
}
.ssb2b-cart-overlay.active { display:block; opacity:1; }
.ssb2b-cart-drawer {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    max-width: 100vw;
    height: 100vh;
    background: #fff;
    z-index: 2001;
    display: flex;
    flex-direction: column;
    transition: right .3s ease;
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
}
.ssb2b-cart-drawer.active { right:0; }
.cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    background: #d32f2f;
    color: #fff;
}
.cart-drawer-header h3 { font-size:18px; font-weight:600; }
.cart-close { background:none; border:none; color:#fff; font-size:28px; cursor:pointer; line-height:1; padding:0 4px; }
.cart-drawer-items { flex:1; overflow-y:auto; padding:0; }
.cart-empty { text-align:center; padding:40px 20px; color:#999; font-size:15px; }
.cart-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    gap: 12px;
    border-bottom: 1px solid #f0f0f0;
}
.cart-item-img { width:50px; height:50px; border-radius:8px; object-fit:cover; background:#f5f5f5; }
.cart-item-info { flex:1; min-width:0; }
.cart-item-name { font-size:14px; font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cart-item-sku { font-size:12px; color:#888; }
.cart-item-price { font-size:14px; font-weight:600; color:#333; margin-top:2px; }
.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}
.cart-qty-btn {
    width: 30px;
    height: 30px;
    background: #f5f5f5;
    border: none;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cart-qty-val {
    width: 36px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    border-left: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
}
.cart-item-remove {
    background: none;
    border: none;
    color: #d32f2f;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    flex-shrink: 0;
}
.cart-drawer-footer { border-top:1px solid #eee; padding:16px 20px; background:#fafafa; }
.cart-totals { margin-bottom:12px; }
.cart-total-row { display:flex; justify-content:space-between; padding:4px 0; font-size:14px; color:#666; }
.cart-total-row.total { font-size:18px; font-weight:700; color:#333; padding-top:8px; border-top:1px solid #eee; margin-top:4px; }
.cart-note-area { margin-bottom:12px; }
.cart-note-area textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    resize: none;
    outline: none;
    font-family: inherit;
}
.place-order-btn {
    width: 100%;
    padding: 14px;
    background: #d32f2f;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}
.place-order-btn:hover { background:#b71c1c; }
.place-order-btn:disabled { background:#ccc; cursor:not-allowed; }

/* ===== ORDER CONFIRMATION ===== */
.ssb2b-order-confirm {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.confirm-content {
    background: #fff;
    border-radius: 16px;
    padding: 40px 30px;
    text-align: center;
    max-width: 360px;
    width: 90%;
}
.confirm-icon {
    width: 64px;
    height: 64px;
    background: #2e7d32;
    color: #fff;
    border-radius: 50%;
    font-size: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}
.confirm-content h2 { font-size:22px; margin-bottom:8px; }
.confirm-content p { color:#666; margin-bottom:20px; font-size:14px; }
.btn-primary, .btn-secondary {
    display: block;
    padding: 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    margin-bottom: 8px;
}
.btn-primary { background:#d32f2f; color:#fff; }
.btn-secondary { background:#f5f5f5; color:#333; border:1px solid #e0e0e0; }

/* ===== MY ORDERS ===== */
.ssb2b-page-title { padding:12px 4px 8px; }
.ssb2b-page-title h2 { font-size:20px; font-weight:700; }
.back-link { color:#d32f2f; text-decoration:none; font-size:13px; display:block; margin-bottom:4px; }
.order-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.order-card-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; }
.order-card-header .order-id { font-weight:700; font-size:15px; }
.order-card-header .order-date { font-size:13px; color:#888; }
.order-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}
.status-processing { background:#fff3e0; color:#e65100; }
.status-confirmed { background:#e3f2fd; color:#1565c0; }
.status-out-for-delivery { background:#f3e5f5; color:#7b1fa2; }
.status-delivered, .status-completed { background:#e8f5e9; color:#2e7d32; }
.status-pending { background:#fafafa; color:#666; }
.status-cancelled, .status-failed { background:#ffebee; color:#c62828; }
.order-card-summary { font-size:13px; color:#666; margin:8px 0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.order-card-footer { display:flex; justify-content:space-between; align-items:center; margin-top:10px; }
.order-card-total { font-size:16px; font-weight:700; }
.order-card-actions { display:flex; gap:8px; }
.order-card-actions a, .order-card-actions button {
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
}
.order-view-btn { background:#f5f5f5; color:#333; }
.order-reorder-btn { background:#d32f2f; color:#fff; }

/* ===== ORDER DETAIL ===== */
.order-progress {
    display: flex;
    justify-content: space-between;
    padding: 20px 10px;
    background: #fff;
    border-radius: 12px;
    margin-bottom: 12px;
    overflow-x: auto;
}
.progress-step {
    text-align: center;
    flex: 1;
    position: relative;
    min-width: 70px;
}
.progress-step::after {
    content: '';
    position: absolute;
    top: 16px;
    left: 50%;
    width: 100%;
    height: 3px;
    background: #e0e0e0;
    z-index: 0;
}
.progress-step:last-child::after { display:none; }
.progress-step.completed::after { background:#2e7d32; }
.progress-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 6px;
    position: relative;
    z-index: 1;
    font-size: 14px;
    color: #fff;
}
.progress-step.completed .progress-dot { background:#2e7d32; }
.progress-step.active .progress-dot { background:#d32f2f; }
.progress-label { font-size:11px; color:#888; line-height:1.2; }
.progress-step.completed .progress-label, .progress-step.active .progress-label { color:#333; font-weight:500; }

.order-detail-items { background:#fff; border-radius:12px; margin-bottom:12px; overflow:hidden; }
.order-detail-items h3 { padding:14px 16px; border-bottom:1px solid #f0f0f0; font-size:16px; }
.order-detail-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
    border-bottom: 1px solid #f0f0f0;
}
.order-detail-item:last-child { border-bottom:none; }
.order-detail-item img { width:44px; height:44px; border-radius:6px; object-fit:cover; }
.order-detail-item .item-info { flex:1; }
.order-detail-item .item-name { font-size:14px; font-weight:500; }
.order-detail-item .item-meta { font-size:12px; color:#888; }
.order-detail-item .item-total { font-weight:600; font-size:14px; }
.order-detail-total {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}
.order-detail-total .total-row { display:flex; justify-content:space-between; padding:6px 0; font-size:14px; }
.order-detail-total .total-row.grand { font-size:18px; font-weight:700; border-top:1px solid #eee; padding-top:10px; margin-top:4px; }

/* ===== DASHBOARD ===== */
.ssb2b-dashboard { padding-bottom:20px; }
.dash-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}
.dash-card h3 { font-size:16px; font-weight:700; margin-bottom:12px; color:#333; }
.dash-row { display:flex; justify-content:space-between; padding:8px 0; border-bottom:1px solid #f5f5f5; font-size:14px; }
.dash-row span { color:#888; }
.dash-row strong { color:#333; }
.dash-actions { display:flex; gap:10px; flex-wrap:wrap; }
.dash-actions .btn-primary, .dash-actions .btn-secondary { flex:1; min-width:120px; margin-bottom:0; }
.btn-logout { width:100%; padding:12px; background:none; border:1.5px solid #d32f2f; color:#d32f2f; border-radius:10px; font-size:14px; font-weight:600; cursor:pointer; }

/* ===== BOTTOM NAV ===== */
.ssb2b-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e8e8e8;
    display: flex;
    z-index: 999;
    padding: 4px 0 env(safe-area-inset-bottom, 8px);
}
.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px 4px;
    font-size: 11px;
    color: #888;
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
    position: relative;
}
.nav-item.active { color:#d32f2f; }
.nav-item svg { margin-bottom:2px; }
.nav-item.active svg { stroke:#d32f2f; }
.cart-nav-btn { position:relative; }
.mobile-cart-count {
    position: absolute;
    top: 2px;
    right: calc(50% - 18px);
    background: #d32f2f;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== NO PRODUCTS ===== */
.no-products {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}
.no-products h3 { font-size:16px; margin-bottom:4px; color:#666; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .ssb2b-main { padding-top:150px; }
    .ssb2b-main.tab-frequent { padding-top:100px; }
    .main-tab { padding:12px 16px; font-size:14px; }
    .header-inner { padding:8px 12px; }
    .logo-text { font-size:16px; }
    .user-btn { display:none; }
    .product-row { padding:10px 12px; }
    .product-image { width:48px; height:48px; }
    .product-name { font-size:13px; }
    .product-price { font-size:14px; }
    .qty-btn { width:30px; height:30px; font-size:16px; }
    .qty-input { width:32px; height:30px; font-size:13px; }
    .add-to-cart-btn { padding:7px 12px; font-size:12px; }
    .ssb2b-cart-drawer {
        top: auto;
        bottom: -100%;
        left: 0;
        right: 0;
        width: 100%;
        height: 85vh;
        border-radius: 16px 16px 0 0;
        transition: bottom .3s ease;
    }
    .ssb2b-cart-drawer.active { bottom:0; right:0; }
    .order-progress { padding:16px 6px; }
    .progress-step { min-width:60px; }
}

@media (min-width: 769px) {
    .ssb2b-bottom-nav { display:none; }
    body.ssb2b-app { padding-bottom:0; }
    .ssb2b-main { padding-top:160px; }
    .ssb2b-main.tab-frequent { padding-top:112px; }
}

@media (max-width: 480px) {
    .product-actions { flex-direction:column; gap:6px; }
    .add-to-cart-btn { width:100%; text-align:center; padding:6px 10px; }
    /* Both tab labels + the user-greeting pill don't fit on phone widths;
       swap to a short label so "All Products" isn't pushed off-screen.
       Uses #ssb2b-main-tabs for higher specificity so it reliably beats
       the unconditional .tab-label-short rule regardless of source order. */
    #ssb2b-main-tabs .tab-label-full { display: none; }
    #ssb2b-main-tabs .tab-label-short { display: inline; }
    #ssb2b-main-tabs .main-tab { padding: 12px 14px; font-size: 13px; }
}

/* ===== FREQUENTLY ORDERED + BROWSE ALL ===== */
.ssb2b-page-loader {
    text-align: center;
    padding: 60px 20px;
}
.ssb2b-page-loader .spinner {
    margin: 0 auto 16px;
}
.ssb2b-page-loader p {
    font-size: 16px;
    color: #555;
}

.ssb2b-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 12px;
}
.section-header {
    padding: 18px 4px 12px;
}
.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.section-title {
    font-size: 22px;
    font-weight: 700;
    color: #222;
    margin: 0;
    line-height: 1.2;
}
.section-sub {
    margin-top: 6px;
    font-size: 15px;
    color: #555;
}
.section-sub strong { color: #d32f2f; }

.freq-badge {
    background: #fff3e0;
    color: #b25500;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

/* ===== MAIN TABS (Frequently Ordered / All Products) ===== */
.ssb2b-main-tabs {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    z-index: 998;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
}
.main-tabs-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 12px;
}
.main-tabs-list {
    display: flex;
    align-items: stretch;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.main-tabs-list::-webkit-scrollbar { display:none; }
.ssb2b-main-tabs .ssb2b-user-greeting {
    flex: 0 0 auto;
    margin-left: auto;
}
.main-tab {
    flex: 0 0 auto;
    padding: 14px 22px;
    background: none;
    border: 0;
    border-bottom: 3px solid transparent;
    font-size: 15px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    white-space: nowrap;
    transition: color .15s ease, border-color .15s ease;
}
.main-tab:hover { color: #d32f2f; }
.main-tab.active {
    color: #d32f2f;
    border-bottom-color: #d32f2f;
}
.main-tab:focus { outline: none; }
.main-tab:focus-visible {
    outline: 2px solid #d32f2f;
    outline-offset: -3px;
}
.tab-label-short { display: none; }

.ssb2b-empty-state {
    text-align: center;
    padding: 48px 16px;
    color: #555;
}
.ssb2b-empty-state h3 {
    margin: 0 0 8px;
    color: #222;
    font-size: 18px;
}
.ssb2b-empty-state p { margin: 0; font-size: 14px; }
.ssb2b-empty-state strong { color: #d32f2f; }

.ssb2b-browse-all-cta {
    display: flex;
    justify-content: center;
    padding: 28px 0 12px;
}
.browse-all-btn {
    background: #d32f2f;
    color: #fff;
    border: 0;
    padding: 16px 36px;
    font-size: 18px;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    min-height: 56px;
    min-width: 240px;
    box-shadow: 0 4px 12px rgba(211,47,47,0.25);
    transition: transform .1s ease, box-shadow .2s ease;
}
.browse-all-btn:hover, .browse-all-btn:focus {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(211,47,47,0.35);
    outline: none;
}
.browse-all-btn:active { transform: translateY(0); }

.back-to-favorites-btn {
    background: #fff;
    color: #d32f2f;
    border: 2px solid #d32f2f;
    padding: 10px 18px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    min-height: 44px;
}
.back-to-favorites-btn:hover, .back-to-favorites-btn:focus {
    background: #d32f2f;
    color: #fff;
    outline: none;
}

/* ===== CART ITEM — TWO-ROW LAYOUT (narrow drawer friendly) ===== */
.cart-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px;
    padding: 14px 12px;
    border-bottom: 1px solid #eef0f3;
}
.cart-item-top {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.cart-item-top .cart-item-img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    background: #f0f0f0;
}
.cart-item-top .cart-item-info {
    flex: 1;
    min-width: 0;
}
.cart-item-top .cart-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #222;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.cart-item-top .cart-item-sku {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}
.cart-item-top .cart-item-remove {
    flex-shrink: 0;
    background: transparent;
    border: 0;
    color: #aaa;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    margin: -4px -4px 0 0;
}
.cart-item-top .cart-item-remove:hover { color: #d32f2f; }

.cart-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.cart-item-bottom .cart-item-qty {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.cart-item-bottom .cart-qty-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 6px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    color: #333;
    padding: 0;
}
.cart-item-bottom .cart-qty-btn:hover { border-color: #d32f2f; color: #d32f2f; }
.cart-item-bottom .cart-qty-val {
    width: 44px;
    height: 30px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #222;
    padding: 0 4px;
    -moz-appearance: textfield;
    appearance: textfield;
}
.cart-item-bottom .cart-qty-val:focus {
    outline: none;
    border-color: #d32f2f;
    box-shadow: 0 0 0 2px rgba(211,47,47,0.15);
}
.cart-item-bottom .cart-qty-val::-webkit-outer-spin-button,
.cart-item-bottom .cart-qty-val::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cart-item-calc {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    flex: 1;
    min-width: 0;
    text-align: right;
}
.cart-item-calc .calc-expr {
    font-size: 12px;
    color: #888;
    line-height: 1.3;
    white-space: nowrap;
}
.cart-item-calc .calc-line {
    font-size: 16px;
    font-weight: 700;
    color: #d32f2f;
    line-height: 1.2;
    white-space: nowrap;
}

/* ===== MOBILE-FIRST POLISH ===== */
@media (max-width: 600px) {
    .section-title { font-size: 19px; }
    .section-sub { font-size: 14px; }
    .browse-all-btn {
        width: 100%;
        max-width: 360px;
        font-size: 17px;
        padding: 16px 24px;
    }
    .back-to-favorites-btn {
        width: 100%;
        text-align: center;
    }
    .cart-item-calc {
        font-size: 13px;
        padding: 6px 8px;
    }
    .cart-item-calc .calc-line { font-size: 14px; }
}

/* ===== SKELETON CARDS (Facebook-style placeholder while loading) ===== */
@keyframes ssb2b-skel-pulse {
    0%   { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}
.skel {
    background: #e9eef3;
    background-image: linear-gradient(90deg, #e9eef3 0px, #f4f7fa 80px, #e9eef3 160px);
    background-size: 200px 100%;
    background-repeat: no-repeat;
    border-radius: 6px;
    animation: ssb2b-skel-pulse 1.2s ease-in-out infinite;
}
.product-row.product-skel {
    pointer-events: none;
    opacity: 0.85;
}
.skel-img  { width: 64px; height: 64px; border-radius: 8px; flex-shrink: 0; }
.skel-line { height: 12px; margin: 6px 0; }
.skel-line-lg { width: 70%; height: 14px; }
.skel-line-sm { width: 40%; height: 10px; }
.skel-btn  { width: 80px; height: 36px; border-radius: 8px; flex-shrink: 0; }

/* ===== INFINITE-SCROLL "Loading more" indicator ===== */
.loading-more-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px 0;
    color: #777;
    font-size: 14px;
}
.loading-more-spinner .spinner {
    width: 22px;
    height: 22px;
    border: 3px solid #eee;
    border-top-color: #d32f2f;
    border-radius: 50%;
    animation: ssb2b-spin 0.8s linear infinite;
    margin: 0;
}
@keyframes ssb2b-spin {
    to { transform: rotate(360deg); }
}

/* ===== USER GREETING in category bar ===== */
.cat-bar-inner {
    display: flex;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    gap: 12px;
}
.cat-bar-inner .cat-tabs {
    flex: 1;
    min-width: 0;
    max-width: none;
    margin: 0;
}
.ssb2b-user-greeting {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #fff5f5;
    border: 1px solid #fadbdb;
    border-radius: 999px;
    color: #b32424;
    font-size: 13px;
    font-weight: 600;
    margin-right: 12px;
    max-width: 260px;
    overflow: hidden;
    line-height: 1.2;
}
.ssb2b-user-greeting .user-greeting-icon {
    flex-shrink: 0;
    color: #d32f2f;
}
.ssb2b-user-greeting .user-greeting-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media (max-width: 600px) {
    .ssb2b-user-greeting {
        padding: 6px 10px;
        font-size: 12px;
        max-width: 140px;
        margin-right: 6px;
    }
    .ssb2b-user-greeting .user-greeting-icon { display: none; }
}

/* ===== STICKY FLOATING PLACE ORDER BUTTON ===== */
/* Remove legacy in-drawer button if any older cache served it */
.place-order-btn { display: none !important; }
.cart-drawer-hint {
    margin-top: 12px;
    font-size: 12px;
    color: #888;
    text-align: center;
    line-height: 1.4;
}
.cart-drawer-hint strong { color: #d32f2f; }

.ssb2b-floating-place-order {
    position: fixed;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1100;
    background: #d32f2f;
    color: #fff;
    border: 0;
    border-radius: 16px;
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 180px;
    max-width: 240px;
    box-shadow: 0 8px 24px rgba(211,47,47,0.35), 0 2px 6px rgba(0,0,0,0.1);
    transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.15s ease;
    text-align: left;
    line-height: 1.2;
}
.ssb2b-floating-place-order:hover,
.ssb2b-floating-place-order:focus {
    transform: translateY(-50%) translateX(2px);
    box-shadow: 0 12px 32px rgba(211,47,47,0.45), 0 3px 8px rgba(0,0,0,0.12);
    outline: none;
}
.ssb2b-floating-place-order:active {
    transform: translateY(-50%) translateX(0) scale(0.98);
}
.ssb2b-floating-place-order:disabled {
    opacity: 0.7;
    cursor: wait;
}
.ssb2b-floating-place-order .fpo-icon {
    display: inline-flex;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255,255,255,0.18);
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ssb2b-floating-place-order .fpo-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.ssb2b-floating-place-order .fpo-label {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
}
.ssb2b-floating-place-order .fpo-meta {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.9;
    white-space: nowrap;
}
.ssb2b-floating-place-order .fpo-sep { margin: 0 4px; opacity: 0.6; }

/* Reserve space on the left so the floating button never sits on top of
   product name/price text while it's visible (cart has items). */
body.ssb2b-fpo-active .ssb2b-products {
    padding-left: 280px;
    transition: padding-left 0.2s ease;
}

/* Tablet — slightly smaller */
@media (max-width: 900px) {
    .ssb2b-floating-place-order {
        left: 16px;
        min-width: 160px;
        padding: 14px 16px;
    }
    .ssb2b-floating-place-order .fpo-icon {
        width: 32px;
        height: 32px;
    }
    body.ssb2b-fpo-active .ssb2b-products {
        padding-left: 250px;
    }
}

/* Mobile — same vertically-centered left card as desktop/tablet, just
   sized down so it fits without forcing the product list too narrow. */
@media (max-width: 600px) {
    .ssb2b-floating-place-order {
        left: 10px;
        min-width: 0;
        max-width: 130px;
        padding: 10px 12px;
        gap: 8px;
        border-radius: 12px;
    }
    .ssb2b-floating-place-order .fpo-label { font-size: 12px; white-space: normal; line-height: 1.15; }
    .ssb2b-floating-place-order .fpo-meta  { font-size: 10px; }
    .ssb2b-floating-place-order .fpo-icon  { width: 24px; height: 24px; }
    body.ssb2b-fpo-active .ssb2b-products {
        padding-left: 112px;
    }
}

/* Phones narrower than ~400px: the row's fixed-width parts (image, qty
   stepper, Add button) leave too little room for product text once the
   floating button's gutter is reserved, so trim them further here. */
@media (max-width: 400px) {
    .ssb2b-floating-place-order {
        left: 8px;
        max-width: 100px;
        padding: 8px 10px;
        gap: 6px;
    }
    .ssb2b-floating-place-order .fpo-label { font-size: 11px; }
    .ssb2b-floating-place-order .fpo-meta  { font-size: 9px; white-space: normal; }
    .ssb2b-floating-place-order .fpo-sep   { display: block; height: 0; margin: 0; }
    .ssb2b-floating-place-order .fpo-icon  { width: 20px; height: 20px; }
    .ssb2b-floating-place-order .fpo-body  { overflow: hidden; }
    body.ssb2b-fpo-active .ssb2b-products {
        padding-left: 92px;
    }
    .product-row { padding: 8px 10px; gap: 8px; }
    .product-image { width: 40px; height: 40px; }
    .product-name { font-size: 12px; }
    .product-meta { font-size: 11px; }
    .product-price { font-size: 13px; }
    .qty-btn { width: 26px; height: 26px; font-size: 14px; }
    .qty-input { width: 26px; height: 26px; font-size: 12px; }
    .add-to-cart-btn { padding: 6px 9px; font-size: 11px; }
}
