/* Страница корзины */
.cart-page {
    padding: 170px 100px 60px 100px;
}

.cart-page h2 {
    color: rgba(29, 43, 79, 1);
    font-size: 36px;
    font-weight: 700;
    font-family: "Playfair Display", serif;
    padding-bottom: 30px;
}

.cart-page h2 .cart-title-count {
    color: rgba(80, 90, 110, 1);
    font-size: 18px;
    font-weight: 400;
    font-family: "Manrope", sans-serif;
}

.cart-page .cart-content {
    display: flex;
    align-items: flex-start;
    gap: 25px;
}

.cart-page .cart-content[hidden] {
    display: none;
}

/* Таблица товаров */
.cart-page .cart-content .items {
    flex-grow: 1;
    min-width: 0;
    border: 1px solid rgba(233, 236, 243, 1);
    border-radius: 12px;
    padding: 0 25px;
}

.cart-page .cart-content .items .table-header {
    display: grid;
    grid-template-columns: 1fr 150px 150px 150px 50px;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid rgba(233, 236, 243, 1);
    color: rgba(29, 43, 79, 1);
    font-size: 15px;
    font-weight: 600;
}

.cart-page .cart-content .items .item {
    display: grid;
    grid-template-columns: 1fr 150px 150px 150px 50px;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid rgba(233, 236, 243, 1);
}

.cart-page .cart-content .items .item:last-child {
    border-bottom: none;
}

.cart-page .cart-content .items .item .product-info {
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 0;
    padding-right: 20px;
}

.cart-page .cart-content .items .item .product-info .image {
    width: 90px;
    height: 90px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(246, 247, 250, 1);
    border: 1px solid rgba(233, 236, 243, 1);
    border-radius: 10px;
    padding: 8px;
    box-sizing: border-box;
    overflow: hidden;
}

.cart-page .cart-content .items .item .product-info .image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cart-page .cart-content .items .item .product-info h3 {
    color: rgba(29, 43, 79, 1);
    font-size: 15px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-page .cart-content .items .item .unit-price {
    color: rgba(29, 43, 79, 1);
    font-size: 15px;
}

.cart-page .cart-content .items .item .quantity {
    display: flex;
    align-items: center;
    width: fit-content;
    border: 1px solid rgba(233, 236, 243, 1);
    border-radius: 8px;
}

.cart-page .cart-content .items .item .quantity button {
    width: 34px;
    height: 34px;
    background: none;
    border: none;
    color: rgba(80, 90, 110, 1);
    font-size: 16px;
    transition: color 0.2s ease;
}

.cart-page .cart-content .items .item .quantity button:hover {
    color: rgba(29, 43, 79, 1);
}

.cart-page .cart-content .items .item .quantity .count {
    min-width: 26px;
    text-align: center;
    color: rgba(29, 43, 79, 1);
    font-size: 15px;
    font-weight: 600;
}

.cart-page .cart-content .items .item .sum {
    color: rgba(29, 43, 79, 1);
    font-size: 15px;
    font-weight: 600;
}

.cart-page .cart-content .items .item .remove {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid rgba(233, 236, 243, 1);
    border-radius: 8px;
    transition: border-color 0.2s ease;
}

.cart-page .cart-content .items .item .remove:hover {
    border-color: rgba(224, 82, 82, 1);
}

.cart-page .cart-content .items .item .remove img {
    width: 18px;
    height: 18px;
}

/* Итоги заказа */
.cart-page .cart-content .summary {
    width: 320px;
    flex-shrink: 0;
    background-color: rgba(240, 244, 252, 1);
    border-radius: 12px;
    padding: 25px;
    box-sizing: border-box;
}

.cart-page .cart-content .summary .row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: rgba(29, 43, 79, 1);
    font-size: 15px;
    padding-bottom: 20px;
}

.cart-page .cart-content .summary .row.total {
    font-size: 18px;
    font-weight: 700;
}

.cart-page .cart-content .summary .checkout-button {
    width: 100%;
    background-color: rgba(244, 180, 0, 1);
    border: none;
    border-radius: 8px;
    padding: 14px;
    color: rgba(29, 43, 79, 1);
    font-size: 16px;
    font-weight: 600;
    transition: background-color 0.25s ease;
}

.cart-page .cart-content .summary .checkout-button:hover {
    background-color: rgba(220, 160, 0, 1);
}

.cart-page .cart-content .summary .checkout-button:disabled {
    opacity: 0.55;
    cursor: default;
}

.cart-page .cart-content .summary .checkout-button:disabled:hover {
    background-color: rgba(244, 180, 0, 1);
}

.cart-page .cart-content .summary .terms {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 12px;
    color: rgba(80, 90, 110, 1);
    font-size: 13px;
    cursor: pointer;
}

.cart-page .cart-content .summary .terms input {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    accent-color: rgba(29, 43, 79, 1);
    cursor: pointer;
}

.cart-page .cart-content .summary .terms a {
    color: rgba(80, 90, 110, 1);
    text-decoration: underline;
}

/* Пустая корзина */
.cart-page .cart-empty {
    text-align: center;
    padding: 60px 0;
}

.cart-page .cart-empty img {
    width: 190px;
    padding-bottom: 25px;
}

.cart-page .cart-empty h3 {
    color: rgba(29, 43, 79, 1);
    font-size: 36px;
    font-weight: 700;
    font-family: "Playfair Display", serif;
    padding-bottom: 15px;
}

.cart-page .cart-empty p {
    max-width: 480px;
    margin: 0 auto;
    color: rgba(80, 90, 110, 1);
    font-size: 16px;
    line-height: 1.5;
    padding-bottom: 35px;
}

.cart-page .cart-empty a {
    display: inline-block;
    background-color: rgba(244, 180, 0, 1);
    border-radius: 8px;
    padding: 13px 30px;
    color: rgba(29, 43, 79, 1);
    font-size: 16px;
    font-weight: 600;
    transition: background-color 0.25s ease;
}

.cart-page .cart-empty a:hover {
    background-color: rgba(220, 160, 0, 1);
}

/* Подтверждение удаления */
.confirm {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(29, 43, 79, 0.5);
}

.confirm[hidden] {
    display: none;
}

.confirm .dialog {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 30px 40px;
    text-align: center;
}

.confirm .dialog h3 {
    color: rgba(29, 43, 79, 1);
    font-size: 18px;
    font-weight: 600;
    padding-bottom: 20px;
}

.confirm .dialog .buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.confirm .dialog .buttons button {
    min-width: 110px;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.25s ease;
}

.confirm .dialog .buttons .delete {
    background-color: rgba(224, 82, 82, 1);
    border: 1px solid rgba(224, 82, 82, 1);
    color: #ffffff;
}

.confirm .dialog .buttons .delete:hover {
    background-color: rgba(200, 60, 60, 1);
    border-color: rgba(200, 60, 60, 1);
}

.confirm .dialog .buttons .cancel {
    background: none;
    border: 1px solid rgba(29, 43, 79, 1);
    color: rgba(29, 43, 79, 1);
}

.confirm .dialog .buttons .cancel:hover {
    background-color: rgba(29, 43, 79, 1);
    color: #ffffff;
}


/* Адаптация корзины */
@media (max-width: 1440px) {
    .cart-page {
        padding: 170px 60px 50px 60px;
    }
}

@media (max-width: 1240px) {
    .cart-page {
        padding: 150px 40px 40px 40px;
    }

    .cart-page .cart-content {
        gap: 20px;
    }

    .cart-page .cart-content .items {
        padding: 0 18px;
    }

    .cart-page .cart-content .items .table-header,
    .cart-page .cart-content .items .item {
        grid-template-columns: 1fr 110px 120px 110px 45px;
    }

    .cart-page .cart-content .summary {
        width: 290px;
    }
}

@media (max-width: 1024px) {
    .cart-page {
        padding: 30px;
    }

    .cart-page h2 {
        font-size: 30px;
    }

    .cart-page .cart-content {
        flex-direction: column;
    }

    .cart-page .cart-content .summary {
        width: 100%;
    }

    .cart-page .cart-content .items {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .cart-page {
        padding: 25px 20px;
    }

    .cart-page .cart-content .items {
        border: none;
        padding: 0;
    }

    .cart-page .cart-content .items .table-header {
        display: none;
    }

    .cart-page .cart-content .items .item {
        grid-template-columns: auto 1fr auto auto;
        grid-template-areas:
            "image name  name  name"
            "image price price price"
            "line  line  line  line"
            "sum   sum   qty   del";
        align-items: center;
        column-gap: 12px;
        row-gap: 4px;
        border: 1px solid rgba(233, 236, 243, 1);
        border-radius: 12px;
        padding: 15px;
        margin-bottom: 15px;
    }

    .cart-page .cart-content .items .item:last-child {
        margin-bottom: 0;
        border: 1px solid rgba(233, 236, 243, 1);
    }

    /* Разделитель между товаром и суммой */
    .cart-page .cart-content .items .item::before {
        content: '';
        grid-area: line;
        height: 1px;
        background-color: rgba(233, 236, 243, 1);
        margin: 10px 0;
    }

    .cart-page .cart-content .items .item .product-info {
        display: contents;
    }

    .cart-page .cart-content .items .item .product-info .image {
        grid-area: image;
    }

    .cart-page .cart-content .items .item .product-info h3 {
        grid-area: name;
        align-self: end;
        white-space: normal;
    }

    .cart-page .cart-content .items .item .unit-price {
        grid-area: price;
        align-self: start;
        color: rgba(80, 90, 110, 1);
    }

    .cart-page .cart-content .items .item .unit-price::after {
        content: '/шт';
    }

    .cart-page .cart-content .items .item .sum {
        grid-area: sum;
    }

    .cart-page .cart-content .items .item .sum::before {
        content: 'Сумма: ';
        color: rgba(80, 90, 110, 1);
        font-weight: 400;
    }

    .cart-page .cart-content .items .item .quantity {
        grid-area: qty;
        justify-self: end;
    }

    .cart-page .cart-content .items .item .remove {
        grid-area: del;
    }

    .confirm .dialog {
        width: calc(100% - 40px);
        padding: 25px;
        box-sizing: border-box;
    }
}

html[lang="ro"] .cart-page .cart-content .items .item .unit-price::after {
    content: '/buc.';
}

html[lang="ro"] .cart-page .cart-content .items .item .sum::before {
    content: 'Suma: ';
}

@media (max-width: 480px) {
    .cart-page {
        padding: 20px 16px;
    }

    .cart-page h2 {
        font-size: 25px;
    }

    .cart-page .cart-title-count {
        display: block;
        padding-top: 5px;
    }

    .cart-page .cart-empty h3 {
        font-size: 26px;
    }

    .cart-page .cart-content .summary {
        padding: 20px;
    }
}

/* Компактная строка суммы на узких экранах */
@media (max-width: 360px) {
    .cart-page .cart-content .items .item {
        column-gap: 8px;
    }

    .cart-page .cart-content .items .item .quantity button {
        width: 28px;
    }

    .cart-page .cart-content .items .item .quantity .count {
        min-width: 20px;
    }

    .cart-page .cart-content .items .item .remove {
        width: 34px;
        height: 34px;
    }
}

@media (min-width: 1680px) {
    .cart-page {
        padding-left: 12%;
        padding-right: 12%;
    }
}
