/* Frontend Styles für Mini Woo Warranty Labels */

/*
 * Produktseite: Die Ausgabeposition wird über einen WooCommerce- oder
 * GeneratePress-Hook bzw. über den Description-Tab konfiguriert.
 * Das Gewaehrleistungslabel ist immer vollstaendig sichtbar und kann in einer
 * Grossansicht geoeffnet werden. Das Garantielabel zeigt zunaechst nur die
 * kompakte Zusammenfassung; ein Link blendet das vollstaendige Label
 * zusaetzlich ein (siehe .mwwl-guarantee-toggle / .mwwl-guarantee-full).
 */
.mwwl-product-labels {
    margin: 32px 0;
    clear: both;
    width: 100%;
    text-align: start;
}

/* Optionaler Gestaltungsrahmen mit Textumfluss. */
.mwwl-product-labels.mwwl-label-container-enabled {
    box-sizing: border-box;
    width: min(var(--mwwl-container-width, 360px), 100%) !important;
    max-width: 100%;
    padding: 16px;
    clear: none !important;
    display: block;
    overflow: visible;
}

.mwwl-product-labels.mwwl-label-float-left {
    float: left !important;
    margin: 0 24px 20px 0;
}

.mwwl-product-labels.mwwl-label-float-right {
    float: right !important;
    margin: 0 0 20px 24px;
}

.mwwl-product-labels.mwwl-label-container-background {
    background-color: var(--mwwl-container-background, #fff);
}

.mwwl-product-labels.mwwl-label-container-border {
    border: var(--mwwl-container-border-width, 1px) solid var(--mwwl-container-border-color, #dcdcde);
}

.mwwl-label-float-clear {
    display: block;
    clear: both;
    width: 100%;
    height: 0;
}

/* Ausreichend Abstand zur Produktbeschreibung, angelehnt an die
   Zwischenueberschriften-Typografie des Themes. */
.mwwl-section-title {
    margin: 28px 0 12px;
    font-size: 1.3em;
    line-height: 1.3;
}

.mwwl-product-labels .mwwl-section-title:first-child {
    margin-top: 0;
}

.mwwl-manufacturer-guarantee-link {
    margin: 12px 0 0;
}

.mwwl-manufacturer-guarantee-link a {
    font-weight: 600;
    text-decoration: underline;
}

.mwwl-manufacturer-guarantee-link a:hover,
.mwwl-manufacturer-guarantee-link a:focus {
    text-decoration: none;
}

.mwwl-labels {
    margin: 20px 0;
}

.mwwl-warranty-label,
.mwwl-guarantee-label {
    margin: 15px 0;
    max-width: var(--mwwl-label-max-width, 100%);
    text-align: start;
}

/* Responsive Bilddarstellung: keine Verzerrung, keine Beschneidung,
   kein horizontales Scrollen auf mobilen Geraeten. */
.mwwl-warranty-label img,
.mwwl-warranty-label svg,
.mwwl-guarantee-label img,
.mwwl-guarantee-label svg,
.mwwl-warranty-label-image,
.mwwl-guarantee-label-image {
    display: block;
    max-width: 100%;
    width: auto;
    height: auto;
    border: 2px solid #003399;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mwwl-label-zoom-trigger {
    cursor: zoom-in;
}

.mwwl-label-zoom-trigger:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 3px;
}

body.mwwl-label-modal-open {
    overflow: hidden;
}

.mwwl-label-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 20px;
}

.mwwl-label-lightbox[hidden] {
    display: none !important;
}

.mwwl-label-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
}

.mwwl-label-lightbox__dialog {
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    width: min(1200px, calc(100vw - 40px));
    max-height: calc(100vh - 40px);
    padding: 48px 20px 20px;
    overflow: auto;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 8px 35px rgba(0, 0, 0, 0.35);
}

.mwwl-label-lightbox__close {
    position: absolute;
    top: 8px;
    right: 10px;
    min-width: 36px;
    min-height: 36px;
    padding: 4px 10px;
    border: 1px solid #767676;
    border-radius: 3px;
    background: #fff;
    color: #111;
    font: inherit;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.mwwl-label-lightbox__image {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: calc(100vh - 110px);
    margin: 0 auto;
    background: #fff;
}

.mwwl-guarantee-label img,
.mwwl-guarantee-label svg,
.mwwl-guarantee-label-image {
    border-color: #009933;
}

/*
 * Garantie-Labelgrafiken bestehen aus SVG/Bild mit weissem Hintergrund.
 * Manche Themes wenden auf svg/img jedoch eigene Filter, Invertierungen
 * oder "currentColor"-Regeln an, wodurch der weisse Hintergrund dunkel
 * erscheinen kann. Ein expliziter weisser Hintergrund auf dem Container
 * stellt die korrekte, vom Theme unabhaengige Darstellung sicher.
 */
.mwwl-guarantee-label img,
.mwwl-guarantee-label svg,
.mwwl-guarantee-label-image {
    background-color: #fff !important;
}

/* Kompaktes Garantielabel (Zusammenfassung) - etwas schmaler als das
   vollstaendige Label, damit es optisch klar als Kurzform erkennbar ist. */
.mwwl-guarantee-compact-image {
    max-width: 400px;
}

/*
 * Umschalter "Vollständiges Garantielabel anzeigen/verbergen".
 * Implementiert als reines CSS-Konstrukt (versteckte Checkbox + <label>),
 * damit die Funktion unabhaengig von JavaScript-Konflikten zuverlaessig
 * funktioniert (siehe MWWL_Frontend::render_collapsible_guarantee_label()).
 */
.mwwl-guarantee-toggle-checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.mwwl-guarantee-compact-toggle,
.mwwl-guarantee-toggle-wrap {
    display: inline-block;
    cursor: pointer;
}

.mwwl-guarantee-compact-toggle {
    max-width: 100%;
}

.mwwl-guarantee-toggle-wrap {
    margin: 10px 0 15px;
}

.mwwl-guarantee-compact-toggle:focus-visible,
.mwwl-guarantee-toggle-wrap:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

.mwwl-guarantee-toggle {
    font-weight: 600;
    text-decoration: underline;
}

.mwwl-guarantee-toggle-wrap:hover .mwwl-guarantee-toggle,
.mwwl-guarantee-toggle-wrap:focus-within .mwwl-guarantee-toggle {
    text-decoration: none;
}

/*
 * Standardzustand: nur "anzeigen" sichtbar, vollständiges Label versteckt.
 * !important schuetzt gegen Theme-/Plugin-Styles, die z. B. global
 * "span { display: inline; }" oder aehnliche breite Regeln definieren und
 * damit ansonsten diese - eigentlich spezifischeren - Selektoren
 * ueberschreiben koennten.
 */
.mwwl-guarantee-toggle-hide {
    display: none !important;
}

.mwwl-guarantee-full {
    display: none !important;
    margin-top: 10px;
}

/* Ist die Checkbox aktiviert: Linktext wechseln und volles Label einblenden. */
.mwwl-guarantee-toggle-checkbox:checked ~ .mwwl-guarantee-toggle-wrap .mwwl-guarantee-toggle-show {
    display: none !important;
}

.mwwl-guarantee-toggle-checkbox:checked ~ .mwwl-guarantee-toggle-wrap .mwwl-guarantee-toggle-hide {
    display: inline !important;
}

.mwwl-guarantee-toggle-checkbox:checked ~ .mwwl-guarantee-full {
    display: block !important;
}

.mwwl-checkout-labels {
    padding: 20px;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.mwwl-checkout-labels h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
}

@media (max-width: 768px) {
    .mwwl-product-labels.mwwl-label-container-enabled {
        float: none !important;
        clear: both !important;
        width: 100% !important;
        margin: 20px 0;
    }

    .mwwl-warranty-label img,
    .mwwl-warranty-label svg,
    .mwwl-guarantee-label img,
    .mwwl-guarantee-label svg,
    .mwwl-warranty-label-image,
    .mwwl-guarantee-label-image {
        max-width: 100%;
    }
}

/* Gewaehrleistungslabel (statisches Bild, generischer Checkout-Fall) */
.mwwl-warranty-label.mwwl-generic {
    max-width: var(--mwwl-label-max-width, 100%);
    margin: 20px auto;
}
