/**
 * Reassurance Module - Frontend styles
 * 
 * @author    Woohoo.pl
 * @copyright 2025 Woohoo.pl
 * @license   https://opensource.org/licenses/AFL-3.0
 */

/* =============================================
   Base reassurance block container
   ============================================= */
.wh-reassurance {
    box-sizing: border-box;
    padding: 15px 0;
}

/* =============================================
   List container - flexbox layout
   ============================================= */
.wh-reassurance__list {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 15px;
}

/* =============================================
   Layout variants
   ============================================= */

/* Row: all items in one line (default) */
.wh-reassurance--row .wh-reassurance__list {
    flex-direction: row;
    justify-content: center;
}

.wh-reassurance--row .wh-reassurance__item {
    flex: 1 1 0;
    min-width: 0;
}

/* Column: items stacked vertically */
.wh-reassurance--column .wh-reassurance__list {
    flex-direction: column;
}

.wh-reassurance--column .wh-reassurance__item {
    flex: 0 0 auto;
}

/* Grid 2 columns */
.wh-reassurance--grid-2 .wh-reassurance__item {
    flex: 0 0 calc(50% - 8px);
}

/* Grid 3 columns */
.wh-reassurance--grid-3 .wh-reassurance__item {
    flex: 0 0 calc(33.333% - 10px);
}

/* Grid 4 columns */
.wh-reassurance--grid-4 .wh-reassurance__item {
    flex: 0 0 calc(25% - 12px);
}

/* =============================================
   Item card
   ============================================= */
.wh-reassurance__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    box-sizing: border-box;
    text-align: left;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

/* Link variant - whole tile */
a.wh-reassurance__item--link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

@media (hover: hover) {
a.wh-reassurance__item--link:hover {
    background-color: var(--wh-rs-hover-tint, rgba(0, 0, 0, 0.03));
    text-decoration: none;
    color: inherit;
}
}

/* Link variant - text only */
.wh-reassurance__text-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

@media (hover: hover) {
.wh-reassurance__text-link:hover {
    text-decoration: underline;
    color: inherit;
}
}

/* =============================================
   Icon
   ============================================= */
.wh-reassurance__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    font-size: 24px; /* rozmiar GLIFU ikony (geometria) — nie typografia */
    line-height: 1;
    color: var(--wh-color-text-primary, #333);
}

.wh-reassurance__icon i {
    font-size: 24px;
    line-height: 1;
}

.wh-reassurance__icon img.wh-reassurance-icon-img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* =============================================
   Text area
   ============================================= */
.wh-reassurance__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.wh-reassurance__title {
    display: block;
    font-size: var(--wh-font-size-body, 14px);
    font-weight: var(--wh-font-weight-semibold, 600);
    line-height: 1.3;
    color: var(--wh-color-text-primary, #333);
}

.wh-reassurance__subtitle {
    display: block;
    font-size: var(--wh-font-size-small, 12px);
    font-weight: var(--wh-font-weight-regular, 400);
    line-height: 1.3;
    color: var(--wh-color-text-muted, #777);
}

/* =============================================
   Responsive visibility
   ============================================= */
.wh-desktop-only {
    display: flex;
}

.wh-mobile-only {
    display: none;
}

/* =============================================
   Tablet (769px - 1024px)
   ============================================= */
@media (min-width: 769px) and (max-width: 1024px) {
    .wh-reassurance--grid-4 .wh-reassurance__item {
        flex: 0 0 calc(50% - 8px);
    }

    .wh-desktop-only {
        display: flex;
    }

    .wh-mobile-only {
        display: none;
    }
}

/* =============================================
   Mobile (max-width: 768px)
   ============================================= */
@media (max-width: 768px) {
    .wh-desktop-only {
        display: none !important;
    }

    .wh-mobile-only {
        display: flex !important;
    }

    /* On mobile, all layouts become 2-column grid */
    .wh-reassurance--row .wh-reassurance__list,
    .wh-reassurance--grid-3 .wh-reassurance__list,
    .wh-reassurance--grid-4 .wh-reassurance__list {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .wh-reassurance--row .wh-reassurance__item,
    .wh-reassurance--grid-3 .wh-reassurance__item,
    .wh-reassurance--grid-4 .wh-reassurance__item {
        flex: 0 0 calc(50% - 8px);
    }

    .wh-reassurance--grid-2 .wh-reassurance__item {
        flex: 0 0 calc(50% - 8px);
    }

    /* Column layout stays as column on mobile */
    .wh-reassurance--column .wh-reassurance__list {
        flex-direction: column;
    }

    .wh-reassurance--column .wh-reassurance__item {
        flex: 0 0 auto;
    }

    /* Slightly smaller on mobile */
    .wh-reassurance__item {
        padding: 10px 12px;
        gap: 8px;
    }

    .wh-reassurance__icon {
        width: 32px;
        height: 32px;
        font-size: 20px;
    }

    .wh-reassurance__icon i {
        font-size: 20px;
    }

    .wh-reassurance__title {
        font-size: var(--wh-font-size-small, 12px);
    }

    .wh-reassurance__subtitle {
        font-size: var(--wh-font-size-small, 12px);
    }
}

/* =============================================
   Very small mobile (max-width: 480px)
   ============================================= */
@media (max-width: 480px) {
    .wh-reassurance__item {
        flex-direction: column;
        text-align: center;
        padding: 10px 8px;
        gap: 6px;
    }

    .wh-reassurance__text {
        align-items: center;
    }
}

/* ═══════════════════════════════════════════
   Layout: logos — pasek logotypow (partnerzy/marki)
   6 / 4 / 2 elementy (desktop / tablet / mobile), gap 9rem na desktop.
   Slider (Swiper) TYLKO gdy elementow wiecej niz miesci sie w widoku — JS
   wstrzykuje go leniwie (data-swiper-js). Gdy sie mieszcza: czysta siatka, zero JS.
   ═══════════════════════════════════════════ */
/* Pasek ma isc od krawedzi do krawedzi kontenera: rozklad robi space-between,
   BEZ gap. Odstep wynika z wolnego miejsca, wiec sam sie dopasowuje do szerokosci
   i nigdy nie rozpycha kontenera (wczesniejszy staly gap 9rem trzymal logotypy
   wysrodkowane, z pustymi marginesami po bokach).
   Gdy miejsca zabraknie nawet na same logotypy — kurczy je flex-shrink na itemach. */
.wh-reassurance--logos .wh-reassurance__list {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    min-width: 0; /* pozwala kurczyc sie zamiast rozpychac kontener */
}

/* Element = samo logo (bez tekstu). Baza mobile: 2 w widoku.
   padding/gap z ogolnego kafelka (.wh-reassurance__item) MUSZA byc wyzerowane —
   dokladaly 2x16px, przez co rzad byl szerszy od kontenera i wylewal sie poza
   ekran (6x158px + 5x90px gap = 1398px przy 1305px dostepnych).
   flex: 0 1 auto + min-width: 0 = bezpiecznik: gdy zabraknie miejsca logotypy
   sie zmniejsza, zamiast przepelnic kontener. */
.wh-reassurance--logos .wh-reassurance__item {
    flex: 0 1 auto;
    min-width: 0;
    padding: 0;
    gap: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wh-reassurance--logos .wh-reassurance__icon,
.wh-reassurance--logos .wh-reassurance__icon img,
.wh-reassurance--logos .wh-reassurance__icon svg {
    display: block;
    width: var(--wh-logos-width, 12.6rem);
    height: auto;
    max-width: 100%;
}

/* Mobile-first: gap mniejszy, 2 w widoku */
@media (max-width: 767px) {
    .wh-reassurance--logos .wh-reassurance__list { gap: var(--wh-logos-gap-mobile, 3.2rem); }
}
/* Tablet: 4 w widoku */
@media (min-width: 768px) and (max-width: 991px) {
    .wh-reassurance--logos .wh-reassurance__list { gap: var(--wh-logos-gap-tablet, 4.8rem); }
}

/* Tryb slidera (klase dodaje JS dopiero gdy Swiper jest potrzebny) */
.wh-reassurance--logos.wh-reassurance--slider .wh-reassurance__list {
    justify-content: flex-start;
    gap: 0; /* odstepy robi spaceBetween Swipera */
}
.wh-reassurance--logos.wh-reassurance--slider .wh-reassurance__item {
    flex-shrink: 0;
    height: auto;
}

/* W pasku logotypow tytul NIE jest pokazywany — sluzy jako alt obrazka (a11y).
   Zalecane uzycie: title = nazwa marki, icon_image = logo. */
.wh-reassurance--logos .wh-reassurance__text {
    display: none;
}
