/* Basket Bridge v1 owns only the modal and its scoped presentation. */
[data-basket-bridge] {
    display: none !important;
}

.basket-bridge-backdrop {
    position: fixed;
    z-index: 1050;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.5);
}

.basket-bridge-modal {
    display: flex;
    width: min(50rem, 100%);
    max-height: min(52rem, calc(100vh - 2rem));
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 0.3rem;
    background: #fff;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    color: #212529;
}

.basket-bridge-header,
.basket-bridge-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
}

.basket-bridge-header {
    border-bottom: 1px solid #dee2e6;
}

.basket-bridge-footer {
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
}

.basket-bridge-title,
.basket-bridge-status,
.basket-bridge-errors,
.basket-bridge-line-title {
    margin: 0;
}

.basket-bridge-title {
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.2;
}

.basket-bridge-close {
    display: inline-flex;
    width: 2.25rem;
    min-width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 1px solid #d5e0da;
    border-radius: 0.75rem;
    background: #fff;
    color: #495057;
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
}

.basket-bridge-close-icon {
    display: grid;
    width: 1.45rem;
    height: 1.45rem;
    place-items: center;
    font-size: 1.45rem;
    line-height: 1;
    transform: translateY(-0.04rem);
}

.basket-bridge-close:hover {
    border-color: #adb5bd;
    background: #f8f9fa;
    color: #212529;
}

.basket-bridge-body {
    min-height: 0;
    overflow: hidden;
}

.basket-bridge-status {
    min-height: 1.35rem;
    padding: 0.75rem 1.25rem 0;
    color: #495057;
    font-size: 0.78rem;
    line-height: 1.45;
}

.basket-bridge-status:empty {
    display: none;
}

.basket-bridge-errors {
    display: grid;
    gap: 0.35rem;
    max-height: 7rem;
    margin: 0.75rem 1.25rem 0;
    padding: 0.7rem 0.75rem 0.7rem 2rem;
    overflow: auto;
    border: 1px solid #ffe69c;
    border-radius: 0.3rem;
    background: #fff3cd;
    color: #664d03;
    font-size: 0.76rem;
    line-height: 1.4;
}

.basket-bridge-lines {
    max-height: min(32rem, 52vh);
    margin-top: 0;
    padding: 0 1.25rem 1rem;
    overflow: auto;
    overscroll-behavior: contain;
}

.basket-bridge-line {
    padding: 0.85rem 0;
    border-top: 1px solid #e9ecef;
}

.basket-bridge-line:first-child {
    border-top: 0;
    padding-top: 0.35rem;
}

.basket-bridge-line-content {
    display: grid;
    grid-template-columns: 2rem 4.25rem minmax(0, 1fr) minmax(72px, auto);
    gap: 0.75rem;
    align-items: center;
}

.basket-bridge-line-selection {
    display: grid;
    min-width: 0;
    place-items: center;
}

.basket-bridge-selection-control {
    position: relative;
    display: grid;
    width: 1.75rem;
    height: 1.75rem;
    place-items: center;
    cursor: pointer;
}

.basket-bridge-selection-control input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.basket-bridge-selection-icon {
    display: grid;
    width: 1.3rem;
    height: 1.3rem;
    place-items: center;
    border: 1px solid #adb5bd;
    border-radius: 0.35rem;
    background: #fff;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1;
    transition: background-color 120ms ease, border-color 120ms ease;
}

.basket-bridge-selection-control input:checked + .basket-bridge-selection-icon {
    border-color: #198754;
    background: #198754;
}

.basket-bridge-selection-control input:checked + .basket-bridge-selection-icon::after {
    content: '✓';
}

.basket-bridge-selection-control input:focus-visible + .basket-bridge-selection-icon {
    outline: 3px solid rgba(13, 110, 253, 0.35);
    outline-offset: 2px;
}

.basket-bridge-line-image {
    width: 4.25rem;
    height: 4.5rem;
    object-fit: contain;
    border-radius: 0.3rem;
    background: #fff;
}

.basket-bridge-line-details {
    min-width: 0;
}

.basket-bridge-line-title {
    color: #212529;
    font-size: 0.84rem;
    font-weight: 600;
    line-height: 1.4;
}

.basket-bridge-line-title a {
    color: inherit;
    text-decoration: none;
}

.basket-bridge-line-title a:hover {
    text-decoration: underline;
}

.basket-bridge-line-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.2rem;
    flex-direction: column;
    min-width: 72px;
}

.basket-bridge-quantity-control {
    display: flex;
    width: 72px;
    height: 41px;
    border-radius: 6px;
    overflow: hidden;
}

.basket-bridge-quantity-input {
    min-width: 0;
    width: 48px;
    box-sizing: border-box;
    border: 1px solid #ced4da;
    border-right: 0;
    border-radius: 6px 0 0 6px;
    padding: 10px 0;
    background: #fff;
    color: #212529;
    font-size: 14px;
    font-weight: 600;
    line-height: 21px;
    text-align: center;
}

.basket-bridge-quantity-input::-webkit-inner-spin-button,
.basket-bridge-quantity-input::-webkit-outer-spin-button {
    margin: 0;
    appearance: none;
}

.basket-bridge-quantity-input {
    appearance: textfield;
}

.basket-bridge-quantity-input:focus {
    outline: 0;
    box-shadow: inset 0 0 0 2px rgba(13, 110, 253, 0.18);
}

.basket-bridge-quantity-buttons {
    display: flex;
    width: 24px;
    flex-direction: column;
}

.basket-bridge-quantity-button {
    display: flex;
    min-height: auto;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    border: 1px solid #ced4da;
    border-radius: 0 6px 0 0;
    background: #e9ecef;
    color: #212529;
    cursor: pointer;
    font-size: 14px;
    line-height: 17.5px;
    padding: 0;
}

.basket-bridge-quantity-button + .basket-bridge-quantity-button {
    border-top: 0;
    border-radius: 0 0 6px 0;
}

.basket-bridge-quantity-button:hover:not(:disabled) {
    background: #e9ecef;
}

.basket-bridge-price-box {
    display: flex;
    min-width: 72px;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.basket-bridge-line-price {
    color: #212529;
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    white-space: nowrap;
}

.basket-bridge-line-remove {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border: 1px solid transparent;
    border-radius: 0.2rem;
    padding: 0;
    background: transparent;
    color: #c82333;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
}

.basket-bridge-line-remove:hover:not(:disabled) {
    color: #a71d2a;
    text-decoration: none;
}

.basket-bridge-line-remove-icon {
    font-size: 0.875rem;
    line-height: 1;
}

.basket-bridge-line-unavailable {
    margin: 0.35rem 0 0;
    color: #495057;
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.35;
}

.basket-bridge-line.is-unavailable {
    padding-right: 0.75rem;
    padding-left: 0.75rem;
    border-left: 3px solid #adb5bd;
    background: #f8f9fa;
}

.basket-bridge-line.is-unavailable .basket-bridge-line-content {
    grid-template-columns: auto minmax(0, 1fr);
}

.basket-bridge-line.is-unavailable.is-without-image .basket-bridge-line-content {
    grid-template-columns: minmax(0, 1fr);
}

.basket-bridge-stage-all,
.basket-bridge-commit,
.basket-bridge-basket-link {
    min-height: 2.4rem;
    border-radius: 0.3rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.2;
}

.basket-bridge-stage-all,
.basket-bridge-commit {
    border: 1px solid transparent;
    cursor: pointer;
}

.basket-bridge-stage-all {
    border-color: #adb5bd;
    background: #fff;
    color: #343a40;
}

.basket-bridge-stage-all:hover:not(:disabled) {
    background: #f8f9fa;
}

.basket-bridge-commit {
    background: #212529;
    color: #fff;
}

.basket-bridge-commit:hover:not(:disabled) {
    background: #000;
}

.basket-bridge-basket-link {
    display: inline-flex;
    align-items: center;
    color: #495057;
    text-decoration: underline;
}

.basket-bridge-stage-all:disabled,
.basket-bridge-commit:disabled,
.basket-bridge-line-remove:disabled,
.basket-bridge-quantity-button:disabled,
.basket-bridge-quantity-input:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.basket-bridge-header button:focus-visible,
.basket-bridge-footer button:focus-visible,
.basket-bridge-footer a:focus-visible,
.basket-bridge-line input:focus-visible,
.basket-bridge-line button:focus-visible,
.basket-bridge-line a:focus-visible,
.basket-bridge-reorder:focus-visible {
    outline: 3px solid rgba(13, 110, 253, 0.35);
    outline-offset: 2px;
}

.basket-bridge-reorder-icon {
    appearance: none;
    border: 0;
    background: transparent;
    margin-left: 0.5rem;
    padding: 0.25rem;
    line-height: 1;
    cursor: pointer;
}

.basket-bridge-reorder-button {
    margin-top: 0.5rem;
}

.basket-bridge-reorder:disabled,
.basket-bridge-reorder[aria-busy="true"] {
    cursor: wait;
    opacity: 0.55;
}

@media (max-width: 36rem) {
    .basket-bridge-backdrop {
        padding: 0.5rem;
    }

    .basket-bridge-modal {
        max-height: calc(100vh - 1rem);
    }

    .basket-bridge-header,
    .basket-bridge-footer,
    .basket-bridge-status {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .basket-bridge-errors {
        margin-left: 1rem;
        margin-right: 1rem;
    }

    .basket-bridge-lines {
        padding-top: 0.75rem;
        padding-bottom: 0.25rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .basket-bridge-line-content {
        grid-template-columns: 1.75rem 3.5rem minmax(0, 1fr) minmax(72px, auto);
        gap: 0.6rem;
        align-items: start;
    }

    .basket-bridge-line-image {
        width: 3.5rem;
        height: 3.5rem;
    }

    .basket-bridge-line-actions {
        grid-column: 4;
        grid-row: 1;
        justify-self: end;
        margin-top: 0;
    }

    .basket-bridge-line {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .basket-bridge-line:first-child {
        padding-top: 0;
    }

    .basket-bridge-line-selection {
        align-self: center;
    }

    .basket-bridge-footer {
        align-items: stretch;
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 0.5rem;
    }

    .basket-bridge-stage-all,
    .basket-bridge-commit {
        width: 100%;
        flex: 0 0 auto;
        min-width: 0;
        justify-content: center;
    }

    .basket-bridge-basket-link {
        width: 100%;
        flex: 0 0 auto;
        justify-content: center;
    }
}

@media (max-width: 22rem) {
    .basket-bridge-line-content {
        grid-template-columns: 1.75rem 3rem minmax(0, 1fr);
        gap: 0.5rem;
    }

    .basket-bridge-line-image {
        width: 3rem;
        height: 3rem;
    }

    .basket-bridge-line-actions {
        grid-column: 3;
        grid-row: 2;
        justify-self: end;
        margin-top: 0.15rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .basket-bridge-selection-icon {
        transition: none;
    }
}
