/* Корзина — Zara-style layout поверх home-front overlay */
.pearl-cart-page {
    margin: 0;
    overflow-x: hidden;
}

/* Гамбургер и правое меню находятся в overlay — поднимаем его выше мобильной верхней панели */
.pearl-cart-page .pearl-home-overlay {
    z-index: 120 !important;
}

.pearl-cart-layout {
    padding: 110px 24px 80px;
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
}

/* Мобильная верхняя панель как на категориях */
.pearl-cart-page .pearl-cat-mobile-topbar {
    display: none;
    position: sticky;
    top: 0;
    /* выше overlay, но ниже гамбургера/кнопок */
    z-index: 135;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(6px);
}
@media (max-width: 768px) {
    .pearl-cart-page .pearl-right-menu { display: none !important; }
    .pearl-cart-page .pearl-cat-mobile-topbar { display: flex !important; }
    /* Верхняя панель должна быть у самого верха (не уезжать вниз из-за padding контейнера) */
    .pearl-cart-page .pearl-cat-mobile-topbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
    }
    .pearl-cart-layout { padding-top: 78px; }
}

/* Минимальные стили кнопок верхней панели в корзине */
.pearl-cart-page .pearl-cat-mobile-topbar {
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 10px 12px 10px 96px; /* слева место под гамбургер (шире, чтобы кнопки не перекрывали) */
}

/* Гамбургер должен быть поверх верхней панели */
@media (max-width: 768px) {
    .pearl-cart-page .pearl-hamburger {
        z-index: 140 !important;
        top: 14px !important;
        left: 14px !important;
    }
}
.pearl-cart-page .pearl-cat-toolbar-btn {
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 0;
    height: 34px;
    padding: 0 12px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    position: relative;
    z-index: 141;
}

/* На всякий случай: "Фильтр" должен быть выше гамбургера (если на узких экранах элементы пересеклись) */
.pearl-cart-page #pearl-cart-menu-trigger-mobile {
    z-index: 150;
}
.pearl-cart-page .pearl-cat-mobile-topbar-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    color: #000;
    text-decoration: none;
    position: relative;
}
.pearl-cart-page .pearl-cat-mobile-cart-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #000;
    color: #fff;
    font-size: 10px;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 999px;
}
.pearl-cart-page .pearl-view-icon {
    width: 14px;
    height: 14px;
    display: inline-block;
    border: 1px solid #111;
}

/* Убираем лишние заголовки WooCommerce (оставляем контент корзины) */
.pearl-cart-page .woocommerce-breadcrumb,
.pearl-cart-page .page-title,
.pearl-cart-page .woocommerce-products-header__title {
    display: none !important;
}

/* Центруем блок корзины, добавляем "воздух" */
.pearl-cart-page .woocommerce {
    max-width: 860px;
    margin: 0 auto;
}

.pearl-cart-page .woocommerce-cart-form {
    margin-top: 24px;
}

/* Таблица корзины как список, минималистично */
.pearl-cart-page table.shop_table {
    border: none;
    border-collapse: collapse;
}
.pearl-cart-page table.shop_table th,
.pearl-cart-page table.shop_table td {
    border: none;
    padding: 14px 0;
}
.pearl-cart-page table.shop_table tr {
    border-bottom: 1px solid #eee;
}

/* Zara-like: скрываем заголовки таблицы */
.pearl-cart-page table.shop_table thead,
.pearl-cart-page table.shop_table tfoot {
    display: none;
}

/* Десктоп корзина: карточки в сетке 1–3 в ряд с нормальными пропорциями фото */
@media (min-width: 769px) {
    /* Тело таблицы превращаем в grid, но служебные строки (actions) растягиваем на всю ширину */
    .pearl-cart-page .woocommerce-cart-form__contents tbody {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 22px 22px;
    }
    @media (max-width: 1200px) {
        .pearl-cart-page .woocommerce-cart-form__contents tbody {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }
    }

    .pearl-cart-page .woocommerce-cart-form__contents tbody tr.cart_item {
        border: 1px solid #eee;
        padding: 14px;
        background: #fff;
        display: block;
    }
    .pearl-cart-page .woocommerce-cart-form__contents tbody tr.actions,
    .pearl-cart-page .woocommerce-cart-form__contents tbody tr:not(.cart_item) {
        grid-column: 1 / -1;
        border: none !important;
        padding: 0 !important;
        background: transparent !important;
    }

    .pearl-cart-page .woocommerce-cart-form__contents tbody tr.cart_item td {
        padding: 0;
        border: none;
        display: block;
        width: 100%;
    }

    /* Remove сверху справа */
    .pearl-cart-page .woocommerce-cart-form__contents tbody tr.cart_item td.product-remove {
        position: absolute;
        top: 10px;
        right: 10px;
        width: auto;
    }
    .pearl-cart-page .woocommerce-cart-form__contents tbody tr.cart_item {
        position: relative;
    }
    .pearl-cart-page td.product-remove a.remove {
        width: 26px;
        height: 26px;
        line-height: 26px;
        text-align: center;
        border-radius: 0;
        color: #000 !important;
        text-decoration: none;
        font-size: 18px;
        display: inline-block;
    }

    /* Большое фото как в каталоге, пропорции 3:4 */
    .pearl-cart-page td.product-thumbnail,
    .pearl-cart-page td.product-thumbnail a {
        display: block !important;
        width: 100%;
    }
    .pearl-cart-page td.product-thumbnail img {
        width: 100% !important;
        max-width: 100% !important;
        aspect-ratio: 3 / 4;
        height: auto !important;
        object-fit: cover;
        display: block;
    }

    .pearl-cart-page td.product-name {
        margin-top: 10px;
    }
    .pearl-cart-page td.product-name a {
        display: block;
        text-decoration: none;
        color: #000;
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        line-height: 1.35;
    }
    .pearl-cart-page td.product-price,
    .pearl-cart-page td.product-subtotal {
        margin-top: 8px;
        white-space: nowrap;
        font-size: 12px;
    }
    .pearl-cart-page td.product-quantity {
        margin-top: 10px;
    }
    .pearl-cart-page td.product-quantity input.qty {
        width: 72px;
        border-radius: 0;
    }
}

/* Мобильная корзина: плитки 1/2/3 в ряд (управляется .pearl-cart-view-*) */
@media (max-width: 768px) {
    .pearl-cart-page table.shop_table,
    .pearl-cart-page table.shop_table tbody,
    .pearl-cart-page table.shop_table tr,
    .pearl-cart-page table.shop_table td {
        display: block;
        width: 100%;
    }

    .pearl-cart-page .woocommerce-cart-form__contents tbody {
        display: grid;
        gap: 14px;
    }
    .pearl-cart-page.pearl-cart-view-1 .woocommerce-cart-form__contents tbody { grid-template-columns: 1fr; }
    .pearl-cart-page.pearl-cart-view-2 .woocommerce-cart-form__contents tbody { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pearl-cart-page.pearl-cart-view-3 .woocommerce-cart-form__contents tbody { grid-template-columns: repeat(3, minmax(0, 1fr)); }

    .pearl-cart-page .woocommerce-cart-form__contents tbody tr.cart_item {
        position: relative;
        border: 1px solid #eee;
        padding: 10px;
        margin: 0;
        background: #fff;
    }

    .pearl-cart-page td.product-remove {
        position: absolute;
        top: 6px;
        right: 6px;
        width: auto;
    }
    .pearl-cart-page td.product-remove a.remove {
        width: 22px;
        height: 22px;
        line-height: 22px;
        text-align: center;
        border-radius: 0;
        color: #000 !important;
        text-decoration: none;
        font-size: 18px;
    }

    .pearl-cart-page td.product-thumbnail {
        width: 100%;
        margin: 0 0 8px;
        display: block !important;
    }
    .pearl-cart-page td.product-thumbnail a {
        display: block !important;
    }
    .pearl-cart-page td.product-thumbnail img {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        display: block;
        object-fit: cover;
    }

    .pearl-cart-page td.product-name {
        margin: 0 0 8px;
    }
    .pearl-cart-page td.product-name a {
        display: block;
        text-decoration: none;
        color: #000;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        line-height: 1.35;
    }

    .pearl-cart-page td.product-price,
    .pearl-cart-page td.product-subtotal {
        display: none; /* итоги остаются в блоке totals */
    }

    .pearl-cart-page td.product-quantity {
        margin-top: 8px;
    }
    .pearl-cart-page td.product-quantity input.qty {
        width: 64px;
        border-radius: 0;
    }
}

.pearl-cart-page .cart_totals {
    margin-top: 24px;
    border-top: 1px solid #eee;
    padding-top: 18px;
}

.pearl-cart-page .wc-proceed-to-checkout a.checkout-button {
    border-radius: 0 !important;
    background: #000 !important;
    color: #fff !important;
    border: 1px solid #000 !important;
    padding: 14px 16px !important;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 12px;
}

@media (max-width: 768px) {
    .pearl-cart-layout {
        padding: 90px 16px 56px;
    }
    .pearl-cart-page .woocommerce {
        max-width: 100%;
    }
}

