/* =========================================
   INDEX / STRONA GŁÓWNA
   ========================================= */

#IndexPage {
    max-width: 1296px;
    margin: 0 auto;
}

.index-section {
    margin-bottom: 40px;
}

@media (max-width: 767.98px) {
    #IndexPage {
        max-width: 95vw;
    }

    .index-section {
        margin-bottom: 32px;
    }
}


/* ============================
   KATEGORIE – GRID
   ============================ */

#IndexPage .CstCategories.category.grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px 12px;
}

/* Link jako pełny kafelek */
#IndexPage .CstCategories.category.grid > a {
    display: block;
    width: 100%;
    min-width: 0; /* zapobiega rozpychaniu grida */
    height: 100%;
    text-align: center;
    text-decoration: none;
    font-weight: 500;
    color: #111111;
}

/* Wnętrze kafelka kategorii */
#IndexPage .CstCategories.category.grid .grid-item {
    height: 100%;
    padding: 10px 8px 12px;
    border-radius: 16px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: background-color 0.25s ease, box-shadow 0.25s ease, transform 0.12s ease;
}

/* Obrazek kategorii */
#IndexPage .CstCategories.category.grid img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 12px;
    display: block;
}

/* Tytuł kategorii */
#IndexPage .CstCategories.category.grid strong {
    margin-top: 2px;
    font-size: 1rem;
    line-height: 1.25;
}

/* Hover */
#IndexPage .CstCategories.category.grid > a:hover .grid-item {
    transform: translateY(-5px);
}


/* ============================
   RESPONSYWNOŚĆ – KATEGORIE
   ============================ */

@media (max-width: 991.98px) {
    #IndexPage .CstCategories.category.grid {
        grid-template-columns: repeat(3, 1fr);
        row-gap: 18px;
    }

    #IndexPage .CstCategories.category.grid img {
        max-width: 130px;
    }
}

@media (max-width: 575.98px) {

    /* Grid kategorii – tylko fr + px */
    #IndexPage .CstCategories.category.grid {
        gap: 12px;
    }

    #IndexPage .CstCategories.category.grid .grid-item {
        padding: 10px;
    }

    #IndexPage .CstCategories.category.grid img {
        max-width: none;
    }

    #IndexPage .CstCategories.category.grid strong {
        font-size: 0.95rem;
        text-align: center;
    }
}


/* =========================================
   MOBILE – BEZPIECZEŃSTWO FLOW (TYLKO SEKCJA)
   ========================================= */

@media (max-width: 575.98px) {

    /* NIE resetujemy * – tylko konkretne sekcje */
    .index-section-categories,
    .index-section-promo-banner {
        position: relative;
        isolation: isolate;
    }
}


/* ============================
   PROMO BANNER
   ============================ */

.index-section-promo-banner {
    position: relative;
    width: 100%;
}

@media (max-width: 575.98px) {

    /* sekcja normalnie w flow */
    .index-section-promo-banner {
        display: block;
        margin: 32px 0;
    }

    /* TYLKO bezpośredni wrapper (VC / builder) */
    .index-section-promo-banner > * {
        position: static !important;
        transform: none !important;
        width: 100%;
        display: block;
    }

    .index-section-promo-banner img,
    .index-section-promo-banner picture,
    .index-section-promo-banner video {
        display: block;
        width: 100%;
        height: auto;
    }
}


/* ============================
   NAJNOWSZE / PROMOWANE / OSTATNIO
   ============================ */

#IndexPage .CstNew.grid,
#IndexPage .CstPromoted.grid,
#IndexPage .CstSeen.grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px 12px;
}

/* Link jako kontener karty */
#IndexPage .CstNew.grid > a,
#IndexPage .CstPromoted.grid > a,
#IndexPage .CstSeen.grid > a {
    display: block;
    width: 100%;
    min-width: 0;
    height: 100%;
    text-decoration: none;
    color: inherit;
    background: transparent;
    position: relative;
}

/* Zabicie ewentualnych overlayów z globalnych styli */
#IndexPage .CstNew.grid > a::before,
#IndexPage .CstPromoted.grid > a::before,
#IndexPage .CstSeen.grid > a::before {
    content: none !important;
}

/* Limity elementów */
#IndexPage .CstNew.grid > a:nth-child(n+16) { display: none; }
#IndexPage .CstPromoted.grid > a:nth-child(n+11) { display: none; }
#IndexPage .CstSeen.grid > a:nth-child(n+6) { display: none; }

/* Przycisk "Pokaż wszystkie" – override limitu, pełna szerokość */
#IndexPage .CstNew.grid > a.grid-more,
#IndexPage .CstPromoted.grid > a.grid-more {
    display: flex !important;
    grid-column: 1 / -1;
    align-items: center;
    justify-content: center;
    padding: 12px 0 2px;
    color: #6b7280;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    gap: 6px;
    transition: color 0.15s ease;
}

#IndexPage .CstNew.grid > a.grid-more:hover,
#IndexPage .CstPromoted.grid > a.grid-more:hover {
    color: #A83F1F;
}

#IndexPage .CstNew.grid > a.grid-more::after,
#IndexPage .CstPromoted.grid > a.grid-more::after {
    content: '→';
    font-size: 0.9rem;
}


/* ============================
   KARTA PRODUKTU
   ============================ */

#IndexPage .CstNew .grid-item,
#IndexPage .CstPromoted .grid-item,
#IndexPage .CstSeen .grid-item {
    height: 100%;
    padding: 12px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    box-shadow: 0 8px 24px -18px rgba(15, 23, 42, 0.15);
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 1;
    transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

/* Treść zawsze nad tłem */
#IndexPage .CstNew .grid-item *,
#IndexPage .CstPromoted .grid-item *,
#IndexPage .CstSeen .grid-item * {
    position: relative;
    z-index: 1;
}

/* Hover */
#IndexPage .CstNew a:hover .grid-item,
#IndexPage .CstPromoted a:hover .grid-item,
#IndexPage .CstSeen a:hover .grid-item {
    opacity: 1;
    background-color: #f2f2f2;
    box-shadow: 0 10px 28px -20px rgba(15, 23, 42, 0.30);
}

/* Miniatury */
#IndexPage .CstNew .grid-item img,
#IndexPage .CstPromoted .grid-item img,
#IndexPage .CstSeen .grid-item img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 12px;
    background-color: #f2f2f2;
}

/* Tytuły */
#IndexPage .CstNew .grid-item strong,
#IndexPage .CstPromoted .grid-item strong,
#IndexPage .CstSeen .grid-item strong {
    margin-top: 4px;
    font-size: clamp(0.9rem, 0.85rem + 0.25vw, 1.05rem);
    font-weight: 700;
}

/* Ceny */
#IndexPage .CstNew .prices,
#IndexPage .CstPromoted .prices,
#IndexPage .CstSeen .prices {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
    font-weight: 800;
}

#IndexPage .Price {
    color: #A83F1F;
    font-weight: 800;
    font-size: clamp(0.95rem, 0.9rem + 0.25vw, 1.1rem);
}

#IndexPage .oldPrice {
    font-size: 0.9rem;
}


/* ============================
   RESPONSYWNOŚĆ – OFERTY
   ============================ */

@media (max-width: 991.98px) {
    #IndexPage .CstNew.grid,
    #IndexPage .CstPromoted.grid,
    #IndexPage .CstSeen.grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 575.98px) {
    #IndexPage .CstNew.grid,
    #IndexPage .CstPromoted.grid,
    #IndexPage .CstSeen.grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Parzysta liczba kart w 2-kolumnowej siatce – brak samotnego elementu w ostatnim rzędzie */
    #IndexPage .CstNew.grid > a:nth-child(n+15)  { display: none; }  /* 15 → 14 kart (7×2) */
    #IndexPage .CstSeen.grid > a:nth-child(n+5)  { display: none; }  /*  5 →  4 karty (2×2) */
}


/* ============================
   BANNER GREY
   ============================ */

.banner-grey {
    max-width: 1296px;
    margin: 32px auto;
    padding: 24px 32px;
    border-radius: 20px;
    background: url("/images/banners/banner-szary.png") center / cover no-repeat;
    display: flex;
    gap: 24px;
}

.banner-grey-left,
.banner-grey-right {
    flex: 1 1 0;
    color: #ffffff;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.banner-grey-left {
    border-right: 1px dotted rgba(255, 255, 255, 0.7);
}

.banner-grey-title {
    margin-bottom: 10px;
    font-weight: 800;
    font-size: clamp(1rem, 0.95rem + 0.45vw, 1.3rem);
    text-transform: uppercase;
}

@media (max-width: 767.98px) {
    .banner-grey {
        padding: 18px 16px;
        flex-direction: column;
    }

    .banner-grey-left {
        border-right: none;
        border-bottom: 1px dotted rgba(255, 255, 255, 0.7);
        padding-bottom: 12px;
        margin-bottom: 8px;
    }
}


/* ============================
   CTA BANNER
   ============================ */

.banner-cta {
    position: relative;
    max-width: 1296px;
    margin: 40px auto 32px;
    padding: 48px 48px;
    border-radius: 24px;
    background: #111827;
    text-align: center;
    overflow: hidden;
}

.banner-cta-accent {
    width: 44px;
    height: 3px;
    background: #A83F1F;
    border-radius: 999px;
    margin: 0 auto 20px;
}

.banner-cta-title {
    font-size: clamp(1.55rem, 1.3rem + 1.1vw, 2.4rem);
    font-weight: 900;
    color: #ffffff;
    margin: 0 auto 14px;
    max-width: 660px;
    line-height: 1.2;
}

.banner-cta-desc {
    font-size: clamp(0.88rem, 0.84rem + 0.2vw, 1rem);
    color: #9ca3af;
    margin: 0 auto 36px;
    max-width: 460px;
    line-height: 1.6;
}

.banner-cta-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.banner-cta-actions .btn-orange,
.banner-cta-actions .btn-white {
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* dekoracyjna nuta w tle */
.banner-cta-deco {
    position: absolute;
    font-size: 220px;
    color: rgba(255, 255, 255, 0.06);
    right: 48px;
    bottom: -16px;
    line-height: 1;
    pointer-events: none;
    user-select: none;
}


@media (max-width: 767.98px) {
    .banner-cta {
        padding: 36px 24px;
    }

    .banner-cta-actions {
        flex-direction: column;
        align-items: center;
    }

    .banner-cta-actions .btn-orange,
    .banner-cta-actions .btn-white {
        width: 100%;
        max-width: 320px;
    }

    .banner-cta-deco {
        font-size: 160px;
        right: -10px;
        bottom: -20px;
    }
}


/* Oddzielenie sekcji */
.index-section-categories {
    margin-bottom: 0 !important;
}

.index-section-promo-banner {
    margin-top: 0 !important;
    padding-top: 0 !important;
}
