/* 365.food — Product Detail experience
   Presentation only. Pricing, variants, extras and cart submission remain server-backed/existing flows. */

#productModal.mpd-modal { direction: rtl; text-align: right; z-index: 100100; }
#productModal.mpd-modal .modal-dialog { width: min(1060px, calc(100% - 32px)); max-width: 1060px; margin: 1.75rem auto; }
#productModal .mpd-card {
    overflow: hidden; position: relative; border: 1px solid var(--mf-line); border-radius: 26px;
    background: var(--mf-card); box-shadow: 0 28px 80px rgba(0,0,0,.20);
}
#productModal .mpd-layout {
    display: grid; grid-template-columns: minmax(330px, .88fr) minmax(0, 1.12fr);
    min-height: 590px; max-height: min(760px, calc(100vh - 64px)); background: var(--mf-card);
}
#productModal .mpd-close {
    position: absolute; top: 14px; inset-inline-end: 14px; z-index: 8; width: 40px; height: 40px;
    display: grid; place-items: center; border: 1px solid rgba(255,255,255,.72); border-radius: 13px;
    background: rgba(255,255,255,.94); color: var(--mf-ink-2); box-shadow: 0 7px 22px rgba(0,0,0,.12);
    backdrop-filter: blur(10px); cursor: pointer; transition: .18s ease;
}
#productModal .mpd-close:hover { color: #018e72; border-color: var(--mf-brand-border); background: #fff; transform: translateY(-1px); }

/* Only the phone sheet needs a second close; on desktop the corner X is
   right there in the customer's eyeline. */
#productModal .mpd-close-inline { display: none; }

/* The big picture, at whatever size it really is.
   `min-height: 590px` with `cover` meant a 200x201 import was blown up
   roughly threefold and cropped to a letterbox: the chequerboard the
   restaurant sees. Nothing is enlarged here now — the image is centred in
   the panel at its own resolution and only ever scaled down, so a small
   source looks small rather than broken. */
#productModal .mpd-media {
    position: relative; min-height: 100%; overflow: hidden;
    display: grid; place-items: center; padding: 18px;
    background: var(--mf-muted-2);
}
#productModal .mpd-media > img {
    width: auto; height: auto; min-height: 0;
    max-width: 100%; max-height: 100%;
    border-radius: 18px; object-fit: contain;
}
/* The shade existed to keep the badge readable over a photo that filled the
   panel edge to edge. The photo no longer does, so the gradient would only
   darken the grey behind it into a smudge. */
#productModal .mpd-media__shade { display: none; }
#productModal .mpd-media__badge {
    position: absolute; bottom: 18px; inset-inline-start: 18px; display: inline-flex; align-items: center;
    min-height: 29px; padding: 0 10px; border-radius: 999px; background: rgba(255,255,255,.92);
    color: var(--mf-ink-2); font-size: 10px; font-weight: 800; backdrop-filter: blur(8px);
}
#productModal.mpd-no-image .mpd-media { display: none !important; }
#productModal.mpd-no-image .mpd-layout { grid-template-columns: minmax(0, 1fr); }
#productModal.mpd-no-image .modal-dialog { max-width: 720px; }

#productModal .mpd-content { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--mf-card); }
#productModal .mpd-scroll { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 34px 34px 20px; scrollbar-width: thin; scrollbar-color: var(--mf-line-2) transparent; }
#productModal .mpd-scroll::-webkit-scrollbar { width: 6px; }
#productModal .mpd-scroll::-webkit-scrollbar-thumb { background: var(--mf-line-2); border-radius: 999px; }

#productModal .mpd-heading { padding-inline-end: 34px; padding-bottom: 21px; border-bottom: 1px solid var(--mf-line); }
#productModal .mpd-kicker {
    display: inline-flex; align-items: center; min-height: 27px; padding: 0 9px; margin-bottom: 9px;
    border: 1px solid var(--mf-brand-border); border-radius: 999px; background: var(--mf-brand-soft);
    color: #018e72; font-size: 9.5px; font-weight: 850;
}
#productModal .mpd-title { margin: 0; color: var(--mf-ink); font-size: clamp(23px, 2.6vw, 31px); line-height: 1.55; font-weight: 900; letter-spacing: -.45px; }
#productModal .mpd-price { margin-top: 8px; color: #018e72; font-size: 16px; line-height: 1.7; font-weight: 900; }
#productModal .mpd-description { margin: 10px 0 0; color: var(--mf-ink-3); font-size: 12px; line-height: 2; }
#productModal .mpd-description:empty { display: none; }

#productModal .mpd-config { display: grid; gap: 12px; padding-top: 18px; }
#productModal .mpd-section { padding: 14px; border: 1px solid var(--mf-line); border-radius: 17px; background: #fff; }
#productModal .mpd-section__heading { display: flex; align-items: flex-start; gap: 10px; }
#productModal .mpd-section__icon {
    width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 11px;
    background: var(--mf-brand-soft); color: #018e72;
}
#productModal .mpd-section__heading strong, #productModal .mpd-section__heading small { display: block; }
#productModal .mpd-section__heading strong { color: var(--mf-ink); font-size: 11.5px; font-weight: 850; }
#productModal .mpd-section__heading small { margin-top: 2px; color: var(--mf-ink-4); font-size: 9px; line-height: 1.75; }
#productModal .mpd-section__body { padding-top: 12px; }

/* Existing variant generator — redesigned as selectable marketplace chips. */
#productModal .mpd-option-group { padding-top: 3px; }
#productModal .mpd-option-group + .mpd-option-group { margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--mf-line); }
#productModal .mpd-option-group__label, #productModal #variants-area-inside > div > .form-control-label {
    display: block; margin: 0 0 8px; color: var(--mf-ink-2); font-size: 10px; font-weight: 800;
}
#productModal .mpd-option-values, #productModal .btn-group-toggle { display: flex; flex-wrap: wrap; gap: 7px; }
#productModal .btn-group-toggle > .btn, #productModal .mpd-choice {
    flex: 0 0 auto; min-height: 36px; margin: 0 !important; padding: 8px 12px; border: 1px solid var(--mf-line-2) !important;
    border-radius: 11px !important; background: #fff !important; color: var(--mf-ink-2) !important;
    box-shadow: none !important; font-size: 10px; font-weight: 750; line-height: 1.5; cursor: pointer; transition: .16s ease;
}
#productModal .btn-group-toggle > .btn:hover { border-color: var(--mf-brand-border) !important; color: #018e72 !important; background: var(--mf-brand-soft) !important; }
#productModal .btn-group-toggle > .btn.active {
    border-color: var(--mf-brand) !important; color: #01775f !important; background: var(--mf-brand-soft) !important;
    box-shadow: inset 0 0 0 1px var(--mf-brand) !important;
}
#productModal .btn-group-toggle > .btn input { position: absolute; opacity: 0; pointer-events: none; }

/* Existing extra checkboxes, without changing extra pricing logic. */
#productModal .mpd-extras { display: grid; gap: 7px; }
#productModal .mpd-extras .custom-control { min-height: 42px; margin: 0 !important; padding: 0; }
#productModal .mpd-extras .custom-control-label {
    width: 100%; min-height: 42px; display: flex; align-items: center; padding: 8px 40px 8px 11px;
    border: 1px solid var(--mf-line); border-radius: 11px; background: var(--mf-muted); color: var(--mf-ink-2);
    font-size: 10px; font-weight: 700; line-height: 1.7; cursor: pointer; transition: .16s ease;
}
#productModal .mpd-extras .custom-control-label::before,
#productModal .mpd-extras .custom-control-label::after { top: 50%; inset-inline-start: 13px; left: auto; transform: translateY(-50%); }
#productModal .mpd-extras .custom-control-input:checked ~ .custom-control-label {
    border-color: var(--mf-brand-border); background: var(--mf-brand-soft); color: #01775f;
}
#productModal .mpd-extras .custom-control-input:checked ~ .custom-control-label::before { border-color: var(--mf-brand); background: var(--mf-brand); }

#productModal .mpd-availability {
    display: flex; align-items: flex-start; gap: 10px; margin-top: 14px; padding: 12px 13px;
    border: 1px solid #f1d7a7; border-radius: 13px; background: #fffbef; color: #805b18;
}
#productModal .mpd-availability > i { margin-top: 3px; }
#productModal .mpd-availability strong, #productModal .mpd-availability span { display: block; }
#productModal .mpd-availability strong { font-size: 10.5px; }
#productModal .mpd-availability span { margin-top: 2px; font-size: 9px; line-height: 1.75; }

#productModal .mpd-related { margin-top: 18px !important; padding-top: 17px !important; border-top: 1px solid var(--mf-line) !important; }
#productModal .mpd-related__heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
#productModal .mpd-related__heading span { color: var(--mf-ink); font-size: 11px; font-weight: 850; }
#productModal .mpd-related__heading small { color: var(--mf-ink-4); font-size: 8.5px; font-weight: 650; }
#productModal .marketplace-related__items { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(158px, 180px); gap: 8px; overflow-x: auto; padding: 1px 1px 5px; scrollbar-width: none; }
#productModal .marketplace-related__items::-webkit-scrollbar { display: none; }
#productModal .marketplace-related__item {
    min-width: 0; max-width: none; display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 8px; align-items: center;
    padding: 7px; border: 1px solid var(--mf-line); border-radius: 12px; background: #fff; text-align: right; transition: .16s ease;
}
#productModal .marketplace-related__item:hover { border-color: var(--mf-brand-border); background: var(--mf-brand-soft); }
#productModal .marketplace-related__item img { width: 54px; height: 54px; object-fit: cover; border-radius: 9px; }
#productModal .marketplace-related__item strong { color: var(--mf-ink); font-size: 9px; }
#productModal .marketplace-related__item small { color: var(--mf-ink-3); font-size: 8px; }

#productModal .mpd-action-area {
    flex: 0 0 auto; display: flex; align-items: center; gap: 12px; margin: 0; padding: 13px 18px;
    border-top: 1px solid var(--mf-line); background: rgba(255,255,255,.98); box-shadow: 0 -8px 24px rgba(0,0,0,.035);
}
#productModal .mpd-quantity { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
#productModal .mpd-quantity__label { color: var(--mf-ink-3); font-size: 9.5px; font-weight: 750; }
#productModal .mpd-stepper {
    height: 42px; display: grid; grid-template-columns: 37px 42px 37px; align-items: stretch;
    overflow: hidden; border: 1px solid var(--mf-line); border-radius: 12px; background: var(--mf-muted);
}
#productModal .mpd-stepper button { border: 0; background: transparent; color: #018e72; cursor: pointer; font-size: 10px; transition: .15s ease; }
#productModal .mpd-stepper button:hover { background: var(--mf-brand-soft); }
#productModal .mpd-stepper input {
    width: 42px; min-width: 0; padding: 0; border: 0; border-inline: 1px solid var(--mf-line); border-radius: 0;
    background: #fff; color: var(--mf-ink); text-align: center; font-size: 11px; font-weight: 850; outline: 0; appearance: textfield;
}
#productModal .mpd-stepper input::-webkit-inner-spin-button,
#productModal .mpd-stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
#productModal .mpd-add-wrap { flex: 1 1 auto; }
#productModal .mpd-add-button {
    width: 100%; min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 0 15px; border: 0; border-radius: 13px; background: var(--mf-brand); color: #fff;
    box-shadow: 0 7px 22px rgba(3,206,164,.20); cursor: pointer; transition: .18s ease; font-size: 10.5px; font-weight: 850;
}
#productModal .mpd-add-button span { display: inline-flex; align-items: center; gap: 7px; }
#productModal .mpd-add-button strong { direction: ltr; unicode-bidi: isolate; font-size: 9.5px; font-weight: 800; }
#productModal .mpd-add-button:hover { background: var(--mf-brand-hover); transform: translateY(-1px); }
#productModal .mpd-add-button:active { transform: translateY(0); }

/* While variants are incomplete the existing order.js hides .quantity-area. */
#productModal .quantity-area[style*="display: none"] { display: none !important; }

@media (max-width: 900px) {
    #productModal.mpd-modal .modal-dialog { width: min(820px, calc(100% - 24px)); }
    #productModal .mpd-layout { grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr); }
    #productModal .mpd-scroll { padding-inline: 24px; }
    #productModal .mpd-heading { padding-inline-end: 30px; }
}

@media (max-width: 767.98px) {
    #productModal.mpd-modal { padding: 0 !important; }
    #productModal.mpd-modal .modal-dialog {
        width: 100%; max-width: none; height: 100%; margin: 0; align-items: flex-end;
    }
    #productModal .mpd-card {
        width: 100%; max-height: 96dvh; margin-top: auto; border: 0; border-radius: 24px 24px 0 0;
        box-shadow: 0 -14px 50px rgba(0,0,0,.20);
    }
    #productModal .mpd-layout { display: block; min-height: 0; max-height: 96dvh; overflow-y: auto; background: var(--mf-surface); }
    #productModal .mpd-media { height: 228px; min-height: 228px; padding: 12px; }
    /* Bounded, never stretched to the band's height. */
    #productModal .mpd-media > img { height: auto; max-height: 100%; min-height: 0; }
    #productModal.mpd-no-image .mpd-media { display: none !important; }
    #productModal .mpd-close { position: fixed; top: max(12px, env(safe-area-inset-top)); inset-inline-end: 12px; width: 38px; height: 38px; border-radius: 12px; }
    #productModal .mpd-content { min-height: 0; overflow: visible; background: var(--mf-surface); }
    #productModal .mpd-scroll { overflow: visible; padding: 18px 14px 104px; }
    #productModal .mpd-heading { padding: 0 0 16px; }
    #productModal .mpd-kicker { min-height: 25px; margin-bottom: 7px; font-size: 8.5px; }
    #productModal .mpd-title { font-size: 20px; }
    #productModal .mpd-price { margin-top: 5px; font-size: 14px; }
    #productModal .mpd-description { margin-top: 7px; font-size: 10.5px; line-height: 1.9; }
    #productModal .mpd-config { padding-top: 12px; gap: 9px; }
    #productModal .mpd-section { padding: 11px; border-radius: 14px; }
    #productModal .mpd-section__heading small { display: none; }
    #productModal .mpd-section__icon { width: 31px; height: 31px; border-radius: 10px; }
    #productModal .mpd-section__body { padding-top: 9px; }
    #productModal .btn-group-toggle > .btn, #productModal .mpd-choice { min-height: 34px; padding: 7px 10px; font-size: 9px; }
    #productModal .mpd-related__heading small { display: none; }
    #productModal .marketplace-related__items { grid-auto-columns: minmax(155px, 68vw); }
    #productModal .mpd-action-area {
        position: fixed; inset-inline: 0; bottom: 0; z-index: 100110; gap: 9px; padding: 9px 12px calc(9px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--mf-line); background: rgba(255,255,255,.97); backdrop-filter: blur(12px); box-shadow: 0 -10px 28px rgba(0,0,0,.09);
    }
    #productModal .mpd-quantity { gap: 0; }
    #productModal .mpd-quantity__label { display: none; }
    #productModal .mpd-stepper { height: 44px; grid-template-columns: 34px 36px 34px; }
    #productModal .mpd-stepper input { width: 36px; }
    #productModal .mpd-add-button { min-height: 44px; border-radius: 12px; }
    #productModal.mpd-no-image .mpd-scroll { padding-top: 54px; }

    /* Fixed rather than in flow: the action bar beside it disappears for an
       item whose variant has not been chosen yet, and the way out must not
       disappear with it. The bar leaves a gap at the start for this. */
    #productModal .mpd-close-inline {
        position: fixed; z-index: 100111; inset-inline-start: 12px;
        bottom: calc(9px + env(safe-area-inset-bottom));
        min-height: 44px; display: inline-flex; align-items: center; gap: 6px;
        padding: 0 13px; border: 1px solid var(--mf-line-2); border-radius: 12px;
        background: #fff; color: var(--mf-ink-2); font-size: 10.5px; font-weight: 850;
        box-shadow: 0 8px 22px rgba(0,0,0,.10); cursor: pointer; pointer-events: auto;
    }
    #productModal .mpd-close-inline:active { background: var(--mf-muted); }
    #productModal .mpd-action-area { padding-inline-start: 104px; }

    /* The dialog fills the viewport and the sheet is pushed to the bottom,
       so the strip above it looked like backdrop but was still the dialog —
       tapping it did nothing, and customers kept tapping. Letting clicks
       fall through to the modal hands them to Bootstrap's own dismiss. */
    #productModal.mpd-modal .modal-dialog { pointer-events: none; }
    #productModal .mpd-card { pointer-events: auto; }
    #productModal .mpd-action-area { pointer-events: auto; }
}

@media (prefers-reduced-motion: reduce) {
    #productModal *, #productModal *::before, #productModal *::after { transition: none !important; animation: none !important; }
}
