/* MODX Evo checkout upsell — adapted to the existing Chisto.UA button classes.
   Main actions use the site's own d-product__btn --blue / --black variants.
   No custom primary/secondary button background or hover colors. */

.checkout-upsell-backdrop[hidden],
.checkout-upsell-dialog[hidden],
.checkout-review-dialog[hidden],
.checkout-upsell-error[hidden],
.checkout-review-error[hidden],
.checkout-upsell-track[hidden] {
    display: none !important;
}

.checkout-upsell-open { overflow: hidden; }
.checkout-upsell-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99999;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    padding: 20px;
    background: rgba(0,0,0,.6);
    font-family: inherit;
    color: #252525;
}
.checkout-upsell-dialog,
.checkout-review-dialog {
    box-sizing: border-box;
    width: min(100%,960px);
    max-height: calc(100vh - 40px);
    overflow: auto;
    padding: 30px;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 15px 50px rgba(0,0,0,.18);
}
.checkout-upsell-dialog h2,
.checkout-review-dialog h2 {
    margin: 0 0 24px;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.25;
    color: #222;
}
.checkout-upsell-slider {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.checkout-upsell-track {
    display: flex;
    flex: 1;
    gap: 16px;
    min-width: 0;
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}
.checkout-upsell-track::-webkit-scrollbar { display: none; }
.checkout-upsell-card {
    box-sizing: border-box;
    flex: 0 0 calc((100% - 32px) / 3);
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    padding: 14px;
    border: 1px solid #ededed;
    border-radius: 4px;
    cursor: pointer;
    scroll-snap-align: start;
}
.checkout-upsell-card:hover { border-color: #cbd9e4; }
.checkout-upsell-card:has(.checkout-upsell-checkbox:checked) { border-color: #1687cc; }
.checkout-upsell-photo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 150px;
}
.checkout-upsell-photo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.checkout-upsell-name { flex: 1; font-size: 15px; line-height: 1.35; }
.checkout-upsell-price { font-size: 17px; font-weight: 700; color: #222; }
.checkout-upsell-choice { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #4a4a4a; }
.checkout-upsell-card input[type="checkbox"] {
    width: 18px;
    height: 18px;
    appearance: auto;
    -webkit-appearance: checkbox;
    accent-color: #1687cc;
}
.checkout-upsell-loading { padding: 32px 8px; text-align: center; }
.checkout-upsell-slider.is-loading .checkout-upsell-prev,
.checkout-upsell-slider.is-loading .checkout-upsell-next { visibility: hidden; }

/* Carousel controls — neutral styling similar to the existing product sliders. */
.checkout-upsell-prev,
.checkout-upsell-next {
    box-sizing: border-box;
    flex: 0 0 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: 1px solid #e5e5e5;
    border-radius: 50%;
    background: #fff;
    color: #222;
    font: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.checkout-upsell-prev:hover,
.checkout-upsell-next:hover { border-color: #888; }

/* Important: the colors, borders, hover, and typography of the three
   action buttons come from EXISTING SITE CSS, not this stylesheet.
   Do not add .submitCart to them: that class submits the order! */
.checkout-upsell-actions {
    display: flex;
    justify-content: flex-end;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}
.checkout-upsell-backdrop .checkout-upsell-actions .d-product__btn,
.checkout-upsell-backdrop .checkout-review-continue.d-product__btn {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: auto;
    max-width: 100%;
    min-width: 170px;
    min-height: 48px;
    margin: 0;
    padding: 12px 24px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
}
.checkout-upsell-backdrop .d-product__btn-text {
    display: inline-block;
    text-align: center;
}
.checkout-upsell-backdrop .checkout-review-continue.d-product__btn {
    margin-top: 22px;
}
.checkout-upsell-error,
.checkout-review-error { margin-top: 12px; color: #b3261e; }

.checkout-review-item {
    display: grid;
    grid-template-columns: 70px minmax(120px,1fr) 95px 120px 95px 36px;
    gap: 10px;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid #eee;
}
.checkout-review-item img { width: 64px; height: 64px; object-fit: contain; }
.checkout-review-item .review-title { overflow-wrap: anywhere; }
.checkout-review-item .review-line-price { font-weight: 700; }
.checkout-review-item .review-qty {
    display: flex;
    align-items: center;
    gap: 4px;
}
.checkout-review-item .review-count {
    box-sizing: border-box;
    width: 42px;
    min-width: 0;
    height: 32px;
    padding: 0 2px;
    border: 1px solid #dedede;
    border-radius: 4px;
    text-align: center;
    font: inherit;
}
.checkout-review-item .review-minus,
.checkout-review-item .review-plus,
.checkout-review-item .review-remove {
    box-sizing: border-box;
    flex: 0 0 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    background: #fff;
    color: #222;
    font: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.checkout-review-item .review-minus:hover,
.checkout-review-item .review-plus:hover,
.checkout-review-item .review-remove:hover { background: #f5f5f5; }
.checkout-review-total { font-size: 20px; font-weight: 700; text-align: right; margin-top: 18px; }
.checkout-upsell-backdrop button:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

@media(max-width: 767px) {
    .checkout-upsell-backdrop { align-items: center; padding: 10px; }
    .checkout-upsell-dialog,
    .checkout-review-dialog { max-height: calc(100vh - 20px); padding: 18px; }
    .checkout-upsell-dialog h2,
    .checkout-review-dialog h2 { font-size: 21px; }
    .checkout-upsell-card { flex-basis: 100%; }
    .checkout-upsell-photo { height: 190px; }
    .checkout-upsell-actions { flex-direction: column; }
    .checkout-upsell-backdrop .checkout-upsell-actions .d-product__btn,
    .checkout-upsell-backdrop .checkout-review-continue.d-product__btn {
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
    }
    .checkout-review-item { grid-template-columns: 60px 1fr 90px; grid-auto-rows: auto; }
}
