/*
 * Lagano Promotions — single-product page banner with bundle suggestions.
 *
 * Loaded only on single-product pages when the plugin renders a banner.
 * Reuses the theme's product-card styles for the mini-cards inside.
 */

.lagano-promo-suggestion {
    margin: 1.25rem 0;
    padding: 0.9rem 1rem;
    background: #faf7ff;
    border: 1px solid #e9e2ff;
    border-radius: 12px;
    position: relative;
}

/* Compact variant — banner z jednym produktem zwęża się żeby nie było
 * ogromnej pustki obok pojedynczej karty. Na mobile zachowuje pełną
 * szerokość (i tak karta będzie wycentrowana w środku). */
.lagano-promo-suggestion--compact {
    max-width: 520px;
}
@media (max-width: 640px) {
    .lagano-promo-suggestion--compact {
        max-width: none;
    }
}

.lagano-promo-suggestion__header {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    margin-bottom: 0.7rem;
}

.lagano-promo-suggestion__text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex: 1;
}

.lagano-promo-suggestion__headline {
    color: #5b21b6;
    font-size: 0.92rem;
    line-height: 1.3;
    font-weight: 600;
}

.lagano-promo-suggestion__headline strong {
    color: #7c3aed;
}

.lagano-promo-suggestion__subline {
    color: #8b5cf6;
    font-size: 0.78rem;
    opacity: 0.9;
}

/* ---- products container ---- */

.lagano-promo-suggestion__products {
    display: grid;
    gap: 0.75rem;
}

.lagano-promo-suggestion__products--single {
    grid-template-columns: 1fr;
    max-width: 240px;
    margin: 0 auto;   /* karta wycentrowana w obrębie banneru */
}

.lagano-promo-suggestion__products--grid {
    /* ZAWSZE jeden rząd. Karty rozciągają się gdy mieszczą się w banerze
     * (np. 4 karty na desktopie wypełniają szerokość), gdy jest ich za
     * dużo na danej szerokości — overflow scroll (slider). Drugi rząd
     * nie powstaje nigdy. */
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #c4b5fd transparent;
    padding-bottom: 0.35rem;
}
.lagano-promo-suggestion__products--grid::-webkit-scrollbar {
    height: 6px;
}
.lagano-promo-suggestion__products--grid::-webkit-scrollbar-thumb {
    background: #c4b5fd;
    border-radius: 3px;
}
.lagano-promo-suggestion__products--grid > .lagano-promo-suggestion__card {
    /* flex-grow=1 stretchuje karty gdy jest miejsce
     * flex-basis=150 = preferowany rozmiar
     * min-width=140 = blokuje przed za małymi kartami → overflow scroll
     * max-width=240 = nie pozwala za szerokim kartom (gdy mało kart) */
    flex: 1 1 150px;
    min-width: 140px;
    max-width: 240px;
    scroll-snap-align: start;
}

/* Slider variant (buy_n_get_m_free) — horizontal scroll-snap.
 * Mobile-friendly, no JS needed. Hides scrollbar but keeps drag/swipe. */
.lagano-promo-suggestion__products--slider {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #c4b5fd transparent;
    padding-bottom: 0.5rem;
}

.lagano-promo-suggestion__products--slider::-webkit-scrollbar {
    height: 6px;
}
.lagano-promo-suggestion__products--slider::-webkit-scrollbar-thumb {
    background: #c4b5fd;
    border-radius: 3px;
}

.lagano-promo-suggestion__products--slider > .lagano-promo-suggestion__card {
    flex: 0 0 160px;
    scroll-snap-align: start;
}

/* ---- mini card (when theme helper unavailable — fallback only) ---- */

.lagano-promo-suggestion__card {
    background: #ffffff;
    border-radius: 10px;
    padding: 0.5rem;
    transition: transform 0.15s ease;
}
.lagano-promo-suggestion__card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.12);
}

/* When theme renders the card (lagano_render_product_card), it already brings
 * its own styles — we just provide the wrapper. Force the inner card to fit. */
.lagano-promo-suggestion__card > .product-card,
.lagano-promo-suggestion__card > .product-card-mini {
    margin: 0;
    height: 100%;
}

/* Compact internal padding for the cards in our banner */
.lagano-promo-suggestion .product-card__title,
.lagano-promo-suggestion .product-card-mini__title {
    font-size: 0.85rem;
    line-height: 1.25;
}

.lagano-promo-suggestion .product-card__price,
.lagano-promo-suggestion .product-card-mini__price {
    font-size: 0.9rem;
}

/* Slim self-rendered card (we deliberately bypass the theme's full ProductCard
 * — no category labels, no omnibus disclaimer, just thumb / title / price /
 * button) */
.lagano-promo-suggestion__card {
    position: relative;
    background: #ffffff;
    border-radius: 10px;
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.lagano-promo-suggestion__card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.12);
}

.lagano-promo-suggestion__card-badge {
    position: absolute;
    top: 0.4rem;
    left: 0.4rem;
    z-index: 2;
    background: #7c3aed;
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 999px;
    line-height: 1.2;
}

.lagano-promo-suggestion__card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    flex: 1;
}

.lagano-promo-suggestion__card-thumb {
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
    aspect-ratio: 1;
}
.lagano-promo-suggestion__card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lagano-promo-suggestion__card-title {
    font-size: 0.82rem;
    line-height: 1.25;
    margin: 0.4rem 0 0.2rem;
    color: #1c1c2b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.05em;  /* zarezerwowane 2 linie = wyrównane karty */
}

.lagano-promo-suggestion__card-price {
    font-size: 0.85rem;
    line-height: 1.2;
    margin-bottom: 0.4rem;
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    flex-wrap: nowrap;          /* cena zawsze w jednej linii */
    white-space: nowrap;
}
.lagano-promo-suggestion__card-price-old {
    color: #94a3b8;
    text-decoration: line-through;
    font-size: 0.72rem;
}
.lagano-promo-suggestion__card-price-now {
    color: #5b21b6;
    font-weight: 600;
}
.lagano-promo-suggestion__card-price .woocommerce-Price-amount {
    font-size: inherit;
}

/* Reset WooCommerce button styling (motyw + WC nakładają double border /
 * heavy shadow — przycisk wyglądał "topornie"). Pełne pokrycie własnym
 * stylem żeby był spójnie cienki i czysty. */
.lagano-promo-suggestion__card-btn,
.lagano-promo-suggestion__card-btn.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    font-size: 0.74rem;
    font-weight: 500;
    line-height: 1.2;
    padding: 0.42rem 0.6rem;
    text-align: center;
    background: #7c3aed;
    color: #ffffff;
    border: 0;
    border-radius: 8px;
    box-shadow: none;
    cursor: pointer;
    transition: background 0.15s ease;
    text-decoration: none;
    text-transform: none;
    letter-spacing: normal;
    min-height: 0;
    outline: 0;
}
.lagano-promo-suggestion__card-btn:hover,
.lagano-promo-suggestion__card-btn:focus,
.lagano-promo-suggestion__card-btn.button:hover,
.lagano-promo-suggestion__card-btn.button:focus {
    background: #6d28d9;
    color: #ffffff;
    box-shadow: none;
    border: 0;
    text-decoration: none;
}

/* =========================================================================
 * "Podobne produkty" — horizontal slider (motyw renderuje grid wewnątrz,
 * my przekształcamy go w slider z mniejszymi kartami i większą liczbą).
 * ========================================================================= */

.product-single__related--slider {
    overflow: hidden; /* container */
}

.product-single__related--slider .product-single__related-track {
    /* Przekształć motywowy .products-grid w pasek. */
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #c4b5fd transparent;
    padding-bottom: 0.75rem;
}

.product-single__related--slider .product-single__related-track::-webkit-scrollbar {
    height: 8px;
}
.product-single__related--slider .product-single__related-track::-webkit-scrollbar-thumb {
    background: #c4b5fd;
    border-radius: 4px;
}

/* Force the grid inside to behave as a flex row */
.product-single__related--slider .products-grid {
    display: flex !important;
    grid-template-columns: none !important;
    gap: 0.85rem;
    flex-wrap: nowrap;
}

/* Each card — fixed narrower width, scroll-snap */
.product-single__related--slider .products-grid > * {
    flex: 0 0 170px;
    scroll-snap-align: start;
}

/* Force every card to the same height (flex stretch) — eliminates the
 * "nierówno" look when some cards have omnibus disclaimer and some don't. */
.product-single__related--slider .products-grid > * {
    display: flex;
    flex-direction: column;
    align-self: stretch;
}

/* Hide the omnibus disclaimer + category label inside the slider — the
 * current product page already shows omnibus for itself, the slider would
 * just multiply that noise. Category label is redundant with breadcrumbs. */
.product-single__related--slider .product-card__omnibus,
.product-single__related--slider .product-card__lowest-price,
.product-single__related--slider .product-card__category,
.product-single__related--slider .product-card .omnibus-info,
.product-single__related--slider .product-card .lowest-price-info {
    display: none !important;
}

/* Tighter card internals (smaller titles/prices) + equal-height title block */
.product-single__related--slider .product-card__title,
.product-single__related--slider .product-card-mini__title {
    font-size: 0.85rem;
    line-height: 1.25;
    /* Reserve 2 lines so cards align regardless of title length */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.5em;
}
.product-single__related--slider .product-card__price,
.product-single__related--slider .product-card-mini__price {
    font-size: 0.88rem;
}
.product-single__related--slider .product-card__price-old {
    font-size: 0.74rem;
}

/* Push the "Dodaj do koszyka" button to the bottom for visual alignment */
.product-single__related--slider .product-card__footer {
    margin-top: auto;
}
.product-single__related--slider .product-card__add-to-cart {
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
}

/* Tablet — slightly wider cards */
@media (min-width: 768px) {
    .product-single__related--slider .products-grid > * {
        flex-basis: 180px;
    }
}

/* Desktop — 6 cards visible w/o scroll on typical widths */
@media (min-width: 1280px) {
    .product-single__related--slider .products-grid > * {
        flex-basis: 200px;
    }
}

/* Mobile (< 640px) */
@media (max-width: 640px) {
    .product-single__related--slider .products-grid > * {
        flex-basis: 150px;
    }
}

/* =========================================================================
 * Quantity input — twardy reset bordera, outline, box-shadow i text-decoration.
 * Bez tego niektóre browsery (Chrome na Windowsie) rysują underline pod cyfrą
 * w <input type="number">. Reset globalny (nie tylko mobile) bo user widzi
 * to na szerokim viewporcie.
 * ========================================================================= */
.product-single__quantity .quantity-input,
.product-single__quantity input[type="number"] {
    appearance: textfield;
    -webkit-appearance: none;
    -moz-appearance: textfield;
    border: 0 !important;
    border-bottom: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    text-decoration: none !important;
    background-image: none !important;
}
.product-single__quantity .quantity-input:focus,
.product-single__quantity input[type="number"]:focus {
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
}

/* =========================================================================
 * Brand logo inline (obok przycisku "Dodaj do koszyka"). Wysokość =
 * btn--lg min-height (52px), szerokość proporcjonalna. Bez aspect-ratio i
 * bez align-self: stretch (kombinacja wcześniej wysadzała layout do 250x250).
 * ========================================================================= */
.product-single__brand-inline {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
    line-height: 0;
    margin-left: 0.25rem;
}
.product-single__brand-inline img {
    display: block;
    height: 52px;
    width: auto;
    max-width: 80px;
}

/* =========================================================================
 * Mobile (< 640px) — wszystko w jeden rząd jako slider, karty kwadratowe.
 * Plus: schowaj zdublowane pillsy kategorii pod galerią (te same kategorie
 * są w breadcrumbs — SEO friendly zostaje, wizualnie czyściej).
 * ========================================================================= */
@media (max-width: 640px) {
    /* --- Suggestion banner (Często kupowane razem / Dobierz X) --- */
    .lagano-promo-suggestion {
        margin: 1rem 0;
        padding: 0.85rem 0.85rem;
        border-radius: 10px;
    }
    .lagano-promo-suggestion__headline {
        font-size: 0.92rem;
    }
    /* --grid już jest flex-nowrap globalnie (zawsze jeden rząd). Mobile
     * tylko kompaktuje karty żeby zmieściło się ich więcej w viewport. */
    .lagano-promo-suggestion__products--grid,
    .lagano-promo-suggestion__products--slider {
        gap: 0.55rem;
    }
    .lagano-promo-suggestion__products--grid > .lagano-promo-suggestion__card,
    .lagano-promo-suggestion__products--slider > .lagano-promo-suggestion__card {
        /* Mobile: fixed slim cards (slider feel), nie stretch. */
        flex: 0 0 130px !important;
        min-width: 130px !important;
        max-width: 130px !important;
        scroll-snap-align: start;
        padding: 0.35rem;
    }
    .lagano-promo-suggestion__card-title {
        font-size: 0.76rem;
        margin: 0.3rem 0 0.2rem;
        min-height: 1.95em;
    }
    .lagano-promo-suggestion__card-price {
        font-size: 0.76rem;
        margin-bottom: 0.3rem;
    }
    .lagano-promo-suggestion__card-price-old {
        font-size: 0.66rem;
    }
    .lagano-promo-suggestion__card-btn,
    .lagano-promo-suggestion__card-btn.button {
        font-size: 0.68rem;
        padding: 0.32rem 0.4rem;
    }

    /* --- "Podobne produkty" slider — narrower cards, same compact look --- */
    .product-single__related--slider .products-grid > * {
        flex-basis: 145px;
    }
    .product-single__related--slider .product-card__title,
    .product-single__related--slider .product-card-mini__title {
        font-size: 0.78rem;
    }

    /* --- Schowaj zdublowane pillsy kategorii pod galerią na mobile.
     *     Te same kategorie wyświetlają się w górnych breadcrumbs → SEO OK. --- */
    .product-single__category {
        display: none !important;
    }

    /* --- Mobile add-to-cart: quantity wąsko po lewej + button rozciąga się
     *     po prawej w tej samej linii (user preference, było tak kiedyś).
     *     Theme @media 767px daje buttonowi flex: 1 1 100% co zawijało go
     *     do drugiej linii lub zasypywało do 0; nadpisujemy. --- */
    .product-single__add-to-cart {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
    }
    .product-single__quantity {
        flex: 0 0 auto !important;
        width: auto !important;
        display: inline-flex !important;
        align-items: center !important;
        box-sizing: border-box !important;
    }
    .product-single__quantity .quantity-btn {
        flex: 0 0 auto !important;
    }
    .product-single__quantity .quantity-input {
        flex: 0 0 36px !important;
        width: 36px !important;
        min-width: 36px !important;
        text-align: center !important;
        padding: 0 0.2rem !important;
    }
    .product-single__add-to-cart .single_add_to_cart_button,
    .product-single__add-to-cart .product-single__btn {
        flex: 1 1 auto !important;
        width: auto !important;
        min-width: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.4rem !important;
        min-height: 48px !important;
        padding: 0.55rem 0.7rem !important;
        font-size: 0.85rem !important;
        line-height: 1.15 !important;
        white-space: nowrap !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    /* SVG koszyka kompaktowe na mobile — zostawia miejsce na tekst. */
    .product-single__add-to-cart .single_add_to_cart_button svg,
    .product-single__add-to-cart .product-single__btn svg {
        width: 16px !important;
        height: 16px !important;
        flex: 0 0 auto !important;
    }

    /* Logo marki obok przycisku — na mobile ukryte (button rozciąga się
     * na resztę szerokości, logo by zabierało miejsce na "Dodaj do koszyka"). */
    .product-single__brand-inline {
        display: none !important;
    }

    /* --- Breadcrumb compact: zwijamy wszystko pośrodku do "..." żeby
     *     na wąskim ekranie nie zalewał 4-5 linii pełnych nazw kategorii. --- */
    .breadcrumb {
        font-size: 0.78rem !important;
        padding: 0.4rem 0 0.75rem !important;
        gap: 0.3rem !important;
        flex-wrap: nowrap !important;
        white-space: nowrap !important;
        overflow: hidden !important;
    }
    .breadcrumb > a:not(:first-of-type) {
        display: none !important;
    }
    .breadcrumb > .breadcrumb__separator:not(:last-of-type) {
        display: none !important;
    }
    .breadcrumb > a:first-of-type::after {
        content: " /  …";
        margin-left: 0.25rem;
        color: var(--color-gray-400);
    }
    .breadcrumb__current {
        flex: 1 1 auto !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        min-width: 0 !important;
    }
}

/* =========================================================================
 * Top breadcrumbs — drobny lifting na każdej szerokości (były "tubo brzydkie"
 * wg klienta). Mniejszy font, więcej oddechu, mniej krzykliwy fiolet,
 * separatory cieńsze.
 * ========================================================================= */
.product-single__breadcrumbs,
.product-single__breadcrumb,
.breadcrumbs,
.lagano-breadcrumbs {
    font-size: 0.82rem;
    line-height: 1.4;
    color: #64748b;
    margin: 0.5rem 0 0.75rem;
}
.product-single__breadcrumbs a,
.product-single__breadcrumb a,
.breadcrumbs a,
.lagano-breadcrumbs a {
    color: #6d28d9;
    text-decoration: none;
}
.product-single__breadcrumbs a:hover,
.product-single__breadcrumb a:hover,
.breadcrumbs a:hover,
.lagano-breadcrumbs a:hover {
    text-decoration: underline;
}
