/* crossSelling by [tech]NEO - Frontend */

.tn-cs-block {
    margin: 40px 0;
    clear: both;
    /* Shop-Farben uebernehmen (NOVA/Bootstrap), sonst Plugin-Standard */
    --tncs-primary: var(--color-primary, var(--bs-primary, var(--primary, #0b6aa2)));
    --tncs-secondary: var(--color-secondary, var(--bs-secondary, var(--secondary, #6c757d)));
}

/* Ueberschrift: Schriftart vom Shop erben, Primaerfarbe vom Shop */
.tn-cs-headline {
    font-family: inherit;
    font-size: 1.3rem;
    margin-bottom: 18px;
    font-weight: 600;
    color: var(--tncs-primary);
    text-transform: none;
    letter-spacing: normal;
}

.tn-cs-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
}

/* Slider-Layout: moderner Karten-Slider mit Pfeil-Navigation.
   Pfeile liegen NEBEN der Karten-Reihe (nicht darueber), damit Checkbox &
   Vorschau-Button in den Ecken anklickbar bleiben. */
.tn-cs-slider {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tn-cs-layout-slider .tn-cs-items {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    gap: 16px;
    padding: 4px 2px 8px;
    /* Scrollbar ausblenden (modernes Slider-Feeling) */
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.tn-cs-layout-slider .tn-cs-items::-webkit-scrollbar { display: none; }

.tn-cs-layout-slider .tn-cs-item {
    /* Identische Kartenbreite wie im Raster (min. 170px) */
    flex: 0 0 170px;
    scroll-snap-align: start;
}

/* Kein Scrollen noetig -> Pfeile ausblenden */
.tn-cs-slider.tn-cs-no-scroll .tn-cs-nav { display: none; }

/* Navigations-Pfeile (neben der Reihe) */
.tn-cs-nav {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: #fff;
    color: var(--tncs-primary);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}
.tn-cs-nav:hover {
    background: var(--tncs-primary);
    color: #fff;
}
.tn-cs-nav[disabled] {
    opacity: .35;
    cursor: default;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}
.tn-cs-nav[disabled]:hover {
    background: #fff;
    color: var(--tncs-primary);
}

@media (max-width: 575px) {
    .tn-cs-nav { width: 34px; height: 34px; font-size: .85rem; }
}

.tn-cs-item {
    position: relative;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px;
    background: #fff;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    display: flex;
    flex-direction: column;
}

.tn-cs-item:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.tn-cs-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.tn-cs-img {
    display: block;
    text-align: center;
    margin-bottom: 8px;
}

.tn-cs-img img {
    max-width: 100%;
    height: 110px;
    object-fit: contain;
    border-radius: 4px;
}

.tn-cs-name {
    font-size: 0.9rem;
    line-height: 1.25;
    margin-bottom: 6px;
    /* Name auf max. 2 Zeilen kuerzen (ohne reservierte Leerzeile) */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tn-cs-price {
    font-weight: 700;
    font-size: 1rem;
    margin-top: 0;
    color: var(--tncs-primary);
}

.tn-cs-cartform {
    margin-top: auto;
    padding-top: 10px;
}

.tn-cs-cart-btn {
    width: 100%;
    border: none;
    border-radius: 6px;
    padding: 8px 10px;
    background: var(--tncs-primary);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease;
}

.tn-cs-cart-btn:hover {
    background: #09527d;
}

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

/* ===== Quick-View (Vorschau) ===== */
.tn-cs-item { position: relative; }
.tn-cs-qv { background: none; border: none; cursor: pointer; color: #6c8398; padding: 4px; font-size: 1rem; line-height: 1; }
.tn-cs-qv:hover { color: var(--tncs-primary); }
.tn-cs-qv-grid { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.92); box-shadow: 0 1px 4px rgba(0,0,0,.15); z-index: 2; display: inline-flex; align-items: center; justify-content: center; }
.tn-cs-list-item .tn-cs-qv { flex: 0 0 auto; }

.tn-cs-qv-modal { position: fixed; inset: 0; z-index: 99999; display: none; align-items: center; justify-content: center; }
.tn-cs-qv-modal.cs-open { display: flex; }
.tn-cs-qv-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.tn-cs-qv-box { position: relative; background: #fff; border-radius: 12px; max-width: 640px; width: 92%; max-height: 88vh; overflow: auto; display: flex; gap: 20px; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
@media (max-width: 560px) { .tn-cs-qv-box { flex-direction: column; } }
.tn-cs-qv-close { position: absolute; top: 10px; right: 14px; background: none; border: none; font-size: 28px; line-height: 1; color: #888; cursor: pointer; }
.tn-cs-qv-close:hover { color: #dc3545; }
.tn-cs-qv-media { flex: 0 0 220px; text-align: center; }
.tn-cs-qv-media img { max-width: 100%; max-height: 240px; object-fit: contain; }
.tn-cs-qv-info { flex: 1; min-width: 0; }
.tn-cs-qv-name { margin: 0 0 8px; font-size: 1.2rem; }
.tn-cs-qv-price { font-weight: 700; color: var(--tncs-primary); font-size: 1.1rem; margin-bottom: 12px; }
.tn-cs-qv-desc { color: #555; line-height: 1.5; margin-bottom: 16px; }
.tn-cs-qv-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.tn-cs-qv-link, .tn-cs-qv-cart { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 8px; font-weight: 600; cursor: pointer; border: none; text-decoration: none; }
.tn-cs-qv-link { background: #eef3f6; color: var(--tncs-primary); }
.tn-cs-qv-link:hover { background: #e0e9ef; }
.tn-cs-qv-cart { background: var(--tncs-primary); color: #fff; }
.tn-cs-qv-cart:hover { background: #09527d; }
.tn-cs-qv-cart:disabled { opacity: .6; cursor: progress; }

/* ===== Listen-Layout / "Wird oft zusammen gekauft" – Box mit Zeilen ===== */
.tn-cs-list {
    border: 1px solid #d7e3ea;
    border-radius: 4px;
    padding: 16px 18px;
    background: #fff;
    margin: 24px 0;
}
.tn-cs-list.tn-cs-bundle { background: #f7fbfd; }
.tn-cs-list .tn-cs-headline {
    font-size: 1.15rem;
    margin-bottom: 12px;
}
.tn-cs-list-items { display: flex; flex-direction: column; }
.tn-cs-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #eef2f5;
}
.tn-cs-list-item:last-child { border-bottom: none; }
.tn-cs-list.tn-cs-bundle .tn-cs-list-item { cursor: pointer; }
.tn-cs-list-img { flex: 0 0 auto; }
.tn-cs-list-img img { width: 44px; height: 44px; object-fit: contain; border-radius: 4px; }
.tn-cs-list-name { flex: 1; min-width: 0; text-decoration: none; color: #243743; font-size: .98rem; }
.tn-cs-list-name:hover { text-decoration: underline; color: var(--tncs-primary); }
.tn-cs-list-price { font-weight: 700; color: var(--tncs-primary); white-space: nowrap; }

/* Checkbox im Raster/Slider (Ecke der Karte) */
.tn-cs-bundle .tn-cs-item { cursor: pointer; }
.tn-cs-bundle-check-grid { position: absolute; top: 8px; left: 8px; z-index: 2; box-shadow: 0 1px 4px rgba(0,0,0,.15); }

/* Checkbox (Checkbox-Modus) */
.tn-cs-bundle-cb { position: absolute; opacity: 0; width: 0; height: 0; }
.tn-cs-bundle-check {
    position: relative;
    flex: 0 0 22px;
    width: 22px; height: 22px;
    border: 2px solid #b9c6ce;
    border-radius: 5px;
    background: #fff;
    transition: all .15s ease;
}
.tn-cs-bundle-cb:checked + .tn-cs-bundle-check {
    background: var(--tncs-primary);
    border-color: var(--tncs-primary);
}
.tn-cs-bundle-cb:checked + .tn-cs-bundle-check::after {
    content: '';
    position: absolute;
    left: 6px; top: 2px;
    width: 6px; height: 11px;
    border: solid #fff;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}
