:root {
    
    --modal-scale: 1;
}

@media screen and (min-width: 7680px) {
    :root {
        --modal-scale: 4;
    }
}

@media screen and (min-width: 5760px) and (max-width: 7679px) {
    :root {
        --modal-scale: 3;
    }
}

@media screen and (min-width: 3840px) and (max-width: 5759px) {
    :root {
        --modal-scale: 2;
    }
}

@media screen and (min-width: 2880px) and (max-width: 3839px) {
    :root {
        --modal-scale: 1.5;
    }
}

@media screen and (min-width: 2560px) and (max-width: 2879px) {
    :root {
        --modal-scale: 1.333;
    }
}

@media screen and (min-width: 2400px) and (max-width: 2559px) {
    :root {
        --modal-scale: 1.25;
    }
}

@media screen and (min-width: 2133px) and (max-width: 2399px) {
    :root {
        --modal-scale: 1.111;
    }
}

@media screen and (min-width: 1920px) and (max-width: 2132px) {
    :root {
        --modal-scale: 1;
    }
}

@media screen and (min-width: 1728px) and (max-width: 1919px) {
    :root {
        --modal-scale: 0.9;
    }
}

@media screen and (min-width: 1600px) and (max-width: 1727px) {
    :root {
        --modal-scale: 0.833;
    }
}

@media screen and (min-width: 1536px) and (max-width: 1599px) {
    :root {
        --modal-scale: 0.8;
    }
}

@media screen and (min-width: 1366px) and (max-width: 1535px) {
    :root {
        --modal-scale: 0.711;
    }
}

@media screen and (min-width: 1280px) and (max-width: 1365px) {
    :root {
        --modal-scale: 0.667;
    }
}

@media screen and (min-width: 1097px) and (max-width: 1279px) {
    :root {
        --modal-scale: 0.571;
    }
}

@media screen and (min-width: 1024px) and (max-width: 1096px) {
    :root {
        --modal-scale: 0.533;
    }
}

@media screen and (min-width: 960px) and (max-width: 1023px) {
    :root {
        --modal-scale: 0.5;
    }
}

@media screen and (min-width: 769px) and (max-width: 959px) {
    :root {
        --modal-scale: 0.4;
    }
}

.product-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(calc(5px * var(--modal-scale)));
}

.modal-content {
    width: calc(700px * var(--modal-scale));
    background-color: white;
    border-radius: calc(70px * var(--modal-scale));
    box-shadow: 0 0 calc(70px * var(--modal-scale)) 0 rgba(2, 10, 46, 0.25);
    position: relative;
    overflow: hidden;
    padding-bottom: calc(50px * var(--modal-scale));
}

.modal-close {
    position: absolute;
    top: calc(25px * var(--modal-scale));
    right: calc(30px * var(--modal-scale));
    background: none;
    border: none;
    font-size: calc(40px * var(--modal-scale));
    color: #3d7979;
    cursor: pointer;
    width: calc(40px * var(--modal-scale));
    height: calc(40px * var(--modal-scale));
    line-height: calc(40px * var(--modal-scale));
    z-index: 10;
    transition: transform 0.3s ease;
}

.modal-close:hover {
    transform: scale(1.2);
}

.modal-body {
    display: flex;
    height: calc(400px * var(--modal-scale));
    padding: calc(40px * var(--modal-scale)) calc(40px * var(--modal-scale)) calc(20px * var(--modal-scale));
}

.modal-image-container {
    flex: 0 0 calc(300px * var(--modal-scale));
    display: flex;
    align-items: center;
    justify-content: center;
    padding-right: calc(40px * var(--modal-scale));
}

.modal-image {
    max-width: 100%;
    max-height: calc(350px * var(--modal-scale));
    object-fit: contain;
    border-radius: calc(20px * var(--modal-scale));
    box-shadow: 0 calc(6px * var(--modal-scale)) calc(20px * var(--modal-scale)) rgba(0, 0, 0, 0.1);
}

.modal-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-left: calc(40px * var(--modal-scale));
    border-left: calc(2px * var(--modal-scale)) solid #f0f0f0;
}

.modal-title {
    font-family: 'Russo One', sans-serif;
    font-size: calc(28px * var(--modal-scale));
    color: #3d7979;
    margin-bottom: calc(20px * var(--modal-scale));
    line-height: 1.3;
}

.modal-description {
    font-family: 'Golos Text', sans-serif;
    font-size: calc(18px * var(--modal-scale));
    color: #333;
    line-height: 1.6;
    flex-grow: 1;
    overflow-y: auto;
    padding-right: calc(10px * var(--modal-scale));
    margin-bottom: 0;
}

.modal-button-container {
    margin-top: calc(50px * var(--modal-scale));
    text-align: center;
    padding: 0 calc(40px * var(--modal-scale));
}

.modal-order-btn {
    font-family: 'Golos Text', sans-serif;
    font-size: calc(17px * var(--modal-scale));
    width: calc(260px * var(--modal-scale));
    height: calc(50px * var(--modal-scale));
    border-radius: calc(25px * var(--modal-scale));
    background: linear-gradient(22deg, rgba(0, 143, 143, 1) 16%, rgb(61, 121, 121) 92%);
    color: white;
    border: none;
    cursor: pointer;
    transition: transform 0.3s ease;
    font-weight: 500;
}

.modal-order-btn:hover {
    transform: scale(0.95);
}

/* Стили для отсутствующего товара в модальном окне */
.product-modal .modal-content.out-of-stock .modal-image-container {
    opacity: 0.5;
    position: relative;
}

.product-modal .modal-content.out-of-stock .modal-image-container::after {
    content: "Нет в наличии";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: calc(12px * var(--modal-scale)) calc(24px * var(--modal-scale));
    border-radius: calc(30px * var(--modal-scale));
    font-family: 'Golos Text', sans-serif;
    font-size: calc(18px * var(--modal-scale));
    font-weight: bold;
    white-space: nowrap;
    z-index: 2;
    pointer-events: none;
    box-shadow: 0 calc(4px * var(--modal-scale)) calc(15px * var(--modal-scale)) rgba(0, 0, 0, 0.3);
}

/* Затемняем кнопку заказа для отсутствующего товара */
.product-modal .modal-content.out-of-stock .modal-order-btn {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Предупреждение в описание */
.product-modal .modal-content.out-of-stock .modal-description {
    position: relative;
}

.product-modal .modal-content.out-of-stock .modal-description::before {
    content: "⚠ Товар временно отсутствует на складе";
    display: block;
    background-color: #fff3cd;
    color: #856404;
    padding: calc(10px * var(--modal-scale)) calc(15px * var(--modal-scale));
    border-radius: calc(10px * var(--modal-scale));
    margin-bottom: calc(15px * var(--modal-scale));
    font-family: 'Golos Text', sans-serif;
    font-size: calc(14px * var(--modal-scale));
    border: 1px solid #ffeeba;
}

/* МОБИЛЬНАЯ ВЕРСИЯ для модального окна (до 768px) */
@media screen and (max-width: 768px) {
    .modal-content {
        width: 90%; 
        max-width: 90%;
        border-radius: 30px;
        padding-bottom: 30px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-close {
        top: 15px;
        right: 15px;
        font-size: 32px;
        width: 32px;
        height: 32px;
        line-height: 32px;
    }

    .modal-body {
        flex-direction: column;
        height: auto;
        padding: 30px 20px 10px;
    }

    .modal-image-container {
        flex: none;
        width: 100%;
        padding-right: 0;
        margin-bottom: 20px;
        max-height: 250px;
    }

    .modal-image {
        max-height: 220px;
        width: auto;
        max-width: 100%;
    }

    .modal-info {
        padding-left: 0;
        border-left: none;
        width: 100%;
    }

    .modal-title {
        font-size: 24px;
        margin-bottom: 15px;
        text-align: center;
    }

    .modal-description {
        font-size: 15px;
        max-height: 200px;
        overflow-y: auto;
        padding-right: 5px;
    }

    .modal-button-container {
        margin-top: 30px;
        padding: 0 20px;
    }

    .modal-order-btn {
        width: 100%;
        max-width: 280px;
        height: 48px;
        font-size: 16px;
        border-radius: 24px;
    }

    /* Out of stock на мобильных */
    .product-modal .modal-content.out-of-stock .modal-image-container::after {
        padding: 8px 16px;
        font-size: 14px;
        white-space: normal;
        text-align: center;
        width: 80%;
    }

    .product-modal .modal-content.out-of-stock .modal-description::before {
        font-size: 12px;
        padding: 8px 12px;
        margin-bottom: 10px;
    }
}

/* (до 480px) */
@media screen and (max-width: 480px) {
    .modal-content {
        width: 90%; /* Тоже 90% */
        border-radius: 25px;
        padding-bottom: 25px;
    }

    .modal-close {
        top: 12px;
        right: 12px;
        font-size: 28px;
        width: 28px;
        height: 28px;
        line-height: 28px;
    }

    .modal-body {
        padding: 25px 15px 5px;
    }

    .modal-image-container {
        max-height: 200px;
        margin-bottom: 15px;
    }

    .modal-image {
        max-height: 180px;
    }

    .modal-title {
        font-size: 20px;
        margin-bottom: 12px;
    }

    .modal-description {
        font-size: 14px;
        max-height: 180px;
    }

    .modal-button-container {
        margin-top: 25px;
        padding: 0 15px;
    }

    .modal-order-btn {
        height: 45px;
        font-size: 15px;
        border-radius: 22.5px;
    }

    .product-modal .modal-content.out-of-stock .modal-image-container::after {
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* Для экранов до 360px */
@media screen and (max-width: 360px) {
    .modal-content {
        width: 90%; /* Тоже 90% */
    }
    
    .modal-body {
        padding: 20px 12px 5px;
    }

    .modal-image-container {
        max-height: 160px;
    }

    .modal-image {
        max-height: 140px;
    }

    .modal-title {
        font-size: 18px;
    }

    .modal-description {
        font-size: 13px;
        max-height: 150px;
    }

    .modal-order-btn {
        height: 42px;
        font-size: 14px;
    }
}