/* ============================================================
   Eloré cart page
   ============================================================ */

.cart-page {
    background: linear-gradient(180deg, #FFF7F8 0%, #F8F5F6 120px);
    min-height: calc(100vh - 80px);
    overflow-x: hidden;
}

.cart-page__inner {
    width: 100%;
    max-width: 1280px;
    margin-inline: auto;
    padding-block: 24px 72px;
    padding-inline: 24px;
}

.cart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.85fr);
    gap: 24px;
    align-items: start;
}

.cart-crumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: #6B7280;
    font-size: 0.82rem;
}

.cart-crumb a {
    color: #6B7280;
    text-decoration: none;
}

.cart-crumb a:hover,
.cart-crumb a:focus-visible {
    color: #D62839;
}

.cart-crumb__sep {
    color: #D1D5DB;
}

.cart-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 12px;
    margin-bottom: 24px;
}

.cart-heading h1 {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 800;
    color: #171717;
    line-height: 1.3;
}

.cart-heading__count {
    color: #6B7280;
    font-size: 0.92rem;
    font-weight: 600;
}

.cart-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.cart-card {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr) auto auto auto;
    gap: 12px 16px;
    align-items: center;
    background: #ffffff;
    border: 1px solid #F0E4E6;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(23, 23, 23, 0.04);
    transition: opacity 0.2s ease, box-shadow 0.2s ease;
}

.cart-card.is-busy {
    opacity: 0.62;
    pointer-events: none;
}

.cart-card__media {
    width: 96px;
    height: 96px;
    border-radius: 12px;
    background: #FFF7F8;
    border: 1px solid #FDE8EB;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-card__media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cart-card__placeholder {
    color: #D1D5DB;
    font-size: 1.4rem;
}

.cart-card__info {
    min-width: 0;
}

.cart-card__name {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
}

.cart-card__name a {
    color: #171717;
    text-decoration: none;
}

.cart-card__name a:hover,
.cart-card__name a:focus-visible {
    color: #D62839;
}

.cart-card__variant {
    margin: 0 0 8px;
    color: #6B7280;
    font-size: 0.82rem;
}

.cart-card.is-unavailable {
    opacity: 0.72;
}

.cart-card__unavailable {
    margin: 6px 0 0;
    color: #D62839;
    font-size: 0.8rem;
    font-weight: 700;
}

.cart-card__price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 8px;
    margin: 0;
    font-weight: 700;
    color: #171717;
}

.cart-card__wholesale {
    color: #A61E2A;
    font-size: 0.75rem;
    font-weight: 700;
}

.cart-card__old {
    color: #9CA3AF;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: line-through;
}

.qty-ctrl {
    display: inline-flex;
    align-items: center;
    height: 40px;
    border: 1px solid #EDE4E6;
    border-radius: 999px;
    overflow: hidden;
    background: #ffffff;
}

.qty-ctrl__btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: #D62839;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.qty-ctrl__btn:hover:not(:disabled),
.qty-ctrl__btn:focus-visible {
    background: #FDE8EB;
    outline: none;
}

.qty-ctrl__btn:focus-visible {
    box-shadow: inset 0 0 0 2px #D62839;
}

.qty-ctrl__btn:disabled {
    color: #D1D5DB;
    cursor: not-allowed;
}

.qty-ctrl__value {
    width: 42px;
    height: 40px;
    border: none;
    text-align: center;
    font-weight: 700;
    color: #171717;
    background: transparent;
    pointer-events: none;
    -moz-appearance: textfield;
}

.qty-ctrl__value::-webkit-outer-spin-button,
.qty-ctrl__value::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cart-card__line {
    min-width: 88px;
    text-align: end;
    font-weight: 800;
    color: #171717;
    font-size: 1rem;
}

.cart-card__remove {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #9CA3AF;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cart-card__remove:hover,
.cart-card__remove:focus-visible {
    background: #FDE8EB;
    color: #D62839;
    outline: none;
}

.cart-summary {
    background: #ffffff;
    border: 1px solid #F0E4E6;
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 12px 32px rgba(23, 23, 23, 0.05);
    position: sticky;
    top: 96px;
}

body.is-merchant .cart-summary {
    top: 128px;
}

.cart-summary h2 {
    margin: 0 0 16px;
    font-size: 1.1rem;
    font-weight: 800;
}

.cart-summary__mode {
    margin: -4px 0 16px;
    color: #A61E2A;
    font-size: 0.8rem;
    font-weight: 700;
}

.cart-summary__row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    color: #6B7280;
    font-size: 0.95rem;
}

.cart-summary__row strong {
    color: #171717;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.cart-summary__row .is-free-shipping,
.shipping-cost-display .is-free-shipping,
.checkout-totals__row .is-free-shipping {
    color: #1F8A4C;
    font-weight: 800;
    white-space: nowrap;
}

.cart-summary__row.is-total {
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid #F0E4E6;
    color: #171717;
    font-size: 1rem;
    font-weight: 800;
}

.cart-summary__row.is-total strong {
    color: #D62839;
    font-size: 1.35rem;
}

.cart-summary__cta {
    width: 100%;
    min-height: 52px;
    margin-top: 20px;
    border: none;
    border-radius: 12px;
    background: #D62839;
    color: #ffffff;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(214, 40, 57, 0.22);
    transition: background 0.2s ease, transform 0.15s ease;
}

.cart-summary__cta:hover,
.cart-summary__cta:focus-visible {
    background: #A61E2A;
    color: #ffffff;
    outline: none;
}

.cart-summary__cta:active {
    transform: scale(0.99);
}

.cart-summary__note {
    margin: 12px 0 0;
    text-align: center;
    color: #6B7280;
    font-size: 0.82rem;
}

.cart-summary__promo {
    margin: 10px 0 0;
    text-align: center;
    color: #A61E2A;
    font-size: 0.82rem;
    font-weight: 700;
}

.checkout-shipping-promo {
    margin: 8px 0 0;
    text-align: center;
    color: #A61E2A;
    font-size: 0.8rem;
    font-weight: 700;
}

.cart-empty {
    background: #ffffff;
    border: 1px solid #F0E4E6;
    border-radius: 20px;
    text-align: center;
    padding: 56px 24px;
    box-shadow: 0 8px 24px rgba(23, 23, 23, 0.04);
}

.cart-empty__icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: #FDE8EB;
    color: #D62839;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

.cart-empty h2 {
    margin: 0 0 8px;
    font-size: 1.3rem;
    font-weight: 800;
}

.cart-empty p {
    margin: 0 0 24px;
    color: #6B7280;
}

.cart-empty__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 24px;
    border-radius: 12px;
    background: #D62839;
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
}

.cart-empty__btn:hover,
.cart-empty__btn:focus-visible {
    background: #A61E2A;
    color: #ffffff;
}

.cart-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1300;
    max-width: calc(100% - 32px);
    padding: 12px 16px;
    border-radius: 12px;
    background: #171717;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 12px 32px rgba(23, 23, 23, 0.2);
}

.cart-toast[hidden] {
    display: none !important;
}

@media (max-width: 1199px) {
    .cart-layout {
        grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.9fr);
        gap: 20px;
    }
}

@media (max-width: 991px) {
    .cart-card {
        grid-template-columns: 88px minmax(0, 1fr) auto;
        gap: 12px;
    }

    .cart-card__line {
        grid-column: 2;
        text-align: right;
        min-width: 0;
    }

    .cart-card__remove {
        grid-row: 1;
        grid-column: 3;
        align-self: start;
    }

    .cart-card__qty {
        grid-column: 2;
    }
}

@media (max-width: 767px) {
    .cart-page__inner {
        padding: 16px 14px 56px;
    }

    .cart-heading h1 {
        font-size: 1.22rem;
    }

    .cart-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .cart-summary {
        position: static;
        padding: 20px 16px;
    }

    .cart-card {
        grid-template-columns: 80px minmax(0, 1fr);
        grid-template-areas:
            "media info"
            "media qty"
            "total total";
        gap: 10px 12px;
        padding: 12px;
        position: relative;
    }

    .cart-card__media {
        grid-area: media;
        width: 80px;
        height: 80px;
        align-self: start;
    }

    .cart-card__info {
        grid-area: info;
        padding-inline-end: 36px;
    }

    .cart-card__qty {
        grid-area: qty;
    }

    .cart-card__line {
        grid-area: total;
        min-width: 0;
        text-align: right;
        padding-top: 4px;
        border-top: 1px solid #F5EDEE;
    }

    .cart-card__remove {
        position: absolute;
        top: 8px;
        inset-inline-end: 8px;
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 479px) {
    .cart-page__inner {
        padding: 12px 10px 48px;
    }

    .cart-heading h1 {
        font-size: 1.12rem;
    }

    .cart-card__name {
        font-size: 0.92rem;
    }

    .cart-card__line,
    .cart-summary__row.is-total strong {
        font-size: 1.05rem;
    }

    .qty-ctrl,
    .qty-ctrl__btn,
    .qty-ctrl__value {
        height: 38px;
    }

    .qty-ctrl__btn {
        width: 38px;
        min-width: 38px;
    }
}

/* ============================================================
   Checkout / confirmation modals
   ============================================================ */

body.cart-page.modal-open {
    overflow: hidden;
}

body.cart-page.modal-open .modal-backdrop {
    z-index: 1340;
    background: rgba(23, 23, 23, 0.55);
}

.checkout-modal {
    z-index: 1350;
    --bs-modal-margin: 16px;
}

.checkout-dialog {
    width: min(92vw, 800px);
    max-width: min(92vw, 800px);
    margin: 16px auto;
    display: flex;
    align-items: center;
    min-height: calc(100% - 32px);
}

.checkout-dialog .modal-content {
    width: 100%;
    max-height: calc(100dvh - 32px);
    border: 0;
    border-radius: 18px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(23, 23, 23, 0.22);
}

.checkout-modal__header {
    flex: 0 0 auto;
    background: #D62839;
    color: #ffffff;
    border-bottom: 0;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.checkout-modal__header .modal-title {
    font-size: 1.05rem;
    font-weight: 800;
    margin: 0;
    line-height: 1.3;
}

.checkout-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    list-style: none;
    margin: 0 0 6px;
    padding: 0;
    font-size: 0.72rem;
    font-weight: 700;
}

.checkout-steps li {
    color: rgba(255, 255, 255, 0.55);
}

.checkout-steps li.is-done,
.checkout-steps li.is-current {
    color: #ffffff;
}

.checkout-steps li.is-current {
    box-shadow: inset 0 -2px 0 #ffffff;
}

.checkout-error {
    margin-top: 4px;
    padding: 12px;
    border-radius: 10px;
    background: #FDE8EB;
    color: #A61E2A;
    font-weight: 700;
    font-size: 0.9rem;
}

.checkout-modal__form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

.checkout-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
}

.checkout-modal__footer {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: stretch;
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    background: #ffffff;
    border-top: 1px solid #F0E4E6;
}

.checkout-field {
    margin-bottom: 16px;
}

.checkout-field:last-child {
    margin-bottom: 0;
}

.checkout-field .form-label {
    font-weight: 700;
    font-size: 0.88rem;
    color: #171717;
    margin-bottom: 8px;
}

.checkout-modal .form-control,
.checkout-modal .form-select {
    min-height: 44px;
    border-radius: 10px;
    border-color: #EDE4E6;
    width: 100%;
    max-width: 100%;
}

.checkout-modal textarea.form-control {
    min-height: 88px;
    resize: vertical;
}

.checkout-modal .form-control:focus,
.checkout-modal .form-select:focus {
    border-color: #D62839;
    box-shadow: 0 0 0 4px rgba(214, 40, 57, 0.12);
}

.shipping-cost-display {
    background: #FDE8EB;
    padding: 10px 12px;
    border-radius: 10px;
    margin-top: 10px;
    font-size: 0.88rem;
    color: #A61E2A;
    font-weight: 700;
    text-align: center;
}

.checkout-section {
    margin-bottom: 16px;
}

.checkout-section__title {
    margin: 0 0 10px;
    font-size: 0.95rem;
    font-weight: 800;
    color: #171717;
}

.checkout-panel {
    background: #FFF7F8;
    border: 1px solid #FDE8EB;
    border-radius: 12px;
    padding: 14px;
}

.checkout-items-head,
.checkout-item {
    display: grid;
    grid-template-columns: 52px minmax(0, 1.6fr) minmax(72px, 0.7fr) minmax(56px, 0.5fr) minmax(72px, 0.7fr);
    gap: 8px 12px;
    align-items: center;
}

.checkout-item__media {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    overflow: hidden;
    background: #FDE8EB;
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkout-item__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.checkout-item__placeholder {
    color: #D62839;
    font-size: 0.95rem;
}

.checkout-items-head {
    padding: 0 4px 8px;
    color: #6B7280;
    font-size: 0.75rem;
    font-weight: 700;
    border-bottom: 1px solid #F0E4E6;
}

.checkout-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkout-item {
    padding: 12px;
    background: #ffffff;
    border: 1px solid #F0E4E6;
    border-radius: 12px;
}

.checkout-item__name {
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1.4;
    word-break: break-word;
}

.checkout-item__name small {
    display: block;
    margin-top: 2px;
    color: #6B7280;
    font-weight: 500;
}

.checkout-item__price,
.checkout-item__qty,
.checkout-item__total {
    font-size: 0.88rem;
}

.checkout-item__total {
    text-align: end;
}

.checkout-item__label {
    display: none;
    color: #6B7280;
    font-size: 0.72rem;
    font-weight: 600;
    margin-inline-end: 4px;
}

.checkout-item__wholesale {
    display: block;
    color: #A61E2A;
    font-size: 0.72rem;
    font-weight: 700;
}

.checkout-review__row,
.checkout-totals__row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #F5D0D4;
    font-size: 0.9rem;
}

.checkout-review__row:last-child,
.checkout-totals__row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.checkout-review__row span,
.checkout-totals__row span:first-child {
    color: #6B7280;
}

.checkout-review__row strong {
    color: #171717;
    text-align: end;
    word-break: break-word;
}

.checkout-totals__row span:last-child {
    color: #171717;
    text-align: end;
    white-space: nowrap;
    flex-shrink: 0;
}

.checkout-totals__row.is-total {
    padding-top: 12px;
    font-weight: 800;
}

.checkout-totals__row.is-total span:first-child {
    color: #171717;
}

.checkout-totals__row.is-total strong {
    color: #D62839;
    font-size: 1.15rem;
}

.checkout-btn {
    min-height: 46px;
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-weight: 800;
    font-size: 0.95rem;
    flex: 1 1 0;
    cursor: pointer;
}

.checkout-btn:focus-visible {
    outline: 2px solid #D62839;
    outline-offset: 2px;
}

.checkout-btn--primary {
    background: #D62839;
    color: #ffffff;
}

.checkout-btn--primary:hover {
    background: #A61E2A;
    color: #ffffff;
}

.checkout-btn--ghost {
    background: #ffffff;
    color: #4B5563;
    border-color: #E5E7EB;
}

.checkout-btn--ghost:hover {
    background: #F9FAFB;
}

.checkout-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.price-original {
    text-decoration: line-through;
    color: #9CA3AF;
    font-size: 0.85em;
    margin-inline-end: 6px;
}

.price-discounted {
    color: #D62839;
    font-weight: 700;
}

@media (max-width: 767px) {
    .checkout-dialog {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        margin: 12px auto;
        min-height: calc(100% - 24px);
    }

    .checkout-dialog .modal-content {
        max-height: calc(100dvh - 24px);
        border-radius: 16px;
    }

    .checkout-items-head {
        display: none;
    }

    .checkout-item {
        grid-template-columns: 52px 1fr 1fr;
    }

    .checkout-item__name {
        grid-column: 2 / -1;
    }

    .checkout-item__label {
        display: inline;
    }

    .checkout-item__total {
        text-align: start;
    }

    .checkout-modal__footer {
        flex-direction: column-reverse;
    }

    .checkout-modal__footer .checkout-btn {
        width: 100%;
        flex: 1 1 auto;
    }

    .checkout-modal textarea.form-control {
        min-height: 76px;
    }
}

@supports not (height: 100dvh) {
    .checkout-dialog .modal-content {
        max-height: calc(100vh - 32px);
    }

    @media (max-width: 767px) {
        .checkout-dialog .modal-content {
            max-height: calc(100vh - 24px);
        }
    }
}
