/* ------------------------------------------------------------------
   WebCheck Widget
   Alle Farben und Abstaende liegen als Variablen auf .wc - damit laesst
   sich das Widget an die eigene Website anpassen, ohne diese Datei zu
   aendern. Einfach im eigenen Stylesheet ueberschreiben:

     .wc { --wc-accent: #b8342f; --wc-radius: 2px; }
   ------------------------------------------------------------------ */

.wc {
    --wc-ink:        #16212e;
    --wc-ink-soft:   #5a6775;
    --wc-line:       #d9e0e8;
    --wc-bg:         #ffffff;
    --wc-bg-soft:    #f4f7fa;
    --wc-accent:     #1d4ed8;
    --wc-accent-ink: #ffffff;
    --wc-good:       #16794a;
    --wc-warn:       #a86212;
    --wc-bad:        #b3261e;
    --wc-radius:     8px;
    --wc-gap:        18px;
    --wc-max:        720px;

    color: var(--wc-ink);
    background: var(--wc-bg);
    font-family: inherit;
    font-size: 16px;
    line-height: 1.55;

    /* Block zentriert sich im umgebenden Container.
       Breite bei Bedarf im eigenen Stylesheet anpassen:
         .wc { --wc-max: 560px; }                                    */
    max-width: var(--wc-max);
    margin-left: auto;
    margin-right: auto;

    box-sizing: border-box;
}

/* Optional: Texte der Startansicht mittig.
   Auf .wc zusaetzlich die Klasse wc--center setzen:
     <div class="wc wc--center" data-wc-endpoint="...">
   Wirkt bewusst NUR auf das Startformular. Sobald das Ergebnis
   erscheint, bleiben Befunde und Erklaerungen linksbuendig -
   zentrierte Fliesstexte sind ueber mehrere Zeilen schlecht lesbar,
   weil das Auge den Zeilenanfang nicht wiederfindet.               */
.wc--center .wc__start .wc__label,
.wc--center .wc__start .wc__hint,
.wc--center .wc__start .wc__notice {
    text-align: center;
}

.wc--center .wc__start .wc__row {
    justify-content: center;
}

.wc *,
.wc *::before,
.wc *::after { box-sizing: inherit; }

.wc p { margin: 0 0 12px; }
.wc h3 { font-size: 1.25em; margin: 0 0 6px; line-height: 1.3; }
.wc h4 { font-size: 1.02em; margin: 0 0 4px; line-height: 1.35; }

/* Sichtbarer Fokus - nicht wegoptimieren, das ist der halbe Sinn der Sache. */
.wc :focus-visible {
    outline: 3px solid var(--wc-accent);
    outline-offset: 2px;
}

.wc__visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* --- Formular ---------------------------------------------------- */

.wc__field { margin-bottom: var(--wc-gap); }

.wc__label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
}

.wc__hint {
    font-size: 0.86em;
    color: var(--wc-ink-soft);
    margin: 4px 0 0;
}

.wc__notice {
    font-size: 0.82em;
    line-height: 1.5;
    color: var(--wc-ink-soft);
    background: var(--wc-bg-soft);
    border-radius: var(--wc-radius);
    padding: 10px 12px;
    margin: 10px 0 0;
}

.wc__notice a { color: inherit; }

.wc__input {
    width: 100%;
    padding: 12px 14px;
    font: inherit;
    color: inherit;
    background: var(--wc-bg);
    border: 1px solid var(--wc-line);
    border-radius: var(--wc-radius);
}

.wc__input:focus { border-color: var(--wc-accent); }

.wc__row { display: flex; gap: 10px; flex-wrap: wrap; }
.wc__row .wc__input { flex: 1 1 260px; }

.wc__btn {
    display: inline-block;
    padding: 12px 22px;
    font: inherit;
    font-weight: 600;
    color: var(--wc-accent-ink);
    background: var(--wc-accent);
    border: 1px solid var(--wc-accent);
    border-radius: var(--wc-radius);
    cursor: pointer;
}

.wc__btn:hover:not([disabled]) { filter: brightness(1.1); }
.wc__btn[disabled] { opacity: .55; cursor: default; }

.wc__btn--quiet {
    color: var(--wc-accent);
    background: transparent;
}

/* --- Zustimmung -------------------------------------------------- */

.wc__check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.wc__check input {
    margin: 3px 0 0;
    width: 18px;
    height: 18px;
    flex: none;
}

.wc__check label {
    font-size: 0.92em;
    line-height: 1.5;
}

.wc__legal {
    font-size: 0.82em;
    color: var(--wc-ink-soft);
    border-top: 1px solid var(--wc-line);
    padding-top: 12px;
    margin-top: 14px;
}

.wc__legal a { color: inherit; }

/* --- Statusanzeige ----------------------------------------------- */

.wc__status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background: var(--wc-bg-soft);
    border-radius: var(--wc-radius);
}

.wc__spinner {
    width: 20px; height: 20px;
    flex: none;
    border: 3px solid var(--wc-line);
    border-top-color: var(--wc-accent);
    border-radius: 50%;
    animation: wc-spin 900ms linear infinite;
}

@keyframes wc-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .wc__spinner { animation: none; border-top-color: var(--wc-line); }
}

.wc__error {
    padding: 14px 16px;
    border-left: 4px solid var(--wc-bad);
    background: var(--wc-bg-soft);
    border-radius: 0 var(--wc-radius) var(--wc-radius) 0;
}

/* --- Ergebnis ---------------------------------------------------- */

.wc__result { margin-top: 4px; }

.wc__summary {
    display: flex;
    gap: 22px;
    align-items: center;
    flex-wrap: wrap;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--wc-line);
}

.wc__dial { flex: none; }

.wc__dial-num {
    font-size: 30px;
    font-weight: 700;
    fill: var(--wc-ink);
}

.wc__dial-max { font-size: 12px; fill: var(--wc-ink-soft); }

.wc__summary-text { flex: 1 1 240px; min-width: 200px; }
.wc__summary-text p:last-child { margin-bottom: 0; }

.wc__bars {
    list-style: none;
    margin: 18px 0 0;
    padding: 0;
}

.wc__bar { margin-bottom: 12px; }

.wc__bar-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.92em;
    margin-bottom: 4px;
}

.wc__bar-name { font-weight: 600; }
.wc__bar-val { color: var(--wc-ink-soft); font-variant-numeric: tabular-nums; }

.wc__bar-track {
    height: 8px;
    background: var(--wc-line);
    border-radius: 99px;
    overflow: hidden;
}

.wc__bar-fill {
    height: 100%;
    border-radius: 99px;
    background: var(--wc-good);
    transition: width 500ms ease;
}

@media (prefers-reduced-motion: reduce) {
    .wc__bar-fill { transition: none; }
}

.wc__bar-fill.is-warn { background: var(--wc-warn); }
.wc__bar-fill.is-bad  { background: var(--wc-bad); }

/* --- Befunde ----------------------------------------------------- */

.wc__findings {
    list-style: none;
    margin: 22px 0 0;
    padding: 0;
}

.wc__finding {
    padding: 14px 16px;
    border: 1px solid var(--wc-line);
    border-radius: var(--wc-radius);
    margin-bottom: 10px;
}

.wc__tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.wc__tag {
    display: inline-block;
    font-size: 0.74em;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 3px;
    background: var(--wc-bg-soft);
    color: var(--wc-ink-soft);
}

.wc__tag--crit  { background: #fbe9e7; color: var(--wc-bad); }
.wc__tag--major { background: #fdf1de; color: var(--wc-warn); }

.wc__more {
    margin-top: 16px;
    padding: 18px;
    background: var(--wc-bg-soft);
    border-radius: var(--wc-radius);
}

.wc__more h3 { margin-bottom: 8px; }

/* --- Erfolgsmeldung ---------------------------------------------- */

.wc__done {
    padding: 22px;
    border: 2px solid var(--wc-good);
    border-radius: var(--wc-radius);
}

.wc__done h3 { color: var(--wc-good); }

/* --- Vollbericht (report.php) ------------------------------------ */

.wc-report { max-width: 860px; margin: 0 auto; padding: 32px 20px 80px; }

.wc-report__meta {
    font-size: 0.88em;
    color: var(--wc-ink-soft);
    margin-bottom: 26px;
}

.wc-report__section { margin-top: 40px; }

.wc-report__section h2 {
    font-size: 1.35em;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--wc-line);
}

.wc-report__evidence {
    list-style: none;
    margin: 10px 0 0;
    padding: 10px 12px;
    background: var(--wc-bg-soft);
    border-radius: 4px;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 0.8em;
    overflow-x: auto;
}

.wc-report__evidence li { margin-bottom: 4px; word-break: break-word; }
.wc-report__evidence li:last-child { margin-bottom: 0; }

.wc-report__ref {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.8em;
    color: var(--wc-ink-soft);
}

.wc-report__detail {
    margin-top: 12px;
    border-top: 1px solid var(--wc-line);
    padding-top: 10px;
}

.wc-report__detail > summary {
    cursor: pointer;
    font-size: 0.86em;
    font-weight: 600;
    color: var(--wc-accent);
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
}

.wc-report__detail > summary::-webkit-details-marker { display: none; }

.wc-report__detail > summary::before {
    content: "+";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: 1px solid currentColor;
    border-radius: 3px;
    font-size: 12px;
    line-height: 1;
    flex: none;
}

.wc-report__detail[open] > summary::before { content: "\2212"; }

.wc-report__detail-body {
    font-size: 0.93em;
    color: var(--wc-ink-soft);
    padding-top: 8px;
    max-width: 68ch;
}

.wc-report__detail-body p { margin: 0 0 10px; }
.wc-report__detail-body p:last-child { margin-bottom: 0; }

.wc-report__note {
    padding: 18px 20px;
    background: var(--wc-bg-soft);
    border-left: 4px solid var(--wc-accent);
    border-radius: 0 var(--wc-radius) var(--wc-radius) 0;
    margin: 30px 0;
    font-size: 0.94em;
}

.wc-report__metrics { margin: 12px 0 16px; }

.wc-report__metrics dt {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    font-weight: 600;
    margin-top: 12px;
}

.wc-report__metrics dd {
    margin: 2px 0 0;
    font-size: 0.93em;
    color: var(--wc-ink-soft);
}

.wc-report__metric-val {
    display: inline-block;
    min-width: 4.5em;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.wc-report__abbr {
    font-size: 0.78em;
    font-weight: 600;
    letter-spacing: .05em;
    color: var(--wc-ink-soft);
    background: var(--wc-bg);
    border: 1px solid var(--wc-line);
    border-radius: 3px;
    padding: 1px 6px;
}

.wc-report__target {
    font-size: 0.8em;
    font-weight: 500;
    color: var(--wc-ink-soft);
}

@media print {
    .wc-report { max-width: none; padding: 0; }
    .wc__finding, .wc-report__note { break-inside: avoid; }
    .wc-noprint { display: none; }

    /* Im Druck alle Erklärungen ausklappen - sonst fehlen sie im PDF */
    .wc-report__detail > summary { display: none; }
    .wc-report__detail-body { display: block !important; }
}
