/* Recipe details: retain desktop cards and optimize the ingredient picker for phones. */
@media (max-width: 575.98px) {
    /* Keep the picker recognizably modal: visible page/backdrop around all edges. */
    .recipe-shopping-modal .modal-dialog {
        margin: 1.25rem auto;
        width: calc(100% - 2.5rem);
        max-width: 440px;
        height: calc(100% - 2.5rem);
    }

    .recipe-shopping-modal .modal-content {
        height: auto;
        max-height: min(82dvh, 720px);
        overflow: hidden;
        border: 1px solid var(--bs-border-color, #ddd);
        border-radius: 16px;
        box-shadow: 0 16px 48px rgb(0 0 0 / 22%);
    }

    .recipe-shopping-modal .modal-header {
        padding: .75rem 1rem;
        flex-shrink: 0;
    }

    .recipe-shopping-modal .modal-body {
        padding: .75rem 1rem;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .recipe-shopping-modal__picker {
        position: sticky;
        top: -.75rem;
        padding: .5rem 0 .75rem;
        background: var(--bs-modal-bg, var(--bs-body-bg, #fff));
        z-index: 2;
        border-bottom: 1px solid var(--bs-border-color, #ddd);
    }

    .recipe-shopping-modal__picker .form-label {
        font-size: .85rem;
        margin-bottom: .25rem;
    }

    .recipe-shopping-modal .modal-footer {
        flex-shrink: 0;
        padding: .65rem 1rem max(.75rem, env(safe-area-inset-bottom));
        border-top: 1px solid var(--bs-border-color, #ddd);
        background: var(--bs-modal-bg, var(--bs-body-bg, #fff));
        box-shadow: 0 -3px 12px rgb(0 0 0 / 5%);
        flex-wrap: nowrap;
        gap: .5rem;
    }

    .recipe-shopping-modal .modal-footer .btn {
        min-height: 44px;
        margin: 0;
    }

    .recipe-shopping-modal [data-recipe-shopping-submit] {
        flex: 1;
    }

    .recipe-shopping-modal .recipe-shopping-ingredient {
        border: 0 !important;
        border-bottom: 1px solid var(--bs-border-color, #ddd) !important;
        border-radius: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .recipe-shopping-ingredient__mobile-summary {
        display: flex;
        width: 100%;
        min-height: 46px;
        align-items: center;
        gap: .5rem;
        padding: .45rem 0;
    }

    button.recipe-shopping-ingredient__mobile-summary {
        color: inherit;
        background: transparent;
        border: 0;
        text-align: left;
    }

    button.recipe-shopping-ingredient__mobile-summary:focus-visible {
        outline: 2px solid var(--bs-primary, #167d42);
        outline-offset: -2px;
    }

    .recipe-shopping-ingredient__icon {
        flex: 0 0 1rem;
        font-size: .95rem;
    }

    .recipe-shopping-ingredient__name {
        flex: 1 1 auto;
        min-width: 0;
        font-weight: 600;
        font-size: .875rem;
        line-height: 1.3;
        overflow-wrap: anywhere;
    }

    .recipe-shopping-ingredient__quantity {
        flex: 0 0 auto;
        max-width: 32%;
        color: var(--bs-secondary-color, #666);
        font-size: .875rem;
        text-align: right;
        line-height: 1.2;
    }

    .recipe-shopping-ingredient__review-state {
        font-size: .72rem;
        color: var(--bs-warning-text-emphasis, #805300);
    }

    .recipe-shopping-ingredient__review-state--done {
        color: var(--bs-success-text-emphasis, #137843);
    }

    .recipe-shopping-ingredient__chevron {
        font-size: .7rem;
        color: var(--bs-secondary-color, #666);
        transition: transform .15s ease;
    }

    [data-review-toggle][aria-expanded="true"] .recipe-shopping-ingredient__chevron {
        transform: rotate(180deg);
    }

    .recipe-shopping-ingredient__details:not([data-expanded="true"]) {
        display: none;
    }

    .recipe-shopping-ingredient__details {
        padding: .15rem 0 .75rem 1.5rem;
    }

    .recipe-shopping-ingredient__details .form-select,
    .recipe-shopping-ingredient__details .form-control {
        min-height: 42px;
    }
}
