/**
 * IDF Woo Addons - Frontend.
 *
 * IDF-Basis-Look über CSS-Custom-Properties (--idf-wa-*), gescoped auf
 * .idf-wa-product-fields - analog zu den anderen IDF-Plugins
 * (Quote-Calculator etc.). Für Sonderfälle lassen sich die Tokens über
 * „Woo Addons -> Einstellungen -> Eigenes CSS" oder das Theme überschreiben.
 */

.idf-wa-product-fields {
    --idf-wa-primary: #c8102e;
    --idf-wa-primary-hover: #a50d26;
    --idf-wa-text: #1f2933;
    --idf-wa-muted: #6b7280;
    --idf-wa-border: #d8dde3;
    --idf-wa-bg: #ffffff;
    --idf-wa-bg-soft: #f6f8fa;
    --idf-wa-success: #1b7a43;
    --idf-wa-error: #c8102e;
    --idf-wa-radius: 0;
    --idf-wa-option-gap: 8px;
    --idf-wa-font-size: 16px;
    /* Hervorgehobener Text (gewählte Option, Gesamtpreis). Standard: wie der
       übrige Text - im Panel getrennt einstellbar. */
    --idf-wa-text-selected: var(--idf-wa-text);

    /* Volle Zeile erzwingen, auch im Flex-/Grid-Add-to-Cart-Formular. */
    width: 100%;
    flex: 1 0 100% !important;
    grid-column: 1 / -1;
    clear: both;
    box-sizing: border-box;

    margin: 1.5em 0;
    display: grid;
    gap: 1.1em;

    color: var(--idf-wa-text);
    font-size: var(--idf-wa-font-size, 16px);
    font-weight: var(--idf-wa-font-weight, inherit);
    letter-spacing: var(--idf-wa-font-spacing, inherit);
    text-transform: var(--idf-wa-font-transform, inherit);
    line-height: 1.5;
}

.idf-wa-product-fields *,
.idf-wa-product-fields *::before,
.idf-wa-product-fields *::after {
    box-sizing: border-box;
}

/* Teilt sich der Feld-Block einen (Flex-)Container mit dem Add-to-Cart-Button
   - z. B. Avadas .fusion-button-wrapper -, den Container umbrechen lassen,
   damit der Button UNTER den Feldern steht statt daneben. Greift nur beim
   direkten Elternelement unseres Feld-Blocks. */
:has(> .idf-wa-product-fields) {
    flex-wrap: wrap !important;
}

/* ── Feld-Layout ─────────────────────────────────────────────────────────── */
.idf-wa-field {
    display: flex;
    flex-direction: column;
    gap: .4em;
}

.idf-wa-label-text {
    color: var(--idf-wa-text);
    font-size: var(--idf-wa-label-size, inherit);
    font-weight: var(--idf-wa-label-weight, 600);
    letter-spacing: var(--idf-wa-label-spacing, inherit);
    text-transform: var(--idf-wa-label-transform, inherit);
}

.idf-wa-required {
    color: var(--idf-wa-primary);
}

.idf-wa-price-hint {
    color: var(--idf-wa-price-color, var(--idf-wa-muted));
    font-size: var(--idf-wa-price-size, 1em);
    font-weight: var(--idf-wa-price-weight, 400);
    letter-spacing: var(--idf-wa-price-spacing, inherit);
    text-transform: var(--idf-wa-price-transform, inherit);
}

/* Der Hilfetext steht im Markup zwischen Überschrift und Feld. Wohin er
   gehört, entscheidet das Design-Set - das Feld ist eine Flex-Spalte, `order`
   schiebt ihn ans Ende, ohne das Markup zu drehen. */
.idf-wa-help {
    color: var(--idf-wa-muted);
    font-size: var(--idf-wa-help-size, .85em);
    font-weight: var(--idf-wa-help-weight, inherit);
    letter-spacing: var(--idf-wa-help-spacing, inherit);
    text-transform: var(--idf-wa-help-transform, inherit);
}

.idf-wa-help--feld .idf-wa-help {
    order: 99;
}

/* ── Eingabefelder einheitlich ───────────────────────────────────────────── */
.idf-wa-input,
.idf-wa-product-fields select,
.idf-wa-product-fields textarea,
.idf-wa-product-fields input[type="text"],
.idf-wa-product-fields input[type="number"],
.idf-wa-product-fields input[type="date"],
.idf-wa-product-fields input[type="time"],
.idf-wa-product-fields input[type="datetime-local"] {
    width: 100%;
    max-width: 100%;
    padding: var(--idf-wa-input-padding, .55rem .6rem);
    border: 1px solid var(--idf-wa-border);
    border-radius: var(--idf-wa-radius);
    background: var(--idf-wa-bg);
    color: var(--idf-wa-text);
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.4;
}

.idf-wa-product-fields textarea {
    min-height: 5rem;
    resize: vertical;
}

.idf-wa-input:focus,
.idf-wa-product-fields select:focus,
.idf-wa-product-fields textarea:focus,
.idf-wa-product-fields input:focus {
    outline: none;
    border-color: var(--idf-wa-primary);
    box-shadow: 0 0 0 1px var(--idf-wa-primary);
}

/* Checkbox */
.idf-wa-field--checkbox .idf-wa-checkbox {
    display: inline-flex;
    align-items: center;
    gap: .5em;
    font-weight: 600;
    cursor: pointer;
}

.idf-wa-checkbox input[type="checkbox"] {
    accent-color: var(--idf-wa-primary);
    width: 1.05em;
    height: 1.05em;
}

/* Radiobuttons / Checkliste.
   Darstellung, Farben, Abstände und der sichtbare Haken kommen aus
   „Woo Addons -> Einstellungen -> Design der Addon-Felder"; die Auswahl haengt
   als Klasse idf-wa-opt--* am Feldblock. Die Options-Variablen fallen auf die
   Grundwerte des Feldblocks zurueck, solange im Panel nichts gesetzt ist. */
.idf-wa-product-fields .idf-wa-options {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    gap: var(--idf-wa-option-gap);
}

.idf-wa-product-fields .idf-wa-option {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Themes (u. a. Avada) floaten Formular-Labels und geben ihnen eine feste
   Breite - das würde die Optionszeile zerreißen. */
.idf-wa-option > label {
    display: flex;
    align-items: baseline;
    gap: .5em;
    margin: 0;
    padding: var(--idf-wa-option-padding, 0);
    float: none;
    width: 100%;
    color: var(--idf-wa-option-text, var(--idf-wa-text));
    font-size: var(--idf-wa-option-size, inherit);
    font-weight: var(--idf-wa-option-weight, 400);
    letter-spacing: var(--idf-wa-option-spacing, inherit);
    text-transform: var(--idf-wa-option-transform, inherit);
    cursor: pointer;
}

.idf-wa-option input[type="radio"],
.idf-wa-option input[type="checkbox"] {
    accent-color: var(--idf-wa-tick-color, var(--idf-wa-primary));
    width: 1.05em;
    height: 1.05em;
    margin: 0;
    flex: 0 0 auto;
}

/* Haken bzw. Punkt ausblenden - wie bei der Farb- und Größen-Auswahl im
   Produkt. Nicht display:none: das Control muss mit der Tastatur erreichbar
   bleiben und den Fokus an die Karte weitergeben. */
.idf-wa-product-fields.idf-wa-opt--nohaken .idf-wa-option input[type="radio"],
.idf-wa-product-fields.idf-wa-opt--nohaken .idf-wa-option input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Karten und Kacheln: die ganze Fläche ist die Klickfläche. */
.idf-wa-opt--karte .idf-wa-option > label,
.idf-wa-opt--karte-preis .idf-wa-option > label,
.idf-wa-opt--kachel .idf-wa-option > label {
    align-items: center;
    gap: .7em;
    padding: var(--idf-wa-option-padding, .7em .9em);
    border: 1px solid var(--idf-wa-option-border, var(--idf-wa-border));
    border-radius: var(--idf-wa-radius);
    background: var(--idf-wa-option-bg, var(--idf-wa-bg));
    transition: border-color .12s ease, background-color .12s ease, color .12s ease;
}

.idf-wa-opt--karte .idf-wa-option > label:hover,
.idf-wa-opt--karte-preis .idf-wa-option > label:hover,
.idf-wa-opt--kachel .idf-wa-option > label:hover {
    border-color: var(--idf-wa-option-border-hover, var(--idf-wa-option-border-selected, var(--idf-wa-primary)));
    background: var(--idf-wa-option-bg-hover, var(--idf-wa-option-bg, var(--idf-wa-bg)));
}

/* Schriftfarbe bei Mauskontakt - auch ohne Karten. */
.idf-wa-option > label:hover {
    color: var(--idf-wa-option-text-hover, var(--idf-wa-option-text, var(--idf-wa-text)));
}

.idf-wa-option > label:hover .idf-wa-price-hint {
    color: var(--idf-wa-price-color-hover, var(--idf-wa-price-color, var(--idf-wa-muted)));
}

/* Kacheln nebeneinander - das Muster der Größen-Auswahl im Produkt. */
.idf-wa-opt--kachel .idf-wa-options {
    flex-direction: row;
}

.idf-wa-opt--kachel .idf-wa-option > label {
    justify-content: center;
    text-align: center;
}

/* Doppelt abgesichert: :has() fuer Browser, die es koennen, und die Klasse
   is-selected, die das JS setzt - sonst faellt der gewaehlte Zustand in
   aelteren Browsern still aus. */
.idf-wa-opt--karte .idf-wa-option.is-selected > label,
.idf-wa-opt--karte-preis .idf-wa-option.is-selected > label,
.idf-wa-opt--kachel .idf-wa-option.is-selected > label,
.idf-wa-opt--karte .idf-wa-option > label:has(input:checked),
.idf-wa-opt--karte-preis .idf-wa-option > label:has(input:checked),
.idf-wa-opt--kachel .idf-wa-option > label:has(input:checked) {
    border-color: var(--idf-wa-option-border-selected, var(--idf-wa-primary));
    background: var(--idf-wa-option-bg-selected, var(--idf-wa-bg-soft));
}

/* Auch ohne Karten soll die gewählte Option als gewählt lesbar sein.
   Die Schriftstärke steht im Panel: ohne eigene Vorgabe bleibt sie, wie sie
   im Normalzustand ist - eine gewählte Option wird nicht von allein fett. */
.idf-wa-option.is-selected > label,
.idf-wa-option > label:has(input:checked) {
    color: var(--idf-wa-option-text-selected, var(--idf-wa-text-selected));
    font-weight: var(--idf-wa-option-weight-selected, inherit);
}

.idf-wa-opt--karte .idf-wa-option > label:focus-within,
.idf-wa-opt--karte-preis .idf-wa-option > label:focus-within,
.idf-wa-opt--kachel .idf-wa-option > label:focus-within {
    border-color: var(--idf-wa-primary);
    box-shadow: 0 0 0 2px var(--idf-wa-bg), 0 0 0 3px var(--idf-wa-primary);
}

/* Preis am rechten Rand statt direkt hinter dem Text. */
.idf-wa-opt--karte-preis .idf-wa-option .idf-wa-price-hint {
    margin-left: auto;
    padding-left: 1em;
    white-space: nowrap;
}

.idf-wa-option.is-selected .idf-wa-price-hint,
.idf-wa-option > label:has(input:checked) .idf-wa-price-hint {
    color: var(--idf-wa-price-color-selected, var(--idf-wa-option-text-selected, var(--idf-wa-text-selected)));
}

/* Gesamtpreis über dem Warenkorb-Button. */
.idf-wa-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .2em .6em;
    padding: var(--idf-wa-total-padding, .8em 1em);
    border: 1px solid var(--idf-wa-total-border, var(--idf-wa-border));
    border-radius: var(--idf-wa-radius);
    background: var(--idf-wa-total-bg, var(--idf-wa-bg-soft));
}

/* display:flex würde die UA-Regel für [hidden] schlagen - variable Produkte
   ohne gewählte Variante blieben sonst mit leerem Betrag sichtbar. */
.idf-wa-summary[hidden] {
    display: none;
}

.idf-wa-summary-label {
    color: var(--idf-wa-total-label-color, var(--idf-wa-text));
    font-size: var(--idf-wa-total-label-size, 1em);
    font-weight: var(--idf-wa-total-label-weight, 600);
    letter-spacing: var(--idf-wa-total-label-spacing, inherit);
    text-transform: var(--idf-wa-total-label-transform, inherit);
}

.idf-wa-summary-value {
    color: var(--idf-wa-total-value-color, var(--idf-wa-text-selected));
    font-size: var(--idf-wa-total-value-size, 1.25em);
    font-weight: var(--idf-wa-total-value-weight, 700);
    letter-spacing: var(--idf-wa-total-value-spacing, inherit);
    text-transform: var(--idf-wa-total-value-transform, inherit);
}

.idf-wa-summary-note {
    flex: 1 0 100%;
    color: var(--idf-wa-muted);
    font-size: var(--idf-wa-total-note-size, .85em);
    font-weight: var(--idf-wa-total-note-weight, inherit);
    letter-spacing: var(--idf-wa-total-note-spacing, inherit);
    text-transform: var(--idf-wa-total-note-transform, inherit);
}

.idf-wa-summary-note:empty {
    display: none;
}
    display: none;
}

/* Wunschtermin: Datum + Uhrzeit nebeneinander */
.idf-wa-datetime {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

/* Sichtbares Feld ist das Flatpickr-Alt-Input; ohne Flatpickr das dt-date. */
.idf-wa-datetime .idf-wa-dt-date,
.idf-wa-datetime .idf-wa-dt-alt {
    flex: 1 1 12rem;
}

.idf-wa-datetime .idf-wa-dt-time {
    flex: 1 1 9rem;
}

/* Flatpickr-Kalender an den IDF-Look angleichen (liegt außerhalb des Wrappers,
   daher hier mit fester Primärfarbe statt Token). */
.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: #c8102e;
    border-color: #c8102e;
}

.flatpickr-day.today {
    border-color: #c8102e;
}

.flatpickr-day.today:hover {
    background: #c8102e;
    border-color: #c8102e;
    color: #fff;
}

/* ── Datei-Upload: Dropzone ──────────────────────────────────────────────── */
.idf-wa-dropzone {
    /* Von den Basis-Tokens abgeleitet; einzeln überschreibbar. */
    --idf-wa-dz-border: var(--idf-wa-border);
    --idf-wa-dz-border-hover: var(--idf-wa-muted);
    --idf-wa-dz-accent: var(--idf-wa-primary);
    --idf-wa-dz-radius: var(--idf-wa-radius);
    --idf-wa-dz-bg: var(--idf-wa-bg);

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .55em;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    padding: 1.6em 1.2em;
    border: 2px dashed var(--idf-wa-dz-border);
    border-radius: var(--idf-wa-dz-radius);
    background: var(--idf-wa-dz-bg);
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}

.idf-wa-dropzone:hover,
.idf-wa-dropzone:focus-within {
    border-color: var(--idf-wa-dz-border-hover);
    outline: none;
}

/* Datei-Feld sichtbar verstecken, aber fokussierbar lassen - das umschließende
   <label> öffnet den Dialog beim Klick nativ (ohne JS). */
.idf-wa-dropzone .idf-wa-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.idf-wa-dropzone.is-dragover {
    border-color: var(--idf-wa-dz-accent);
    background: color-mix(in srgb, var(--idf-wa-dz-accent) 7%, transparent);
}

.idf-wa-dropzone.is-error {
    border-color: var(--idf-wa-error);
}

.idf-wa-dz-icon {
    color: var(--idf-wa-dz-accent);
    line-height: 0;
}

.idf-wa-dz-icon svg {
    width: 34px;
    height: 34px;
    display: block;
}

.idf-wa-dz-text {
    max-width: 24em;
    line-height: 1.45;
    color: var(--idf-wa-muted);
}

.idf-wa-file-status {
    font-size: .9em;
}

.idf-wa-dropzone.is-uploading .idf-wa-dz-text {
    opacity: .5;
}

/* Nach dem Upload: Prompt aus, Dateiname an. */
.idf-wa-dropzone.has-file {
    cursor: default;
    border-style: solid;
    border-color: var(--idf-wa-success);
}

.idf-wa-dropzone.has-file .idf-wa-dz-icon,
.idf-wa-dropzone.has-file .idf-wa-dz-text {
    display: none;
}

.idf-wa-file-name {
    font-weight: 600;
    word-break: break-word;
}

.idf-wa-file-remove {
    background: none;
    border: 0;
    margin-left: .4em;
    padding: 0 .25em;
    cursor: pointer;
    text-decoration: underline;
    color: inherit;
    font-size: .9em;
}

.idf-wa-dropzone.is-error .idf-wa-file-status {
    color: var(--idf-wa-error);
}

/* Hochgeladene Dateien als Chips unter der Dropzone. */
.idf-wa-file-list {
    list-style: none;
    margin: .5em 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: .4em;
}

.idf-wa-file-chip {
    display: inline-flex;
    align-items: center;
    gap: .45em;
    max-width: 100%;
    padding: .25em .55em;
    background: var(--idf-wa-bg-soft, #f6f8fa);
    border: 1px solid var(--idf-wa-border, #d8dde3);
    border-radius: var(--idf-wa-radius, 0);
    font-size: .9em;
}

.idf-wa-file-chip .idf-wa-file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 16em;
    font-weight: 400;
}

.idf-wa-file-chip .idf-wa-file-remove {
    margin: 0;
    padding: 0 .1em;
    border: 0;
    background: none;
    cursor: pointer;
    color: var(--idf-wa-error, #c8102e);
    font-size: 1.15em;
    line-height: 1;
    text-decoration: none;
}

/* Anfrage-Hinweis unter dem Add-to-Cart-Button (eigener Kontext, feste Farben). */
.idf-wa-request-hint {
    flex: 1 0 100%;
    width: 100%;
    box-sizing: border-box;
    margin-top: .9em;
    padding: .8em 1em;
    background: #f6f8fa;
    border-left: 3px solid #c8102e;
    color: #4b5563;
    font-size: .9em;
    line-height: 1.5;
}

.idf-wa-request-hint p {
    margin: 0 0 .5em;
}

.idf-wa-request-hint p:last-child {
    margin-bottom: 0;
}

/* Im Warenkorb / Checkout ist kein Flex-Kontext - normal als Block. */
.idf-wa-request-hint--order {
    flex: none;
    margin: 1em 0 0;
}

/* ── „Für später merken": Link in der Warenkorb-Zeile + Merkliste ─────────
   Eigener Kontext außerhalb von .idf-wa-product-fields, daher feste Farben
   (analog zum Anfrage-Hinweis). */
.idf-wa-save-later {
    display: block;
    margin: .25em 0 .35em;
    font-size: .85em;
    color: #6b7280;
    text-decoration: underline;
}

.idf-wa-save-later:hover,
.idf-wa-save-later:focus {
    color: #c8102e;
}

.idf-wa-saved {
    margin: 2em 0 1em;
    border: 1px solid #d8dde3;
    background: #fff;
    clear: both;
}

.idf-wa-saved__title {
    margin: 0;
    padding: .7em 1em;
    font-size: 1.15em;
    line-height: 1.3;
    background: #f6f8fa;
    border-bottom: 1px solid #d8dde3;
}

.idf-wa-saved__count {
    font-weight: 400;
    color: #6b7280;
}

.idf-wa-saved__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.idf-wa-saved__item {
    display: flex;
    align-items: flex-start;
    gap: 1em;
    padding: 1em;
    border-bottom: 1px solid #eef1f4;
}

.idf-wa-saved__item:last-child {
    border-bottom: 0;
}

.idf-wa-saved__thumb {
    flex: 0 0 64px;
}

.idf-wa-saved__thumb img {
    display: block;
    width: 64px;
    height: auto;
}

.idf-wa-saved__body {
    flex: 1 1 auto;
    min-width: 0;
}

.idf-wa-saved__name {
    display: inline-block;
    font-weight: 600;
    color: #1f2933;
    text-decoration: none;
}

.idf-wa-saved__name:hover,
.idf-wa-saved__name:focus {
    color: #c8102e;
}

.idf-wa-saved__badge {
    display: inline-block;
    margin-left: .4em;
    padding: .1em .5em;
    font-size: .75em;
    vertical-align: middle;
    background: #f6f8fa;
    border: 1px solid #d8dde3;
    color: #4b5563;
    white-space: nowrap;
}

.idf-wa-saved__qty {
    display: block;
    margin-top: .15em;
    font-size: .85em;
    color: #6b7280;
}

.idf-wa-saved__meta {
    list-style: none;
    margin: .35em 0 0;
    padding: 0;
    font-size: .85em;
    color: #6b7280;
}

.idf-wa-saved__meta li {
    margin: 0;
}

.idf-wa-saved__price {
    flex: 0 0 auto;
    text-align: right;
    font-weight: 600;
    color: #1f2933;
}

.idf-wa-saved__surcharge {
    display: block;
    font-size: .8em;
    font-weight: 400;
    color: #6b7280;
}

.idf-wa-saved__actions {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .5em;
}

.idf-wa-saved__actions .idf-wa-saved__restore {
    white-space: nowrap;
}

.idf-wa-saved__forget {
    font-size: .85em;
    color: #6b7280;
    text-decoration: underline;
}

.idf-wa-saved__forget:hover,
.idf-wa-saved__forget:focus {
    color: #c8102e;
}

.idf-wa-saved__unavailable {
    font-size: .85em;
    color: #c8102e;
}

@media (max-width: 640px) {
    .idf-wa-saved__item {
        flex-wrap: wrap;
    }

    .idf-wa-saved__price {
        flex: 1 1 auto;
        text-align: left;
        margin-left: calc(64px + 1em);
    }

    .idf-wa-saved__actions {
        flex: 1 1 100%;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
    }
}
