/* Extra ruimte boven menu-list geforceerd */
.menu-list {
    margin-top: 0 !important;
}
/* Overschrijf padding van .menu-section uit styles.css */
.menu-section {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* -------- Responsive -------- */
@media (max-width: 800px) {
    .menu-order-container {
        display: flex;
        flex-direction: column;
        padding-right: 0;
    }
    .menu-list { width: 100%; }
    .cart {
        width: 100%;
        margin-top: 1.5rem;
        position: static;
        top: auto;
        right: auto;
        max-height: none;
        overflow-y: visible;
    }
}

/* -------- Layout -------- */
.menu-order-container {
    --desktop-cart-width: 24rem;
    --desktop-cart-gap: 1.5rem;
    --desktop-panel-offset: 2.5rem;
    --desktop-cart-offset: 0.5rem;
    position: relative;
    max-width: 1200px;
    margin: 2rem auto;
    padding-top: var(--desktop-panel-offset);
    padding-right: calc(var(--desktop-cart-width) + var(--desktop-cart-gap));
    box-sizing: border-box;
}
.menu-list {
    width: 100%;
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px #0001;
    box-sizing: border-box;
}
.cart {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px #0001;
    margin-top: 0;
    position: fixed;
    top: calc(100px + 2rem + var(--desktop-cart-offset));
    right: max(1rem, calc((100vw - 1200px) / 2));
    width: var(--desktop-cart-width);
    max-height: calc(100vh - (0px + 2rem + var(--desktop-cart-offset) + 1.25rem));
    overflow-y: auto;
    box-sizing: border-box;
}
.cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.35rem;
}
.cart-header h2 {
    margin: 0;
}
.cart-mobile-close,
.mobile-cart-toggle,
.mobile-cart-backdrop,
.cart-toast {
    display: none;
}
.cart-mobile-close {
    border: none;
    background: #e9efe6;
    color: #256a0c;
    border-radius: 999px;
    padding: 0.5rem 0.9rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}
.cart-toast {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    transform: translate(-50%, 1rem);
    background: #256a0c;
    color: #fff;
    padding: 0.85rem 1.2rem;
    border-radius: 999px;
    box-shadow: 0 12px 28px rgba(37, 106, 12, 0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 10010;
}
.cart-toast.cart-toast-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* -------- Menu Secties -------- */
.menu-section {
    margin-bottom: 2rem;
}
.menu-section-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}
.menu-item-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}
.menu-item-thumb {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 8px;
    background: #f5f5f5;
}
.menu-item-info { flex: 1; }
.menu-item-title { font-weight: 600; }
.menu-item-desc {
    font-size: 0.95em;
    color: #666;
    margin-top: 0.2em;
}
.menu-item-allergens {
    margin-top: 0.25em;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.4rem;
}
.menu-item-allergen-icon {
    height: 18px;
    width: auto;
    display: inline-block;
}
.menu-item-price {
    min-width: 70px;
    text-align: right;
    font-weight: 600;
    color: #256a0c;
    font-size: 1.1em;
}

/* -------- Winkelmandje -------- */
.cart-list { margin-bottom: 1.5rem; }
.cart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}
.cart-item:hover {
    background: #f7f7f7;
}
.cart-item-copy {
    flex: 1;
    min-width: 0;
}
.cart-item-title {
    display: block;
    flex: 1;
    font-weight: 600;
}
.cart-item-detail {
    margin-top: 0.2rem;
    font-size: 0.88rem;
    color: #666;
}
.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 0.5em;
    justify-content: center;
    position: relative;
    z-index: 1;
}
.cart-qty-btn, .modal-qty-btn {
    width: 2em;
    height: 2em;
    border: none;
    background: #eee;
    border-radius: 50%;
    font-size: 1.2em;
    cursor: pointer;
}
.cart-item-price {
    min-width: 60px;
    text-align: right;
}
.cart-total {
    font-weight: bold;
    font-size: 1.2em;
    text-align: right;
    margin-top: 1rem;
}
.btn-order {
    width: 100%;
    padding: 1rem;
    background: #256a0c;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1.1em;
    cursor: pointer;
    margin-top: 1.5rem;
}
.order-popup-line {
    margin-bottom: 0.35rem;
}
.order-popup-line-sub {
    margin: -0.05rem 0 0.45rem 0.6rem;
    color: #666;
    font-size: 0.9rem;
}

/* -------- Modal -------- */
.modal-bg,
.order-popup-bg {
    display: none;
    position: fixed;
    z-index: 9800;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: #0008;
    align-items: center;
    justify-content: center;
}
.modal-bg {
    align-items: flex-start;
    padding: 4.75rem 1rem 1.5rem;
    box-sizing: border-box;
    overflow-y: auto;
}
.modal {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    max-width: 760px;
    width: min(92vw, 760px);
    max-height: min(88vh, 920px);
    overflow-y: auto;
    position: relative; /* nodig voor het absoluut gepositioneerde sluitkruisje */
    box-shadow: 0 4px 24px #0002;
    box-sizing: border-box;
}
.order-popup-bg {
    z-index: 9999;
}
.modal-img {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1rem;
}
.modal-title { font-size: 1.3em; font-weight: bold; }
.modal-desc { color: #555; margin: 0.5em 0 1em 0; }
.modal-allergens {
    margin: 0.3em 0 0.6em 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.4rem;
}
.modal-allergens .menu-item-allergen-icon {
    height: 20px;
}
.modal-price { color: #256a0c; font-weight: bold; font-size: 1.1em; }
.modal-extras-wrapper {
    margin-top: 1rem;
}
.modal-extras-title,
.modal-remarks-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.45rem;
}
.modal-extras-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem 0.75rem;
    position: relative;
}
.modal-extras-shield {
    position: absolute;
    inset: 0;
    z-index: 3;
    background: transparent;
}
.modal-extra-option {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid #e7e7e7;
    border-radius: 8px;
    background: #fafafa;
}
.modal-extra-copy {
    display: flex;
    flex: 1;
    min-width: 0;
}
.modal-extra-line {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
}
.modal-extra-name {
    font-weight: 600;
}
.modal-extra-price {
    color: #256a0c;
    font-size: 0.92rem;
    white-space: nowrap;
}
.modal-remarks {
    width: 100%;
    min-height: 88px;
    padding: 0.7rem 0.8rem;
    border: 1px solid #dcdcdc;
    border-radius: 8px;
    box-sizing: border-box;
    resize: vertical;
}
.modal-qty {
    display: flex;
    align-items: center;
    gap: 1em;
    margin: 1em 0;
}
.modal-add-btn {
    width: 100%;
    padding: 0.8em;
    background: #256a0c;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1.1em;
    cursor: pointer;
    margin-top: 1em;
}

@supports (height: 100dvh) {
    .modal-bg,
    .order-popup-bg {
        height: 100dvh;
    }
}

@media (max-width: 900px) {
    .modal-extras-options {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* -------- Mobile -------- */
@media (max-width: 700px) {
    .menu-order-container {
        flex-direction: column;
        gap: 0;
        margin: 1.2rem auto;
        padding: 0 0.9rem calc(6.5rem + env(safe-area-inset-bottom, 0px));
    }
    .mobile-warning {
        margin-bottom: 1.5rem !important;
    }
    .menu-list {
        padding: 1.2rem;
        border-radius: 10px;
        box-sizing: border-box;
    }
    .cart {
        display: none;
        padding: 1.2rem;
        margin: 0;
        border-radius: 18px;
        box-sizing: border-box;
        overflow: hidden;
        background: #fff;
    }
    .cart.mobile-cart-visible {
        display: block;
        position: fixed;
        left: 0.9rem;
        right: 0.9rem;
        bottom: 5.8rem;
        width: auto;
        max-width: calc(100vw - 1.8rem);
        z-index: 9500;
        max-height: min(70vh, 560px);
        overflow-y: auto;
        box-shadow: 0 18px 36px rgba(0, 0, 0, 0.18);
    }
    .cart-header {
        position: sticky;
        top: 0;
        padding-bottom: 0.8rem;
        background: #fff;
        z-index: 1;
    }
    .cart-mobile-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .mobile-cart-backdrop.mobile-cart-backdrop-visible {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(44, 62, 80, 0.35);
        z-index: 9400;
    }
    .mobile-cart-toggle {
        display: flex;
        position: fixed !important;
        left: 0.9rem;
        right: 0.9rem;
        bottom: calc(0.9rem + env(safe-area-inset-bottom, 0px));
        width: auto;
        max-width: calc(100vw - 1.8rem);
        z-index: 9600;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: 0.95rem 1.1rem;
        box-sizing: border-box;
        border: none;
        border-radius: 16px;
        background: linear-gradient(135deg, #256a0c, #3d9b16);
        color: #fff;
        box-shadow: 0 16px 30px rgba(37, 106, 12, 0.28);
        cursor: pointer;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        will-change: transform;
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
    }
    .mobile-cart-toggle.mobile-cart-toggle-disabled {
        pointer-events: none;
        z-index: 9300;
    }
    .mobile-cart-toggle-label {
        font-size: 1rem;
        font-weight: 700;
    }
    .mobile-cart-toggle-summary {
        font-size: 0.9rem;
        text-align: right;
        opacity: 0.95;
        white-space: nowrap;
    }
    .cart-toast {
        display: block;
        bottom: 5.8rem;
        width: calc(100vw - 1.8rem);
        max-width: 320px;
        text-align: center;
    }
    .menu-section-title {
        font-size: 1.2rem;
    }
    .menu-item-row {
        display: grid;
        grid-template-columns: 56px 1fr;
        grid-template-areas:
            "thumb info"
            "thumb price";
        column-gap: 0.8rem;
        row-gap: 0.35rem;
        padding: 0.8rem 0;
    }
    .menu-item-thumb {
        width: 56px;
        height: 56px;
        grid-area: thumb;
    }
    .menu-item-info {
        grid-area: info;
    }
    .menu-item-price {
        grid-area: price;
        min-width: 0;
        text-align: left;
        font-size: 1em;
    }
    .cart-item {
        flex-wrap: wrap;
        gap: 0.4rem 0.6rem;
    }
    .cart-item-title {
        flex: 1 1 60%;
    }
    .cart-item-price {
        min-width: 70px;
    }
    .cart-total {
        font-size: 1.05em;
        text-align: left;
    }
    .btn-order {
        padding: 0.9rem;
        font-size: 1.05em;
    }
    .desktop-warning {
        display: none;
    }
    .mobile-warning {
        display: block !important;
    }
    .modal-bg {
        align-items: flex-start;
        padding: 5.8rem 0.9rem calc(2rem + env(safe-area-inset-bottom, 0px));
        box-sizing: border-box;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .modal {
        width: min(96vw, 560px);
        max-width: calc(100vw - 1.8rem);
        padding: 1.2rem;
        box-sizing: border-box;
        max-height: none;
        overflow: visible;
        margin: 0 auto calc(1rem + env(safe-area-inset-bottom, 0px));
    }
    .modal-img {
        max-height: 180px;
    }
    .modal-extras-options {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .modal-add-btn {
        margin-top: 1.2rem;
    }
}

@supports (height: 100dvh) {
    @media (max-width: 700px) {
        .modal-bg {
            min-height: 100dvh;
        }
    }
}

@media (max-width: 480px) {
    .menu-list {
        padding: 1rem;
    }
    .cart {
        padding: 1rem;
    }
    .menu-item-row {
        align-items: flex-start;
    }
    .menu-item-price {
        text-align: left;
        min-width: 0;
    }
    .modal-title {
        font-size: 1.15em;
    }
    .modal-qty {
        gap: 0.6em;
    }
    .cart-qty-btn, .modal-qty-btn {
        width: 1.8em;
        height: 1.8em;
        font-size: 1.1em;
    }
    .mobile-cart-toggle {
        padding: 0.9rem 1rem;
    }
    .mobile-cart-toggle-summary {
        font-size: 0.85rem;
    }
}

/* -------- Popup (mobile) -------- */
@media (max-width: 700px) {
    .order-popup-bg {
        align-items: flex-start;
        padding: 2rem 0.9rem calc(1rem + env(safe-area-inset-bottom, 0px));
        box-sizing: border-box;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .order-popup {
        width: 100%;
        max-width: 100%;
        margin: 4vh auto 2vh auto;
        padding: 1.4rem;
        border-radius: 14px;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    .order-popup h2 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }
    #order-popup-form label {
        font-size: 0.95rem;
    }
    #order-popup-form input,
    #order-popup-form select,
    #order-popup-form button,
    #order-popup-form textarea {
        width: 100%;
        font-size: 1rem;
        padding: 0.6rem 0.7rem;
        box-sizing: border-box;
        max-width: 100%;
    }
    #order-popup-cart {
        font-size: 0.95rem;
    }
    #order-popup-total {
        font-size: 1rem;
    }
    #order-popup-submit {
        padding: 0.9rem;
        font-size: 1.05rem;
    }
}
