/* ============================================================================
   Wegvio Matching Engine (Modul 3) - Styles
   ============================================================================ */
.match { display: flex; flex-direction: column; gap: 20px; }

.match-top {
    display: grid; grid-template-columns: 1fr; gap: 16px;
    padding: 20px 24px;
    background: var(--wv-surface);
    border: 1px solid var(--wv-border);
    border-radius: var(--wv-radius-lg);
}
.match-top__actions { display: flex; flex-direction: column; gap: 14px; align-items: stretch; }

/* Zwei gleich gestaltete Felder nebeneinander (Datenquellen + Profilwahl) */
.match-fields { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .match-fields { grid-template-columns: 1fr 1fr; } }
.match-field {
    display: flex; flex-direction: column; gap: 6px; justify-content: center;
    min-height: 70px;
    padding: 12px 14px;
    background: var(--wv-surface-soft);
    border: 1px solid var(--wv-border);
    border-radius: var(--wv-radius);
}
.match-field__label {
    display: inline-flex; align-items: center; gap: 6px;
    margin: 0;
    font-size: 11px; font-weight: 700; letter-spacing: 0.05em;
    text-transform: uppercase; color: var(--wv-text-muted);
}
.match-field__label .icon { color: var(--wv-coral-deep); }
.match-field__value { font-size: 13px; line-height: 1.45; color: var(--wv-text-soft); }
.match-field__value strong { color: var(--wv-coral-deep); margin: 0 1px; }
.match-field__select { width: 100%; }
.match-top__btn { align-self: flex-start; }
@media (max-width: 559px) { .match-top__btn { align-self: stretch; } }

/* Aktueller Web-Kontext pro Karte */
.match-current-context {
    margin-top: 6px;
    padding: 8px 12px;
    background: var(--wv-surface-soft);
    border-left: 3px solid var(--wv-info);
    border-radius: 8px;
    font-size: 13px; line-height: 1.5;
    display: flex; flex-direction: column; gap: 2px;
}
.match-current-context__lab {
    font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--wv-info); font-weight: 700;
}

/* Anbieter-Block pro Empfehlungs-Karte */
.match-providers {
    background: var(--wv-gradient-soft);
    border-radius: var(--wv-radius-lg);
    padding: 16px 18px;
    margin-top: 14px;
    /* Query-Container: Provider-Karten reagieren auf die BREITE DES BLOCKS
       (= Breite der Empfehlungs-Karte), nicht auf die Viewport-Breite. So
       stapeln sie auch dann, wenn die Karte im 2-/3-Spalten-Desktop-Grid
       schmal wird – sonst quetscht der Link-Button die Beschreibung auf 0
       (Zeichen-für-Zeichen-Umbruch). */
    container-type: inline-size;
}
[data-theme="dark"] .match-providers {
    background: rgba(107, 70, 255, 0.10);
}
.match-providers .match-block__title {
    color: var(--wv-coral-deep);
    font-size: 14px;
    display: flex; align-items: baseline; gap: 6px;
}
.match-providers .match-block__title small {
    font-weight: 500;
    color: var(--wv-text-muted);
    font-size: 12px;
}
.match-providers__intro,
.match-providers__outro {
    font-size: 13px;
    line-height: 1.55;
    color: var(--wv-text-soft);
    margin: 6px 0 10px;
}
.match-providers__outro {
    margin: 10px 0 0;
    font-style: italic;
    font-size: 12px;
}

.provider-list {
    display: flex; flex-direction: column; gap: 8px;
    margin-top: 8px;
}
.provider-card {
    background: var(--wv-surface);
    border: 1px solid var(--wv-border);
    border-radius: var(--wv-radius);
    padding: 12px 14px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    transition: border-color var(--wv-trans), transform var(--wv-trans);
}
.provider-card:hover {
    border-color: var(--wv-coral);
    transform: translateY(-1px);
}
[data-theme="dark"] .provider-card { background: var(--wv-surface); }

/* Mobile-Fallback (Viewport-basiert, falls Container-Queries nicht greifen). */
@media (max-width: 540px) {
    .provider-card { grid-template-columns: 1fr; }
    .provider-card__links { justify-self: stretch; }
}
/* Container-basiert: sobald die Empfehlungs-Karte schmal ist (Desktop-Mehr-
   spalter ODER kleines Viewport) stapelt Name/Beschreibung über dem Link,
   damit die Beschreibung die volle Breite bekommt und nicht zerbricht. */
@container (max-width: 380px) {
    .provider-card { grid-template-columns: 1fr; }
    .provider-card__links { justify-self: stretch; }
}

.provider-card__body { min-width: 0; }
.provider-card__head {
    display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px;
    margin-bottom: 2px;
}
.provider-card__name {
    font-size: 14px;
    font-weight: 700;
    color: var(--wv-text);
    line-height: 1.3;
}
.provider-card__loc {
    font-size: 11px;
    font-weight: 700;
    color: var(--wv-coral-deep);
    background: var(--wv-gradient-soft);
    padding: 2px 8px;
    border-radius: 999px;
}
[data-theme="dark"] .provider-card__loc {
    background: rgba(107, 70, 255, 0.18);
    color: var(--wv-orange-soft);
}
.provider-card__desc {
    font-size: 13px;
    line-height: 1.5;
    color: var(--wv-text-soft);
    margin: 0;
}
.provider-card__desc strong { color: var(--wv-text); }
.provider-card__desc em     { color: var(--wv-text); }

.provider-card__links {
    display: flex; flex-wrap: wrap; gap: 6px;
    align-self: center;
}
.provider-card__btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 7px 12px;
    background: var(--wv-gradient);
    color: #fff;
    border-radius: 999px;
    font-size: 12px; font-weight: 600;
    text-decoration: none;
    transition: transform var(--wv-trans), box-shadow var(--wv-trans);
    box-shadow: var(--wv-shadow-xs);
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.provider-card__btn:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--wv-shadow-sm);
}
.provider-card__btn span { font-size: 11px; opacity: 0.9; }

/* Web-Findings Block */
.web-findings { margin-top: 24px; }
.web-findings__list { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.web-finding {
    padding: 14px 16px;
    background: var(--wv-surface-soft);
    border-radius: var(--wv-radius);
    border-left: 3px solid var(--wv-info);
}
.web-finding__q {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--wv-info); font-weight: 700;
    margin-bottom: 6px;
}
.web-finding__c { font-size: 14px; line-height: 1.55; color: var(--wv-text); }
.web-finding__c p { margin: 0 0 8px; }
.web-finding__c p:last-child { margin-bottom: 0; }
.web-finding__c strong { color: var(--wv-text); }
.web-finding__c em { font-style: normal; color: var(--wv-text); }
.web-finding__c ul.md-list {
    list-style: none; padding: 0; margin: 8px 0 0;
    display: flex; flex-direction: column; gap: 6px;
}
.web-finding__c ul.md-list li {
    padding: 8px 12px;
    background: var(--wv-surface);
    border-radius: 8px;
    border-left: 2px solid var(--wv-info);
}
.web-finding__cites {
    display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
    padding-top: 10px; border-top: 1px solid var(--wv-border-soft);
}
.web-finding__cites a {
    padding: 4px 10px;
    background: var(--wv-surface);
    color: var(--wv-coral-deep);
    border-radius: 999px;
    font-size: 12px; font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--wv-border);
}
.web-finding__cites a:hover { border-color: var(--wv-coral); }

/* Pipeline */
.match-running { border-color: var(--wv-orange); }
.match-stages { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 12px; }
.match-stages li {
    display: flex; gap: 14px; align-items: flex-start;
    padding: 12px;
    background: var(--wv-surface-soft);
    border-radius: var(--wv-radius);
    transition: all 300ms ease;
}
.match-stages li.is-active {
    background: var(--wv-gradient-soft);
    transform: translateX(4px);
}
.match-stages li.is-done {
    background: rgba(43,182,115,0.08);
    border-left: 3px solid var(--wv-success);
}
.match-stages__dot {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid var(--wv-border);
    background: #fff;
    flex-shrink: 0;
    margin-top: 2px;
    position: relative;
}
.match-stages li.is-active .match-stages__dot {
    border-color: var(--wv-orange);
    background: var(--wv-gradient);
    animation: pulseDot 1.2s infinite;
}
.match-stages li.is-done .match-stages__dot {
    border-color: var(--wv-success);
    background: var(--wv-success);
}
.match-stages li.is-done .match-stages__dot::after {
    content: '✓'; color: #fff; font-size: 12px; font-weight: 800;
    position: absolute; inset: 0; display: grid; place-items: center;
}

/* Headline */
.match-headline-card {
    background: var(--wv-gradient);
    color: #fff;
    padding: 14px;
    border-radius: var(--wv-radius);
    box-shadow: var(--wv-shadow-brand);
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
    margin-bottom: 14px;
}
@media (min-width: 640px) { .match-headline-card { padding: 20px; gap: 16px; margin-bottom: 20px; border-radius: var(--wv-radius-lg); } }
@media (min-width: 880px) { .match-headline-card { padding: 28px; gap: 20px; margin-bottom: 24px; } }
.match-headline-card h2 { color: #fff; font-size: 18px; margin: 0 0 4px; line-height: 1.25; }
@media (min-width: 640px) { .match-headline-card h2 { font-size: 22px; } }
@media (min-width: 880px) { .match-headline-card h2 { font-size: var(--wv-fs-2xl); } }
.match-headline-card p { font-size: 13px; line-height: 1.45; margin: 0; }
@media (min-width: 640px) { .match-headline-card p { font-size: 15px; line-height: 1.55; } }
.match-headline-card p { color: rgba(255,255,255,0.95); }
.match-headline-card .btn { background: rgba(255,255,255,0.92); color: var(--wv-coral-deep); border: 0; }
/* Teilen / PDF / Neu berechnen duerfen umbrechen, statt am Rand anzustossen. */
.match-headline-card .flex { flex-wrap: wrap; }

/* Top-3 Grid: 1 Spalte auf dem Handy (volle Breite, gut lesbar),
   2 Spalten ab Tablet (Top-Karte spannt beide), 3 Spalten am Desktop. */
.match-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
    /* Container darf nie breiter werden als der verfuegbare Platz. */
    min-width: 0;
}
/* WICHTIG: Grid-Items duerfen unter ihre Inhalts-Mindestbreite schrumpfen.
   Ohne min-width:0 zwingt z.B. die Button-Reihe die Spalte auf ihre
   min-content-Breite (~640px) -> Karten werden auf Mobile abgeschnitten. */
.match-grid > * { min-width: 0; }
@media (min-width: 680px) {
    .match-grid {
        grid-template-columns: 1fr 1fr;
    }
    .match-grid .match-card--top {
        grid-column: 1 / -1;
    }
}
@media (min-width: 1040px) {
    .match-grid { grid-template-columns: 1.2fr 1fr 1fr; gap: 20px; }
    .match-grid .match-card--top { grid-column: auto; }
}

.match-card {
    background: var(--wv-surface);
    border: 1px solid var(--wv-border);
    border-radius: var(--wv-radius);
    padding: 14px;
    transition: all var(--wv-trans);
    display: flex; flex-direction: column; gap: 10px;
    position: relative;
    /* Karte schrumpft mit der Spalte; lange Woerter/URLs brechen um statt
       die Karte aufzublaehen. */
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}
/* Alle Flex-/Grid-Kinder in der Karte duerfen ebenfalls schrumpfen. */
.match-card > *,
.match-block,
.match-block__title,
.match-journey,
.match-phase { min-width: 0; }
.match-block__title { flex-wrap: wrap; }
@media (min-width: 640px) { .match-card { padding: 18px; gap: 12px; border-radius: var(--wv-radius-lg); } }
@media (min-width: 980px) { .match-card { padding: 24px; gap: 14px; } }
.match-card:hover { transform: translateY(-2px); box-shadow: var(--wv-shadow); }
.match-card--top {
    border-color: var(--wv-orange);
    box-shadow: var(--wv-shadow-brand);
}
.match-card__rank {
    position: absolute;
    top: -14px; left: 24px;
    background: var(--wv-gradient);
    color: #fff;
    padding: 6px 14px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.04em;
    box-shadow: var(--wv-shadow-sm);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
/* Dezente Inline-Icons (ersetzen Haken/Medaille-Emojis). Trophy erbt das Weiß
   des Badges; der Haken in den Block-Titeln ist Marken-Lila. */
.match-ico { flex: 0 0 auto; }
.match-block__title .match-ico { color: var(--wv-orange); }
.match-card__type {
    display: inline-block;
    padding: 4px 10px;
    background: var(--wv-surface-soft);
    color: var(--wv-text-soft);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.match-card__title { font-size: 15px; margin: 4px 0; letter-spacing: -0.02em; line-height: 1.2; }
@media (min-width: 640px) { .match-card__title { font-size: 20px; } }
@media (min-width: 880px) { .match-card__title { font-size: var(--wv-fs-2xl); } }
.match-card__headline { font-size: 12.5px; color: var(--wv-text-soft); margin: 0 0 4px; line-height: 1.4; }
@media (min-width: 640px) { .match-card__headline { font-size: var(--wv-fs-base); margin: 0 0 6px; line-height: 1.5; } }
.match-card__description { font-size: 12px; color: var(--wv-text-soft); margin: 0; line-height: 1.4; }
@media (min-width: 640px) { .match-card__description { font-size: 14px; line-height: 1.55; } }

.match-block { margin-top: 12px; }
.match-block__title { font-weight: 700; font-size: 14px; margin: 0 0 8px; display: flex; align-items: center; gap: 6px; }
.match-block__list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.match-block__list li { padding: 8px 12px; background: var(--wv-gradient-soft); border-radius: var(--wv-radius); font-size: 14px; color: var(--wv-coral-deep); overflow-wrap: anywhere; }
.match-block__list--neutral li { background: var(--wv-surface-soft); color: var(--wv-text-soft); }

/* Werdegang Timeline */
.match-journey { display: flex; flex-direction: column; gap: 10px; }
.match-phase {
    background: var(--wv-surface-soft);
    border-radius: var(--wv-radius);
    padding: 12px 14px;
}
.match-phase__title { font-weight: 700; font-size: 13px; color: var(--wv-coral-deep); margin: 0 0 6px; }
.match-phase__steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.match-phase__steps li { font-size: 13px; color: var(--wv-text-soft); line-height: 1.45; padding-left: 16px; position: relative; }
.match-phase__steps li::before { content: '→'; position: absolute; left: 0; color: var(--wv-orange); font-weight: 700; }

.match-card__actions {
    display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px;
    padding-top: 12px; border-top: 1px solid var(--wv-border-soft);
}
.match-card__actions button {
    background: var(--wv-surface);
    border: 1px solid var(--wv-border);
    border-radius: var(--wv-radius);
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--wv-text-soft);
    transition: all var(--wv-trans);
    /* Buttons fuellen die Zeile und brechen sauber um (2x2 auf schmalen Karten),
       statt die Karte aufzublaehen. */
    flex: 1 1 auto;
    white-space: nowrap;
    text-align: center;
}
.match-card__actions button:hover { background: var(--wv-surface-soft); }
.match-card__actions button.is-active { background: var(--wv-gradient); color: #fff; border-color: transparent; }

/* Pipeline-Transparenz (.meta-*) liegt jetzt global in wegvio.css (von
   Empfehlungen UND Profil gemeinsam genutzt). */

/* Checker-Warnung wird aus wegvio_ai.css geerbt */
.checker-warning { margin-bottom: 20px; }

/* -------------------- Empfehlungs-Versionen (frühere Läufe) -------------------- */
.mver-list { display: flex; flex-direction: column; gap: 10px; }
.mver-item {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 14px;
    background: var(--wv-surface);
    border: 1px solid var(--wv-border);
    border-radius: var(--wv-radius);
}
.mver-item__body { min-width: 0; }
.mver-item__top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mver-item__top strong { font-size: 14px; }
.mver-item__src { font-size: 13px; color: var(--wv-text-soft); margin-top: 3px; }
.mver-item__meta { margin-top: 6px; }
.mver-item__action { flex-shrink: 0; }
.mver-badge {
    display: inline-block; font-size: 11px; font-weight: 700;
    padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}
.mver-badge--current { background: var(--wv-gradient); color: #fff; }
.mver-badge--ok   { background: color-mix(in srgb, var(--wv-success) 16%, transparent); color: var(--wv-success); }
.mver-badge--warn { background: color-mix(in srgb, var(--wv-warning) 20%, transparent); color: var(--wv-warning); }
@media (max-width: 480px) {
    .mver-item { flex-direction: column; align-items: stretch; }
    .mver-item__action { display: flex; }
    .mver-item__action .btn { width: 100%; }
}
