/* ============================================================
   PODSTAWOWY WIDOK (TABLE)
   ============================================================ */

.cgallery-wrapper {
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

.cgallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(260px, 500px));
    gap: 20px;
    justify-content: center;
}

.cgallery-item {
    background: #fff;
    border-radius: 10px;
    padding: 1px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: box-shadow .25s ease, transform .25s ease;
}

.cgallery-main {
    overflow: hidden;
    display: block;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1 / 1;
    margin: 0 auto 15px;
    background: #fff;
    border-radius: 10px;
}

.cgallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 1;
    transition: transform .95s ease, opacity .85s ease-in-out;
}

.cgallery-main:hover img {
    transform: scale(1.58);
}

.cgallery-main img.cg-fade {
    opacity: 0;
}

.cgallery-title {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.cgallery-price-range {
    font-size: 18px;
    margin-top: -5px;
    margin-bottom: 10px;
    color: #444;
    font-weight: 500;
}

.cgallery-price-range .cg-price-sale {
    color: #d33;
    font-weight: 600;
}

.cgallery-price-range .cg-price-regular {
    color: #777;
    text-decoration: line-through;
    margin-left: 6px;
    font-size: 14px;
}

.cgallery-btn {
    display: inline-block;
    background: #000;
    color: #fff;
    padding: 10px 18px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    margin-top: 10px;
    transition: background .25s ease, transform .25s ease;
}
body.woocommerce .cgallery-btn,
.woocommerce-page .cgallery-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    padding: 15px 18px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: 30px !important;
    background: #000 !important;
    color: #fff !important;
    text-decoration: none !important;
    box-sizing: border-box !important;
      font-family: inherit !important;
}

.cgallery-wrapper br {
    display: none !important;
}



.cgallery-btn:hover {
    background: #333;
    transform: translateY(-2px);
}

/* Miniaturki (TABLE) */
.cgallery-thumbs {
    display: flex !important;
    justify-content: center !important;
    gap: 2px !important;
    flex-wrap: wrap;
    background: #fafafa;
    padding: 2px 4px !important;
    border-radius: 8px !important;
}

.cgallery-thumbs a {
    display: inline-flex !important;
    width: 45px;
    height: 45px;
    align-items: center !important;
    justify-content: center !important;
}

.cgallery-thumbs p {
    margin : 0px !important
}
.cgallery-thumb-link {
    display: inline-flex !important;
    width: 45px;
    height: 45px;
    align-items: center !important;
    justify-content: center !important;
}



.cgallery-thumb {
    width: 45px !important;
    height: 45px !important;
    object-fit: cover !important;
    border-radius: 4px;
    transition: transform .2s ease, box-shadow .2s ease;
}

.cgallery-thumb:hover {
    transform: scale(1.08);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* ============================================================
   WIDOK CAROUSEL — GLOBALNE TŁO
   ============================================================ */

.cgallery-carousel.cgallery-wrapper {
    background: #e0e0e0;
    padding: 20px 10px !important;
    border-radius: 12px !important;
}

/* ============================================================
   WIDOK CAROUSEL — UKŁAD
   ============================================================ */

.cgallery-carousel .cgallery-grid {
    display: flex !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    gap: 20px !important;
    scroll-snap-type: x mandatory;
    padding: 10px 0 !important;
    margin: 10px !important;
    justify-content: flex-start !important;
}

.cgallery-carousel .cgallery-item {
    flex: 0 0 auto !important;
    width: 380px ;
    scroll-snap-align: start;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
}

/* Kolejność elementów */
.cgallery-carousel .cgallery-main { order: 1; margin: 0 !important; padding: 0 !important; }
.cgallery-carousel .cgallery-main img { margin: 0 !important; padding: 0 !important; }
.cgallery-carousel .cgallery-title { order: 3; margin-top: 8px !important;  }
.cgallery-carousel .cgallery-price-range { order: 4 !important; }
.cgallery-carousel .cgallery-btn { order: 5 !important; }

/* ============================================================
   MINIATURKI W GALERII PRODUKTU (POJEDYNCZY PRODUKT)
   ============================================================ */

.cgallery-product-thumbs {
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    gap: 6px 8px;
    margin: 20px 0;
    justify-content: flex-start;
    line-height: 0;
    font-size: 0;
}

.cgallery-product-thumb-link {
    display: inline-flex;
    width: 70px;
    height: 70px;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    position: relative;
}

.cgallery-product-thumb {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 4px;
    transition: transform .2s ease, box-shadow .2s ease;
}

.cgallery-product-thumb:hover {
    transform: scale(1.08);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.cgallery-product-thumb-link.active .cgallery-product-thumb {
    outline: 3px solid #000;
    outline-offset: 2px;
    border-radius: 4px;
    transform: scale(1.05);
}


/* ============================================================
   TOOLTIP Z NAZWĄ KOLORU (GALERIA PRODUKTU)
   ============================================================ */



.cgallery-product-thumb-link::after {
    content: attr(data-color);
    position: absolute;
    left: 50%;
    top: 0;
    transform: translate(-50%, -110%);
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    z-index: 999;
    transition: opacity .15s ease, transform .15s ease;
}

.cgallery-product-thumb-link:hover::after {
    opacity: 1;
    transform: translate(-50%, -120%);
}

/* --- DYNAMICZNY KONTENER MINIATUREK W KARUZELI --- */

.cgallery-carousel .cgallery-thumbs {
    order: 2 !important;
    width: 100% !important;
    max-width: 500px !important;
    height: 70px   !important;                 /* stała wysokość */
    display: flex !important;
    flex-wrap: wrap !important;               /* pozwala na 2 rzędy */
    justify-content: center !important;
    align-content: center !important;        /* pionowe centrowanie miniaturek */
    gap: 1px !important;
    padding: 0 !important;
    margin-top: 0 !important;
    background: #fff;
    border-radius: 6px !important;
    overflow: hidden !important;             /* nic nie wystaje */
}



/* --- MINIATURKI AUTO-SCALING --- */
.cgallery-carousel .cgallery-thumbs a {
    width: 36px !important;
    height: 36px !important;
    flex: 1 0 auto !important;               /* pozwala rosnąć i maleć */
    max-width: 50px !important;              /* nigdy większe niż kontener */
    max-height: 50px !important;
    aspect-ratio: 1 / 1 !important;          /* zawsze kwadrat */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}



.cgallery-thumb-link{
    width: 36px;
    height: 36px;
    flex: 1 0 auto;               /* pozwala rosnąć i maleć */
    max-width: 50px;              /* nigdy większe niż kontener */
    max-height: 50px;
    aspect-ratio: 1 / 1;          /* zawsze kwadrat */
    display: flex;
    align-items: center;
    justify-content: center;
}


.cgallery-carousel .cgallery-thumb {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 4px !important;
}

/* --- STRZAŁKI KARUZELI --- */
.cgallery-carousel {
    position: relative !important;
}

/* DOMYŚLNIE STRZAŁKI SĄ UKRYTE */
.cgallery-arrow {
    display: none;
}

/* STRZAŁKI TYLKO W KARUZELI */

/* STRZAŁKI TYLKO W KARUZELI */
.cgallery-carousel .cgallery-arrow {
    display: flex !important; /* ← przywracamy widoczność */
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 42px !important; 
    height: 42px !important;
    background: rgba(255,255,255,0.55);
    backdrop-filter: blur(6px);
    border-radius: 50% !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 26px !important;
    font-weight: bold !important;
    color: #333;
    cursor: pointer !important;
    z-index: 20 !important;
    transition: background .25s ease, transform .25s ease;
    user-select: none !important;
}

.cgallery-carousel .cgallery-arrow-left {
    left: 0px !important;
}

.cgallery-carousel .cgallery-arrow-right {
    right: 0px !important;
}

.cgallery-arrow:hover {
    background: rgba(255,255,255,0.85);
    transform: translateY(-50%) scale(1.12);
}

.cgallery-thumbs {
    display: flex !important;
    align-items: center !important;
}

.cgallery-thumbs a {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.cgallery-thumb-link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}


.cgallery-thumb {
    display: block !important;
   
}

/* 1. Flex na cały element */
.cgallery-item {
    display: flex !important;
    flex-direction: column !important;
}

/* 2. Każde <p> wewnątrz galerii ma znikać jako kontener */
.cgallery-item > p {
    display: contents !important;
}

/* 3. Ukryj tylko naprawdę puste <p> (bez dzieci) */
.cgallery-item > p:empty {
    display: none !important;
}
.cgallery-thumbs > p:empty {
    display: none !important;
}
.cgallery-thumbs p {
    display: contents;
}


/* 4. Ukryj puste <a>, ale NIE te z klasami galerii */
.cgallery-item > a:not(.cgallery-main-link):not(.cgallery-btn):empty {
    display: none !important;
}

/* 5. KOLEJNOŚĆ */
.cgallery-main-link { order: 1 !important; }
.cgallery-thumbs { order: 2 !important; }
.cgallery-title { order: 3 !important; }
.cgallery-price-range { order: 4 !important; }
.cgallery-btn { order: 5 !important; }


.cgallery-item {
    opacity: 0;
    transform: scale(1.15);
    animation: cgalleryFadeIn 0.6s ease-out forwards;
}

/* opóźnienie dla każdego kolejnego kafelka */
.cgallery-item:nth-child(1) { animation-delay: 0.05s; }
.cgallery-item:nth-child(2) { animation-delay: 0.30s; }
.cgallery-item:nth-child(3) { animation-delay: 0.55s; }
.cgallery-item:nth-child(4) { animation-delay: 0.80s; }
.cgallery-item:nth-child(5) { animation-delay: 1.05s; }
.cgallery-item:nth-child(6) { animation-delay: 1.30s; }
/* możesz dodać więcej jeśli masz więcej elementów */

@keyframes cgalleryFadeIn {
    0% {
        opacity: 0;
        transform: scale(1.15);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}





/* stylowanie wyglądu kategoriz produktami */
/* --- Stylizacja listy produktów WooCommerce --- */
.cgallery-wrapper ul.products::before,
.cgallery-wrapper ul.products::after {
    content: none !important;
    display: none !important;
}

.cgallery-wrapper .products .product {
    border-radius: 12px;
    padding: 20px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.cgallery-wrapper ul.products {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin: 40px 0;
}

/* Wyłączamy flexa WooCommerce, żeby grid działał poprawnie */
.cgallery-wrapper ul.products {
    display: grid !important;
    flex-wrap: unset !important;
}



/* Kafelek produktu */
.cgallery-wrapper ul.products li.product {
    width: 100% !important;
    float: none !important;
    margin: 0 !important;
    background: #ffffff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.08);
    transition: transform .25s ease, box-shadow .25s ease;
    text-align: center;
}

.cgallery-wrapper ul.products li.product:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.12);
}

/* Miniatura */
.cgallery-wrapper ul.products li.product img {
    border-radius: 12px;
    margin-bottom: 15px;
}

/* Tytuł */
.cgallery-wrapper ul.products li.product .woocommerce-loop-product__title {
    font-size: 18px;
    font-weight: 600;
    color: #222;
    margin-bottom: 10px;
    min-height: 48px;
}

/* Cena */
.cgallery-wrapper ul.products li.product .price {
    font-size: 17px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

/* Przycisk */
.cgallery-wrapper ul.products li.product .button {
    background: #222 !important;
    color: #fff !important;
    padding: 12px 18px;
    border-radius: 8px;
    font-weight: 600;
    text-transform: none;
    transition: background .25s ease;
}

.cgallery-wrapper ul.products li.product .button:hover {
    background: #444 !important;
}

/* Responsywność */
@media (max-width: 768px) {
    .cgallery-wrapper ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .cgallery-wrapper ul.products {
        grid-template-columns: 1fr;
    }
}

/* stylowanie wyglądu kategoriz produktami */


