/* Страница категории — конструктор блоков */
.pearl-category-page { margin: 0; overflow-x: hidden; }

/* Оверлей как на главной: гамбургер слева, меню вертикально справа (переопределяем возможные конфликты) */
.pearl-category-page .pearl-home-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    pointer-events: none;
    z-index: 100 !important;
}
.pearl-category-page .pearl-hamburger {
    display: flex !important;
    visibility: visible !important;
    position: fixed !important;
    top: 24px !important;
    left: 24px !important;
    z-index: 102 !important;
    pointer-events: auto !important;
}
.pearl-category-page .pearl-right-menu {
    display: flex !important;
    flex-direction: column !important;
    position: fixed !important;
    top: 124px !important;
    right: 24px !important;
    left: auto !important;
    align-items: flex-end !important;
    gap: 16px !important;
    z-index: 101 !important;
}
.pearl-category-page .pearl-right-menu,
.pearl-category-page .pearl-right-menu .pearl-right-item {
    pointer-events: auto !important;
}
.pearl-category-page .pearl-right-menu .pearl-right-item {
    display: block !important;
}

/* ---------- Страница поиска (Zara): без лого и без верхнего меню Shop/About Us/Корзина ---------- */
.pearl-search-page .site-header { display: none !important; }
.pearl-search-page .pearl-home-overlay {
    position: fixed !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    pointer-events: none;
    z-index: 100 !important;
}
.pearl-search-page .pearl-hamburger {
    display: flex !important;
    visibility: visible !important;
    position: fixed !important;
    top: 24px !important; left: 24px !important;
    z-index: 102 !important;
    pointer-events: auto !important;
}
.pearl-search-page .pearl-right-menu {
    display: flex !important;
    flex-direction: column !important;
    position: fixed !important;
    top: 124px !important; right: 24px !important; left: auto !important;
    align-items: flex-end !important;
    gap: 16px !important;
    z-index: 101 !important;
    pointer-events: auto !important;
}
.pearl-search-page .pearl-right-menu .pearl-right-item {
    pointer-events: auto !important;
    display: block !important;
}
.pearl-search-layout {
    display: flex;
    min-height: 100vh;
    padding-top: 80px;
}
/* Левый блок категорий/фильтров на странице поиска — липкий при скролле (как на категориях) */
.pearl-search-page .pearl-category-sidebar {
    flex-shrink: 0;
    width: 200px;
    padding: 24px 24px 48px 7vw;
}
@media (min-width: 1025px) {
    .pearl-search-page .pearl-category-sidebar {
        position: sticky;
        top: 80px;
        align-self: flex-start;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }
}
.pearl-search-main {
    flex: 1;
    min-width: 0;
    padding: 24px 7vw 80px 48px;
    display: flex;
    flex-direction: column;
}
/* Блок поиска всегда виден; результаты выводятся ниже */
.pearl-search-header {
    flex-shrink: 0;
}
/* «Что вы ищете?» и строка поиска — по центру блока */
.pearl-search-title {
    font-size: 14px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 16px 0;
    color: #000;
    text-align: center;
}
.pearl-search-form-center {
    margin-bottom: 100px;
    text-align: center;
}
.pearl-search-form-center .pearl-search-input {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    display: block;
    padding: 12px 0;
    border: none;
    border-bottom: 1px solid #000;
    font-size: 14px;
    background: transparent;
    outline: none;
}
.pearl-search-form-center .pearl-search-input::placeholder {
    color: #999;
}
/* Сетка товаров на всю ширину центральной колонки */
.pearl-search-main .pearl-cat-products-grid {
    width: 100%;
}
@media (max-width: 768px) {
    .pearl-search-layout { flex-direction: column; padding-top: 70px; }
    /* На мобильной — верхняя панель как на категории; правое меню скрыто */
    .pearl-search-page .pearl-right-menu {
        display: none !important;
    }
    .pearl-search-page .pearl-cat-mobile-topbar {
        display: flex !important;
        order: -1;
    }
    .pearl-search-page .pearl-category-sidebar {
        display: none !important;
    }
    .pearl-search-main { padding: 16px 16px 48px; }
    .pearl-search-form-center { margin-bottom: 48px; }
    .pearl-search-page .pearl-cat-products-cols-3 ul.products { grid-template-columns: repeat(2, 1fr); }
    .pearl-search-page #pearl-search-products-block.pearl-view-1 .pearl-cat-products-grid ul.products { grid-template-columns: 1fr; }
    .pearl-search-page #pearl-search-products-block.pearl-view-2 .pearl-cat-products-grid ul.products { grid-template-columns: repeat(2, 1fr); }
    .pearl-search-page #pearl-search-products-block.pearl-view-3 .pearl-cat-products-grid ul.products { grid-template-columns: repeat(3, 1fr); }
}

.pearl-category-constructor-layout {
    display: flex;
    min-height: 100vh;
}
.pearl-category-constructor-layout .pearl-category-sidebar {
    flex-shrink: 0;
}
.pearl-category-constructor-layout .pearl-category-root {
    flex: 1;
    min-width: 0;
}
.pearl-category-root {
    padding: 0;
    padding-top: 0;
}
/* Блок на весь экран */
.pearl-cat-block-fullscreen {
    min-height: 100vh;
    width: 100%;
    background-size: cover;
    background-position: center;
    background-color: #f0f0f0;
    position: relative;
}
.pearl-cat-block-fullscreen .pearl-cat-block-link {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
}
/* 2 в ряд */
.pearl-cat-block-half {
    display: flex;
    min-height: 100vh;
    width: 100%;
}
.pearl-cat-block-half .pearl-cat-half-cell {
    flex: 1;
    min-height: 100vh;
    background-size: cover;
    background-position: center;
    background-color: #eee;
    position: relative;
}
.pearl-cat-block-half .pearl-cat-half-cell a {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
}
/* 3 в ряд */
.pearl-cat-block-third {
    display: flex;
    min-height: 100vh;
    width: 100%;
}
.pearl-cat-block-third .pearl-cat-third-cell {
    flex: 1;
    min-height: 100vh;
    background-size: cover;
    background-position: center;
    background-color: #eee;
}
/* Сетка товаров */
.pearl-cat-block-products {
    padding: 40px 24px 60px;
    max-width: 1400px;
    margin: 0;
}
.pearl-cat-toolbar {
    display: none;
}
.pearl-cat-toolbar-btn {
    border: 1px solid #000;
    background: #fff;
    padding: 6px 10px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
}
.pearl-cat-toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.pearl-cat-toolbar-link {
    text-decoration: none;
    color: #000;
}
.pearl-cat-toolbar-link:hover {
    text-decoration: underline;
}
.pearl-cat-products-grid {
    display: block;
    gap: 24px;
}
.pearl-cat-products-grid ul.products {
    display: grid;
    gap: 24px;
    list-style: none;
    margin: 0;
    padding: 0;
}
/* WooCommerce может навязывать размеры/float для li.product — сбрасываем для нашей grid-сетки */
.pearl-cat-products-grid ul.products > li.product {
    float: none !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    clear: none !important;
}
/* Удаляем служебные before/after WooCommerce, чтобы они не занимали первую ячейку grid */
.pearl-cat-products-grid ul.products::before,
.pearl-cat-products-grid ul.products::after {
    content: none !important;
}
.pearl-cat-products-cols-2 ul.products { grid-template-columns: repeat(2, 1fr); }
.pearl-cat-products-cols-3 ul.products { grid-template-columns: repeat(3, 1fr); }
.pearl-cat-products-cols-4 ul.products { grid-template-columns: repeat(4, 1fr); }
/* Режимы вида на мобильных: 1 / 2 / 3 в ряд */
@media (max-width: 768px) {
    .pearl-cat-block-products.pearl-view-1 .pearl-cat-products-grid ul.products { grid-template-columns: repeat(1, 1fr); gap: 16px; }
    .pearl-cat-block-products.pearl-view-2 .pearl-cat-products-grid ul.products { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .pearl-cat-block-products.pearl-view-3 .pearl-cat-products-grid ul.products { grid-template-columns: repeat(3, 1fr); gap: 12px; }
}
@media (max-width: 768px) {
    .pearl-cat-products-cols-2 ul.products,
    .pearl-cat-products-cols-3 ul.products,
    .pearl-cat-products-cols-4 ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    .pearl-cat-block-products { padding: 24px 16px 40px; }
}
.pearl-cat-products-load-more {
    text-align: center;
    padding: 32px 16px;
    cursor: pointer;
    position: relative;
    z-index: 1;
}
.pearl-cat-products-load-more .pearl-cat-loading-text {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #666;
    cursor: pointer;
    pointer-events: none;
}
.pearl-cat-products-load-more .pearl-cat-loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2px solid #ccc;
    border-top-color: #000;
    border-radius: 50%;
    animation: pearl-spin 0.8s linear infinite;
}

/* Быстрое добавление в корзину (+) в правом нижнем углу карточки */
.product-card {
    position: relative;
}
.product-quick-add {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #000;
    background: #fff;
    color: #000;
    font-size: 20px;
    line-height: 30px;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}
.product-quick-add:hover {
    background: #000;
    color: #fff;
}

/* Режим 3 в ряд (как Zara): только цена и + под фото, без названия — цена, под ней + */
.pearl-cat-block-products.pearl-view-3 .product-card {
    display: flex;
    flex-direction: column;
}
.pearl-cat-block-products.pearl-view-3 .product-card > a:first-of-type {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}
.pearl-cat-block-products.pearl-view-3 .product-title {
    display: none;
}
.pearl-cat-block-products.pearl-view-3 .product-quick-add {
    position: static;
    margin-top: 8px;
    align-self: center;
}
.pearl-cat-block-products.pearl-view-3 .product-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 8px;
}

/* Режим 2 в ряд (как Zara): название тонким шрифтом без отступов, + в один ряд с названием */
.pearl-cat-block-products.pearl-view-2 .product-card {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
}
.pearl-cat-block-products.pearl-view-2 .product-card > a:first-of-type {
    display: contents;
}
.pearl-cat-block-products.pearl-view-2 .product-card .product-info {
    display: contents;
}
.pearl-cat-block-products.pearl-view-2 .product-card .product-image {
    grid-column: 1 / -1;
}
.pearl-cat-block-products.pearl-view-2 .product-card .product-title {
    grid-column: 1;
    grid-row: 2;
    font-weight: 300;
    padding-left: 0;
    padding-right: 0;
    margin: 0 0 4px 0;
}
.pearl-cat-block-products.pearl-view-2 .product-card .product-quick-add {
    grid-column: 2;
    grid-row: 2;
    align-self: start;
    position: static;
    margin-left: 8px;
}
.pearl-cat-block-products.pearl-view-2 .product-card .product-price {
    grid-column: 1 / -1;
    grid-row: 3;
}
.pearl-cat-block-products.pearl-view-2 .product-info {
    padding-left: 0;
    padding-right: 0;
}

@keyframes pearl-spin {
    to { transform: rotate(360deg); }
}

/* Сайдбар в стиле Zara: отступы слева, нумерация | 01 |, | 02 | … */
.pearl-category-constructor-layout .pearl-category-sidebar {
    width: 280px;
    padding: 24px 20px 40px 88px;
    border-right: 1px solid #eee;
    background: #fff;
}
.pearl-cat-sidebar-zara .pearl-cat-sidebar-list-numbered {
    list-style: none;
    margin: 0;
    padding: 0;
}
.pearl-cat-sidebar-zara .pearl-cat-sidebar-item {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 12px;
    min-height: 24px;
}
.pearl-cat-sidebar-zara .pearl-cat-sidebar-num {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #000;
}
.pearl-cat-sidebar-zara .pearl-cat-sidebar-list a {
    font-size: 14px;
    color: #000;
    text-decoration: none;
}
.pearl-cat-sidebar-zara .pearl-cat-sidebar-list a:hover { text-decoration: underline; }
.pearl-cat-sidebar-zara .pearl-cat-sidebar-item-filters .pearl-cat-filters-trigger {
    display: inline;
    width: auto;
    padding: 0;
    font-size: 14px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: none;
    border: none;
    cursor: pointer;
    color: #000;
    text-align: left;
}
.pearl-cat-sidebar-zara .pearl-cat-sidebar-item-filters .pearl-cat-filters-trigger:hover { text-decoration: underline; }
.pearl-cat-filter-drawer {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1000;
    pointer-events: none;
    visibility: hidden;
}
.pearl-cat-filter-drawer.open { pointer-events: auto; visibility: visible; }
.pearl-cat-filter-drawer-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.25s ease;
}
.pearl-cat-filter-drawer.open .pearl-cat-filter-drawer-backdrop { opacity: 1; }
.pearl-cat-filter-drawer-panel {
    position: absolute;
    top: 0; right: 0;
    width: 100%;
    max-width: 380px;
    height: 100%;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.pearl-cat-filter-drawer.open .pearl-cat-filter-drawer-panel { transform: translateX(0); }
.pearl-cat-filter-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 24px 16px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}
.pearl-cat-filter-drawer-header h2 { margin: 0; font-size: 18px; font-weight: 400; text-transform: uppercase; }
.pearl-cat-filter-drawer-close {
    width: 40px; height: 40px;
    font-size: 24px; line-height: 1;
    background: none; border: none;
    cursor: pointer; color: #000; padding: 0;
}
.pearl-cat-filter-form { padding: 24px; flex: 1; }
.pearl-cat-filter-section { margin-bottom: 24px; }
.pearl-cat-filter-section-title { font-size: 12px; font-weight: 600; text-transform: uppercase; margin-bottom: 12px; color: #000; }
.pearl-cat-filter-sort {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pearl-cat-sort-btn {
    display: block;
    width: 100%;
    padding: 10px 12px;
    font-size: 13px;
    text-align: left;
    background: #fff;
    border: 1px solid #ddd;
    cursor: pointer;
    color: #000;
}
.pearl-cat-sort-btn:hover { border-color: #000; background: #f9f9f9; }
.pearl-cat-sort-btn.active { border-color: #000; background: #000; color: #fff; }
.pearl-cat-filter-price-section .pearl-cat-price-slider-wrap { position: relative; padding: 8px 0 36px; }
.pearl-cat-filter-price-section input[type="range"] {
    width: 100%;
    height: 6px;
    margin: 8px 0;
    -webkit-appearance: none;
    appearance: none;
    background: #eee;
    border-radius: 3px;
}
.pearl-cat-filter-price-section input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #000;
    cursor: pointer;
}
.pearl-cat-price-range-labels { margin-top: 8px; font-size: 13px; color: #333; }
.pearl-cat-filter-checkbox { display: block; margin-bottom: 0; font-size: 14px; cursor: pointer; }
.pearl-cat-filter-checkbox input { margin-right: 8px; }
.pearl-cat-filter-attr-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.pearl-cat-attr-option {
    padding: 8px 14px;
    font-size: 13px;
    background: #fff;
    border: 1px solid #ddd;
    cursor: pointer;
    color: #000;
}
.pearl-cat-attr-option:hover { border-color: #000; }
.pearl-cat-attr-option.active { border-color: #000; background: #000; color: #fff; }
/* Ссылки в панели фильтров (страница поиска) выглядят как кнопки */
.pearl-cat-filter-drawer a.pearl-cat-sort-btn,
.pearl-cat-filter-drawer a.pearl-cat-attr-option {
    text-decoration: none;
    color: inherit;
}
.pearl-cat-filter-actions { margin-top: 32px; padding-top: 24px; border-top: 1px solid #eee; }
.pearl-cat-filter-reset {
    font-size: 13px;
    color: #666;
    text-decoration: underline;
}
.pearl-cat-filter-reset:hover { color: #000; }

/* По умолчанию мобильная верхняя панель скрыта (на десктопе) */
.pearl-cat-mobile-topbar {
    display: none;
}

/* Фиксированный (плавающий) сайдбар категорий на десктопе */
@media (min-width: 1025px) {
    .pearl-category-constructor-layout .pearl-category-sidebar {
        position: sticky;
        top: 80px;
        align-self: flex-start;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }
}

/* ---------------------- SINGLE PRODUCT (DESKTOP) ---------------------- */

.pearl-single-product-page .pearl-single-layout {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
}

.pearl-single-product-page .single-product {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    column-gap: 60px;
    padding: 80px 7vw 120px 7vw;
    width: 100%;
}

.pearl-single-product-page .single-product .product-gallery {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.pearl-single-product-page .single-product .product-main-image {
    width: 100%;
    padding-top: 150%;
    background-size: cover;
    background-position: center;
}

.pearl-single-product-page .single-product .product-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
}

.pearl-single-product-page .single-product h1 {
    font-weight: 400;
    font-size: 18px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.pearl-single-product-page .single-product .product-price-large {
    font-size: 16px;
}

.pearl-single-product-page .single-product .product-description,
.pearl-single-product-page .single-product .product-full-description {
    font-size: 12px;
    line-height: 1.7;
}

/* MOBILE SINGLE */
@media (max-width: 768px) {
    .pearl-single-product-page .pearl-single-layout {
        display: block;
    }
    .pearl-single-product-page .single-product {
        grid-template-columns: 1fr;
        padding: 60px 16px 80px 16px;
        row-gap: 32px;
    }
}

/* ---------- Мобильная версия страницы категории ---------- */
@media (max-width: 768px) {
    /* На мобильной двигаем гамбургер ближе к краю, чтобы не пересекался с верхней панелью */
    .pearl-category-page .pearl-hamburger,
    .pearl-search-page .pearl-hamburger {
        top: 14px !important;
        left: 14px !important;
    }

    /* Левый блок категорий/аудитории только для десктопа */
    .pearl-category-constructor-layout .pearl-category-sidebar {
        display: none !important;
    }
    /* Правый блок (Поиск, Корзина, Сеанс, Помощь) только для десктопа; в мобильной — верхняя панель с иконками */
    .pearl-category-page .pearl-right-menu {
        display: none !important;
    }
    /* Мобильная верхняя панель: кнопки притянуты к правой части и собраны вместе */
    .pearl-cat-mobile-topbar {
        display: flex !important;
        align-items: center;
        justify-content: flex-end;
        gap: 12px;
        padding: 12px 16px 12px 96px; /* слева резерв под гамбургер */
        flex-wrap: nowrap;
        background: #fff;
        border-bottom: 1px solid #eee;
        flex-shrink: 0;
        position: sticky;
        top: 0;
        z-index: 50;
        /* Контейнер не должен перехватывать клики над гамбургером */
        pointer-events: none;
    }
    .pearl-cat-mobile-topbar .pearl-cat-toolbar-btn,
    .pearl-cat-mobile-topbar .pearl-cat-mobile-topbar-icon {
        pointer-events: auto;
    }
    .pearl-cat-mobile-topbar .pearl-cat-toolbar-btn {
        padding: 8px 12px;
    }
    .pearl-cat-mobile-topbar-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        color: #000;
        text-decoration: none;
        border: 1px solid #eee;
        border-radius: 50%;
    }
    .pearl-cat-mobile-topbar-icon:hover {
        background: #f5f5f5;
        color: #000;
    }
    .pearl-cat-mobile-cart {
        position: relative;
    }
    .pearl-cat-mobile-cart-count {
        position: absolute;
        top: -4px;
        right: -4px;
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        font-size: 10px;
        line-height: 16px;
        text-align: center;
        background: #000;
        color: #fff;
        border-radius: 8px;
    }
    /* На мобильной панель инструментов внутри блока товаров скрыта (дублирует верхнюю) */
    .pearl-cat-block-products .pearl-cat-toolbar {
        display: none !important;
    }
    /* Медиа-блоки из конструктора: на мобильной один блок с горизонтальным скроллом */
    .pearl-cat-media-blocks-wrap {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        gap: 0;
    }
    .pearl-cat-media-blocks-wrap .pearl-cat-block {
        flex: 0 0 auto;
        width: 85vw;
        min-width: 85vw;
        scroll-snap-align: start;
    }
    .pearl-cat-media-blocks-wrap .pearl-cat-block-fullscreen {
        min-height: 50vh;
    }
    .pearl-cat-media-blocks-wrap .pearl-cat-block-half {
        min-height: 50vh;
    }
    .pearl-cat-media-blocks-wrap .pearl-cat-block-half .pearl-cat-half-cell {
        min-height: 50vh;
        min-width: 42.5vw;
    }
    .pearl-cat-media-blocks-wrap .pearl-cat-block-third {
        min-height: 50vh;
    }
    .pearl-cat-media-blocks-wrap .pearl-cat-block-third .pearl-cat-third-cell {
        min-height: 50vh;
        min-width: 28.33vw;
    }
    /* Кнопка «добавить в корзину» (+) справа в карточке товара */
    .product-quick-add {
        left: auto !important;
        right: 8px !important;
        bottom: 8px !important;
    }
}

/* Десктоп: мобильная верхняя панель скрыта */
@media (min-width: 769px) {
    .pearl-cat-mobile-topbar {
        display: none !important;
    }
}
