/* ==========================================================
   CrossSell — Frontend CSS v1.1.1
   ========================================================== */

/* ── Section wrapper ───────────────────────────────────── */
.cs-product-sections {
    margin-top: 1.5rem;
}

.cs-section__title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    padding: 0 8px;
}

.cs-section__title.h6,
h6.cs-section__title {
    padding: 0;
}

.cs-section__subtitle {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 0.75rem;
    padding: 0 8px;
}

/* ── Grid ──────────────────────────────────────────────── */
.cs-products--grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

@media (max-width: 1350px) {
    .cs-product-sections .cs-products--grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .cs-products--grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.cs-product-wrap {
    min-width: 0;
}

/* Miniatura musi być w pełni zawarta — nie wypadać poza wrap */
.cs-product-wrap .product-miniature,
.cs-slide .product-miniature {
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

/* Thumbnail container musi trzymać proporcje */
.cs-product-wrap .thumbnail-container,
.cs-slide .thumbnail-container {
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

/* Przycisk add-to-cart — zostaje wewnątrz miniaturki */
.cs-product-wrap .product-description,
.cs-slide .product-description {
    overflow: hidden;
}

.cs-product-wrap .add-to-cart,
.cs-slide .add-to-cart {
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.78rem;
    padding: 6px 8px;
}

/* ── Embla Carousel ────────────────────────────────────── */
.cs-embla {
    overflow: hidden;
    padding: 0 4px 8px;
}

.cs-embla__viewport {
    overflow: hidden;
    width: 100%;
}

.cs-embla__container {
    display: flex;
    gap: 12px;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: pan-y;
    -webkit-tap-highlight-color: transparent;
    align-items: stretch;
}

.cs-slide {
    flex: 0 0 180px;
    min-width: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.cs-slide .product-miniature {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cs-slide .thumbnail-container {
    flex: 1;
}

@media (max-width: 576px) {
    .cs-slide {
        flex: 0 0 150px;
    }
}

/* ── Modal crosssell ───────────────────────────────────── */
.cs-modal-crosssell {
    border-top: 1px solid #e5e5e5;
    margin-top: 1rem;
    padding-top: 0.75rem;
}

.cs-modal-step__header {
    margin-bottom: 0.75rem;
}

.cs-modal-crosssell .cs-slide {
    flex: 0 0 160px;
}

/* ── Progress dots ─────────────────────────────────────── */
.cs-popup__progress {
    display: flex;
    gap: 0.4rem;
    justify-content: center;
    padding: 0.6rem 0 0;
}

.cs-popup__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ddd;
    transition: background 0.2s;
}

.cs-popup__dot--active {
    background: #c00;
}

/* Ukryj tekst "Dodaj do koszyka" w przyciskach ramki CS i popupu */
.cs-product-wrap .add-to-cart span,
.cs-slide .add-to-cart span,
.cs-modal-crosssell .add-to-cart span {
    display: none;
}

/* ── Popup — przesuń CS nad przyciski koszyka ───────────── */
#blockcart-modal .modal-body {
    display: flex;
    flex-direction: column;
}

#blockcart-modal .modal-body > .cart-content-btn {
    order: 1;
    display: flex;
    justify-content: space-between;
    padding: 0 16px 16px 16px;
}

#blockcart-modal .cs-modal-crosssell {
    order: 0;
    border-bottom: 1px solid #e5e5e5;
    margin-bottom: 12px;
    padding: 16px;
    border-top: none;
    margin-top: 0;
    padding-top: 8px;
}

/* Popup grid — 2 kolumny na mobile */
#blockcart-modal .cs-products--grid {
    grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 576px) {
    #blockcart-modal .cs-products--grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================================
   Flash Sale (Gorący Strzał) — crosssell integration
   ============================================================ */

/* Karta flash sale */
.cs-flash-card {
    position: relative;
    border: 2px solid #e74c3c;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    display: flex;
    flex-direction: column;
    height:100%;
}

.cs-flash-card__badge {
    position: absolute;
    top: 0px;
    left: 0px;
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 0 0 3px 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 1;
    width:100%;
    text-align: center;
}

.cs-flash-card__image-wrap {
    display: block;
    overflow: hidden;
    aspect-ratio: 1;
}

.cs-flash-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.cs-flash-card__image-wrap:hover .cs-flash-card__image {
    transform: scale(1.04);
}

.cs-flash-card__body {
    padding: 10px 12px 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cs-flash-card__name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cs-flash-card__variant {
    font-size: 12px;
    color: #888;
}

.cs-flash-card__prices {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 6px;
    margin-top: auto;
    flex-wrap: wrap;
}

.cs-flash-card__price-promo {
    font-size: .9375rem;
    font-weight: 700;
    color: #e74c3c;
}

.cs-flash-card__price-old {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
}

.cs-flash-card__price-30d {
    font-size: 11px;
    color: #999;
}

/* Pasek stock */
.cs-flash-card__stock {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cs-flash-card__stock-bar {
    height: 6px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
}

.cs-flash-card__stock-fill {
    height: 100%;
    background: #e74c3c;
    border-radius: 3px;
    transition: width 0.5s;
}

.cs-flash-card__stock-label {
    font-size: 11px;
    color: #666;
}

/* Countdown */
.cs-flash-card__countdown {
    font-size: 12px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 4px;
}

.cs-flash-countdown-timer {
    font-weight: 700;
    color: #e74c3c;
    font-variant-numeric: tabular-nums;
}

.cs-flash-card__ended {
    font-size: 12px;
    color: #999;
    font-style: italic;
}

.cs-flash-card__footer {
    padding: 8px 8px 6px;
}

.cs-flash-card__footer form {
    margin: 0;
}

body .btn.cs-flash-card__btn {
    width: 100%;
    background: #e74c3c;
    border-color: #e74c3c;
    padding: 8px 10px !important;
    font-size: 14px;
}

body .btn.cs-flash-card__btn:hover {
    background: #c0392b;
    border-color: #c0392b;
}

/* ── Grid: flash jako 1. kafelek ───────────────────────── */
.cs-flash-grid-item {
    /* dopasuj szerokość do innych kart w gridzie */
}

/* ── Karuzela: flash jako stały element z lewej ────────── */
.cs-section--carousel-with-flash {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.cs-flash-fixed {
    flex: 0 0 200px;
    max-width: 200px;
}

.cs-section--carousel-with-flash .cs-embla {
    flex: 1;
    min-width: 0;
}

/* ── Modal koszyk ──────────────────────────────────────── */
.cs-modal-crosssell {
    display: block;
}

@media (max-width: 575px) {
    .cs-section--carousel-with-flash {
        flex-direction: column;
    }
    .cs-flash-fixed {
        flex: 0 0 auto;
        max-width: 100%;
        width: 100%;
    }
}

/* Flash card — brak w magazynie */
.cs-flash-card--oos {
    opacity: 0.7;
}
.cs-flash-card--oos .cs-flash-card__badge {
    background: #95a5a6;
}
.cs-flash-card--oos .cs-flash-card__price-promo {
    color: #95a5a6;
}
