/* Kobalz Sidecart v1.1.0 – Variante B „Versandfrei-Booster“
   Nur aktiv bei Schalter „Neues Sidecart-Design aktiv“ = Ja oder Admin-Vorschau. */

.ksc2,
.ksc2-backdrop {
    --ksc2-green: #0b7a0b;
    --ksc2-green-dark: #096409;
    --ksc2-green-soft: #eef6ee;
    --ksc2-text: #1c2329;
    --ksc2-muted: #5b6670;
    --ksc2-line: #e4e9e6;
}

/* NOVA-Miniwarenkorb wird durch das Sidecart ersetzt (wie v1.0.51). */
body.kobalz-sidecart-enabled #cart-dropdown-container,
body.kobalz-sidecart-enabled li.cart-icon-dropdown .dropdown-menu {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

html.kobalz-sidecart-lock,
body.kobalz-sidecart-lock {
    overflow: hidden;
}

/* ---------- Grundgerüst ---------- */
.ksc2-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2147483600;
    background: rgba(17, 24, 20, .45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
}

.ksc2 {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 2147483601;
    display: flex;
    flex-direction: column;
    width: 440px;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: #fff;
    color: var(--ksc2-text);
    font-family: "Open Sans", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    box-shadow: -18px 0 45px rgba(0, 0, 0, .2);
    transform: translateX(105%);
    visibility: hidden;
    transition: transform .24s ease, visibility .24s ease;
    outline: 0;
}

.ksc2 *,
.ksc2 *::before,
.ksc2 *::after {
    box-sizing: border-box;
}

body.kobalz-sidecart-open .ksc2 {
    transform: translateX(0);
    visibility: visible;
}

body.kobalz-sidecart-open .ksc2-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.ksc2 .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ksc2 a:focus-visible,
.ksc2 button:focus-visible {
    outline: 3px solid var(--ksc2-green);
    outline-offset: 2px;
}

/* ---------- Kopf ---------- */
.ksc2-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--ksc2-line);
}

.ksc2-title {
    margin: 0;
    font-family: "Oswald", Arial, sans-serif;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--ksc2-text);
}

.ksc2-close {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f1f4f2;
    color: var(--ksc2-text);
    cursor: pointer;
    transition: background-color .15s ease;
}

.ksc2-close:hover {
    background: #e4e9e6;
}

.ksc2-close svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
}

/* ---------- Inhalt ---------- */
.ksc2-body {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 20px 20px;
    transition: opacity .15s ease;
}

.ksc2.is-busy .ksc2-body {
    opacity: .55;
    pointer-events: none;
}

.ksc2-loading,
.ksc2-error {
    padding: 32px 8px;
    text-align: center;
    color: var(--ksc2-muted);
}

.ksc2-error a {
    color: var(--ksc2-green);
    font-weight: 700;
}

/* Versandfrei-Kasten */
.ksc2-ship {
    margin: 0 0 16px;
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--ksc2-green-soft);
    color: var(--ksc2-text);
}

.ksc2-ship-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ksc2-ship-icon {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff;
    color: var(--ksc2-green);
}

.ksc2-ship-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linejoin: round;
}

.ksc2-ship-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}

.ksc2-ship-text b {
    color: var(--ksc2-green);
    font-weight: 700;
}

.ksc2-progress {
    position: relative;
    height: 8px;
    margin: 12px 0 6px;
    border-radius: 999px;
    background: #d5e7d5;
    overflow: hidden;
}

.ksc2-progress span {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: inherit;
    background: var(--ksc2-green);
    transition: width .3s ease;
}

.ksc2-ship-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: var(--ksc2-muted);
}

/* Artikelliste */
.ksc2-items {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ksc2-item {
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    padding: 14px 0;
    border-bottom: 1px solid var(--ksc2-line);
}

.ksc2-item:first-child {
    padding-top: 4px;
}

.ksc2-item-img {
    display: block;
    width: 60px;
    height: 60px;
    border-radius: 10px;
    overflow: hidden;
    background: #f5f7f6;
}

.ksc2-item-img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ksc2-item-noimg {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    color: #9aa5ad;
}

.ksc2-item-noimg svg,
.ksc2-empty-icon svg,
.ksc2-card-img svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linejoin: round;
}

.ksc2-item-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    color: var(--ksc2-text);
    font-weight: 600;
    line-height: 1.35;
    text-decoration: none;
}

a.ksc2-item-name:hover {
    color: var(--ksc2-green);
    text-decoration: underline;
}

.ksc2-item-props,
.ksc2-item-gift {
    margin: 4px 0 0;
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--ksc2-muted);
    overflow-wrap: anywhere;
}

.ksc2-item-gift {
    color: var(--ksc2-green);
    font-weight: 700;
}

.ksc2-qty {
    display: inline-flex;
    align-items: center;
    margin-top: 8px;
    border: 1px solid #d3dbd6;
    border-radius: 999px;
}

.ksc2-qty button {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ksc2-text);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.ksc2-qty button:hover:not([disabled]) {
    background: #eef2ef;
}

.ksc2-qty button[disabled] {
    color: #b3bcb6;
    cursor: default;
}

.ksc2-qty-value {
    min-width: 28px;
    text-align: center;
    font-weight: 700;
}

.ksc2-item-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.ksc2-item-price {
    font-weight: 700;
    white-space: nowrap;
}

.ksc2 sup {
    font-size: .7em;
    top: -.45em;
}

.ksc2-remove {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ksc2-muted);
    cursor: pointer;
}

.ksc2-remove:hover {
    background: #fbeeee;
    color: #a12020;
}

.ksc2-remove svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Rabatte (z. B. Bundle-Rabatt) */
.ksc2-discounts {
    margin: 0;
    padding: 10px 0;
    list-style: none;
    border-bottom: 1px solid var(--ksc2-line);
}

.ksc2-discounts li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 0;
    color: var(--ksc2-green);
    font-weight: 600;
}

/* Passt dazu */
.ksc2-suggest {
    margin-top: 20px;
}

.ksc2-suggest-title {
    margin: 0 0 12px;
    font-family: "Oswald", Arial, sans-serif;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--ksc2-text);
}

.ksc2-suggest-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ksc2-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: 8px;
    border: 1px solid var(--ksc2-line);
    border-radius: 12px;
}

.ksc2-card-img {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f7f6;
    color: #9aa5ad;
}

.ksc2-card-img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ksc2-card-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    min-height: 2.7em;
    color: var(--ksc2-text);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.35;
    text-decoration: none;
}

a.ksc2-card-name:hover {
    color: var(--ksc2-green);
    text-decoration: underline;
}

.ksc2-card-price {
    font-size: 13px;
    font-weight: 700;
}

.ksc2-card-add {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin-top: auto;
    padding: 6px 4px;
    border: 1.5px solid var(--ksc2-green);
    border-radius: 10px;
    background: #fff;
    color: var(--ksc2-green);
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.ksc2-card-add:hover {
    background: var(--ksc2-green);
    color: #fff;
    text-decoration: none;
}

.ksc2-card-add.is-loading {
    opacity: .6;
}

/* Leer */
.ksc2-empty {
    padding: 40px 12px;
    text-align: center;
}

.ksc2-empty-icon {
    display: inline-flex;
    width: 64px;
    height: 64px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--ksc2-green-soft);
    color: var(--ksc2-green);
}

.ksc2-empty-title {
    margin: 16px 0 4px;
    font-size: 16px;
    font-weight: 700;
}

.ksc2-empty-text {
    margin: 0 0 18px;
    color: var(--ksc2-muted);
}

.ksc2-empty-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 24px;
    border-radius: 10px;
    background: var(--ksc2-green);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}

.ksc2-empty-link:hover {
    background: var(--ksc2-green-dark);
    color: #fff;
    text-decoration: none;
}

/* ---------- Fuß ---------- */
.ksc2-foot {
    flex: 0 0 auto;
    padding: 14px 20px calc(16px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--ksc2-line);
    background: #fff;
    box-shadow: 0 -8px 22px rgba(0, 0, 0, .04);
}

.ksc2-foot[hidden] {
    display: none;
}

.ksc2-subtotal {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    font-size: 15px;
}

.ksc2-subtotal strong {
    font-size: 18px;
    font-weight: 800;
}

.ksc2-legal {
    margin: 2px 0 12px;
    font-size: 12px;
    color: var(--ksc2-muted);
}

.ksc2-legal a {
    color: var(--ksc2-muted);
    text-decoration: underline;
}

.ksc2-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    align-items: stretch;
}

.ksc2-actions.has-paypal {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.ksc2-actions:not(.has-paypal) .ksc2-paypal {
    display: none;
}

.ksc2-paypal {
    min-width: 0;
}

.ksc2-checkout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 0 12px;
    border-radius: 10px;
    background: var(--ksc2-green);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 6px 14px rgba(11, 122, 11, .18);
}

.ksc2-checkout:hover,
.ksc2-checkout:focus {
    background: var(--ksc2-green-dark);
    color: #fff;
    text-decoration: none;
}

.ksc2-cartlink {
    display: block;
    margin-top: 10px;
    padding: 6px 0;
    text-align: center;
    color: var(--ksc2-text);
    font-weight: 600;
    text-decoration: underline;
}

.ksc2-cartlink:hover {
    color: var(--ksc2-green);
}

/* PayPal (Portal/Mirror aus v1.0.51, nur Position und Optik angepasst).
   !important nur hier: überschreibt Inline-Styles des JTL-PayPal-Blocks innerhalb des Sidecarts. */
.ksc2 .kobalz-sidecart-paypal-native {
    display: none;
    width: 100%;
}

.ksc2 .kobalz-sidecart-paypal-native.is-active,
.ksc2 .kobalz-sidecart-paypal-native.is-portal {
    display: block;
}

.ksc2 .kobalz-sidecart-paypal-native.is-portal > [id^="ppc-paypal-button-custom-"],
.ksc2 .kobalz-sidecart-paypal-native.is-portal > [id^="paypal-button-"] {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.ksc2 .kobalz-sidecart-paypal-native iframe,
.ksc2 .kobalz-sidecart-paypal-native .btn-ppc,
.ksc2 .kobalz-sidecart-paypal-native .ppc-paypal-button-custom {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 52px;
    border-radius: 10px !important;
}

.ksc2 .kobalz-sidecart-paypal-mirror.is-empty {
    display: none;
}

.ksc2 .kobalz-sidecart-paypal-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    min-height: 52px;
    padding: 0 8px;
    border: 0;
    border-radius: 10px;
    background: #ffc439;
    color: #111;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.ksc2 .kobalz-sidecart-paypal-logo {
    font-style: italic;
    font-weight: 900;
    color: #003087;
}

/* ---------- Mobil: Bottom-Sheet über die volle Breite ---------- */
@media (max-width: 991.98px) {
    .ksc2 {
        top: auto;
        bottom: 0;
        left: 0;
        width: 100vw;
        height: auto;
        max-height: 92vh;
        max-height: 92dvh;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -18px 45px rgba(0, 0, 0, .26);
        transform: translateY(105%);
    }

    body.kobalz-sidecart-open .ksc2 {
        transform: translateY(0);
    }

    .ksc2-head {
        padding: 12px 16px;
    }

    .ksc2-title {
        font-size: 20px;
    }

    .ksc2-body {
        padding: 14px 16px 16px;
    }

    .ksc2-foot {
        padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
    }
}

@media (max-width: 399.98px) {
    .ksc2-actions.has-paypal {
        grid-template-columns: minmax(0, 1fr);
    }

    .ksc2-suggest-grid {
        gap: 8px;
    }
}

/* ---------- Hilfsregeln aus v1.0.51 ---------- */
#kobalz-mobile-cart-overlay {
    display: none !important;
}

@media (max-width: 991.98px) {
    #kobalz-mobile-cart-overlay {
        display: block !important;
        position: fixed !important;
        z-index: 2147482500 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        appearance: none !important;
        -webkit-appearance: none !important;
        cursor: pointer !important;
        touch-action: manipulation !important;
    }

    body.kobalz-sidecart-open #kobalz-mobile-cart-overlay {
        display: none !important;
    }

    html.kobalz-cartpage-mobile-hide-header-cart li.cart-icon-dropdown,
    body.kobalz-cartpage-mobile-hide-header-cart li.cart-icon-dropdown,
    html.kobalz-cartpage-mobile-hide-header-cart #kobalz-mobile-cart-overlay,
    body.kobalz-cartpage-mobile-hide-header-cart #kobalz-mobile-cart-overlay {
        display: none !important;
    }
}

html.kobalz-cartpage-mobile-hide-header-cart button[type="submit"][name="fake"].btn-hidden-default,
html.kobalz-cartpage-mobile-hide-header-cart button[type="submit"][name="fake"].btn-hidden,
body.kobalz-cartpage-mobile-hide-header-cart button[type="submit"][name="fake"].btn-hidden-default,
body.kobalz-cartpage-mobile-hide-header-cart button[type="submit"][name="fake"].btn-hidden {
    display: none !important;
}
