/* =========================================================
   ChapResto Menu Details Modal - Stable Final Version
   Replace existing file completely.
   Scope: Menu item details popup only.
   ========================================================= */

.cr-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(16, 12, 10, .58);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: crModalFadeIn .18s ease-out;
}

.cr-menu-modal {
    width: min(900px, 100%);
    max-height: min(82vh, 680px);
    display: grid;
    grid-template-columns: 42% 58%;
    overflow: hidden;
    position: relative;
    background: #fff;
    border-radius: 26px;
    border: 1px solid rgba(56, 38, 24, .10);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .24);
    animation: crModalSlideIn .2s ease-out;
}

/* =========================================================
   Close button
   ========================================================= */

.cr-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 8;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .96);
    color: #1f1916;
    display: grid;
    place-items: center;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .12);
    cursor: pointer;
    transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
}

    .cr-modal-close:hover {
        transform: translateY(-1px);
        background: #fff3ea;
        box-shadow: 0 14px 30px rgba(0, 0, 0, .16);
    }

    .cr-modal-close i {
        font-size: .95rem;
        line-height: 1;
    }

/* =========================================================
   Image side
   Stable behavior:
   - normal state = cover, fills container
   - hover on image = real zoom-in
   - no reverse zoom / no background-size conflict
   ========================================================= */

.cr-menu-modal-image {
    position: relative;
    min-height: 100%;
    height: 100%;
    background-color: #eadfce;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    overflow: hidden;
    isolation: isolate;
}

    .cr-menu-modal-image::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: 1;
        background-image: inherit;
        background-repeat: no-repeat;
        background-position: center center;
        background-size: cover;
        transform: scale(1);
        transform-origin: center center;
        transition: transform .45s ease, filter .35s ease;
    }

    .cr-menu-modal-image:hover::before {
        transform: scale(1.08);
        filter: saturate(1.05) contrast(1.03);
    }

    .cr-menu-modal-image::after {
        content: "";
        position: absolute;
        inset: 0;
        z-index: 2;
        background: linear-gradient(180deg, rgba(0, 0, 0, .02), rgba(0, 0, 0, .10)), linear-gradient(90deg, rgba(0, 0, 0, .04), transparent 42%);
        pointer-events: none;
    }

    .cr-menu-modal-image:not([style*="background-image"])::before {
        background-image: radial-gradient(circle at 25% 24%, rgba(226, 101, 35, .18), transparent 28%), radial-gradient(circle at 80% 70%, rgba(255, 191, 89, .16), transparent 30%), linear-gradient(135deg, #f7e6d5, #fff7ef);
    }

/* =========================================================
   Body
   ========================================================= */

.cr-menu-modal-body {
    min-width: 0;
    padding: 24px 26px 22px;
    overflow-y: auto;
    background: radial-gradient(circle at top right, rgba(226, 101, 35, .06), transparent 24%), linear-gradient(180deg, #fff, #fffaf6);
    scrollbar-width: thin;
    scrollbar-color: rgba(226, 101, 35, .40) transparent;
}

    .cr-menu-modal-body::-webkit-scrollbar {
        width: 7px;
    }

    .cr-menu-modal-body::-webkit-scrollbar-thumb {
        border-radius: 999px;
        background: rgba(226, 101, 35, .40);
    }

    .cr-menu-modal-body::-webkit-scrollbar-track {
        background: transparent;
    }

/* =========================================================
   Loading / error
   ========================================================= */

.cr-menu-modal-loading {
    grid-column: 1 / -1;
    min-height: 300px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    text-align: center;
    padding: 2rem;
    color: #625851;
}

    .cr-menu-modal-loading i {
        width: 48px;
        height: 48px;
        display: grid;
        place-items: center;
        border-radius: 999px;
        background: #fff1e8;
        color: #e06222;
        font-size: 1.15rem;
    }

    .cr-menu-modal-loading strong {
        color: #1c1714;
        font-size: 1.1rem;
        font-weight: 950;
    }

    .cr-menu-modal-loading p {
        max-width: 420px;
        margin: 0;
        color: #625851;
        line-height: 1.5;
    }

/* =========================================================
   Kicker / tags
   ========================================================= */

.cr-menu-modal-kicker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

    .cr-menu-modal-kicker span,
    .cr-menu-modal-meta span {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        min-height: 28px;
        padding: 5px 10px;
        border-radius: 999px;
        background: #fff1e8;
        color: #b94d17;
        font-size: .74rem;
        font-weight: 900;
        line-height: 1;
    }

    .cr-menu-modal-kicker i,
    .cr-menu-modal-meta i {
        font-size: .76rem;
    }

/* =========================================================
   Title / intro
   ========================================================= */

.cr-menu-modal h2 {
    margin: 0 0 8px;
    color: #171311;
    font-size: clamp(1.8rem, 2.7vw, 2.5rem);
    line-height: 1.02;
    letter-spacing: -.045em;
    font-weight: 1000;
}

.cr-menu-modal-short {
    margin: 0;
    color: #625851;
    font-size: .98rem;
    line-height: 1.5;
}

/* =========================================================
   Price row
   ========================================================= */

.cr-menu-modal-price-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(80, 58, 40, .10);
}

    .cr-menu-modal-price-row strong {
        color: #e06222;
        font-size: clamp(1.5rem, 2.3vw, 1.95rem);
        line-height: 1;
        font-weight: 1000;
        letter-spacing: -.03em;
    }

    .cr-menu-modal-price-row del {
        color: #9d8f84;
        font-weight: 800;
        font-size: .92rem;
    }

    .cr-menu-modal-price-row span {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        min-height: 32px;
        padding: 6px 11px;
        border-radius: 999px;
        background: #fff6ef;
        color: #201915;
        font-size: .85rem;
        font-weight: 900;
        line-height: 1;
    }

    .cr-menu-modal-price-row i {
        color: #f2b01e;
    }

/* =========================================================
   Sections
   ========================================================= */

.cr-menu-modal-section {
    margin-top: 12px;
    padding-top: 12px;
}

    .cr-menu-modal-section + .cr-menu-modal-section {
        border-top: 1px solid rgba(80, 58, 40, .08);
    }

    .cr-menu-modal-section h3 {
        display: flex;
        align-items: center;
        gap: 8px;
        margin: 0 0 8px;
        color: #1f1916;
        font-size: 1rem;
        line-height: 1.2;
        font-weight: 950;
    }

        .cr-menu-modal-section h3::before {
            content: "";
            width: 8px;
            height: 8px;
            flex: 0 0 auto;
            border-radius: 999px;
            background: #ea6a25;
            box-shadow: 0 0 0 4px rgba(234, 106, 37, .12);
        }

    .cr-menu-modal-section p {
        margin: 0;
        color: #5f554d;
        font-size: .96rem;
        line-height: 1.55;
    }

/* =========================================================
   Accompaniments box
   ========================================================= */

.cr-menu-modal-accompaniments {
    padding: 12px 14px;
    border: 1px solid #f2e4d7;
    border-radius: 16px;
    background: #fffaf6;
}

/* =========================================================
   Options
   ========================================================= */

.cr-menu-options {
    display: grid;
    gap: 8px;
}

    .cr-menu-options div {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px;
        align-items: center;
        padding: 10px 12px;
        border: 1px solid rgba(90, 60, 40, .08);
        border-radius: 14px;
        background: #fff;
    }

    .cr-menu-options span {
        color: #201915;
        font-weight: 850;
        font-size: .92rem;
    }

    .cr-menu-options em {
        font-style: normal;
        white-space: nowrap;
        color: #e06222;
        font-weight: 950;
        font-size: .9rem;
    }

/* =========================================================
   Meta row
   ========================================================= */

.cr-menu-modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

    .cr-menu-modal-meta span {
        background: #fff4ed;
        color: #8b481d;
    }

/* =========================================================
   Main CTA
   ========================================================= */

.cr-menu-modal-order {
    width: 100%;
    min-height: 48px;
    margin-top: 16px;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, #e46120, #f0782d);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    font-size: .96rem;
    font-weight: 950;
    line-height: 1;
    box-shadow: 0 14px 30px rgba(228, 97, 32, .24);
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}

    .cr-menu-modal-order:hover:not(:disabled) {
        transform: translateY(-1px);
        box-shadow: 0 18px 34px rgba(228, 97, 32, .30);
    }

    .cr-menu-modal-order:disabled {
        opacity: .55;
        box-shadow: none;
        cursor: not-allowed;
    }

/* =========================================================
   Tablet
   ========================================================= */

@media (max-width: 920px) {
    .cr-modal-backdrop {
        padding: 12px;
    }

    .cr-menu-modal {
        width: min(760px, 100%);
        max-height: 86vh;
        grid-template-columns: 1fr;
        grid-template-rows: 250px minmax(0, 1fr);
        border-radius: 24px;
    }

    .cr-menu-modal-image {
        min-height: 250px;
        height: 100%;
        background-size: cover;
        background-position: center center;
    }

        .cr-menu-modal-image:hover::before {
            transform: none;
            filter: none;
        }

    .cr-menu-modal-body {
        padding: 20px 20px 18px;
    }

    .cr-menu-modal h2 {
        font-size: clamp(1.65rem, 5vw, 2.2rem);
    }

    .cr-menu-modal-order {
        min-height: 46px;
        border-radius: 15px;
    }
}

/* =========================================================
   Mobile
   ========================================================= */

@media (max-width: 640px) {
    .cr-modal-backdrop {
        padding: 0;
        align-items: end;
    }

    .cr-menu-modal {
        width: 100%;
        max-height: 92dvh;
        grid-template-columns: 1fr;
        grid-template-rows: 210px minmax(0, 1fr);
        border-radius: 22px 22px 0 0;
    }

    .cr-menu-modal-image {
        min-height: 210px;
        height: 100%;
        background-size: cover;
        background-position: center center;
    }

    .cr-menu-modal-body {
        padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    }

    .cr-menu-modal h2 {
        font-size: 1.55rem;
        margin-bottom: 6px;
    }

    .cr-menu-modal-short,
    .cr-menu-modal-section p {
        font-size: .93rem;
        line-height: 1.48;
    }

    .cr-menu-modal-price-row {
        gap: 8px;
        margin: 14px 0 12px;
        padding-bottom: 12px;
    }

        .cr-menu-modal-price-row strong {
            font-size: 1.45rem;
        }

    .cr-menu-modal-order {
        min-height: 45px;
        font-size: .92rem;
    }

    .cr-modal-close {
        width: 38px;
        height: 38px;
        top: 12px;
        right: 12px;
    }
}

@media (max-width: 420px) {
    .cr-menu-modal {
        grid-template-rows: 190px minmax(0, 1fr);
    }

    .cr-menu-modal-image {
        min-height: 190px;
    }

    .cr-menu-modal-body {
        padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
    }

    .cr-menu-modal-price-row span,
    .cr-menu-modal-kicker span,
    .cr-menu-modal-meta span {
        font-size: .7rem;
    }

    .cr-menu-options div {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   Animations
   ========================================================= */

@keyframes crModalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes crModalSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
