/*
 * Shop (extcode/cart, extcode/cart_products)
 * Übernommen aus dem Sitepackage "sitepackage_ruebezahl_spinnereien" (cart.css, cart_products.css),
 * angepasst an Bootstrap 6 (z. B. btn-solid/theme-*, .grid).
 */


@media (max-width: 991.98px) {
    #shop {
        padding: 0 1rem;
    }
}

/* Warenkorb - Produktansicht */
@media (max-width: 991.98px) {
    :where(.tx-cart, .tx-cart-products) td.product-image-bevariant,
    :where(.tx-cart, .tx-cart-products) td.product-image {
        display: none;
    }
}

:where(.tx-cart, .tx-cart-products) td.product-image-bevariant,
:where(.tx-cart, .tx-cart-products) td.product-image {
    max-width: 100px !important;
}

:where(.tx-cart, .tx-cart-products) .bg-light-grey {
    background-color: #efefef;
}

#tx-cart-minicart {
    text-align: right;
    padding-top: 1.5rem;
}

@media (max-width: 991.98px) {
    #tx-cart-minicart {
        padding-bottom: 2rem;
        padding-right: 1.5rem;
        display: block;
    }
}

/* Listenansicht */
@media (min-width: 992px) {
    #body-40 #tx-cart-minicart {
        padding-top: 0;
    }
}

/* Button 'zur Kasse' */
:where(.tx-cart, .tx-cart-products) .checkout-link a {
    color: var(--white);
}

@media (max-width: 991.98px) {
    .tx-cart .row {
        margin: 0;
    }
}

.tx-cart form#form-order .form-title .num,
.tx-cart form#form-cart .form-title .num {
    background: #333;
    color: #fff;
    display: inline-block;
    width: 20px;
    border-radius: 50%;
    text-align: center;
    height: 20px;
    line-height: 20px;
    font-size: 0.75em;
    vertical-align: middle;
    margin-right: 10px;
    margin-top: -3px;
}

.tx-cart h5.form-title {
    background: #ccc;
    margin: 0 0 .5rem 0;
    padding: 0 20px;
    line-height: 2;
}

@media (max-width: 991.98px) {
    :where(.tx-cart, .tx-cart-products) .form-list {
        padding: 0 .5rem;
    }
}

#accept-term fieldset {
    padding: 16px 8px 18px 8px;
}

.service-gross .price,
.total-gross .price,
.cart-gross .price {
    text-align: right;
}

/* cart.css setzt `.tx-cart .price { display: block }` und wird nach dieser Datei geladen:
   höhere Spezifität nötig, sonst ist die Preiszelle keine Tabellenzelle mehr (Trennlinien reißen ab). */
.tx-cart td.price,
.tx-cart th.price {
    min-width: auto;
    display: table-cell;
}

.tx-cart .price:not(td, th) {
    min-width: auto;
    display: revert;
}

/* Gesamtsumme */
:where(.tx-cart, .tx-cart-products) tr.total-gross {
    font-weight: 600;
}

:where(.tx-cart, .tx-cart-products) label:not([for^="orderItem"]) {
    display: inline;
    padding-left: .5rem;
}

/* Pflichtfeld */
:where(.tx-cart, .tx-cart-products) label:not([for^="orderItem"]) em {
    display: inline;
    color: red;
}

:where(.tx-cart, .tx-cart-products) .required {
    color: var(--font-color);
}

@media (max-width: 991.98px) {
    .tx-cart fieldset dl {
        padding: 0 .5rem;
    }
}

.tx-cart fieldset dl dd {
    margin-left: 0 !important;
    padding-left: 0 !important;
}

.tx-cart fieldset dl dd ul {
    margin-left: 0 !important;
    padding-left: 0 !important;
}

.field.acceptTerms label {
    font-weight: normal;
}

/* Mengenangabe in Detail view */
input[name="tx_cart_cart[quantity]"] {
    width: 35px;
    text-align: center;
    margin-right: .5rem;
}

@media (max-width: 991.98px) {
    #checkout-review-table {
        width: 96% !important;
    }
}

@media (max-width: 575.98px) {
    #checkout-product-table th:nth-child(4) {
        display: none;
    }
}

:where(.tx-cart, .tx-cart-products) .unit {
    clear: both;
    padding-left: 2.9em;
}

#shipping-method dt {
    font-weight: 300;
    padding: .3rem 0;
}

#shipping-method dt .ship {
    float: right;
}

#shipping-method dt .green {
    color: #3f7000;
    font-weight: 500;
}

/* Detail View → List View Link */
:where(.tx-cart, .tx-cart-products) .backlist {
    clear: both;
    float: right;
}

:where(.tx-cart, .tx-cart-products) .show_order {
    clear: both;
    padding-top: 1em;
}

:where(.tx-cart, .tx-cart-products) .form-control {
    padding: .1rem .5rem;
}

:where(.tx-cart, .tx-cart-products) select.form-control {
    width: 100%;
    margin-bottom: .5rem;
    padding: .1rem;
}

/* 100 gr Preise in List + Detail View */
:where(.tx-cart, .tx-cart-products) .list_measure {
    font-weight: 400;
}

/* Bilder der Varianten */
:where(.tx-cart, .tx-cart-products) .variants {
    padding-top: 1rem;
    clear: both;
}

/* Unterzeile in Listview */
:where(.tx-cart, .tx-cart-products) .list_teaser {
    font-size: 95%;
    clear: both;
}

/* Kodierung für das Sonderzeichen ':' */
#billingAddress\3azip,
#shippingAddress\3azip {
    width: 5rem;
}

:where(.tx-cart, .tx-cart-products) .shipping {
    border-bottom: 1px solid #0a0c59;
}

:where(.tx-cart, .tx-cart-products) .comment {
    padding: 1rem 0;
    font-weight: 600;
}

:where(.tx-cart, .tx-cart-products) .back {
    margin: 1rem 0;
}

:where(.tx-cart, .tx-cart-products) .clear_cart {
    margin-bottom: .5rem;
}

:where(.tx-cart, .tx-cart-products) .validation-error {
    color: #c9302c;
    font-weight: 500;
}

/* Meldung: das Produkt kann nicht in den Warenkorb gelegt werden */
/* @extend .validation-error aufgelöst */
:where(.tx-cart, .tx-cart-products) .alert.theme-warning {
    color: #c9302c;
    font-weight: 500;
    padding: .3rem;
    border: 1px solid #c9302c;
    margin-top: 1rem;
    display: inline-block;
    border-radius: .3rem;
}

/* Meldung: das Produkt ist in den Warenkorb gelegt worden */
:where(.tx-cart, .tx-cart-products) .alert.theme-success {
    padding: .3rem;
    font-weight: 500;
    margin-top: 1rem;
    border-color: #ccc;
}

#add-product-form {
    margin-top: 1rem;
}

:where(.tx-cart, .tx-cart-products) .submit-order {
    margin: 1rem 0;
}

:where(.tx-cart, .tx-cart-products) .empty-cart {
    margin: 1rem 0;
}

:where(.tx-cart, .tx-cart-products) .delete-link.btn {
    margin-top: -.4rem;
}

:where(.tx-cart, .tx-cart-products) .checkout-step-field td {
    padding-right: 0;
}

:where(.tx-cart, .tx-cart-products) input[type="number"] {
    width: 60px;
}

:where(.tx-cart, .tx-cart-products) .product-image {
    width: 100px;
}

:where(.tx-cart, .tx-cart-products) .cart-product-image {
    max-width: 200px;
}

/* Acceptance */
:where(.tx-cart, .tx-cart-products) .checkbox-left {
    text-indent: -1rem;
    margin-left: 1rem !important;
}

/* Payment / Shipping */
:where(.tx-cart, .tx-cart-products) .checkbox-left2 {
    text-indent: -1.3rem;
    margin-left: 1.3rem;
}

.tx-cart #form-order .checkout-step-number,
.tx-cart #form-cart .checkout-step-number {
    margin-top: 0;
}

#form-order .checkout-step-title {
    padding: 10px;
    line-height: 1.3;
}

:where(.tx-cart, .tx-cart-products) .bg-white {
    background-color: #fff;
}

/* Warenkorb */
#body-36 {
    #c305 {
        visibility: hidden !important;
    }
}

/* Summe der Varianten */
@media (max-width: 991.98px) {
    :where(.tx-cart, .tx-cart-products) tr.sum {
        visibility: hidden;
    }
}

@media (min-width: 992px) {
    :where(.tx-cart, .tx-cart-products) tr.sum > td {
        padding-bottom: 3rem;
    }
}

.cart-preview-content {
    text-align: right;
    padding-bottom: .2rem;

    a.active {
        color: white;
    }
}

:where(.tx-cart, .tx-cart-products) .checkout-link {
    margin-bottom: 1rem;
}


/* Desktop: Luft um die Zellen; die Trennlinie (sonst border-bottom bis zum Zellrand) wird als Hintergrundlinie
   gezeichnet und hält links und rechts denselben Abstand wie der Zellinhalt. */
@media (min-width: 768px) {
    .checkout-product-table.stack {
        --cell-gap: .75rem;
        --line: linear-gradient(var(--bs-theme-border, var(--bs-table-border-color)), var(--bs-theme-border, var(--bs-table-border-color)));
    }

    .checkout-product-table.stack :is(thead th, tbody td) {
        padding-block: var(--cell-gap);
        padding-inline: var(--cell-gap);
        border-block-end-width: 0;
        background-image: var(--line);
        background-repeat: no-repeat;
        background-size: 100% var(--bs-table-border-width, 1px);
        background-position: left bottom;
    }

    .checkout-product-table.stack :is(thead th, tbody td):first-child {
        background-size: calc(100% - var(--cell-gap)) var(--bs-table-border-width, 1px);
        background-position: right bottom;
    }

    .checkout-product-table.stack :is(thead th, tbody td):last-child {
        background-size: calc(100% - var(--cell-gap)) var(--bs-table-border-width, 1px);
        background-position: left bottom;
    }

    .checkout-product-table.stack :is(thead th, tbody td):only-child {
        background-size: calc(100% - 2 * var(--cell-gap)) var(--bs-table-border-width, 1px);
        background-position: center bottom;
    }
}

/* Responsive "stack"-Layout der Warenkorb-Tabelle: unter 768 px wird jede Zeile zur Karte (Beschriftung aus data-label). */
@media (max-width: 767.98px) {

    .checkout-product-table.stack thead {
        display: none;
    }

    /* Die Tabelle trägt die Bootstrap-Klasse "bg-white" (!important) -
       die füllt sonst auch die Lücken zwischen den gestapelten Cards
       weiß aus. Für die mobile Ansicht deaktivieren. */
    .checkout-product-table.stack {
        background-color: transparent !important;
    }

    .checkout-product-table.stack,
    .checkout-product-table.stack tbody,
    .checkout-product-table.stack tr,
    .checkout-product-table.stack td {
        display: block;
        width: 100%;
        padding-top: .3rem;
    }

    .checkout-product-table.stack tr {
        margin-bottom: 1.5rem;
        padding: .75rem;
        border: 1px solid #dee2e6;
        border-radius: .375rem;
        background-color: #FFFFFF;
        overflow: hidden;
    }

    .checkout-product-table.stack tr.product-group-header {
        border-bottom: none;
        border-radius: .375rem .375rem 0 0;
        margin-bottom: 0;
        background: #f8f9fa;
    }

    .checkout-product-table.stack tr.sum {
        border-top: none;
        border-radius: 0 0 .375rem .375rem;
        margin-top: -1rem;
        background: #f8f9fa;
    }

    .checkout-product-table.stack td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: .75rem;
        padding: .375rem 0;
        border: none;
        background-color: transparent !important;
        box-shadow: none !important;
        text-align: right;
    }

    /* Bootstrap gibt jeder Zeile per .table>:not(caption)>*>* einen
       eigenen weißen Hintergrund (--bs-table-bg) - das erzeugt den
       "Card"-Look, unabhängig vom Hintergrund des <tr>. Für die
       grau hinterlegten Zeilen (Gruppenkopf/Summe) hier explizit
       wieder herstellen. */
    .checkout-product-table.stack tr.product-group-header td,
    .checkout-product-table.stack tr.sum td {
        background-color: #f8f9fa !important;
    }

    /* Label shown via data-label, e.g. data-label="Stückpreis" */
    .checkout-product-table.stack td[data-label]::before {
        content: attr(data-label);
        font-weight: 600;
        text-align: left;
        white-space: nowrap;
    }

    .checkout-product-table.stack td.product-image {
        justify-content: center;
        padding-bottom: .5rem;
    }

    .checkout-product-table.stack td.product-image:empty {
        display: none;
    }

    .checkout-product-table.stack td.product-name {
        align-items: flex-start;
    }

    /* Label stays a fixed size on the left; the title fills the rest
       of the row and stays right-aligned even when it wraps onto a
       second line. */
    .checkout-product-table.stack td.product-name::before {
        flex: 0 0 auto;
        padding-top: .15rem;
    }

    .checkout-product-table.stack td.product-name .cell-value {
        flex: 1 1 auto;
        min-width: 0;
        text-align: right;
    }

    .checkout-product-table.stack td.last {
        justify-content: flex-end;
        padding-top: .5rem;
    }

    .checkout-product-table.stack td[colspan] {
        text-align: left;
        font-weight: 700;
    }

    .checkout-product-table.stack .quantity,
    .checkout-product-table.stack .form-control-inline {
        max-width: 6rem;
        margin-left: auto;
    }
}

/* ---- Produktliste und Detailseite ---- */

#cart-preview {
  text-align: right;
  padding-top: 1rem;
}

/* Content-Spalten in der Listenansicht */
.cart_list .soldout {
  margin-top: -.6rem;
  color: #b34700;
}

/* Listenansicht - Sortiment */
.cart_product_list_item .list_title {
  font-weight: 700;
}

:where(.tx-cart, .tx-cart-products) .show_product_img {
  text-align: center;
}

:where(.tx-cart, .tx-cart-products) .show_product_img figure {
  float: left;
  margin-right: .6rem;
}

:where(.tx-cart, .tx-cart-products) .show_product_img figure figcaption {
  text-align: center;
}

/* media-breakpoint-up(sm) → min-width: 576px */
@media (min-width: 576px) {
  :where(.tx-cart, .tx-cart-products) .description,
  :where(.tx-cart, .tx-cart-products) .teaser {
    clear: both;
  }
}

:where(.tx-cart, .tx-cart-products) .list-back {
  margin: 1rem 0;
}

.tx-cart-products select.form-control {
  width: auto;
  margin-bottom: 0.5rem;
}

/* Zentrierung der Produktbox bis 576px */
@media (max-width: 575.98px) {
  .cart_product_list {
    clear: both;
    margin-top: 2rem;
  }

  .cart_product_list_item {
    margin-left: auto;
    margin-right: auto;
    max-width: 307px;
    padding-bottom: 2rem;
  }

  /* Bild zentrieren */
  .cart_product_list_item img.img-fluid {
    display: block;
    margin-left: auto;
    margin-right: auto;
  }

  /* Titel + Preis Zeile zentrieren */
  .cart_product_list_item .row.g-0 {
    justify-content: center;
  }

  /* Teaser-Text zentrieren */
  .cart_product_list_item .list_teaser {
    text-align: left;
  }
}

.cart_product_price {
  font-weight: 700;
}

/* Bootstrap 6 hat kleinere Überschriften: Schrittüberschriften im Warenkorb wie im Original */
.tx-cart h5.form-title {
  font-size: 1.25rem;
  padding-block: .35rem;
}
