/* ==========================================================================
   Mini-Cart: Leiste mit Angebotsanfrage und Mustern (functions-mini-cart.php,
   woocommerce/cart/mini-cart.php)

   Lädt auf jeder Seite, aber nicht blockierend: Die Leiste ist erst nach einem
   Klick auf das Warenkorb-Symbol zu sehen. Knöpfe und Spinner kommen aus
   assets/flow-base.css, Farben aus style.css (--flow-*). Die Kreise am Symbol
   stehen in style.css, weil sie sofort sichtbar sind.

   Die Leiste ist Basels .cart-widget-side; geöffnet wird sie weiter über
   body.basel-cart-opened. Hier stehen nur die Abweichungen von Basel und der
   Inhalt. Eigene Knöpfe tragen ihr Element im Selektor (button.…), damit sie
   Basels Button-Regeln schlagen.
   ========================================================================== */

/* --- Leiste ---------------------------------------------------------------- */

.cart-widget-side.cantana-minicart {
    width: min(500px, 100vw);
    overflow: hidden;
    background: #f7f5ef;
    color: var(--flow-text);
    font-size: 14px;
    line-height: 1.4;
    outline: 0;
    transform: translate3d(100%, 0, 0);
    /* Geschlossen nicht per Tab erreichbar. */
    visibility: hidden;
    transition: transform .3s cubic-bezier(.25, 0, 0, 1), visibility 0s .3s;
}

/* Basel blendet die Leiste erst mit .document-ready ein (display: block). */
.document-ready .cart-widget-side.cantana-minicart {
    display: flex;
    flex-direction: column;
}

.basel-cart-opened .cart-widget-side.cantana-minicart {
    transform: none;
    visibility: visible;
    box-shadow: -16px 0 64px rgb(44 76 53 / 22%);
    transition: transform .3s cubic-bezier(.25, 0, 0, 1), visibility 0s;
}

.basel-cart-opened .basel-close-side {
    background-color: rgb(20 36 26 / 36%);
}

html.cantana-minicart-open { overflow: hidden; }

/* HubSpot-Chat liegt sonst über „Zur Kasse“ (wie beim Angebots-Panel). */
html.cantana-minicart-open #hubspot-messages-iframe-container { display: none !important; }

.cantana-minicart .widget_shopping_cart_content {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.cantana-minicart .amount {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

.cantana-minicart__sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}

/* --- Kopf ------------------------------------------------------------------ */

.cantana-minicart .cantana-minicart__head {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 28px;
    background: var(--flow-green-deep);
}

.cantana-minicart .cantana-minicart__heading {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.cantana-minicart .cantana-minicart__title {
    margin: 0;
    padding: 0;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
    text-transform: none;
    color: #fff;
}

.cantana-minicart .cantana-minicart__count {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 8px;
    border-radius: var(--flow-radius-pill);
    background: rgb(255 255 255 / 16%);
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.cantana-minicart button.cantana-minicart__close {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-height: 0;
    margin: 0;
    padding: 0;
    background: rgb(255 255 255 / 8%);
    border: 1px solid rgb(255 255 255 / 25%);
    border-radius: 50%;
    box-shadow: none;
    color: #fff;
    cursor: pointer;
    transition: background-color .16s;
}

.cantana-minicart button.cantana-minicart__close:hover,
.cantana-minicart button.cantana-minicart__close:focus {
    background: rgb(255 255 255 / 18%);
    border-color: rgb(255 255 255 / 25%);
    color: #fff;
}

.cantana-minicart button.cantana-minicart__close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* --- Rumpf ----------------------------------------------------------------- */

.cantana-minicart .cantana-minicart__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 28px;
    min-height: 0;
    padding: 24px 28px 32px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.cantana-minicart .cantana-minicart__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 56px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--flow-green-deep);
}

/* --- Abschnitt (Angebotsanfrage, Muster) ----------------------------------- */

.cantana-minicart .cantana-minicart__group {
    display: flex;
    flex: none;
    flex-direction: column;
    gap: 14px;
}

.cantana-minicart .cantana-minicart__group + .cantana-minicart__group {
    padding-top: 28px;
    border-top: 1px solid var(--flow-line);
}

.cantana-minicart .cantana-minicart__group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--flow-line);
}

.cantana-minicart .cantana-minicart__group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0;
    text-transform: none;
    color: var(--flow-text);
}

.cantana-minicart .cantana-minicart__group-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 6px;
    background: var(--flow-line);
    font-size: 13px;
    font-weight: 700;
    color: var(--flow-muted);
}

/* Kennzeichnung rechts im Abschnittskopf und Pillen an der Position. */
.cantana-minicart .cantana-minicart__flag,
.cantana-minicart .cantana-minicart__pill {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--flow-green-soft);
    border-radius: var(--flow-radius-pill);
    background: var(--flow-green-tint);
    font-size: 13px;
    line-height: 1.5;
    color: var(--flow-green-deep);
}

.cantana-minicart .cantana-minicart__flag {
    flex: none;
    gap: 6px;
    padding: 3px 10px;
    font-weight: 600;
    white-space: nowrap;
}

.cantana-minicart .cantana-minicart__flag::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.cantana-minicart .cantana-minicart__pill {
    padding: 3px 9px;
    font-weight: 700;
}

.cantana-minicart .cantana-minicart__flag--sample,
.cantana-minicart .cantana-minicart__pill--sample {
    border-color: var(--flow-amber-line);
    background: var(--flow-amber-soft);
    color: var(--flow-amber-text);
}

/* --- Position -------------------------------------------------------------- */

.cantana-minicart .cantana-minicart__item {
    display: flex;
    flex: none;
    gap: 14px;
    margin: 0;
    padding: 14px;
    background: var(--flow-surface);
    border: 1px solid var(--flow-line);
    border-radius: 18px;
    transition: opacity .2s;
}

.cantana-minicart .cantana-minicart__item.is-busy {
    opacity: .5;
    pointer-events: none;
}

.cantana-minicart .cantana-minicart__thumb {
    flex: none;
    width: 84px;
    height: 106px;
    overflow: hidden;
    border-radius: 12px;
    background: var(--flow-surface-muted);
}

.cantana-minicart .cantana-minicart__thumb a {
    display: block;
    height: 100%;
}

.cantana-minicart .cantana-minicart__thumb img {
    display: block;
    width: 100%;
    max-width: none;
    height: 100%;
    margin: 0;
    border-radius: 0;
    object-fit: cover;
}

/* Vorschau aus dem Konfigurator: ganzes Textil zeigen, nicht beschneiden. Sie ist weiß
   hinterlegt und je Produkt anders geschnitten: auf Weiß bleiben keine Streifen stehen. */
.cantana-minicart .cantana-minicart__thumb.has-design {
    background: var(--flow-surface);
}

.cantana-minicart .cantana-minicart__thumb.has-design img {
    padding: 4px;
    object-fit: contain;
}

.cantana-minicart .cantana-minicart__info {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.cantana-minicart .cantana-minicart__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.cantana-minicart .cantana-minicart__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.cantana-minicart .cantana-minicart__name {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--flow-text);
    text-decoration: none;
}

.cantana-minicart a.cantana-minicart__name:hover {
    color: var(--flow-green-deep);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cantana-minicart .cantana-minicart__sub {
    font-size: 14px;
    color: var(--flow-muted);
}

/* Mülleimer (.flow-remove in flow-base.css): Symbol oben rechts in der Karte, die
   Klickfläche ragt in deren Innenabstand und macht die Kopfzeile nicht höher. */
.cantana-minicart button.cantana-minicart__remove {
    margin: -8px -8px -2px 0;
}

.cantana-minicart .cantana-minicart__tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}

.cantana-minicart .cantana-minicart__design-state {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--flow-green-deep);
}

/* Knopf bzw. Menge links, Stückzahl oder Betrag rechts. Passt beides nicht nebeneinander
   (Handy: Design-Knopf und „120 Stück / Preis im Angebot“), rutscht die rechte Angabe in
   eine eigene Zeile darunter und bleibt rechtsbündig, statt aus der Karte zu laufen. */
.cantana-minicart .cantana-minicart__bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
}

.cantana-minicart a.cantana-minicart__design {
    display: inline-flex;
    align-items: center;
    height: 38px;
    padding: 0 14px;
    background: var(--flow-surface);
    border: 1.5px solid var(--flow-green-deep);
    border-radius: var(--flow-radius-pill);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    color: var(--flow-green-deep);
    text-decoration: none;
    transition: background-color .2s, border-color .2s;
}

/* Wie die Design-Knöpfe der Anfrageseite (.design-button in checkout-flow.css):
   „Design bearbeiten“ zurückhaltend, „Design hinzufügen“ hervorgehoben. */
.cantana-minicart a.cantana-minicart__design:hover {
    background: var(--flow-green-soft);
    color: var(--flow-green-deep);
}

.cantana-minicart a.cantana-minicart__design--add {
    background: var(--flow-green);
    border-color: var(--flow-green);
    color: #000;
}

.cantana-minicart a.cantana-minicart__design--add:hover {
    background: var(--flow-green-hover);
    border-color: var(--flow-green-hover);
    color: #000;
}

.cantana-minicart .cantana-minicart__amount {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-left: auto;
    text-align: right;
    white-space: nowrap;
}

.cantana-minicart .cantana-minicart__amount-main {
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--flow-text);
}

.cantana-minicart .cantana-minicart__amount-sub {
    font-size: 13px;
    color: var(--flow-muted);
}

.cantana-minicart .cantana-minicart__fixed {
    font-size: 15px;
    font-weight: 700;
    color: var(--flow-text);
}

/* --- Textlink („Weiteres Produkt anfragen“) --------------------------------- */

.cantana-minicart .cantana-minicart__link {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 6px;
    min-height: 32px;
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0;
    text-transform: none;
    color: var(--flow-green-deep);
    text-decoration: none;
    cursor: pointer;
}

.cantana-minicart .cantana-minicart__link:hover,
.cantana-minicart .cantana-minicart__link:focus {
    background: none;
    color: var(--flow-green-deep);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cantana-minicart .cantana-minicart__link--more {
    gap: 8px;
    min-height: 36px;
    padding: 0 2px;
    font-size: 15px;
}

/* --- Menge ----------------------------------------------------------------- */

.cantana-minicart .cantana-minicart__sizes {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.cantana-minicart .cantana-minicart__sizes li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 0;
}

.cantana-minicart .cantana-minicart__sizes li::before { content: none; }

.cantana-minicart .cantana-minicart__size {
    font-size: 14px;
    font-weight: 600;
    color: var(--flow-text);
}

.cantana-minicart .cantana-minicart__stepper {
    display: inline-flex;
    flex: none;
    align-items: center;
    overflow: hidden;
    background: var(--flow-surface);
    border: 1px solid var(--flow-line);
    border-radius: var(--flow-radius-pill);
}

.cantana-minicart .cantana-minicart__stepper button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-height: 0;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    font-size: 18px;
    font-weight: 400;
    line-height: 1;
    color: var(--flow-green-deep);
    cursor: pointer;
}

.cantana-minicart .cantana-minicart__stepper button:hover,
.cantana-minicart .cantana-minicart__stepper button:focus {
    background: var(--flow-surface-muted);
    color: var(--flow-green-deep);
}

.cantana-minicart .cantana-minicart__stepper button:disabled {
    background: transparent;
    color: var(--flow-line-strong);
    cursor: default;
}

.cantana-minicart .cantana-minicart__stepper-value {
    min-width: 28px;
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: center;
    color: var(--flow-text);
}

.cantana-minicart .cantana-minicart__sizes .cantana-minicart__stepper button {
    width: 32px;
    height: 32px;
}

/* --- Abschluss eines Abschnitts -------------------------------------------- */

.cantana-minicart .cantana-minicart__subtotal {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 0 2px;
}

.cantana-minicart .cantana-minicart__subtotal-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--flow-text);
}

.cantana-minicart .cantana-minicart__subtotal-value {
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--flow-text);
}

.cantana-minicart .flow-btn.cantana-minicart__cta {
    min-height: 52px;
    font-size: 16px;
}

.cantana-minicart .cantana-minicart__hint {
    margin: -4px 0 0;
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
    color: var(--flow-muted);
}

/* --- Leer ------------------------------------------------------------------ */

.cantana-minicart .cantana-minicart__empty {
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding: 40px 24px;
    background: var(--flow-surface);
    border: 1px solid var(--flow-line);
    border-radius: 18px;
    text-align: center;
}

.cantana-minicart .cantana-minicart__empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--flow-green-soft);
    color: var(--flow-green-deep);
}

.cantana-minicart .cantana-minicart__empty-title {
    margin: 0;
    padding: 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0;
    text-transform: none;
    color: var(--flow-green-deep);
}

.cantana-minicart .cantana-minicart__empty-text {
    max-width: 34ch;
    margin: 0;
    font-size: 15px;
    line-height: 1.55;
    color: var(--flow-muted);
}

/* --- Fokus ----------------------------------------------------------------- */

.cantana-minicart .cantana-minicart__body a:focus-visible,
.cantana-minicart .cantana-minicart__body button:focus-visible {
    outline: 2px solid var(--flow-green-deep);
    outline-offset: 2px;
}

/* --- Handy ----------------------------------------------------------------- */

@media (max-width: 575px) {
    .cantana-minicart .cantana-minicart__head { padding: 18px 20px; }
    .cantana-minicart .cantana-minicart__body { padding: 24px 20px calc(32px + env(safe-area-inset-bottom)); }

    .cantana-minicart .cantana-minicart__thumb {
        width: 72px;
        height: 92px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cart-widget-side.cantana-minicart,
    .cantana-minicart * {
        transition: none !important;
    }

    /* Ein stehender Ring sähe nicht nach Laden aus: langsamer, aber er dreht sich. */
    .cantana-minicart .flow-spinner {
        animation: flowSpin 1.6s linear infinite !important;
    }
}
