/**
 * KFZ-Web Wishlist / Merkliste ("Parken")
 *
 * Farben/Radien/Schatten kommen aus dem Token-System (includes/Design/Tokens.php).
 * Keine Hex-Literale — die :root-Variablen werden immer mit dem Frontend geladen.
 */

/* Card image containers need positioning context for the floating button. */
.kfzweb-vehicle__image,
.kfzweb-card { position: relative; }

.kfzweb-wishlist-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--kfzweb-space-2);
    cursor: pointer;
    border: none;
    background: none;
    color: var(--kfzweb-text-muted);
    font: inherit;
    line-height: 1;
}

.kfzweb-wishlist-btn__icon {
    display: block;
    /* Explizite Größe: schützt das Inline-SVG (Markup 20×20) gegen globale
       Theme-svg-Regeln (z. B. Kadence/Gutenberg `svg{width:1em}` bzw.
       `img,svg{height:auto}`), die sonst die Präsentationsattribute aushebeln
       und das Herz auf der Card verzerren. --single überschreibt auf 16px. */
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    transition: fill var(--kfzweb-transition-fast),
                stroke var(--kfzweb-transition-fast),
                transform var(--kfzweb-transition-fast);
}

/* Floating heart on cards */
.kfzweb-wishlist-btn--card {
    position: absolute;
    top: var(--kfzweb-space-2);
    right: var(--kfzweb-space-2);
    z-index: var(--kfzweb-z-fab);
    width: 38px;
    height: 38px;
    justify-content: center;
    border-radius: var(--kfzweb-radius-full);
    background: var(--kfzweb-surface);
    box-shadow: var(--kfzweb-shadow-md);
    transition: transform var(--kfzweb-transition-fast),
                color var(--kfzweb-transition-fast),
                background-color var(--kfzweb-transition-fast);
}
.kfzweb-wishlist-btn--card .kfzweb-wishlist-btn__label { display: none; }
.kfzweb-wishlist-btn--card:hover { transform: scale(1.08); color: var(--kfzweb-danger); }

/* Inline-Button auf der Einzelseite — visuell IDENTISCH zum PDF-Exposé-Button
   (.kfzweb-pdf-button in kfzweb-frontend.css), damit beide Aktionen als
   konsistentes Paar nebeneinander stehen. */
.kfzweb-wishlist-btn--single {
    padding: 8px 16px;
    font-size: var(--kfzweb-text-sm);
    font-weight: var(--kfzweb-font-semibold);
    color: var(--kfzweb-primary);
    background: transparent;
    border: 1px solid var(--kfzweb-primary);
    border-radius: var(--kfzweb-radius);
    line-height: 1.4 !important; /* identisch zum PDF-Button → gleiche Höhe (beide 1.4); !important = theme-robust */
    box-sizing: border-box;
    transition: all var(--kfzweb-transition);
}
.kfzweb-wishlist-btn--single:hover {
    background: var(--kfzweb-primary);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--kfzweb-shadow-md);
}
/* Icon auf PDF-Button-Größe (16px) bringen — Markup liefert 20px. */
.kfzweb-wishlist-btn--single .kfzweb-wishlist-btn__icon {
    width: 16px;
    height: 16px;
}
/* „Gemerkt"-Zustand: rotes Herz + roter Rahmen statt des blauen. */
.kfzweb-wishlist-btn--single.is-active {
    color: var(--kfzweb-danger);
    border-color: var(--kfzweb-danger);
}

/* Active (gemerkt) state — filled brand-danger heart */
.kfzweb-wishlist-btn.is-active { color: var(--kfzweb-danger); }
.kfzweb-wishlist-btn.is-active .kfzweb-wishlist-btn__icon {
    fill: var(--kfzweb-danger);
    stroke: var(--kfzweb-danger);
    transform: scale(1.05);
}

/* Wishlist page */
.kfzweb-wishlist-empty {
    padding: var(--kfzweb-space-10) var(--kfzweb-space-4);
    text-align: center;
    color: var(--kfzweb-text-muted);
    font-size: var(--kfzweb-text-lg);
}
.kfzweb-wishlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--kfzweb-gap);
    margin-top: var(--kfzweb-space-4);
}

/* Optional count badge (e.g. in a menu): [data-kfzweb-wishlist-count] */
[data-kfzweb-wishlist-count].is-empty { opacity: .55; }

/* Schwebender „Merkliste (N)"-Zähler — dezent unten rechts, JS blendet ihn
   nur bei N>0 ein (Klasse `is-empty`). Token-konform, unaufdringlich. */
.kfzweb-wishlist-fab {
    position: fixed;
    right: var(--kfzweb-space-4);
    bottom: var(--kfzweb-space-4);
    z-index: var(--kfzweb-z-fab);
    display: inline-flex;
    align-items: center;
    gap: var(--kfzweb-space-2);
    padding: var(--kfzweb-space-2) var(--kfzweb-space-4);
    border-radius: var(--kfzweb-radius-full);
    background: var(--kfzweb-surface);
    color: var(--kfzweb-text);
    font-size: var(--kfzweb-text-sm);
    font-weight: var(--kfzweb-font-semibold);
    line-height: 1;
    text-decoration: none;
    box-shadow: var(--kfzweb-shadow-lg);
    border: 1px solid var(--kfzweb-border);
    transition: transform var(--kfzweb-transition-fast),
                opacity var(--kfzweb-transition-fast),
                background-color var(--kfzweb-transition-fast),
                color var(--kfzweb-transition-fast);
}
.kfzweb-wishlist-fab:hover {
    transform: translateY(-2px);
    background: var(--kfzweb-primary);
    color: #fff;
}
.kfzweb-wishlist-fab__icon {
    display: block;
    width: 20px;   /* gegen Theme-svg-Regeln, analog Card-Icon (Markup 20×20) */
    height: 20px;
    color: var(--kfzweb-danger);
    flex: 0 0 auto;
}
.kfzweb-wishlist-fab:hover .kfzweb-wishlist-fab__icon { color: #fff; }
.kfzweb-wishlist-fab__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 var(--kfzweb-space-1);
    border-radius: var(--kfzweb-radius-full);
    background: var(--kfzweb-primary);
    color: #fff;
    font-size: var(--kfzweb-text-xs);
    line-height: 1;
}
.kfzweb-wishlist-fab:hover .kfzweb-wishlist-fab__count {
    background: #fff;
    color: var(--kfzweb-primary);
}
/* Verborgen, solange die Merkliste leer ist (N=0). */
.kfzweb-wishlist-fab.is-empty {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(8px);
}
