/* CL Cross-selling – front styles
   Samodzielne style (bez Swipera i klas Bootstrapa 4 stable), żeby widget
   wyglądał tak samo w każdym motywie sklepów multistore. Kolor akcentu
   domyślnie pod Fabrykę Instalacji – nadpisz --clcs-accent w motywie. */
.clcrossselling-widget {
    --clcs-accent: #375d89;
    --clcs-border: #e5e5e5;
    --clcs-muted: #777;
    --clcs-gap: 16px;
    display: block;
}

.clcs-is-hidden,
.clcs__pane:not(.is-active),
.clcs__body[hidden] {
    display: none !important;
}

/* ── Section ── */
.clcs--product-page {
    margin: 40px 0;
}

.clcs--cart,
.clcrossselling-cart-popup {
    clear: both;
    width: 100%;
    padding: 12px 0 4px;
}

.clcs__title {
    margin: 0 0 16px;
}

.clcs__title--popup {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 8px;
}

.clcs__header--toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 0;
    background: none;
    border: 0;
    border-top: 1px solid var(--clcs-border);
    cursor: pointer;
    text-align: left;
}

.clcs__header--toggle .clcs__title {
    margin: 0;
    font-weight: 700;
}

.clcs__toggle-icon {
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-135deg);
    transition: transform .2s;
}

.clcs__header--toggle.is-collapsed .clcs__toggle-icon {
    transform: rotate(45deg);
}

/* ── Tabs ── */
.clcs__tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.clcs__tabs::-webkit-scrollbar {
    display: none;
}

.clcs__tab {
    flex: 0 0 auto;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid var(--clcs-border);
    border-radius: 999px;
    color: inherit;
    font-size: .875rem;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
}

.clcs__tab:hover {
    border-color: var(--clcs-accent);
}

.clcs__tab.is-active {
    background: var(--clcs-accent);
    border-color: var(--clcs-accent);
    color: #fff;
}

/* ── Carousel ── */
.clcs__carousel {
    position: relative;
}

.clcs__track {
    display: flex;
    gap: var(--clcs-gap);
    padding: 8px 2px 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

/* Nawigacja strzałkami (desktop) i przesuwaniem palcem (mobile) – pasek przewijania zbędny */
.clcs__track::-webkit-scrollbar {
    display: none;
}

.clcs__item {
    flex: 0 0 calc((100% - var(--clcs-gap)) / 1.3);
    min-width: 0;
    scroll-snap-align: start;
}

@media (min-width: 576px) {
    .clcs__item { flex-basis: calc((100% - var(--clcs-gap)) / 2); }
}

@media (min-width: 768px) {
    .clcs__item { flex-basis: calc((100% - 2 * var(--clcs-gap)) / 3); }
}

@media (min-width: 992px) {
    .clcs--product-page .clcs__item { flex-basis: calc((100% - 3 * var(--clcs-gap)) / 4); }
}

@media (min-width: 1200px) {
    .clcs--product-page .clcs__item { flex-basis: calc((100% - 4 * var(--clcs-gap)) / 5); }
    .clcs--cart-popup .clcs__item { flex-basis: calc((100% - 3 * var(--clcs-gap)) / 4); }
}

.clcs__nav {
    display: none;
    position: absolute;
    top: 35%;
    z-index: 2;
    width: 40px;
    height: 40px;
    padding: 0;
    background: #fff;
    border: 1px solid var(--clcs-border);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
    cursor: pointer;
}

.clcs__nav::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--clcs-accent);
    border-bottom: 2px solid var(--clcs-accent);
}

.clcs__nav--prev { left: -12px; }
.clcs__nav--prev::before { transform: translate(-30%, -50%) rotate(135deg); }
.clcs__nav--next { right: -12px; }
.clcs__nav--next::before { transform: translate(-70%, -50%) rotate(-45deg); }

.clcs__nav:disabled {
    opacity: 0;
    pointer-events: none;
}

@media (min-width: 768px) {
    .clcs__carousel.is-scrollable .clcs__nav { display: block; }
}

/* ── Product tile ── */
.clcs-product {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--clcs-border);
    border-radius: 4px;
    text-align: left;
}

.clcs-product__thumb {
    display: block;
    margin-bottom: 8px;
}

.clcs-product__img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
}

.clcs-product__name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
    margin-bottom: 6px;
    color: inherit;
    font-size: .875rem;
    line-height: 1.3;
}

.clcs-product__prices {
    margin-bottom: 8px;
}

.clcs-product__regular-price {
    margin-right: 6px;
    color: var(--clcs-muted);
    font-size: .8125rem;
    text-decoration: line-through;
}

.clcs-product__price {
    font-weight: 700;
}

.clcs-product__variants select {
    width: 100%;
    margin-bottom: 6px;
}

.clcs-product__btn {
    width: 100%;
    margin-top: auto;
    white-space: normal;
}

.clcrossselling__add-btn--added,
.clcrossselling__add-btn--added:hover,
.clcrossselling__add-btn--added:focus {
    background: #fff;
    border-color: #2e7d32;
    color: #2e7d32;
}

/* ── Cart popup ── */
.clcrossselling-cart-popup .clcrossselling-cart-popup__btn {
    display: inline-block;
    width: auto;
    padding-left: 24px;
    padding-right: 24px;
    border-radius: 12px;
}

/* Motywy z przyklejonym nagłówkiem (venedor: z-index 10000) przykrywają
   standardowy modal Bootstrapa (1050) – modal i jego tło muszą być wyżej. */
.clcrossselling-modal {
    z-index: 10060;
}

body.clcs-modal-open .modal-backdrop {
    z-index: 10050;
}

@media (min-width: 992px) {
    .clcrossselling-modal .modal-dialog { max-width: 960px; width: auto; }
}

/* ── Skeleton ── */
.clcs-skeleton__header,
.clcs-skeleton__img,
.clcs-skeleton__line {
    background: linear-gradient(90deg, #f0f0f0 25%, #e6e6e6 37%, #f0f0f0 63%);
    background-size: 400% 100%;
    border-radius: 4px;
    animation: clcs-shimmer 1.4s ease infinite;
}

.clcs-skeleton {
    margin: 24px 0;
}

.clcs-skeleton--cart-popup,
.clcs-skeleton--cart {
    margin: 8px 0;
}

.clcs-skeleton__header {
    width: 220px;
    height: 24px;
    margin-bottom: 16px;
}

.clcs-skeleton__items {
    display: flex;
    gap: 16px;
    overflow: hidden;
}

.clcs-skeleton__item {
    flex: 0 0 calc((100% - 48px) / 4);
    min-width: 140px;
}

.clcs-skeleton__img {
    aspect-ratio: 1 / 1;
    margin-bottom: 8px;
}

.clcs-skeleton__line {
    height: 12px;
    margin-bottom: 6px;
}

.clcs-skeleton__line--short {
    width: 50%;
}

.clcs-skeleton--cart .clcs-skeleton__header {
    display: none;
}

@keyframes clcs-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}
