:root { --border-color: #eee; --font-sans: 'Helvetica Neue', Helvetica, Arial, sans-serif; }
body { margin: 0; padding: 0; background-color: var(--bg-color); }

/* Base App Reset to prevent Theme Conflicts */
.rb-app-wrapper { background-color: var(--bg-color); min-height: 100vh; position: relative; font-family: var(--font-sans); line-height: 1.5; color: var(--text-dark); }
.rb-app-wrapper * { box-sizing: border-box; }
.rb-menu-container { max-width: 480px; margin: 0 auto; background-color: var(--bg-color); box-shadow: 0 0 15px rgba(0,0,0,0.05); min-height: 100vh; position: relative; }

/* Strip native tap highlights */
button, a, select, input, .rb-chip, .rb-qty-btn, .rb-info-icon, .rb-close-btn, .rb-clear-btn, .rb-add-btn {
    -webkit-tap-highlight-color: transparent !important;
    outline: none !important;
}
button:active, button:focus, .rb-qty-btn:active, .rb-qty-btn:focus, .rb-add-btn:active, .rb-add-btn:focus {
    background: transparent;
    outline: none !important;
    box-shadow: none !important;
}

/* Header */
.rb-sticky-header { position: sticky; top: 0; z-index: 90; display: block; padding: 0; background: transparent; }
.rb-header-top { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--border-color); }
.rb-store-identity { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.rb-store-logo { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.rb-store-name { margin: 0; font-size: 18px !important; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Table Pill at Top Right */
.rb-header-switch { display: inline-flex; align-items: center; padding: 6px 12px; border: 1px solid var(--accent-color); border-radius: 20px; background: #fff; cursor: pointer; flex-shrink: 0; }
.rb-table-text { font-size: 13px; font-weight: 600; }
.rb-header-change-btn { text-transform: uppercase; font-size: 10px; margin-left: 6px; color: var(--accent-color); font-weight: 800; letter-spacing: 0.5px; }

.rb-category-slider { position: sticky; top: 65px; z-index: 89; background: var(--bg-color); display: flex; overflow-x: auto; padding: 12px 15px; margin: 0; scrollbar-width: none; border-bottom: 1px solid var(--border-color); }
.rb-category-slider::-webkit-scrollbar { display: none; }
.rb-chip { background: transparent; border: 1px solid var(--border-color); padding: 8px 16px; border-radius: 20px; margin-right: 8px; white-space: nowrap; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text-dark); transition: 0.2s;}
.rb-chip.active { background: var(--accent-color); color: #fff; border-color: var(--accent-color); }

.rb-product-list { display: flex; flex-direction: column; padding: 15px; padding-bottom: 120px; }
.rb-product-card { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px dotted #ccc; background: transparent; }
.rb-product-card:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.out-of-stock-card { opacity: 0.5; filter: grayscale(50%); pointer-events: none; }

.rb-product-info { flex: 1; padding-right: 15px; }
.rb-product-title { font-size: 15px !important; font-weight: 700; margin: 0 0 4px 0 !important; line-height: 1.3; }
.rb-product-subtitle { color: var(--text-light); font-size: 12px; display: block; margin-top: 4px; line-height: 1.4; }
.rb-price { font-weight: 700; font-size: 15px; }

.rb-product-image-container { position: relative; width: 110px; height: 110px; flex-shrink: 0; border-radius: 12px; }
.rb-product-img { width: 100%; height: 100%; border-radius: 12px; object-fit: cover; background: #f4eee9; }
.rb-controls-wrapper { position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%); background: #fff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.15); width: 80px; display: flex; justify-content: center; }
.rb-add-btn { background: #fff; border: 1px solid var(--border-color); color: var(--accent-color); font-weight: 800; padding: 6px 0; width: 100%; border-radius: 8px; cursor: pointer; font-size: 13px; text-align: center; }
.rb-sold-out-badge { background: #eee; color: #888; font-size: 11px; padding: 6px 0; width: 100%; text-align: center; border-radius: 6px; font-weight: bold; }

.rb-qty-controls { display: flex; align-items: center; justify-content: space-between; background: #fff; border: 1px solid var(--border-color); border-radius: 8px; padding: 2px 4px; width: 100%; }
.rb-qty-controls.active-in-cart { background-color: var(--active-qty-bg); border-color: var(--active-qty-bg); }
.rb-qty-btn { background: none; border: none; font-size: 18px; color: var(--accent-color) !important; cursor: pointer; padding: 2px 8px; font-weight: bold; }
.rb-qty-val { min-width: 20px; text-align: center; font-size: 14px; font-weight: 700; }

/* Sticky Cart Preview */
#rb-sticky-cart-preview { position: fixed; bottom: 110px; left: 50%; transform: translateX(-50%); width: calc(100% - 30px); max-width: 450px; background: var(--accent-color); color: #fff; padding: 20px 20px; border-radius: 18px; box-shadow: 0 4px 15px rgba(0,0,0,0.2); z-index: 99; display: flex; justify-content: space-between; align-items: center; font-size: 15px; cursor: pointer; }

/* Floating Pill Bottom Navbar */
.rb-bottom-nav-wrapper { position: fixed; bottom: 15px; left: 50%; transform: translateX(-50%); width: 100%; max-width: 450px; z-index: 100; padding: 0 15px; }
.rb-bottom-nav-inner { background: #fff; border-radius: 40px; display: flex; justify-content: space-around; padding: 6px 10px; box-shadow: 0 4px 20px rgba(0,0,0,0.12); }
.rb-nav-item { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; color: #999; flex: 1; padding: 6px 0; text-decoration:none; }
.rb-nav-item.active { color: var(--text-dark); }
.rb-nav-icon { width: 45px; height: 30px; border-radius: 15px; display: flex; align-items: center; justify-content: center; transition: 0.3s; }
.rb-nav-item.active .rb-nav-icon { background: #f0f0f0; }
.rb-nav-item span { font-size: 10px; font-weight: 700; }
.rb-nav-icon svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2; fill: none; display: block; }

/* Popups & Modals */
.rb-cart-popup { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 9999; display: flex; align-items: flex-end; justify-content: center; opacity: 0; visibility: hidden; transition: opacity 0.3s ease; }
.rb-cart-popup.open { opacity: 1; visibility: visible; }
.rb-cart-container { width: 100%; max-width: 480px; background: var(--bg-color); border-radius: 20px 20px 0 0; transform: translateY(100%); transition: transform 0.3s ease-out; display: flex; flex-direction: column; padding: 20px; border: none !important; max-height:85vh;}
.rb-cart-popup.open .rb-cart-container { transform: translateY(0); }
.rb-cart-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 10px; border-bottom: 1px solid var(--border-color); margin-bottom: 15px; }
.rb-cart-title { font-size: 22px !important; margin: 0 !important; font-weight: 800; }
.rb-cart-title-sub { color: var(--text-light); font-size: 18px; font-weight: normal; }
.rb-close-btn { background: none; border: none; font-size: 32px; color: #999; cursor: pointer; line-height: 1; padding: 0; }

.rb-checkout-button { width: 100%; background: var(--text-dark); color: #fff; border: none; padding: 16px; border-radius: 12px; font-size: 16px; font-weight: bold; display: flex; justify-content: space-between; cursor: pointer; margin-top: 10px; }
.rb-checkout-button:disabled { opacity: 0.7; cursor: not-allowed; }

/* Cart Product Rows */
#rb-cart-items::-webkit-scrollbar { width: 4px; }
#rb-cart-items::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
#rb-cart-items .rb-product-card { padding-bottom: 15px; margin-bottom: 15px; border-bottom: 1px solid var(--border-color); align-items: center; }
#rb-cart-items .rb-product-image-container, #rb-cart-items .rb-product-subtitle { display: none !important; }
#rb-cart-items .rb-product-info { padding-right: 0; flex: 1; }
#rb-cart-items .rb-controls-wrapper { position: static; transform: none; width: auto; box-shadow: none; background: transparent; }
#rb-cart-items .rb-qty-controls { padding: 4px 8px; width: 90px; }

.rb-table-list-btn { width: 100%; text-align: left; padding: 15px; margin-bottom: 10px; background: #fff; border: 1px solid var(--border-color); border-radius: 10px; font-size: 16px; font-weight: bold; cursor: pointer; }
.rb-variant-row-item { display: flex; justify-content: space-between; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--border-color); }

/* Orders Card */
.rb-user-order-card { background: #fff; border-radius: 10px; padding: 15px; margin-bottom: 15px; border: 1px solid var(--border-color); box-shadow: 0 2px 5px rgba(0,0,0,0.02); transition: 0.2s; cursor:pointer;}
.rb-user-order-card:active { transform: scale(0.98); }
.rb-user-order-header { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px; color: var(--text-light); font-weight: bold; }
.rb-user-order-status { font-weight: 800; padding: 4px 8px; border-radius: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }

.status-pending, .status-preparing { background: #fff3cd; color: #856404; }
.status-delivering { background: #cce5ff; color: #004085; }
.status-delivered, .status-completed { background: #d4edda; color: #155724; }
.status-cancelled { background: #fde8e8; color: #e11d48; }

.rb-app-wrapper input[type="number"], .rb-app-wrapper input[type="text"] { width: 100%; padding: 14px; font-size: 16px; border: 1px solid #ccc; border-radius: 10px; box-sizing: border-box; background: #fff; }

/* --- Admin Dashboard Specific --- */
.rb-admin-topbar { display: flex; align-items: center; justify-content: space-between; background: #fff; padding: 12px 15px; position: sticky; top: 0; z-index: 100; border-bottom: 1px solid var(--border-color); box-shadow: 0 2px 4px rgba(0,0,0,0.03); }
.rb-topbar-back { background: none; border: none; font-size: 24px; color: var(--text-dark); cursor: pointer; text-decoration:none; display:flex; align-items:center; justify-content:center; width:30px; height:30px; padding:0; margin:0;}
.rb-topbar-title { margin: 0; font-size: 18px; font-weight: 800; }
.rb-dashboard-links-grid { display: flex; flex-direction: column; gap: 15px; }
.rb-dash-card { display: flex; align-items: center; background: #fff; padding: 20px; border-radius: 12px; border: 1px solid var(--border-color); text-decoration: none; color: var(--text-dark); box-shadow: 0 2px 8px rgba(0,0,0,0.02); }
.rb-dash-icon { font-size: 32px; margin-right: 15px; }
.rb-dash-info h3 { margin: 0 0 5px 0; font-size: 18px; }
.rb-dash-info p { margin: 0; font-size: 13px; color: var(--text-light); }

/* --- Toggle Switch UI --- */
.rb-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.rb-switch input { opacity: 0; width: 0; height: 0; }
.rb-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .3s; border-radius: 24px; }
.rb-slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; box-shadow:0 1px 2px rgba(0,0,0,0.2);}
.rb-switch input:checked + .rb-slider { background-color: #10b981; }
.rb-switch input:checked + .rb-slider:before { transform: translateX(20px); }

/* --- Menu Editor --- */
.rb-menu-edit-card { background: #fff; border-radius: 12px; border: 1px solid var(--border-color); margin-bottom: 15px; overflow: hidden; position:relative; transition: opacity 0.2s; }
.rb-menu-edit-header { display: flex; justify-content: space-between; align-items: center; padding: 15px; }
.rb-menu-edit-title-col { flex: 1; }
.rb-menu-edit-title-col h4 { margin: 0; font-size: 16px; color: var(--text-dark); }
.rb-menu-item-price-sub { display: block; font-size: 13px; color: var(--text-light); margin-top: 4px; }
.rb-menu-item-price-col { font-weight: bold; font-size: 15px; text-align:center; }
.rb-menu-item-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.rb-expand-variants-btn { background: #f4f4f4; border: none; border-radius: 50%; width: 32px; height: 32px; font-size: 20px; line-height: 1; cursor: pointer; color: #333; display:flex; align-items:center; justify-content:center; padding:0;}
.rb-variants-edit-container { background: #fafafa; border-top: 1px solid var(--border-color); padding: 10px 15px; }
.rb-variant-edit-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px dashed #ddd; }
.rb-variant-edit-row:last-child { border-bottom: none; }
.rb-v-edit-name { font-size: 14px; font-weight: 600; flex:1; }
.rb-v-edit-controls { display: flex; align-items: center; gap: 10px; }
.rb-price-edit-input { width: 70px !important; padding: 6px !important; border: 1px solid #ccc !important; border-radius: 6px !important; font-weight: bold !important; text-align: center !important; font-size: 14px !important; }

@media (max-width: 768px) {
    .desktop-only { display: none !important; }
}
@media (min-width: 769px) {
    .rb-menu-item-price-sub { display: none !important; }
    .rb-menu-edit-header { grid-template-columns: 1fr 100px 100px; display: grid; }
}
