/* ============================================
   QB Off-Canvas Cart – buah.de Style
   ============================================ */

/* Cart Container */
.qb-cart {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;            /* allows flex shrinking for nested scroll */
    height: 100%;
    font-family: inherit;
    color: #1a1a1a;
    font-size: 14px;
    line-height: 1.5;
}

/* ---- Header ---- */
.qb-cart__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.qb-cart__title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.qb-cart__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--tertiary);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    width: 22px;
    height: 22px;
    border-radius: 50%;
}

.qb-cart__close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #666;
    transition: color 0.2s;
    line-height: 1;
}

.qb-cart__close:hover {
    color: #1a1a1a;
}

/* ---- Gamification Progress (buah.de style) ---- */
.qb-cart__gamification {
    padding: 16px 24px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.qb-cart__gami-message {
    font-size: 13px;
    line-height: 1.5;
    color: #333;
    text-align: center;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap;
}

.qb-cart__gami-message strong {
    color: var(--tertiary);
}

.qb-cart__gami-message svg {
    color: var(--tertiary);
    flex-shrink: 0;
}

/* Labels above bar */
.qb-cart__gami-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #333;
    margin-bottom: 4px;
    padding: 0 0 0 0;
}
.qb-cart__gami-labels span:first-child { width: 0; }
.qb-cart__gami-labels span:last-child { text-align: right; }

/* Track */
.qb-cart__gami-track {
    position: relative;
    height: 6px;
    background: var(--neutral-ultra-light);
    border-radius: 3px;
    margin: 16px 0;
}

.qb-cart__gami-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--tertiary), var(--tertiary));
    border-radius: 3px;
    transition: width 0.4s ease;
    z-index: 1;
}

/* Start dot */
.qb-cart__gami-dot--start {
    position: absolute;
    left: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e8e8e8;
    z-index: 2;
    border: 2px solid #fff;
}
.qb-cart__gami-dot--start.active {
    background: var(--tertiary);
}

/* Milestones */
.qb-cart__gami-milestone {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
}

.qb-cart__gami-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--neutral-ultra-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--base);
    transition: all 0.3s;
}
.qb-cart__gami-icon svg {
    stroke: var(--base);
}
.qb-cart__gami-icon.reached {
    border-color: var(--tertiary);
    color: #fff;
    background: var(--tertiary);
}
.qb-cart__gami-icon.reached svg {
    stroke: #fff;
}

/* Amounts below bar */
.qb-cart__gami-amounts {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #333;
    margin-top: 4px;
}
.qb-cart__gami-amounts span:first-child { width: 0; }
.qb-cart__gami-amounts span:last-child { text-align: right; }

/* ---- Scrollable Body (items + cross-sells) ---- */
.qb-cart__body {
    flex: 1;
    min-height: 0;           /* critical: allows flex item to shrink below content */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ---- Cart Items ---- */
.qb-cart__items {
    padding: 0;
}

.qb-cart__item {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
    align-items: start;
}

.qb-cart__item-image {
    display: block;
    width: 72px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #eee;
    flex-shrink: 0;
}

.qb-cart__item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.qb-cart__item-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.qb-cart__item-name {
    font-weight: 600;
    font-size: 14px;
    color: #1a1a1a;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.qb-cart__item-name:hover {
    color: var(--tertiary);
}

.qb-cart__item-price {
    font-size: 13px;
    color: #1a1a1a;
}

.qb-cart__item-price del {
    color: #333;
    font-size: 12px;
    margin-left: 4px;
}

.qb-cart__item-price ins {
    text-decoration: none;
    color: #e53935;
    font-weight: 600;
}

.qb-cart__item-variant {
    font-size: 12px;
    color: #888;
}

.qb-cart__item-remove {
    background: none;
    border: none;
    color: #333;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
    margin-top: 4px;
    transition: color 0.2s;
}

.qb-cart__item-remove:hover {
    color: #e53935;
}

/* Quantity Controls */
.qb-cart__item-qty {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    align-self: start;
    margin-top: 4px;
}

.qb-cart__qty-btn {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    color: #333;
    transition: background 0.15s, color 0.15s;
    user-select: none;
}

.qb-cart__qty-btn:hover {
    background: #f5f5f5;
    color: #1a1a1a;
}

.qb-cart__qty-input {
    width: 32px;
    height: 32px;
    padding: 0;
    text-align: center;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    font-size: 14px;
    font-weight: 600;
    background: #fff;
    -moz-appearance: textfield;
    color: #1a1a1a;
}

.qb-cart__qty-input::-webkit-outer-spin-button,
.qb-cart__qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ---- Cross-Sells ---- */
.qb-cart__cross-sells {
    padding: 16px 24px;
    border-top: 1px solid #eee;
}

.qb-cart__cross-sells-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

/* Arrow Buttons */
.qb-cart__cross-sells-nav {
    display: flex;
    gap: 4px;
}

.qb-cart__cross-sells-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    color: #1a1a1a;
    transition: all 0.2s;
    padding: 0;
}

.qb-cart__cross-sells-arrow:hover:not(:disabled) {
    background: #1a1a1a;
    color: #fff;
    border-color: #1a1a1a;
}

.qb-cart__cross-sells-arrow:disabled {
    opacity: 0.3;
    cursor: default;
}

/* Scrollable Track (no visible scrollbar) */
.qb-cart__cross-sells-track {
    position: relative;
    overflow: hidden;
}

.qb-cart__cross-sells-list {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    /* Hide scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.qb-cart__cross-sells-list::-webkit-scrollbar {
    display: none;
}

.qb-cart__cross-sell-item {
    display: flex;
    flex-direction: column;
    min-width: 140px;
    max-width: 160px;
    background: #f9f9f9;
    border-radius: 10px;
    padding: 12px;
    flex-shrink: 0;
}

.qb-cart__cross-sell-image {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
    display: block;
}

.qb-cart__cross-sell-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.qb-cart__cross-sell-info {
    flex: 1;
    margin-bottom: 8px;
}

.qb-cart__cross-sell-name {
    font-size: 12px;
    font-weight: 600;
    color: #1a1a1a;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.qb-cart__cross-sell-name:hover {
    color: var(--tertiary);
}

.qb-cart__cross-sell-price {
    font-size: 12px;
    color: #333;
    margin-top: 4px;
}

.qb-cart__cross-sell-price del {
    color: #333;
}

.qb-cart__cross-sell-price ins {
    text-decoration: none;
    color: #e53935;
    font-weight: 600;
}

.qb-cart__cross-sell-add {
    display: block;
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #1a1a1a;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    text-decoration: none;
}

.qb-cart__cross-sell-add:hover {
    background: #1a1a1a;
    color: #fff;
    border-color: #1a1a1a;
}

.qb-cart__cross-sell-add:disabled {
    opacity: 0.5;
    cursor: default;
}

.qb-cart__cross-sell-select {
    border-color: var(--tertiary);
    color: var(--tertiary);
}

.qb-cart__cross-sell-select:hover {
    background: var(--tertiary);
    color: #fff;
    border-color: var(--tertiary);
}

/* ---- Footer ---- */
.qb-cart__footer {
    padding: 16px;
    flex-shrink: 0;
    background: var(--neutral);
}

.qb-cart__subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.qb-cart__subtotal-label {
    font-size: 16px;
    font-weight: 700;
}

.qb-cart__subtotal-amount {
    font-size: 16px;
    font-weight: 700;
}

.qb-cart__tax-info {
    font-size: 12px;
    color: #888;
    margin: 0 0 16px 0;
}

.qb-cart__free-shipping-link {
    color: var(--tertiary);
    font-weight: 600;
}

.qb-cart__actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.qb-cart__continue {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    padding: 12px 0;
    transition: color 0.2s;
    white-space: nowrap;
    font-weight: 500;
}

.qb-cart__continue:hover {
    color: #1a1a1a;
}

.qb-cart__checkout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    background: var(--tertiary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
    text-align: center;
}

.qb-cart__checkout:hover {
    background: var(--tertiary-semi-dark);
    color: #fff;
}

/* ---- Empty Cart ---- */
.qb-cart__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 60px 24px;
    text-align: center;
}

.qb-cart__empty svg {
    margin-bottom: 16px;
    opacity: 0.4;
}

.qb-cart__empty p {
    font-size: 16px;
    color: #888;
    margin: 0 0 24px 0;
}

.qb-cart__empty .qb-cart__continue {
    border: 1px solid #ddd;
    border-radius: 50px;
    padding: 12px 24px;
}

/* ---- Loading State ---- */
.qb-cart--loading {
    pointer-events: none;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.qb-cart__item--removing {
    opacity: 0.3;
    transform: translateX(20px);
    transition: all 0.3s ease;
}

/* ---- Header Cart Badge ----
   Wrap-Container .qb--mini-cart-tgl (ein DIV im Bricks-Flex-Header) ist u.U.
   breiter als das eigentliche SVG-Icon .qb--mini-cart-icon. Das Icon sitzt
   ganz links im Wrap (offset 0/0) und ist 28×28 px → Badge wird per fix-
   Coords positioniert (left: 18px = icon-width 28 − badge-overhang 10). */
.qb--mini-cart-tgl {
    position: relative;
}

.qb-header-cart-count {
    position: absolute;
    top: -6px;
    left: 18px;
    right: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--tertiary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    line-height: 1;
    pointer-events: none;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Hide badge when empty */
.qb-header-cart-count:empty {
    display: none;
}

/* ---- Cart-/Checkout-Seite: Mini-Cart ausblenden ----
   Off-Canvas-Container weg, Header-Toggle bleibt sichtbar aber inaktiv
   (Badge soll dort weiterhin angezeigt werden). */
.woocommerce-cart .qb--mini-cart-tgl,
.woocommerce-checkout .qb--mini-cart-tgl {
    pointer-events: none;
    cursor: default;
}

.woocommerce-cart .qb--off-cart,
.woocommerce-checkout .qb--off-cart {
    display: none !important;
}

/* ---- Bricks OffCanvas Overrides ---- */

/* Fixed position: off-canvas stays in viewport with 10px inset from all edges */
.qb--off-cart .bc-offcanvas-menu__items-wrapper {
    position: fixed !important;
    top: 10px !important;
    right: 10px !important;
    bottom: 10px !important;
    height: calc(100vh - 20px) !important;
    height: calc(100dvh - 20px) !important;
    max-width: 480px;
    width: calc(100% - 20px);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15);
}

/* Shortcode wrapper: must pass height down to .qb-cart */
.qb--off-cart .bc-offcanvas-menu__items-wrapper > .brxe-shortcode {
    height: 100% !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0 !important;
}

/* Legacy: in case Bricks uses offcanvas-content wrapper */
.qb--off-cart .brxe-offcanvas-content {
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

/* Backdrop: fixed overlay for the whole viewport */
.qb--off-cart .bc-offcanvas-menu__backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: -1;
    transition: opacity 0.4s ease, visibility 0.4s ease !important;
}

/* Custom X cursor on backdrop */
.qb--off-cart .bc-offcanvas-menu__backdrop {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Ccircle cx='20' cy='20' r='19' fill='white' stroke='%23ddd' stroke-width='1'/%3E%3Cline x1='14' y1='14' x2='26' y2='26' stroke='%23333' stroke-width='2' stroke-linecap='round'/%3E%3Cline x1='26' y1='14' x2='14' y2='26' stroke='%23333' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") 20 20, pointer;
}

/* Hide Bricks default close button since we have our own */
.qb--off-cart .bricks-offcanvas-close,
.qb--off-cart .brx-close-offcanvas {
    display: none !important;
}

/* ---- Scrollbar Styling ---- */
.qb-cart__body::-webkit-scrollbar {
    width: 4px;
}

.qb-cart__body::-webkit-scrollbar-track {
    background: transparent;
}

.qb-cart__body::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

.qb-cart__body::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
    .qb-cart__item {
        grid-template-columns: 60px 1fr auto;
        gap: 10px;
        padding: 12px 16px;
    }

    .qb-cart__item-image {
        width: 60px;
        height: 60px;
    }

    .qb-cart__header,
    .qb-cart__shipping-progress,
    .qb-cart__cross-sells,
    .qb-cart__footer {
        padding: 8px 16px;
    }
    .qb-cart__gamification {
        padding: 10px 24px;
    }
    .qb-cart__checkout {
        padding: 10px 16px;;
    }
    .qb-cart__actions .qb--dnm {
        display: none;
    }
}
/* =====================================================================
 * ly-mini-cart-overlay-fix (2026-06-22)
 * Trusted-Shops-Badge (#trustbadge-container-*, z-index 2147483647) und
 * WPC-Smart-Compare-Bubble (#woosc-area, z-index 99999979) sind fixed mit
 * sehr hohem z-index und lagen damit ueber dem geoeffneten Off-Canvas-
 * Warenkorb (Panel z-index 101). Solange der Mini-Cart offen ist
 * (NextBricks setzt data-open="bc-offcanvas-menu--opened" auf .qb--off-cart),
 * beide Floating-Widgets ausblenden. Im geschlossenen Zustand unveraendert.
 * ===================================================================== */
body:has(.qb--off-cart[data-open="bc-offcanvas-menu--opened"]) #woosc-area,
body:has(.qb--off-cart[data-open="bc-offcanvas-menu--opened"]) [id^="trustbadge-container"] {
    display: none !important;
}

/* =====================================================================
 * Lade-Spinner im Mini-Cart — gleicher Look wie der Warenkorb-Spinner
 * (cart-page.css .qb-cart-spinner). Wird beim Add-to-Cart sofort gezeigt
 * (Off-Canvas öffnet direkt mit Spinner) und vom frischen Fragment ersetzt.
 * ===================================================================== */
#qb-mini-cart-content {
    position: relative;
}
.qb-cart__overlay {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.6);
    cursor: progress;
}
.qb-cart__overlay.is-active {
    display: flex;
}
.qb-cart__spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(76, 175, 80, 0.25);
    border-top-color: var(--tertiary);
    border-radius: 50%;
    animation: qb-cart-spin 0.7s linear infinite;
}
@keyframes qb-cart-spin {
    to { transform: rotate(360deg); }
}
