/* ================================
   CATEGORY CARDS — PREMIUM STYLE
   ================================ */

/* Основна картка категорії */
.woocommerce ul.products li.product-category {
    position: relative !important;

    padding: 0 !important;
    margin: 0 !important;

    min-height: 270px !important;

    background: #101010 !important;
    border-radius: 28px !important;
    border: 1px solid rgba(255,255,255,0.10) !important;

    overflow: hidden !important;

    box-shadow:
        0 18px 45px rgba(0,0,0,0.10),
        0 0 0 rgba(255,0,0,0);

    transition:
        transform .28s ease,
        box-shadow .28s ease,
        border-color .28s ease;
}

/* Hover */
.woocommerce ul.products li.product-category:hover {
    transform: translateY(-6px) !important;
    border-color: rgba(255,43,43,0.35) !important;

    box-shadow:
        0 22px 55px rgba(0,0,0,0.18),
        0 0 38px rgba(255,0,0,0.13) !important;
}

/* Посилання всередині категорії */
.woocommerce ul.products li.product-category > a {
    position: relative !important;

    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 270px !important;

    text-decoration: none !important;
    color: #ffffff !important;
}

/* Зображення категорії як обкладинка */
.woocommerce ul.products li.product-category img {
    position: absolute !important;
    inset: 0 !important;

    width: 100% !important;
    height: 100% !important;

    object-fit: cover !important;
    object-position: center !important;

    padding: 0 !important;
    margin: 0 !important;

    background: #111111 !important;
    border-radius: 0 !important;

    transform: scale(1.01);
    transition:
        transform .35s ease,
        filter .35s ease,
        opacity .35s ease;
}

/* Затемнення поверх картинки */
.woocommerce ul.products li.product-category > a::before {
    content: "";
    position: absolute;
    inset: 0;

    z-index: 1;

    background:
        linear-gradient(
            180deg,
            rgba(0,0,0,0.12) 0%,
            rgba(0,0,0,0.34) 42%,
            rgba(0,0,0,0.86) 100%
        );

    pointer-events: none;
}

/* Легкий червоний акцент */
.woocommerce ul.products li.product-category > a::after {
    content: "";
    position: absolute;
    left: -20%;
    right: -20%;
    bottom: -35%;

    height: 70%;

    z-index: 2;

    background: radial-gradient(
        circle at center,
        rgba(255,43,43,0.22),
        transparent 62%
    );

    opacity: 0;
    transition: opacity .28s ease;

    pointer-events: none;
}

.woocommerce ul.products li.product-category:hover > a::after {
    opacity: 1;
}

.woocommerce ul.products li.product-category:hover img {
    transform: scale(1.07);
    filter: saturate(1.08) contrast(1.05);
}

/* Назва категорії */
.woocommerce ul.products li.product-category h2,
.woocommerce ul.products li.product-category h2.woocommerce-loop-category__title {
    position: absolute !important;
    left: 22px !important;
    right: 22px !important;
    bottom: 22px !important;

    z-index: 3 !important;

    margin: 0 !important;
    padding: 0 !important;

    color: #ffffff !important;

    font-size: 22px !important;
    font-weight: 900 !important;
    line-height: 1.15 !important;
    letter-spacing: -0.03em !important;

    text-align: left !important;

    min-height: 0 !important;

    display: block !important;
    overflow: visible !important;
}

/* Кількість товарів */
.woocommerce ul.products li.product-category mark,
.woocommerce ul.products li.product-category .count {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    margin-left: 8px !important;
    padding: 4px 9px !important;

    background: rgba(255,255,255,0.13) !important;
    color: #ffffff !important;

    border: 1px solid rgba(255,255,255,0.16) !important;
    border-radius: 999px !important;

    font-size: 13px !important;
    font-weight: 900 !important;
    line-height: 1 !important;

    backdrop-filter: blur(8px);
}

/* Прибираємо зайве від Woo/Blocksy */
.woocommerce ul.products li.product-category .button,
.woocommerce ul.products li.product-category .price,
.woocommerce ul.products li.product-category .star-rating {
    display: none !important;
}


/* ================================
   DESKTOP CATEGORY GRID
   ================================ */

@media (min-width: 769px) {

    .home .woocommerce ul.products li.product-category,
    .woocommerce-page .woocommerce ul.products li.product-category {
        min-height: 250px !important;
    }

    .home .woocommerce ul.products li.product-category > a,
    .woocommerce-page .woocommerce ul.products li.product-category > a {
        min-height: 250px !important;
    }
}


/* ================================
   MOBILE CATEGORY CARDS
   ================================ */

@media (max-width: 768px) {

    .woocommerce ul.products li.product-category {
        min-height: 230px !important;
        border-radius: 24px !important;
    }

    .woocommerce ul.products li.product-category > a {
        min-height: 230px !important;
    }

    .woocommerce ul.products li.product-category h2,
    .woocommerce ul.products li.product-category h2.woocommerce-loop-category__title {
        left: 14px !important;
        right: 14px !important;
        bottom: 16px !important;

        font-size: 17px !important;
        line-height: 1.18 !important;

        text-align: left !important;
    }

    .woocommerce ul.products li.product-category mark,
    .woocommerce ul.products li.product-category .count {
        margin-left: 5px !important;
        padding: 3px 7px !important;
        font-size: 11px !important;
    }
}


/* Дуже вузькі екрани */
@media (max-width: 390px) {

    .woocommerce ul.products li.product-category {
        min-height: 210px !important;
    }

    .woocommerce ul.products li.product-category > a {
        min-height: 210px !important;
    }

    .woocommerce ul.products li.product-category h2,
    .woocommerce ul.products li.product-category h2.woocommerce-loop-category__title {
        font-size: 15px !important;
    }
}

/* ================================
   CATEGORY IMAGE VISIBILITY FIX
   ================================ */

/* Робимо всі можливі обгортки картинки повноцінним фоном */
.woocommerce ul.products li.product-category .ct-image-container,
.woocommerce ul.products li.product-category .ct-media-container,
.woocommerce ul.products li.product-category figure,
.woocommerce ul.products li.product-category picture,
.woocommerce ul.products li.product-category .woocommerce-loop-category__image {
    position: absolute !important;
    inset: 0 !important;

    width: 100% !important;
    height: 100% !important;

    display: block !important;

    margin: 0 !important;
    padding: 0 !important;

    border-radius: 0 !important;
    overflow: hidden !important;

    z-index: 0 !important;
}

/* Саме фото */
.woocommerce ul.products li.product-category img,
.woocommerce ul.products li.product-category .ct-image-container img,
.woocommerce ul.products li.product-category .ct-media-container img,
.woocommerce ul.products li.product-category figure img,
.woocommerce ul.products li.product-category picture img {
    position: absolute !important;
    inset: 0 !important;

    display: block !important;

    width: 100% !important;
    height: 100% !important;

    max-width: none !important;
    max-height: none !important;

    object-fit: cover !important;
    object-position: center !important;

    opacity: 1 !important;
    visibility: visible !important;

    padding: 0 !important;
    margin: 0 !important;

    border-radius: 0 !important;
    background: transparent !important;

    z-index: 0 !important;

    transform: scale(1.01);
}

/* Затемнення має бути поверх фото, але під текстом */
.woocommerce ul.products li.product-category > a::before {
    z-index: 1 !important;
}

/* Червоне світіння */
.woocommerce ul.products li.product-category > a::after {
    z-index: 2 !important;
}

/* Назва категорії завжди поверх усього */
.woocommerce ul.products li.product-category h2,
.woocommerce ul.products li.product-category h2.woocommerce-loop-category__title {
    z-index: 5 !important;
}

/* Щоб посилання було нормальним контейнером */
.woocommerce ul.products li.product-category > a {
    position: relative !important;
    overflow: hidden !important;
}

/* ================================
   CATEGORY TITLE BADGE FINAL
   ================================ */

/* Компактна плашка тільки під текст */
.woocommerce ul.products li.product-category h2,
.woocommerce ul.products li.product-category h2.woocommerce-loop-category__title {
    position: absolute !important;

    left: 18px !important;
    right: auto !important;
    bottom: 18px !important;

    width: auto !important;
    min-width: 0 !important;
    max-width: calc(100% - 36px) !important;

    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex-wrap: nowrap !important;
    gap: 7px !important;

    margin: 0 !important;
    padding: 7px 10px !important;

    background: rgba(0, 0, 0, 0.58) !important;
    border: 1px solid rgba(255,255,255,0.16) !important;
    border-radius: 13px !important;

    color: #ffffff !important;

    font-size: 18px !important;
    font-weight: 900 !important;
    line-height: 1.1 !important;
    letter-spacing: -0.03em !important;

    text-align: left !important;
    white-space: nowrap !important;

    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;

    box-shadow:
        0 8px 22px rgba(0,0,0,0.24),
        inset 0 1px 0 rgba(255,255,255,0.08) !important;

    text-shadow: 0 2px 8px rgba(0,0,0,0.55) !important;

    z-index: 6 !important;
}

/* Кількість товарів */
.woocommerce ul.products li.product-category h2 mark,
.woocommerce ul.products li.product-category h2 .count,
.woocommerce ul.products li.product-category .count {
    flex: 0 0 auto !important;

    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    margin: 0 !important;
    padding: 3px 8px !important;

    min-width: auto !important;
    height: auto !important;

    background: rgba(255,255,255,0.18) !important;
    color: #ffffff !important;

    border: 1px solid rgba(255,255,255,0.22) !important;
    border-radius: 999px !important;

    font-size: 12px !important;
    font-weight: 900 !important;
    line-height: 1 !important;

    box-shadow: inset 0 1px 0 rgba(255,255,255,0.12) !important;
}

/* Hover */
.woocommerce ul.products li.product-category:hover h2,
.woocommerce ul.products li.product-category:hover h2.woocommerce-loop-category__title {
    background: rgba(0, 0, 0, 0.66) !important;
    border-color: rgba(255,43,43,0.36) !important;

    box-shadow:
        0 10px 26px rgba(0,0,0,0.28),
        0 0 22px rgba(255,0,0,0.12),
        inset 0 1px 0 rgba(255,255,255,0.10) !important;
}

/* Mobile */
@media (max-width: 768px) {

    .woocommerce ul.products li.product-category h2,
    .woocommerce ul.products li.product-category h2.woocommerce-loop-category__title {
        left: 14px !important;
        right: auto !important;
        bottom: 14px !important;

        max-width: calc(100% - 28px) !important;

        padding: 7px 9px !important;
        gap: 6px !important;

        border-radius: 12px !important;

        font-size: 16px !important;
        line-height: 1.15 !important;

        white-space: normal !important;
    }

    .woocommerce ul.products li.product-category h2 mark,
    .woocommerce ul.products li.product-category h2 .count,
    .woocommerce ul.products li.product-category .count {
        padding: 3px 7px !important;
        font-size: 11px !important;
    }
}

