/* shop/css/shop.css
   Storefront tab + product sheet + checkout stepper.
   Same look and flow as the restaurant menu; every selector is shop-prefixed so it never collides
   with restaurant CSS/JS on cards that enable both. Logical properties (inset-inline, margin-inline)
   keep the layout correct in RTL. */

/* Sticky Back/Continue bar of the checkout: the card shell (.vcard-container {overflow:hidden} in the themes)
   is an ancestor, and overflow:hidden makes it the sticky element's scroll container, so the bar never stuck
   to the screen. Menu cards were fine only because stepper-optimized2.css forces overflow:visible, booking
   cards because booking-l10n.css has this same rule; a shop-only card loaded neither.
   clip = the same clipping, but no scroll container. */
body .vcard-container,
body .tab-content {
    overflow: visible;
    overflow: clip;
}

:root {
    --shop-accent: var(--menu-primary-color, var(--primary-color, #0d6efd));
    --shop-text: #212529;
    --shop-muted: #6c757d;
    --shop-border: #eceef1;
    --shop-bg-soft: #f6f7f9;
    --shop-sale: #e5484d;
    --shop-success: #1f9d55;
    --shop-radius: 15px;
    --shop-tap: 44px;
}

/* ============================================================
   BROWSE
   ============================================================ */
.shop-browse-container { position: relative; padding-bottom: 90px; container-type: inline-size; }

.shop-empty-state { text-align: center; padding: 48px 16px; color: var(--shop-muted); }
.shop-empty-state i { font-size: 3rem; display: block; margin-bottom: 12px; opacity: .6; }
.shop-empty-state.small { padding: 28px 16px; }
.shop-empty-state.small i { font-size: 2rem; }

.shop-top-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid var(--shop-border);
}

.shop-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    white-space: nowrap;
}
.shop-breadcrumb::-webkit-scrollbar { display: none; }

.shop-crumb {
    border: 1px solid var(--shop-border);
    background: #fff;
    color: var(--shop-text);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: .85rem;
    cursor: pointer;
    flex-shrink: 0;
}
.shop-crumb.active { background: var(--shop-accent); border-color: var(--shop-accent); color: #fff; }
.shop-crumb-sep { color: #adb5bd; padding: 0 2px; }

.shop-search-mini { position: relative; }
.shop-search-mini i {
    position: absolute;
    inset-inline-start: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #adb5bd;
}
.shop-search-mini input {
    width: 100%;
    border: 1px solid var(--shop-border);
    border-radius: 24px;
    padding: 10px 16px;
    padding-inline-start: 40px;
    font-size: .95rem;
    background: var(--shop-bg-soft);
    outline: none;
}
.shop-search-mini input:focus { background: #fff; border-color: var(--shop-accent); }

.shop-content-area { padding: 16px; }

.shop-section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
    font-weight: 700;
    margin: 18px 0 12px;
}
.shop-count-badge {
    background: var(--shop-bg-soft);
    color: var(--shop-muted);
    border-radius: 12px;
    padding: 2px 9px;
    font-size: .75rem;
    font-weight: 600;
}

/* Promotions */
.shop-promotions { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-bottom: 8px; }
.shop-promotions::-webkit-scrollbar { display: none; }
.shop-promo-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    background: #fff8e6;
    border: 1px solid #ffe3a3;
    color: #8a5a00;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: .85rem;
}
.shop-promo-value { font-weight: 700; color: var(--shop-sale); }

/* Category + subcategory grids (same as restaurant category grid) */
.shop-category-grid,
.shop-subcategory-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.shop-category-card,
.shop-subcategory-card {
    background: #fff;
    border: 1px solid var(--shop-border);
    border-radius: var(--shop-radius);
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .06);
    transition: transform .2s ease, box-shadow .2s ease;
}
.shop-category-card:hover,
.shop-subcategory-card:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(0, 0, 0, .1); }
.shop-category-card:focus-visible,
.shop-subcategory-card:focus-visible { outline: 3px solid var(--shop-accent); outline-offset: 2px; }

.shop-category-image,
.shop-subcategory-image { position: relative; aspect-ratio: 4 / 3; background: var(--shop-bg-soft); }
.shop-category-image img,
.shop-subcategory-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shop-category-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    color: var(--shop-accent);
}
.shop-category-overlay {
    position: absolute;
    inset: auto 0 0 0;
    padding: 18px 10px 8px;
    background: linear-gradient(transparent, rgba(0, 0, 0, .55));
}
.shop-category-count { color: #fff; font-size: .78rem; font-weight: 600; }
.shop-category-body { padding: 10px 12px 12px; }
.shop-category-title { font-size: .95rem; font-weight: 700; margin: 0; }
.shop-category-desc { font-size: .78rem; color: var(--shop-muted); margin: 4px 0 0; }

.shop-subcategory-count {
    position: absolute;
    top: 8px;
    inset-inline-end: 8px;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    border-radius: 10px;
    padding: 1px 8px;
    font-size: .72rem;
}
.shop-subcategory-name { display: block; padding: 8px 10px; font-weight: 600; font-size: .88rem; }

/* ============================================================
   PRODUCT CARD (mirrors restaurant .menu-item-card)
   ============================================================ */
.shop-items-list { display: flex; flex-direction: column; gap: 14px; }

.shop-product-card {
    position: relative;
    display: flex;
    background: #fff;
    border: 1px solid var(--shop-border);
    border-radius: var(--shop-radius);
    box-shadow: 0 4px 15px rgba(0, 0, 0, .07);
    overflow: hidden;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}
.shop-product-card:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(0, 0, 0, .12); }
.shop-product-card.in-cart { border-color: color-mix(in srgb, var(--shop-accent) 45%, transparent); }
.shop-product-card.is-unavailable .shop-card-image img { filter: grayscale(.8); opacity: .7; }

.shop-discount-ribbon {
    position: absolute;
    top: 10px;
    inset-inline-start: 0;
    z-index: 3;
    background: var(--shop-sale);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .5px;
    padding: 4px 10px;
    border-start-end-radius: 10px;
    border-end-end-radius: 10px;
}

.shop-card-left {
    width: 128px;
    min-width: 128px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    border-inline-end: 1px solid var(--shop-border);
}
.shop-card-image {
    position: relative;
    width: 104px;
    height: 104px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--shop-bg-soft);
    flex-shrink: 0;
}
.shop-card-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shop-card-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #c4c9d0;
}
.shop-featured-badge {
    position: absolute;
    top: 6px;
    inset-inline-end: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ffc107;
    color: #5c4300;
    font-size: .72rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shop-btn-add {
    width: 100%;
    min-height: 38px;
    border: none;
    border-radius: 20px;
    background: var(--shop-accent);
    color: #fff;
    font-weight: 600;
    font-size: .85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
}
.shop-btn-add:active { transform: scale(.96); }
.shop-btn-add-count {
    background: #fff;
    color: var(--shop-accent);
    border-radius: 10px;
    padding: 0 6px;
    font-size: .72rem;
    margin-inline-start: 2px;
}
.shop-btn-soldout {
    width: 100%;
    text-align: center;
    padding: 8px 4px;
    border-radius: 20px;
    background: var(--shop-bg-soft);
    color: var(--shop-muted);
    font-size: .78rem;
    font-weight: 600;
}

.shop-qty-controls {
    width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 2px solid var(--shop-accent);
    border-radius: 20px;
    padding: 0 4px;
}
.shop-qty-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--shop-accent);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.shop-qty-btn:disabled { opacity: .35; cursor: not-allowed; }
.shop-qty-value { font-weight: 700; min-width: 20px; text-align: center; }

.shop-card-info {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
}
.shop-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.shop-card-tag {
    background: var(--shop-bg-soft);
    color: var(--shop-muted);
    border-radius: 8px;
    padding: 1px 8px;
    font-size: .7rem;
}
.shop-card-name { font-size: 1rem; font-weight: 700; margin: 0 0 4px; line-height: 1.35; }
.shop-card-desc {
    font-size: .82rem;
    color: var(--shop-muted);
    margin: 0 0 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.shop-card-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.shop-price { font-weight: 700; font-size: 1.05rem; color: var(--shop-accent); font-variant-numeric: tabular-nums; }
.shop-price-sale { color: var(--shop-sale); }
.shop-price-original { color: var(--shop-muted); text-decoration: line-through; font-size: .88rem; }
.shop-price-from { color: var(--shop-muted); font-size: .78rem; }
.shop-card-stock { font-size: .75rem; margin-top: 4px; }
.shop-card-stock.low { color: #d9480f; font-weight: 600; }

.shop-btn-details {
    align-self: flex-start;
    border: 1px solid var(--shop-border);
    background: #fff;
    color: var(--shop-text);
    border-radius: 16px;
    padding: 4px 14px;
    font-size: .78rem;
    cursor: pointer;
}

/* Toast: same look as the restaurant stepper's showToast (top corner, coloured by type), mirrored in RTL */
.shop-toast {
    position: fixed;
    top: 20px;
    inset-inline-end: 20px;
    max-width: calc(100vw - 40px);
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
    z-index: 1060;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity .3s, transform .3s;
    color: #fff;
    background-color: #17a2b8;
    font-weight: 500;
}
.shop-toast.show { opacity: 1; transform: translateY(0); }
.shop-toast .toast-content { display: flex; align-items: center; gap: 10px; }
.shop-toast .toast-content i { font-size: 1.2rem; }
.shop-toast.toast-success { background-color: #28a745; }
.shop-toast.toast-error { background-color: #dc3545; }
.shop-toast.toast-warning { background-color: #ffc107; color: #212529; }
.shop-toast.toast-info { background-color: #17a2b8; }

/* ============================================================
   PRODUCT SHEET (mirrors restaurant item-detail-sheet.css)
   ============================================================ */
.shop-product-modal .modal-dialog { max-width: 520px; }
.shop-product-modal .modal-content { border: none; border-radius: 20px; overflow: hidden; }

.shop-modal-gallery { position: relative; background: var(--shop-bg-soft); }
.shop-modal-gallery img#shopModalImage { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.shop-modal-gallery.no-image img#shopModalImage { visibility: hidden; }
.shop-modal-thumbs {
    position: absolute;
    inset: auto 0 10px 0;
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 0 12px;
}
.shop-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 2px solid #fff;
    padding: 0;
    overflow: hidden;
    opacity: .75;
    cursor: pointer;
}
.shop-thumb.active { opacity: 1; border-color: var(--shop-accent); }
.shop-thumb img { width: 100%; height: 100%; object-fit: cover; }
/* The whole sheet scrolls (image included) instead of only the body under a fixed image:
   Bootstrap's .modal-dialog-scrollable scrolls .modal-body only, leaving a short reading area. */
.shop-product-modal .modal-dialog-scrollable .modal-content {
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.shop-product-modal .modal-dialog-scrollable .modal-body { overflow: visible; flex: 0 0 auto; }
.shop-product-modal .shop-modal-gallery { flex: 0 0 auto; }
.shop-product-modal .shop-modal-footer {
    position: sticky;
    bottom: 0;
    z-index: 3;
    box-shadow: 0 -6px 12px -10px rgba(0, 0, 0, .25);
}
/* sticky close button: first child of .modal-content, overlaps the image, stays while scrolling */
.shop-modal-close {
    position: sticky;
    top: 12px;
    z-index: 4;
    margin-inline-start: auto;      /* pushed to the inline end: right in LTR, left in RTL */
    margin-inline-end: 12px;
    margin-top: 12px;
    margin-bottom: -50px;           /* take no space: it floats over the image */
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
    display: flex;
    align-items: center;
    justify-content: center;
}
.shop-modal-discount {
    position: absolute;
    top: 12px;
    inset-inline-start: 12px;
    background: var(--shop-sale);
    color: #fff;
    border-radius: 12px;
    padding: 4px 10px;
    font-size: .8rem;
    font-weight: 700;
}

.shop-modal-body { padding: 18px 20px; }
.shop-modal-loading { display: flex; justify-content: center; padding: 40px 0; }
.shop-modal-loading[hidden] { display: none; }
.shop-modal-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.shop-modal-name { font-size: 1.35rem; font-weight: 700; margin: 0 0 6px; }
.shop-modal-rating { display: flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--shop-muted); margin-bottom: 8px; }
.shop-stars { color: #f59f00; letter-spacing: 1px; }
.shop-modal-price-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; margin-bottom: 10px; }
.shop-modal-price { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.shop-modal-stock { font-size: .8rem; font-weight: 600; border-radius: 10px; padding: 2px 10px; }
.shop-modal-stock.in { background: #e7f6ec; color: var(--shop-success); }
.shop-modal-stock.low { background: #fff1e6; color: #d9480f; }
.shop-modal-stock.out { background: #fdecec; color: var(--shop-sale); }
.shop-modal-short { color: var(--shop-muted); margin-bottom: 14px; }

.shop-option-group { margin-bottom: 14px; }
.shop-option-label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 8px; }
.shop-option-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.shop-chip {
    min-height: 38px;
    border: 1.5px solid var(--shop-border);
    background: #fff;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: .88rem;
    cursor: pointer;
}
.shop-chip.active { border-color: var(--shop-accent); background: color-mix(in srgb, var(--shop-accent) 10%, #fff); color: var(--shop-accent); font-weight: 600; }
.shop-chip.unavailable { color: #adb5bd; text-decoration: line-through; }

.shop-modal-section { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--shop-border); }
.shop-modal-section-title { font-weight: 700; font-size: .95rem; margin-bottom: 10px; display: flex; gap: 6px; align-items: center; }
.shop-modal-desc { font-size: .92rem; line-height: 1.7; color: #343a40; }
.shop-review { padding: 10px 0; border-bottom: 1px solid var(--shop-border); }
.shop-review:last-child { border-bottom: none; }
.shop-review-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.shop-reviews-more {
    display: block; width: 100%; margin-top: 10px;
    border: 1px solid var(--shop-accent); color: var(--shop-accent);
    background: transparent; border-radius: 10px; font-size: .9rem;
}
.shop-reviews-more:hover { background: var(--shop-accent); color: #fff; }
.shop-reviews-more[hidden] { display: none; }
.shop-review p { margin: 0 0 4px; font-size: .88rem; }
.shop-review small { color: var(--shop-muted); }
.shop-muted { color: var(--shop-muted); font-size: .88rem; }

.shop-modal-footer {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--shop-border);
    background: #fff;
}
.shop-modal-footer > * { margin: 0; }
.shop-modal-remove {
    width: var(--shop-tap);
    height: var(--shop-tap);
    flex-shrink: 0;
    border: 1px solid #f5c2c7;
    border-radius: 50%;
    background: #fff;
    color: var(--shop-sale);
}
.shop-modal-remove[hidden] { display: none; }
.shop-modal-qty {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    height: var(--shop-tap);
    border: 1px solid var(--shop-border);
    border-radius: 24px;
}
.shop-modal-qty button {
    width: var(--shop-tap);
    height: 100%;
    border: none;
    background: transparent;
    font-size: 1.15rem;
    color: var(--shop-accent);
}
.shop-modal-qty button:disabled { opacity: .35; }
.shop-modal-qty span { min-width: 24px; text-align: center; font-weight: 700; }
.shop-modal-add {
    flex: 1;
    min-height: var(--shop-tap);
    border-radius: 24px;
    background: var(--shop-accent);
    border-color: var(--shop-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 600;
    white-space: nowrap;
}
.shop-modal-add-total:not(:empty)::before { content: '·'; margin-inline-end: 6px; opacity: .7; }

@media (max-width: 575.98px) {
    .shop-product-modal .modal-dialog { margin: 0; max-width: none; min-height: 100%; height: 100%; display: flex; align-items: flex-end; }
    .shop-product-modal .modal-content { border-radius: 20px 20px 0 0; max-height: 92dvh; width: 100%; }
    .shop-product-modal.fade .modal-dialog { transform: translateY(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
    .shop-product-modal.show .modal-dialog { transform: none; }
    .shop-modal-add-total { display: none; }
}

/* ============================================================
   CHECKOUT — only what the restaurant stepper has no equivalent for.
   Everything else comes from shop-checkout.css (generated from the restaurant CSS).
   ============================================================ */
.shop-checkout-alert {
    background: #fff4e5;
    border: 1px solid #ffd8a8;
    color: #8a4b00;
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: .88rem;
}
#shop-checkout [data-summary].is-loading { opacity: .5; transition: opacity .15s; }
#shop-checkout [hidden] { display: none !important; }
.shop-cart-item-noimg { display: flex; align-items: center; justify-content: center; background: var(--shop-bg-soft); color: #c4c9d0; font-size: 1.4rem; }

/* shipping methods: same card style as the restaurant order-type options */
.shop-shipping-methods { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.shop-shipping-option {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    background: #fff;
    transition: border-color .2s, background .2s;
}
.shop-shipping-option.active { border-color: var(--menu-primary-color, var(--shop-accent)); background: color-mix(in srgb, var(--menu-primary-color, var(--shop-accent)) 6%, #fff); }
.shop-shipping-option input { accent-color: var(--menu-primary-color, var(--shop-accent)); }
.shop-shipping-name { flex: 1; display: flex; flex-direction: column; font-weight: 600; font-size: .9rem; }
.shop-shipping-name small { color: var(--shop-muted); font-weight: 400; }
.shop-shipping-cost { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ============================================================
   WIDER LAYOUTS — container queries: the vCard is often shown in a
   phone-width shell on a wide screen, so the viewport width says nothing.
   ============================================================ */
@container (min-width: 720px) {
    .shop-top-bar { flex-direction: row; align-items: center; justify-content: space-between; }
    .shop-search-mini { width: 280px; flex-shrink: 0; }
    .shop-category-grid, .shop-subcategory-grid { grid-template-columns: repeat(3, 1fr); }
    .shop-items-list { display: grid; grid-template-columns: 1fr 1fr; }
}
@container (max-width: 360px) {
    .shop-card-left { width: 108px; min-width: 108px; padding: 10px; }
    .shop-card-image { width: 88px; height: 88px; }
}

/* Dark mode (dark-mode.js sets data-bs-theme on <html>) */
[data-bs-theme="dark"] .shop-top-bar,
[data-bs-theme="dark"] .shop-product-card,
[data-bs-theme="dark"] .shop-category-card,
[data-bs-theme="dark"] .shop-subcategory-card,
[data-bs-theme="dark"] .shop-btn-details,
[data-bs-theme="dark"] .shop-crumb,
[data-bs-theme="dark"] .shop-modal-footer {
    background: #1f2328;
    border-color: #30363d;
    color: #e6edf3;
}
[data-bs-theme="dark"] .shop-search-mini input { background: #161b22; color: #e6edf3; }
