/* Общий оверлей для модалок комплекта (yas-pdp) */
.modal[data-yas-complect-ui] {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, .52);
    backdrop-filter: blur(2px);
    z-index: 100500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
    padding: 16px;
    box-sizing: border-box;
}

.modal[data-yas-complect-ui].show {
    opacity: 1;
    visibility: visible;
}

.modal[data-yas-complect-ui] .modal-complect__inner {
    position: relative;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(31, 45, 80, .2);
    opacity: 0;
    transform: translateY(12px) scale(.98);
    transition: transform .32s cubic-bezier(.22, 1, .36, 1), opacity .32s ease;
    max-width: 640px;
    width: min(640px, calc(100vw - 32px));
    margin: 16px;
}

.modal-buy-success.show .modal-complect__inner {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ===== Pop-up товара комплекта (изолированный класс) ===== */
.yas-complect-item-modal {
    padding: 20px 16px;
}

.yas-complect-item-modal__dialog {
    position: relative;
    width: min(920px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 28px 72px rgba(31, 45, 80, .22);
    opacity: 0;
    transform: translateY(14px) scale(.98);
    transition: transform .32s cubic-bezier(.22, 1, .36, 1), opacity .32s ease;
}

.yas-complect-item-modal.show .yas-complect-item-modal__dialog {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.yas-complect-item-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 3;
    width: 38px;
    height: 38px;
    border: 1px solid #e6e8f0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    opacity: .9;
    transition: opacity .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.yas-complect-item-modal__close:hover {
    opacity: 1;
    border-color: #3498db;
    box-shadow: 0 4px 14px rgba(52, 152, 219, .16);
}

.yas-complect-item-modal__close:after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 14px;
    height: 14px;
    background: url('/local/templates/ssn-1/resources/417e68d399fa648ce8fa998634bd0348.png') center/contain no-repeat;
}

.yas-complect-item-modal__content {
    min-height: 120px;
}

.yas-complect-item-modal__layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr) 220px;
    gap: 0;
    align-items: stretch;
}

.yas-complect-item-modal__media {
    padding: 24px 20px;
    border-right: 1px solid #eef1f6;
    background: linear-gradient(180deg, #fafbfd 0%, #f5f8fc 100%);
}

.yas-complect-item-modal__image {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    height: 100%;
}

.yas-complect-item-modal__image img {
    max-width: 100%;
    max-height: 260px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.yas-complect-item-modal__image-placeholder {
    display: block;
    width: 120px;
    height: 120px;
    border-radius: 12px;
    background: #e8edf3;
}

.yas-complect-item-modal__info {
    padding: 24px 22px 24px 24px;
    min-width: 0;
}

.yas-complect-item-modal__title {
    margin: 0 44px 12px 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.35;
    color: #1b1c28;
}

.yas-complect-item-modal__stock {
    display: inline-flex;
    align-items: center;
    margin: 0 0 16px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
}

.yas-complect-item-modal__stock.is-in {
    color: #1f8f57;
    background: #e8f8ef;
}

.yas-complect-item-modal__stock.is-out {
    color: #c0392b;
    background: #fdeeed;
}

.yas-complect-item-modal__meta {
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 10px;
}

.yas-complect-item-modal__meta li {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 10px;
    align-items: baseline;
    font-size: 14px;
    line-height: 1.4;
}

.yas-complect-item-modal__meta-label {
    color: #7a8194;
}

.yas-complect-item-modal__meta-value {
    color: #1b1c28;
    font-weight: 500;
}

.yas-complect-item-modal__meta-value a {
    color: #3498db;
    text-decoration: none;
}

.yas-complect-item-modal__meta-value a:hover {
    text-decoration: underline;
}

.yas-complect-item-modal__links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.yas-complect-item-modal__link {
    font-size: 13px;
    font-weight: 600;
    color: #3498db;
    text-decoration: none;
}

.yas-complect-item-modal__link:hover {
    text-decoration: underline;
}

.yas-complect-item-modal__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none !important;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, opacity .18s ease;
    cursor: pointer;
    border: none;
}

.yas-complect-item-modal__btn--outline {
    color: #3498db !important;
    background: #fff;
    border: 1.5px solid #3498db;
}

.yas-complect-item-modal__btn--outline:hover {
    background: #eaf4fb;
}

.yas-complect-item-modal__btn--primary {
    width: 100%;
    color: #fff !important;
    background: linear-gradient(180deg, #3aa0de 0%, #3498db 55%, #2c7fb8 100%);
    box-shadow: 0 8px 22px rgba(52, 152, 219, .28);
}

.yas-complect-item-modal__btn--primary:hover {
    opacity: .94;
}

.yas-complect-item-modal__buy {
    padding: 24px 22px;
    border-left: 1px solid #eef1f6;
    background: #f8fbff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
}

.yas-complect-item-modal__price {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.yas-complect-item-modal__price-current {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    color: #3498db;
}

.yas-complect-item-modal__price-old {
    font-size: 16px;
    font-weight: 500;
    color: #9296a6;
    text-decoration: line-through;
}

.yas-complect-item-modal__only-complect {
    margin: 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: #eaf4fb;
    border: 1px solid #cfe6f8;
    font-size: 13px;
    line-height: 1.45;
    font-weight: 500;
    color: #2c7fb8;
    text-align: center;
}

.yas-complect-item-modal__error {
    margin: 0;
    padding: 32px 24px;
    font-size: 15px;
    line-height: 1.5;
    color: #525566;
    text-align: center;
}

@media (max-width: 900px) {
    .yas-complect-item-modal__layout {
        grid-template-columns: 220px minmax(0, 1fr);
        grid-template-areas:
            "media info"
            "buy buy";
    }

    .yas-complect-item-modal__media { grid-area: media; }
    .yas-complect-item-modal__info { grid-area: info; }
    .yas-complect-item-modal__buy {
        grid-area: buy;
        border-left: none;
        border-top: 1px solid #eef1f6;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 20px;
    }

    .yas-complect-item-modal__cta {
        flex: 0 0 220px;
    }
}

@media (max-width: 640px) {
    .yas-complect-item-modal {
        padding: 12px;
        align-items: flex-end;
    }

    .yas-complect-item-modal__dialog {
        width: 100%;
        max-height: calc(100vh - 24px);
        border-radius: 16px 16px 12px 12px;
    }

    .yas-complect-item-modal__layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "media"
            "info"
            "buy";
    }

    .yas-complect-item-modal__media {
        border-right: none;
        border-bottom: 1px solid #eef1f6;
        padding: 18px 16px;
    }

    .yas-complect-item-modal__image {
        min-height: 180px;
    }

    .yas-complect-item-modal__info {
        padding: 18px 16px 16px;
    }

    .yas-complect-item-modal__title {
        margin-right: 36px;
        font-size: 18px;
    }

    .yas-complect-item-modal__meta li {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .yas-complect-item-modal__links {
        flex-direction: column;
        align-items: stretch;
    }

    .yas-complect-item-modal__btn--outline {
        width: 100%;
    }

    .yas-complect-item-modal__buy {
        padding: 16px;
        flex-direction: column;
        align-items: stretch;
    }

    .yas-complect-item-modal__cta {
        flex: 1 1 auto;
        width: 100%;
    }
}

/* ===== Модалка замены / сопутствующих ===== */
.modal-soputs {
    justify-content: flex-end;
    align-items: stretch;
    padding: 0;
    background-color: rgba(0, 0, 0, .45);
    backdrop-filter: none;
}

.modal-soputs__products {
    background-color: #fff;
    height: 100%;
    padding: 20px 18px;
    box-shadow: 4px 0 4px rgba(0, 0, 0, .25);
    overflow-x: hidden;
    overflow-y: auto;
}

.modal-soputs__product-pic {
    width: 80px;
    flex-basis: 80px;
    max-width: 80px;
}

.modal-soputs__product-info,
.modal-soputs__product-btn {
    max-width: calc(100% - 95px);
    flex-basis: calc(100% - 95px);
}

.modal-soputs__product-pic img,
.modal-buy-success__item-img img {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.modal-soputs__product {
    padding: 20px 0;
    border-bottom: 1px solid #e6e8f0;
}

.modal-soputs__product-inner {
    gap: 15px;
}

.modal-soputs__product-name {
    margin-bottom: 10px;
}

.modal-soputs__product-price {
    margin-bottom: 0;
    font-size: 19px;
}

.modal-soputs__product-btn {
    margin: 15px 0 0 auto;
}

.modal-soputs__product-discount,
.modal-buy-success__item-discount {
    font-weight: 600;
    margin-left: 5px;
    text-decoration-line: line-through;
    color: #e74c3c;
}

.modal-soputs__inner {
    position: relative;
    max-width: 320px;
    width: 100%;
    height: 100%;
}

.modal-soputs .close-modal,
.modal-buy-success .close-modal:not(.btn-continue) {
    cursor: pointer;
    outline: none;
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border: 1px solid #e6e8f0;
    border-radius: 8px;
    background: #fff;
    opacity: .85;
    transition: opacity .18s ease, border-color .18s ease;
}

.modal-soputs .close-modal {
    top: 10px;
    left: -40px;
    right: auto;
    border-radius: 50%;
}

.modal-buy-success .close-modal:not(.btn-continue):hover {
    opacity: 1;
    border-color: #3498db;
}

.modal-soputs .close-modal:after,
.modal-buy-success .close-modal:not(.btn-continue):after {
    content: "";
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-image: url('/local/templates/ssn-1/resources/417e68d399fa648ce8fa998634bd0348.png');
    background-repeat: no-repeat;
    background-size: contain;
    width: 12px;
    height: 12px;
}

.modal-buy-success .modal-complect__inner {
    max-width: 640px;
    width: min(640px, calc(100vw - 32px));
    padding: 28px 28px 24px;
}

.modal-buy-success__info {
    max-height: min(60vh, 420px);
    overflow-y: auto;
    margin: 0 -4px;
    padding: 0 4px;
}

.modal-buy-success__title {
    font-weight: 700;
    font-size: 22px;
    line-height: 1.3;
    color: #3498db;
    text-align: center;
    margin: 0 0 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e6e8f0;
}

.modal-buy-success__added {
    display: flex;
    flex-direction: column;
}

.modal-buy-success__item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid #e6e8f0;
}

.modal-buy-success__item:last-child {
    border-bottom: none;
}

.modal-buy-success__item-img {
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e6e8f0;
    border-radius: 8px;
    background: #f6f8fc;
    overflow: hidden;
}

.modal-buy-success__item-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 14px;
    line-height: 1.4;
    color: #1b1c28;
    margin: 0;
}

.modal-buy-success__item-price {
    flex: 0 0 auto;
    white-space: nowrap;
}

.modal-buy-success__item-price b {
    font-size: 17px;
    font-weight: 700;
    color: #1b1c28;
}

.modal-buy-success__btns {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 20px;
    margin-top: 4px;
    border-top: 1px solid #e6e8f0;
}

.modal-soputs__product-btn a,
.modal-buy-success__btns a:not(.btn-continue) {
    font-size: 14px;
    line-height: 1.2;
    color: #fff !important;
    padding: 12px 22px;
    border-radius: 999px;
    background: linear-gradient(180deg, #3aa0de 0%, #3498db 55%, #2c7fb8 100%);
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(52, 152, 219, .32);
    transition: background .18s ease, box-shadow .18s ease;
}

.modal-buy-success__btns a.btn-continue {
    color: #3498db !important;
    background: #fff !important;
    border: 1.5px solid #3498db;
    box-shadow: none;
}

.modal-buy-success__btns a.btn-continue:hover {
    background: #eaf4fb !important;
}

@media (max-width: 575.98px) {
    .modal-buy-success .modal-complect__inner {
        padding: 22px 18px 18px;
    }

    .modal-buy-success__title {
        font-size: 18px;
    }

    .modal-buy-success__item {
        flex-wrap: wrap;
    }

    .modal-buy-success__item-name {
        flex: 1 1 calc(100% - 88px);
    }

    .modal-buy-success__item-price {
        flex: 1 1 100%;
        padding-left: 88px;
    }

    .modal-buy-success__btns {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .modal-buy-success__btns a {
        width: 100%;
    }
}
