/* Farbauswahl, Eckdaten und Service-Hinweise auf der Seite eines gruppierten
   Eltern-Produkts. Wird ausschließlich auf genau diesen Seiten geladen.
   Farben mit Kontrast >= 4,5:1 auf Weiß (#111, #4b4f57, #5f6570). */

/* ---------- Eckdaten (Material, Lauflänge, Nadelstärke) ---------- */
.dla-facts {
    margin: 0 0 26px;
    padding: 0;
    border-top: 1px solid #e9e9e9;
}

.dla-facts-row {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid #e9e9e9;
    font-size: 15px;
    line-height: 1.45;
}

.dla-facts dt,
.dla-facts dd {
    margin: 0;
    padding: 0;
    font-size: inherit;
}

.dla-facts dt {
    color: #5f6570;
    font-weight: 400;
}

.dla-facts dd {
    color: #111;
    font-weight: 500;
}

/* ---------- Farbauswahl ---------- */
.dla-picker {
    margin: 0 0 1.5em;
}

/* Kopf (v0.3.0): „Farbe: Nr – Name“ + Lieferzeit der gewählten Farbe */
.dla-picker-head {
    margin: 0 0 14px;
}

.dla-picker-color {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 1.5rem;
    row-gap: 2px;
    margin: 0 0 2px;
    font-size: 15px;
    line-height: 1.4;
}

/* EAN der gewählten Farbe (v0.3.2): rechts neben dem Farbnamen, auf schmalen
   Bildschirmen rutscht sie in die nächste Zeile. Normaler Schnitt, markier- und
   kopierbar, Ziffern gleich breit. */
.dla-picker-ean {
    font-weight: 400;
    color: #111;
    font-variant-numeric: tabular-nums;
    -webkit-user-select: text;
    user-select: text;
}

.dla-picker-ean[hidden] {
    display: none;
}

.dla-picker-delivery {
    margin: 0;
    font-size: 15px;
    line-height: 1.4;
    color: #111;
}

.dla-picker-delivery:empty {
    display: none;
}

/* Theme-Absatzabstand (15 px oben/unten aus der Summary) im Kopf
   neutralisieren, damit Farbe und Lieferzeit eng beieinander stehen */
.dla-picker .dla-picker-head p {
    margin: 0 0 2px !important;
}

/* Lieferrückstand: Rot #c62828 auf Weiß = 5,6:1 (AA) */
.dla-picker-delivery.is-backorder {
    color: #c62828;
    font-weight: 600;
}

.dla-picker-color-caption {
    margin-right: 4px;
    color: #5f6570;
}

.dla-picker-color strong {
    font-weight: 600;
    color: #111;
}

.dla-picker-swatches {
    display: grid;
    grid-template-columns: repeat(auto-fill, 72px);
    gap: 14px 10px;
    margin: 0 0 16px;
}

.dla-swatch {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 72px;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    cursor: pointer;
    font: inherit;
    line-height: 1.25;
    text-align: center;
}

/* Theme-Button-Styles neutralisieren */
.dla-swatch,
.dla-swatch:hover,
.dla-swatch:focus,
.dla-swatch:focus-visible,
.dla-swatch:active {
    background: transparent !important;
    color: #111 !important;
    border: 0 !important;
    box-shadow: none !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    outline: none;
}

.dla-swatch:focus-visible {
    outline: 2px solid #111;
    outline-offset: 3px;
}

.dla-swatch-media {
    position: relative;
    display: block;
    box-sizing: border-box;
    width: 72px;
    height: 72px;
    padding: 1px;
    border: 1px solid #d5d5d5;
    border-radius: 2px;
    background: #fff;
    overflow: hidden;
    transition: border-color 0.15s ease;
}

/* "reduziert"-Badge, Kontrast schwarz/weiss (AAA). */
.dla-swatch-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 2px;
    background: #000;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

.dla-swatch:hover .dla-swatch-media {
    border-color: #111;
}

.dla-swatch.is-active .dla-swatch-media {
    padding: 0;
    border: 2px solid #111;
}

.dla-swatch .dla-swatch-img,
.dla-swatch .dla-swatch-placeholder {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    object-fit: cover;
    border-radius: 1px;
    background: #f3f3f3;
}

.dla-swatch .dla-swatch-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #4b4f57;
}

.dla-swatch-label {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.3;
    color: #111;
    overflow-wrap: anywhere;
}

.dla-swatch-note {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.2;
    color: #5f6570;
}

/* ---------- Zustände je Farbe (v0.3.0) ---------- */
/* nachbestellbar: roter Punkt oben links (Text für Screenreader im Button) */
.dla-swatch-dot {
    position: absolute;
    top: 3px;
    left: 3px;
    z-index: 1;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #c62828;
    box-shadow: 0 0 0 2px #fff;
}

.dla-swatch-dot.is-legend {
    position: static;
    display: inline-block;
    flex: 0 0 12px;
}

.dla-picker-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 6px;
    font-size: 13px;
    line-height: 1.4;
    color: #4b4f57;
}

/* nicht mehr lieferbar: grau + durchgestrichen, nicht wählbar (aria-disabled) */
.dla-swatch.is-unavailable {
    cursor: not-allowed;
}

.dla-swatch.is-unavailable .dla-swatch-img,
.dla-swatch.is-unavailable .dla-swatch-placeholder {
    opacity: 0.4;
    filter: grayscale(1);
}

.dla-swatch.is-unavailable .dla-swatch-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top right, transparent calc(50% - 1px), #6b6f76 calc(50% - 1px), #6b6f76 calc(50% + 1px), transparent calc(50% + 1px));
    pointer-events: none;
}

.dla-swatch.is-unavailable:hover .dla-swatch-media {
    border-color: #d5d5d5;
}

.dla-swatch.is-unavailable .dla-swatch-label {
    color: #5f6570;
    text-decoration: line-through;
}

/* ---------- Kaufzeile ---------- */
.dla-picker-form,
.woocommerce div.product form.cart.dla-picker-form {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-start;
    gap: 10px;
    margin: 0 0 10px;
}

/* WooCommerce-Clearfix (::before/::after) wäre im Flex-Layout ein eigenes Element */
.woocommerce div.product form.cart.dla-picker-form::before,
.woocommerce div.product form.cart.dla-picker-form::after {
    display: none;
    content: none;
}

/* Menge mit −/+ (v0.3.0) */
.dla-picker-form .dla-qty {
    display: flex;
    flex: 0 0 auto;
    align-items: stretch;
    box-sizing: border-box;
    height: 52px;
    border: 1px solid #c9c9c9;
    border-radius: 2px;
    background: #fff;
}

.dla-picker-form .dla-qty .quantity {
    display: flex;
    margin: 0 !important;
}

.dla-picker-form .dla-qty .quantity .qty,
.woocommerce div.product form.cart.dla-picker-form .dla-qty .quantity .qty {
    box-sizing: border-box;
    width: 46px;
    height: 50px;
    min-height: 50px;
    margin: 0;
    padding: 0;
    border: 0 !important;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    color: #111 !important;
    -webkit-text-fill-color: #111;
    font-size: 16px;
    text-align: center;
    -moz-appearance: textfield;
    appearance: textfield;
}

.dla-qty .qty::-webkit-outer-spin-button,
.dla-qty .qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.dla-qty-btn,
.dla-qty-btn:hover,
.dla-qty-btn:focus {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-width: 44px;
    height: 50px;
    margin: 0;
    padding: 0;
    border: 0 !important;
    border-radius: 0;
    background: #fff !important;
    color: #111 !important;
    box-shadow: none !important;
    font-size: 20px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
}

.dla-qty-btn:hover {
    background: #f3f3f3 !important;
}

.dla-qty-btn:focus-visible {
    outline: 2px solid #111;
    outline-offset: -2px;
}

.dla-qty-btn[disabled] {
    color: #8a8f98 !important;
    cursor: default;
}

.dla-picker-form .single_add_to_cart_button {
    flex: 1 1 auto;
    max-width: 380px;
    min-height: 52px;
    margin: 0 !important;
    padding: 0 1.5em;
    background: #000 !important;
    color: #fff !important;
    border: 0;
    border-radius: 2px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.dla-picker-form .single_add_to_cart_button:hover,
.dla-picker-form .single_add_to_cart_button:focus-visible {
    background: #333 !important;
    color: #fff !important;
}

.dla-picker-form .single_add_to_cart_button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.dla-picker-stock {
    margin: 0 0 18px;
    font-size: 13px;
    line-height: 1.4;
}

.dla-picker-stock:empty {
    margin: 0;
}

.woocommerce div.product .dla-picker-stock p.available-on-backorder,
.woocommerce div.product .dla-picker-stock p.out-of-stock {
    color: #4b4f57;
}

.dla-picker-stock p,
.dla-picker-stock .stock,
.woocommerce div.product .dla-picker-stock p.stock {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
}

/* ---------- Service-Hinweise ---------- */
.dla-service {
    list-style: none;
    margin: 20px 0 0;
    padding: 16px 0 0;
    border-top: 1px solid #e9e9e9;
}

.dla-service li {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 6px;
    padding: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #4b4f57;
}

.dla-service-icon {
    flex: 0 0 18px;
    color: #111;
}

.dla-service a {
    display: inline-block;
    padding: 2px 0;
    color: #111;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ---------- Farbmuster-Ersatzbild im Galerie-Hauptbild (v0.2.7) ---------- */
/* Farben ohne Knäuelbild (_K) haben stattdessen das Farbmuster (_M) als
   Produktbild (Plugin 1 v0.3.4) – oft ein hoher schmaler Streifen statt eines
   quadratischen Fotos. Die Klasse "dla-farbmuster" wird nur für diese Bilder
   gesetzt (server- und clientseitig, siehe class-dla-frontend.php und
   picker.js) und zeigt sie als quadratischen Ausschnitt wie ein Knäuelbild.
   Knäuelbilder bekommen die Klasse nie und bleiben unverändert. In der
   Lightbox/Lupe (PhotoSwipe) bleibt weiterhin das ganze Farbmuster sichtbar,
   weil nur dieses kleine Vorschaubild zugeschnitten wird. Hover-Zoom wird für
   Farbmuster deaktiviert, weil er beim Zuschnitt sonst verrutschen kann. */
.woocommerce-product-gallery__image.dla-farbmuster {
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.woocommerce-product-gallery__image.dla-farbmuster a {
    display: block;
    width: 100%;
    height: 100%;
    cursor: zoom-in;
}

.woocommerce-product-gallery__image.dla-farbmuster img {
    /* !important: das Theme setzt „.woocommerce div.product div.images img {
       height: auto }" mit höherer Spezifität (0,3,3 vs. 0,2,1) – ohne
       !important bliebe das Farbmuster im Seitenverhältnis der Bilddatei
       (hoher schmaler Streifen) statt quadratisch zugeschnitten zu werden. */
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    object-position: center;
}

/* ---------- „Dazu passt …“ (v0.3.0) ---------- */
.dla-dazu {
    clear: both;
    margin: 40px 0 8px;
}

.dla-dazu > h2 {
    margin: 0 0 20px;
}

@media (max-width: 600px) {
    .dla-facts-row {
        grid-template-columns: 112px minmax(0, 1fr);
    }

    .dla-picker-swatches {
        grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
        gap: 12px 8px;
    }

    .dla-swatch {
        width: auto;
    }

    .dla-swatch-media {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
    }

    .dla-picker-form .single_add_to_cart_button {
        max-width: none;
    }
}

/* Grundpreis (v0.5.0): steht in der Germanized-Zeile unter dem Preis, gleiche Schrift.
   Auf schmalen Bildschirmen eigene Zeile ohne Trennpunkt, sonst bleibt "Grundpreis: ..." zusammen. */
.dla-unit-price{white-space:nowrap}
.dla-unit-price[hidden]{display:none}
@media (max-width:600px){
  .dla-unit-price{display:block}
  .dla-unit-price .dla-unit-sep{display:none}
}
