/* public/css/cart.css */

.cart-page {
    text-align: center;
    width: 100%;
    max-width: 1200px;
    /* Ограничим ширину, чтобы не разлеталось на 1920px */
    margin: 50px auto;
    padding: 0 20px;
    position: relative;
    font-family: 'Helvetica', 'Arial', sans-serif;
    min-height: 80vh;
}

h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 30px;
    text-transform: uppercase;
}

/* --- СЕТКА ТОВАРОВ И ИТОГА --- */
.cart-layout {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

@media(min-width: 1024px) {
    .cart-layout {
        flex-direction: row;
        align-items: flex-start;
    }
}

/* Товары */
.cart-items-column {
    flex: 1;
    width: 100%;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid #ccc;
}

.cart-item:first-child {
    border-top: 1px solid #ccc;
}

.cart-item-image {
    width: 85px;
    min-width: 85px;
    height: 110px;
    object-fit: cover;
    margin-right: 20px;
}

.cart-item-info {
    display: flex;
}

.cart-item-info1 {
    display: flex;
    flex-direction: column;
    min-width: 220px;
    text-align: left;
    margin: 0px 35px;
}

.cart-item-info1 p {
    margin: 3px 0;
}

.cart-item-info1 a {
    text-decoration: none;
    color: #000;
    font-weight: 700;
    font-size: 16px;
}

.cart-item-info1-color {
    color: #777;
    font-size: 13px;
}

.cart-item-quantity {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    max-width: 30px;
    min-width: 30px;
    text-align: center;
    margin: 0px 50px 0px 0px;
}

.cart-item-quantity button {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 0 10px;
}

.cart-item-quantity span {
    font-size: 16px;
    font-weight: bold;
    width: 20px;
    text-align: center;
}

.product-price-center {
    align-items: center;
    display: flex;
    min-width: 220px;
    padding: 0px 50px 0px 30px;
}

.product-new-price1 {
    display: block;
    font-weight: 700;
    color: #000;
    font-size: 16px;
}

.product-new-price1.discounted {
    color: #d32f2f;
}

.product-old-price1 {
    text-decoration: line-through;
    color: #999;
    font-size: 13px;
    margin-left: 5px;
}

.remove-item {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    margin-left: 10px;
}

/* Сайдбар (Итог) */
.cart-order-details1 {
    width: 100%;
    max-width: 350px;
}

.cart-order-details {
    align-content: center;
    align-items: center;
    background-color: #fcfcfc;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-left: 35px;
    min-width: 215px;
    padding: 50px 35px;
}

.cart-order-details h2 {
    margin-top: 0;
    font-size: 20px;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 20px;
}

.cart-order-details-price {
    border-top: 1px solid #ccc;
    padding: 15px 0;
}

.cart-order-details-price1 {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 5px;
}

#total-price-display {
    font-size: 22px;
    font-weight: bold;
    color: #000;
    margin: 0;
}

.cart-order-details-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    margin-bottom: 10px;
    box-sizing: border-box;
}

.cart-order-details button {
    width: 100%;
    background: #000;
    color: #fff;
    border: none;
    padding: 12px;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
}

.cart-order-details button:hover {
    background: #333;
}

/* =========================================
   ОФОРМЛЕНИЕ ЗАКАЗА (3 КОЛОНКИ)
   ========================================= */
.cart-summary {
    width: 100%;
    margin-top: 60px;
    border: 1px solid #ccc;
    padding: 40px;
    box-sizing: border-box;
    text-align: left;
}

.cart-summary h3 {
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 50px;
    text-transform: uppercase;
}

/* СЕТКА GRID - РОВНО 3 КОЛОНКИ */
.checkout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    /* Три равные колонки */
    gap: 40px;
    /* Отступ между колонками */
    align-items: start;
}

.checkout-col h4 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 25px;
    text-transform: uppercase;
    color: #000;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Поля ввода (Input) */
.form-group {
    margin-bottom: 25px;
    position: relative;
}

.form-input {
    width: 100%;
    padding: 10px 0;
    border: none;
    border-bottom: 1px solid #ccc;
    background: transparent;
    font-size: 14px;
    color: #000;
    outline: none;
    border-radius: 0;
    font-family: inherit;
}

.form-input:focus {
    border-bottom-color: #000;
}

.form-input::placeholder {
    color: #999;
}

/* --- КАСТОМНЫЙ SELECT (ВЫПАДАЮЩИЙ СПИСОК) --- */
.custom-select-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 25px;
    font-family: inherit;
}

.custom-select-wrapper select {
    display: none;
}

/* Скрываем нативный селект */

/* Заголовок селекта (то, что видит юзер) */
.select-selected {
    background-color: transparent;
    border-bottom: 1px solid #ccc;
    padding: 10px 0;
    cursor: pointer;
    font-size: 14px;
    color: #000;
    position: relative;
}

/* Стрелочка */
.select-selected:after {
    content: "";
    position: absolute;
    top: 45%;
    right: 5px;
    width: 6px;
    height: 6px;
    border-right: 1px solid #000;
    border-bottom: 1px solid #000;
    transform: rotate(45deg) translateY(-50%);
    transition: transform 0.2s;
}

.select-selected.select-arrow-active:after {
    transform: rotate(225deg) translateY(-50%);
    top: 50%;
}

/* Если disabled */
.select-selected.select-disabled {
    color: #999;
    border-bottom: 1px solid #e0e0e0;
    cursor: default;
}

.select-selected.select-disabled:after {
    border-color: #ccc;
}

/* Выпадающий список (Контейнер) */
.select-items {
    position: absolute;
    background-color: #fff;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 999;
    border: 1px solid #e0e0e0;
    border-top: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    max-height: 250px;
    overflow-y: auto;
}


.select-hide {
    display: none;
}

/* Пункты списка */
.select-items div {
    color: #000;
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f9f9f9;
    font-size: 14px;
}

.select-items div:hover,
.same-as-selected {
    background-color: #f0f0f0;
}

/* --- РАДИО КНОПКИ --- */
.radio-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 30px;
    margin-bottom: 15px;
    cursor: pointer;
    font-size: 14px;
    user-select: none;
}

.radio-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 18px;
    width: 18px;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 50%;
}

.radio-container:hover input~.checkmark {
    background-color: #eee;
}

.radio-container input:checked~.checkmark {
    background-color: #000;
    border-color: #000;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.radio-container input:checked~.checkmark:after {
    display: block;
}

.radio-container .checkmark:after {
    top: 5px;
    left: 5px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: white;
}

/* Комментарий и Кнопка */
.order-comments textarea {
    width: 100%;
    background-color: transparent;
    border: none;
    border-bottom: 1px solid #ccc;
    resize: none;
    outline: none;
    padding: 10px 0;
    font-family: inherit;
}

.submit-wrap {
    text-align: center;
    margin-top: 40px;
}

.submit-btn {
    background: #000;
    color: #fff;
    padding: 15px 40px;
    border: none;
    font-weight: bold;
    font-size: 14px;
    text-transform: uppercase;
    cursor: pointer;
    letter-spacing: 1px;
}

.submit-btn:hover {
    background: #333;
}

/* Пустая корзина */
.empty-cart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.empty-cart-icon {
    width: 80px;
    height: 80px;
    opacity: 0.3;
    margin-bottom: 20px;
}

.go-to-catalog-button {
    background: #000;
    color: #fff;
    padding: 12px 30px;
    text-decoration: none;
    text-transform: uppercase;
    font-weight: bold;
    margin-top: 15px;
}

/* Модалка */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-window {
    background: #fff;
    padding: 40px;
    width: 90%;
    max-width: 400px;
    text-align: center;
}

.modal-btn {
    background: #000;
    color: #fff;
    border: none;
    padding: 5px 20px;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    margin-top: 20px;
}

/* Поле ввода, которое выглядит как селект */
input.select-selected {
    padding: 12px 15px;
    width: 100%;
    font-size: 14px;
    cursor: text;
    border-radius: 4px;
    outline: none;
    
    /* Стрелочка справа */
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 10px;
}

/* Когда список открыт */
input.select-selected.active {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-color: #000;
}

/* Выпадающий список */
.select-items {
    position: absolute;
    background-color: #fff;
    border: 1px solid #ddd;
    border-top: none;
    z-index: 99;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 250px; /* Ограничение высоты */
    overflow-y: auto;  /* Скролл */
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Скрытый список */
.select-hide {
    display: none;
}

/* Пункты списка */
.select-items div {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f1f1f1;
    font-size: 14px;
}

.select-items div:hover, 
.same-as-selected {
    background-color: #f1f1f1;
}

/* Если селект выключен */
input.select-selected:disabled {
    background-color: #f9f9f9;
    cursor: not-allowed;
    opacity: 0.7;
}

/* АДАПТИВ */
@media (max-width: 1024px) {
    .checkout-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .cart-layout {
        flex-direction: column;
    }

    .cart-order-details1 {
        max-width: 85%;
        margin: 0 auto;
    }
}

@media screen and (max-width: 1024px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="password"],
    input[type="search"],
    textarea,
    select {
        font-size: 16px !important; /* Магическое число для iOS */
        transform: scale(1); /* Иногда помогает предотвратить микро-зум */
    }
}

/* Общие стили для мобильных устройств */
@media (max-width: 1024px) {
    .cart-page {
        margin: 90px auto;
        padding: 0 15px;
    }

    .cart-layout {
        flex-direction: column;
        width: 100%;
    }

    .cart-item {
        display: grid;
        grid-template-columns: 80px 1fr;
        gap: 15px;
        padding: 15px 0;
        border-bottom: 1px solid #e0e0e0;
        position: relative;
        width: 100%;
    }

    .quantity-display {
        margin: 0 10px;
        font-size: 16px;
    }

    .cart-item-image {
        width: 80px;
        height: 100px;
        object-fit: cover;
    }

    .cart-item-name {
        font-size: 16px;
        font-weight: bold;
        margin-bottom: 5px;
    }

    .cart-item-price {
        font-size: 16px;
        font-weight: bold;
        margin-top: 5px;
    }

    .cart-item-old-price {
        font-size: 12px;
        color: #999;
        text-decoration: line-through;
        margin-left: 5px;
    }


    .cart-item-info {
        font-size: 12px;
        color: #666;
        margin-bottom: 5px;
        display: flex;
        justify-content: space-around;
    }

    .cart-item-info1 {
        margin: 10px 0;
        min-width: 115px;
        max-width: 130px;
    }

    .product-price-center {
        padding: 10px 0;
        min-width: 65px;
        justify-content: center;
        flex-direction: column;
    }

    .cart-item-quantity {
        justify-content: space-between;
        width: 100%;
        margin: 10px 0;
        align-items: center;
    }

    .product-new-price1 {
        font-size: 14px;
    }

    .product-new-price1.discounted {
        color: rgb(235, 0, 28);
    }

    .product-old-price1 {
        font-size: 12px;
    }

    .product-price-center1 {
        flex-direction: column;
    }

    .cart-order-details {
        margin-left: 0;
        margin-top: 20px;
        padding: 20px;
    }

    .cart-summary {
        padding: 15px;
    }

    .order-details-columns {
        flex-direction: column;
    }

    .order-column {
        margin: 10px 0;
    }

    .comment-box {
        width: 100%;
    }

    .cart-order-details-input {
        margin: 20px 0px 10px 0px;
        padding: 10px;
        border: 1px solid #ccc;
        outline: none;
        font-size: 16px;
        /* Фиксированный размер шрифта */
        width: calc(100% - 22px);
        /* Учитываем border и padding */
        transition: none;
        /* Отключаем все анимации */
        -webkit-appearance: none;
        /* Отключаем стандартные стили для iOS */
        -moz-appearance: none;
        appearance: none;
    }

    .cart-order-details-input:focus {
        border: 1px solid #888;
        /* Немного темнее граница при фокусе */
        box-shadow: none;
        /* Убираем тень при фокусе */
    }

    /* Убедимся, что кнопка применения промокода также не меняет размер */
    .cart-order-details button {
        font-size: 16px;
        /* Фиксированный размер шрифта */
        transition: background-color 0.3s ease;
        /* Только анимация цвета фона */
    }

    .cart-order-details-input,
    .cart-order-details button {
        width: 100%;
        box-sizing: border-box;
    }

    .order-column input[type="text"] {
        font-size: 16px;
        /* Гарантируем, что размер шрифта не меняется на мобильных */
    }
}

/* Стили для планшетов */
@media (min-width: 769px) and (max-width: 1024px) {
    .cart-layout {
        align-items: center;
    }

    .cart-order-details-input,
    .cart-order-details button {
        width: 45%;
        box-sizing: border-box;
    }

    .cart-summary {}

    .cart-item-image {
        margin-right: 20px;
    }

    .cart-items-column {
        width: 85%;
        display: flex;
        flex-direction: column;
        align-items: center;
        margin: 0 auto;
    }

    .cart-item {
        margin: 0 auto;
        align-items: center;
    }

    .cart-item-info1 {
        min-width: 150px;
    }

    .product-price-center {
        padding: 0 20px;
        min-width: 150px;
    }
}

//* ==========================================================================
   FINAL ADAPTIVE (iPhone SE + Staff Style)
   Вставить в конец public/css/cart.css
   ========================================================================== */

/* -------------------------------------------------------------------------
   1. МОБИЛЬНЫЙ ВЕРТИКАЛЬНЫЙ (Portrait) - < 640px
   Стиль: Как на скрине Staff (Вертикальный +/-, Мусорка справа)
   ------------------------------------------------------------------------- */
@media screen and (max-width: 640px) {
    
    /* Отступы страницы */
    .cart-page {
        margin: 20px auto 50px;
        padding: 0 15px;
        width: 100%;
        box-sizing: border-box;
    }

    .cart-layout {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    /* --- КАРТОЧКА ТОВАРА --- */
    .cart-item {
        display: grid;
        /* Сетка: Картинка (90px) | Отступ (15px) | Инфо (Остаток) */
        grid-template-columns: 90px 15px 1fr;
        padding: 20px 0;
        border-bottom: 1px solid #e0e0e0;
        align-items: stretch; /* Растягиваем на всю высоту */
        position: relative;
    }

    /* Картинка */
    .cart-item-image {
        width: 100%;
        height: 130px; /* Высокая, как на скрине */
        object-fit: cover;
        margin: 0;
    }

    /* ПРАВАЯ ЧАСТЬ (ИНФО) */
    .cart-item-info {
        display: grid;
        width: 100%;
        /* СЕТКА ПРАВОЙ ЧАСТИ:
           Верх: Текст (на всю ширину)
           Низ:  Кол-во | Цена (растягивается) | Мусорка
        */
        grid-template-rows: auto 1fr; 
        grid-template-columns: auto 1fr auto; 
        grid-template-areas: 
            "info info info"
            "qty price trash";
        align-items: center; /* Центрирование по вертикали */
        margin: 0;
    }

    /* 1. ТЕКСТ (Название, размер) */
    .cart-item-info1 {
        grid-area: info;
        margin: 0 0 10px 0;
        width: 100%;
        align-self: start; /* Прижать к верху */
    }

    .cart-item-info1 a {
        font-size: 15px;
        font-weight: 700;
        line-height: 1.3;
        display: block;
        margin-bottom: 4px;
        color: #000;
    }

    .cart-item-info1 p {
        margin: 2px 0;
        font-size: 13px;
        color: #666;
    }

    /* 2. КОЛИЧЕСТВО (ВЕРТИКАЛЬНО) */
    .cart-item-quantity {
        grid-area: qty;
        display: flex;
        flex-direction: column-reverse !important; /* Плюс сверху, минус снизу */
        align-items: center;
        justify-content: space-between; /* РАВНОЕ РАССТОЯНИЕ */
        
        /* Важно: задаем высоту, чтобы space-between сработал */
        height: 70px; 
        width: 30px;
        
        margin: 0 15px 0 0; /* Отступ справа от цифр до цены */
        padding: 0;
        border: none;
        background: transparent;
    }

    .cart-item-quantity button {
        font-size: 24px;
        font-weight: 300;
        padding: 0;
        height: 24px;
        width: 100%;
        line-height: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #000;
        border: none;
        background: transparent;
    }

    .cart-item-quantity span {
        font-size: 16px;
        font-weight: 700;
        color: #000;
    }

    /* 3. ЦЕНА (Красная, по центру свободного места) */
    .product-price-center {
        grid-area: price;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: flex-start; /* Прижата к блоку количества */
        padding: 0;
        margin: 0;
    }

    .product-new-price1 {
        font-size: 18px;
        font-weight: 700;
        color: #d32f2f; /* Красный */
        display: block;
    }

    .product-old-price1 {
        font-size: 13px;
        color: #999;
        text-decoration: line-through;
    }

    /* 4. МУСОРКА (В САМОМ ПРАВОМ УГЛУ) */
    .remove-item {
        grid-area: trash;
        justify-self: end; /* Прижимает в самый конец сетки */
        background: transparent;
        border: none;
        padding: 10px; /* Удобно нажимать */
        margin: 0 -10px 0 0; /* Компенсация padding справа */
        display: flex;
        align-items: center;
    }
    
    .remove-item svg {
        width: 20px;
        height: 20px;
        fill: #333;
    }

    /* Оформление заказа (1 колонка) */
    .checkout-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .cart-items-column, 
    .cart-order-details1,
    .cart-order-details {
        width: 100%;
        box-sizing: border-box;
    }
    
    .cart-order-details {
        padding: 20px;
    }
    
    .submit-btn {
        width: 100%;
        padding: 18px;
    }
}

/* -------------------------------------------------------------------------
   2. ЛАНДШАФТ И ПЛАНШЕТЫ (> 640px)
   Стиль: Горизонтальный (как на старом сайте)
   ------------------------------------------------------------------------- */
@media screen and (min-width: 641px) and (max-width: 1024px) {
    
    .cart-page {
        margin: 30px auto;
        padding: 0 20px;
    }

    .cart-layout {
        display: flex;
        flex-direction: column;
        gap: 30px;
    }

    .cart-item {
        display: grid;
        /* Жесткая строка: Фото | Инфо | Кол-во | Цена | Мусорка */
        grid-template-columns: 90px 1fr 110px 100px 40px;
        gap: 20px;
        align-items: center;
        padding: 20px 0;
        border-bottom: 1px solid #e0e0e0;
    }

    .cart-item-image {
        width: 90px;
        height: 110px;
        object-fit: cover;
        margin: 0;
    }

    .cart-item-info {
        display: contents; /* Разворачиваем детей в сетку родителя */
    }

    /* Текст */
    .cart-item-info1 {
        margin: 0;
        text-align: left;
    }
    .cart-item-info1 a { font-size: 16px; margin-bottom: 5px; display: block; }

    /* Кол-во (Горизонтально) */
    .cart-item-quantity {
        display: flex;
        flex-direction: row !important;
        align-items: center;
        justify-content: space-between;
        border-radius: 4px;
        height: 40px;
        width: 100%;
        margin: 0;
        padding: 0 5px;
    }
    
    .cart-item-quantity button {
        font-size: 20px;
        height: 100%;
        display: flex;
        align-items: center;
    }

    /* Цена */
    .product-price-center {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 0;
        margin: 0;
    }
    .product-new-price1 { font-size: 16px; color: #000; font-weight: 700; }

    /* Мусорка */
    .remove-item {
        margin: 0;
        display: flex;
        justify-content: center;
    }
    
    .checkout-grid {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
    }
}

/* =========================================
   STREET SEARCH DROPDOWN STYLES
   ========================================= */

/* Container for the courier input */
#courier-block {
    position: relative; 
}

/* The Dropdown List itself */
#streets-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 9999; /* Very high z-index to sit on top of everything */
    background-color: #fff;
    border: 1px solid #000; /* Black border to match your design */
    border-top: none;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

/* Items inside the dropdown */
#streets-dropdown div {
    padding: 12px 15px;
    cursor: pointer;
    font-size: 14px;
    color: #000;
    border-bottom: 1px solid #f1f1f1;
    background-color: #fff;
    text-align: left; /* Ensure text aligns left */
}

/* Hover effect */
#streets-dropdown div:hover {
    background-color: #f0f0f0;
}

/* Ensure the hidden class works with high specificity */
.select-hide {
    display: none !important;
}

/* Optional: Loading state style if you want to add it later */
.street-loading {
    color: #999;
    font-style: italic;
    padding: 10px;
}