/* aiat-barrierefrei-engine dashboard styles — vendored (air-gapped, no CDN).
   WCAG 2.1 AA: AA-contrast tokens (documented inline), ≥48px targets, icon+text status,
   reduced-motion safe. The engine's own UI is the on-brand bar for an a11y-remediation tool. */
:root {
  --fg: #1a1a1a;        /* ~16:1 on white */
  --muted: #595959;     /* 7:1 on white  */
  --bg: #ffffff;
  --border: #c4c4c4;
  --accent: #0b5fb0;    /* link/focus — 5.3:1 on white */
  --accent-fg: #ffffff;
  --pass-bg: #d8f5d8; --pass-fg: #0b6b1f;  /* 5.2:1 */
  --fail-bg: #fbe0e0; --fail-fg: #a01818;  /* 6.0:1 */
}
* { box-sizing: border-box; }
body {
  font-family: system-ui, -apple-system, sans-serif;
  max-width: 760px; margin: 0 auto; padding: 2rem 1rem 4rem;
  color: var(--fg); background: var(--bg); line-height: 1.5;
}
h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); font-size: .9rem; }
a.link { color: var(--accent); }
a.link:hover { text-decoration: none; }

/* Skip link — first focusable element (WCAG 2.4.1) */
.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--fg); color: var(--accent-fg);
  padding: .5rem .9rem; border-radius: 0 0 .4rem 0; z-index: 10;
}
.skip-link:focus { left: 0; }

/* Visible focus indicator on every interactive element (WCAG 2.4.7) */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
/* Result heading / alert receive focus after swap (tabindex=-1) — keep a visible ring. */
[data-result-focus]:focus-visible, [data-result-focus]:focus {
  outline: 3px solid var(--accent); outline-offset: 4px;
}

.card { border: 1px solid var(--border); border-radius: .6rem; padding: 1.25rem; margin-top: 1.25rem; }

label { display: block; font-weight: 600; margin-bottom: .4rem; }
input[type="file"], input[type="url"] {
  display: block; width: 100%; padding: .6rem; min-height: 48px;
  border: 1px solid var(--border); border-radius: .4rem; background: #fff;
}
.help { margin: .4rem 0 1rem; }
button {
  min-height: 48px; min-width: 48px; padding: .6rem 1.2rem;
  border: 0; border-radius: .4rem; background: var(--fg); color: var(--accent-fg);
  font-size: 1rem; font-weight: 600; cursor: pointer;
}
button:hover { background: #000; }

/* --- (a) Upload: fieldset groups the mutually-exclusive file/URL inputs --- */
.upload-fieldset { border: 1px solid var(--border); border-radius: .6rem; padding: 1rem 1.25rem; margin: 0; }
.upload-fieldset legend { font-weight: 600; padding: 0 .4rem; }
.upload-or { text-align: center; margin: 1rem 0; font-weight: 600; }

/* Dropzone is a visual wrapper; the native input inside it stays the real, focusable control. */
.dropzone { position: relative; border: 2px dashed var(--border); border-radius: .5rem;
            padding: 1rem; background: #fff; }
.dropzone input[type="file"] { min-height: 48px; }
.dropzone__hint { margin: .5rem 0 0; font-size: .9rem; color: var(--muted); }
/* dragover feedback uses border + bg, NOT colour alone (WCAG 1.4.1). */
.dropzone.is-dragover { border-color: var(--accent); background: #eef4fb; }

.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; }

.badge { display: inline-flex; align-items: center; gap: .4rem;
         padding: .3rem .7rem; border-radius: .4rem; font-weight: 700; margin: 0 0 1rem; }
.badge--pass { background: var(--pass-bg); color: var(--pass-fg); }
.badge--fail { background: var(--fail-bg); color: var(--fail-fg); }
.badge--neutral { background: #eef1f4; color: var(--muted); border: 1px solid var(--border); }
.badge__icon { font-size: 1.1em; }

/* Before/after remediation panel: two stacked columns on mobile, side-by-side ≥ 32rem. */
.ba { display: grid; grid-template-columns: 1fr; gap: 1rem; margin: 0 0 1rem; }
.ba__col { border: 1px solid var(--border); border-radius: .5rem; padding: 1rem; }
.ba__label { margin: 0 0 .5rem; font-size: .85rem; font-weight: 700;
             text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.ba__col .badge { margin: 0 0 .5rem; }
.ba__stat { margin: 0; font-variant-numeric: tabular-nums; }
.ba__col--after.ba__col--pass { border: 2px solid var(--pass-fg); background: var(--pass-bg); }
.ba__arrow { display: none; }
@media (min-width: 32rem) {
  .ba { grid-template-columns: 1fr auto 1fr; align-items: center; }
  .ba__arrow { display: block; text-align: center; font-size: 1.4rem;
               font-weight: 700; color: var(--muted); }
}

/* Download CTA: an <a> styled as a primary button (navigation to a resource). */
.btn-download {
  display: inline-flex; align-items: center; gap: .5rem;
  min-height: 48px; min-width: 48px; padding: .7rem 1.2rem;
  border-radius: .4rem; background: var(--accent); color: var(--accent-fg);
  font-size: 1rem; font-weight: 700; text-decoration: none;
}
.btn-download:hover { background: #094e91; text-decoration: none; }
.result__download-pdf { margin: 1rem 0 .5rem; }

.mode { display: inline-block; padding: .15rem .5rem; border-radius: .3rem;
        border: 1px solid var(--border); font-weight: 600; font-size: .85rem; }

.result__summary { display: grid; grid-template-columns: 1fr auto; gap: .15rem .75rem; margin: 0 0 1rem; }
.result__row { display: contents; }
.result__summary dt { color: var(--muted); }
.result__summary dd { margin: 0; font-variant-numeric: tabular-nums; text-align: right; }

.rules { list-style: none; padding: 0; margin: .5rem 0 0; }
.rule { border-top: 1px solid var(--border); padding: .6rem 0; }
.rule__clause { margin: 0 0 .2rem; font-weight: 600; }
.rule__desc { margin: 0 0 .2rem; }
.rule__pages { margin: 0; }

/* (4) OCR degrade / rate-limit note — non-colour: icon + "Hinweis" + left border. */
.ocr-note { display: flex; gap: .5rem; align-items: flex-start;
            border: 1px solid var(--border); border-left-width: 4px; border-left-color: var(--accent);
            border-radius: .4rem; padding: .75rem 1rem; margin: 0 0 1rem; background: #eef4fb; }
.ocr-note__icon { font-size: 1.2em; line-height: 1.4; }
.ocr-note p { margin: 0; }

/* --- (b) HTMX busy indicator: hidden by default, shown only while in flight. --- */
#busy { display: none; }
#busy.htmx-request { display: block; }
.spinner { display: inline-block; width: 1em; height: 1em; vertical-align: -.15em;
           border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%;
           animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- (d) BYOK / Admin key inputs --- */
.cost-note { display: flex; gap: .5rem; align-items: flex-start;
             border: 1px solid var(--fail-fg); border-left-width: 4px; border-radius: .4rem;
             padding: .75rem 1rem; margin: 0 0 1.25rem; background: #fff7f3; }
.cost-note__icon { font-size: 1.2em; line-height: 1.4; }
.cost-note p { margin: 0; }

.key-group { margin: 0 0 1.25rem; }
.key-field { display: flex; gap: .5rem; align-items: stretch; }
.key-field input { flex: 1; min-height: 48px; padding: .6rem;
                   border: 1px solid var(--border); border-radius: .4rem; font-family: monospace; }
/* 48×48 minimum target (WCAG 2.5.8). */
.key-toggle { min-height: 48px; min-width: 48px; display: inline-flex; gap: .35rem;
              align-items: center; padding: .5rem .8rem; border: 1px solid var(--border);
              border-radius: .4rem; background: #fff; color: var(--fg); cursor: pointer; }
.key-toggle:hover { background: #f2f2f2; }
.key-toggle[aria-pressed="true"] { background: #eef4fb; border-color: var(--accent); }

/* --- (e) Error fragment --- */
.error-text { color: var(--fail-fg); font-weight: 600; margin: .4rem 0 0; }
[aria-invalid="true"] { outline: 2px solid var(--fail-fg); outline-offset: 1px; }

/* Reduced motion: kill all animation/transition; spinner becomes a static ring. */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .spinner { border-top-color: var(--border); }
}
