/*
 * EqualDoX website – free PDF check (check.html, en/check.html).
 * Loaded after style.css; uses only its colour tokens (no literal colours).
 *
 * Contrast: text #1F2937 and muted #6B7280 only on #FFFFFF / #F9FAFB here;
 * on #DCFCE7 only #1F2937 and #166534 (muted grey never). Status icons are
 * graphics (>= 3:1): error #B91C1C, primary-dark #166534, muted #6B7280.
 * Status is never shown by colour alone: every icon sits next to its text.
 */

/* ---------- Upload form ---------- */

/* Visible heading and short description above the panel, left-aligned with it. */
.fc-heading {
  margin: 0 0 0.25rem;
}

.fc-intro {
  margin: 0 0 1.25rem;
  color: var(--color-text-muted);
}

/* One panel: drop zone, AGB checkbox, privacy notice and the submit button. */
.fc-panel {
  display: grid;
  gap: 1.5rem;
  padding: clamp(1rem, 0.5rem + 2vw, 1.75rem);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg);
  box-shadow: var(--shadow-card);
}

.fc-panel .upload-drop {
  position: relative;
  gap: 0.5rem;
  padding: clamp(1.75rem, 1.25rem + 2.5vw, 3rem) 1.25rem;
  border-radius: var(--radius);
  background: var(--color-bg-alt);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

@media (prefers-reduced-motion: reduce) {
  .fc-panel .upload-drop {
    transition: none;
  }
}

.fc-panel .upload-icon {
  margin-bottom: 0.25rem;
}

.fc-or {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.fc-panel .upload-drop .fine-print {
  margin-top: 0.5rem;
}

/*
 * The native file input stays in the tab order and in the accessibility tree (it gets
 * keyboard focus and opens the file picker); it is only visually replaced by its label,
 * styled as a button, which shows the focus ring (same pattern as the dashboard uploader).
 */
.fc-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.fc-choose {
  cursor: pointer;
}

.fc-file-input:focus-visible + .fc-choose {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px var(--color-bg);
}

.fc-file-input:disabled + .fc-choose {
  cursor: not-allowed;
}

.upload:disabled .upload-drop {
  border-style: dashed;
}

/* Drag-over: green surface; only #1F2937 / #166534 text on #DCFCE7 (see header). */
.upload-drop.is-dragover {
  border-style: solid;
  border-color: var(--color-primary-dark);
  background: var(--color-primary-light);
}

.upload-drop.is-dragover .fc-or,
.upload-drop.is-dragover .fine-print {
  color: var(--color-text);
}

.upload-drop.has-file {
  border-style: solid;
  border-color: var(--color-primary-dark);
}

.upload-drop.has-error {
  border-style: solid;
  border-color: var(--color-error);
}

/* While a file is dragged over the zone, the drop target state wins over earlier states. */
.upload-drop.is-dragover.has-file,
.upload-drop.is-dragover.has-error {
  border-color: var(--color-primary-dark);
}

/* The chosen file: a chip with a check mark (the text says "Ausgewählt:" / "Selected:"). */
.fc-selected {
  display: inline-flex;
  gap: 0.625rem;
  align-items: center;
  max-width: 100%;
  margin: 0.25rem 0 0;
  padding: 0.375rem 0.875rem;
  border: 1px solid var(--color-border-strong);
  border-radius: 999px;
  background: var(--color-bg);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.fc-selected::before {
  content: "";
  flex: none;
  width: 0.4rem;
  height: 0.8rem;
  margin: -0.2rem 0.1rem 0;
  border: solid var(--color-primary-dark);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

/* A file that failed the check gets no check mark. */
.upload-drop.has-error .fc-selected::before {
  display: none;
}

.fc-selected[hidden],
.fc-progress[hidden],
.fc-alert[hidden],
.fc-result[hidden],
.fc-unavailable[hidden] {
  display: none;
}

.upload-drop .field-error {
  max-width: 34rem;
}

.fc-consent {
  display: grid;
  gap: 0.375rem;
}

/* AGB checkbox, privacy notice and the button, stacked and left-aligned below the drop zone. */
.fc-panel .upload-actions {
  display: grid;
  gap: 1rem;
  justify-items: start;
  margin-top: 0;
}

.fc-privacy {
  max-width: 44rem;
}

.fc-submit {
  margin-top: 0.25rem;
}

@media (max-width: 40rem) {
  .fc-panel .upload-actions {
    justify-items: stretch;
  }

  .fc-submit {
    width: 100%;
  }
}

.fc-consent .checkbox input[aria-invalid="true"] {
  outline: 2px solid var(--color-error);
  outline-offset: 2px;
}

/* Running check: text, spinner (only with motion allowed) and cancel button */
.fc-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--color-border-strong);
  border-left: 4px solid var(--color-primary-dark);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}

.fc-progress-text {
  flex: 1 1 16rem;
  margin: 0;
  font-weight: 600;
}

.fc-spinner {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid var(--color-border-strong);
  border-top-color: var(--color-primary-dark);
  border-radius: 50%;
}

@media (prefers-reduced-motion: no-preference) {
  .fc-spinner {
    animation: fc-spin 0.9s linear infinite;
  }
}

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

.fc-alert {
  margin-top: 1.5rem;
}

.fc-alert p {
  margin: 0;
}

/* ---------- Result ---------- */

.fc-result h2:focus {
  outline: none;
}

.fc-result h2:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
}

.fc-icon {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 2rem;
  height: 2rem;
  color: var(--color-text-muted);
}

.fc-icon--untagged,
.fc-icon--failures {
  color: var(--color-error);
}

.fc-icon--no_failures {
  color: var(--color-primary-dark);
}

.fc-summary {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-top: 1.5rem;
  padding: 1.25rem;
  border: 1px solid var(--color-border-strong);
  border-left-width: 6px;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}

/* Untagged / failures: red bar and light red fill (text #1F2937, 13.4:1) */
.fc-summary--untagged,
.fc-summary--failures {
  border-left-color: var(--color-error);
  background: var(--color-error-light);
}

/* No failures: neutral panel, no success badge */
.fc-summary--no_failures {
  border-left-color: var(--color-primary-dark);
}

.fc-summary-text {
  min-width: 0;
}

.fc-summary-text p {
  margin: 0 0 0.5rem;
}

.fc-headline {
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.35;
}

.fc-counts {
  margin: 0.75rem 0 0;
  padding-left: 1.25rem;
  font-weight: 600;
}

.fc-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.75rem 1.5rem;
  margin: 1.5rem 0 2rem;
}

.fc-facts > div {
  min-width: 0;
}

.fc-facts dt {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.fc-facts dd {
  margin: 0;
  font-weight: 600;
}

.fc-fact-extra {
  display: block;
  font-weight: 400;
  font-size: var(--text-sm);
}

.fc-categories,
.fc-findings {
  margin: 0;
  padding: 0;
  list-style: none;
}

.fc-category {
  margin-top: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
}

.fc-category--none {
  padding-block: 0.75rem;
  background: var(--color-bg-alt);
}

.fc-category-head {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.fc-category-head > div {
  min-width: 0;
}

.fc-category h4 {
  margin: 0.15rem 0 0;
  font-size: var(--text-lg);
}

.fc-category-counts {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.fc-category--findings .fc-category-counts {
  color: var(--color-text);
  font-weight: 600;
}

.fc-explain {
  margin: 0.75rem 0 0;
}

.fc-category h5 {
  margin: 1.25rem 0 0.5rem;
  font-size: var(--text-base);
}

.fc-finding {
  padding: 0.875rem 0;
  border-top: 1px solid var(--color-border);
}

.fc-finding-text {
  margin: 0 0 0.25rem;
}

.fc-finding-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0 0 0.5rem;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.fc-details summary {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--color-link);
  font-weight: 600;
  cursor: pointer;
}

.fc-details dl {
  margin: 0.25rem 0 0;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--color-bg-alt);
  font-size: var(--text-sm);
}

.fc-details dl > div + div {
  margin-top: 0.5rem;
}

.fc-details dt {
  font-weight: 700;
}

.fc-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.fc-details code {
  font-family: var(--font-mono);
}

.fc-download h3 {
  margin-top: 0;
}

.fc-download p:last-child {
  margin-bottom: 0;
}

/* Download panel: heading, description, the two buttons and the notice below them. */
.fc-download {
  margin-top: 2rem;
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg-alt);
}

.fc-download > p {
  max-width: 44rem;
}

.fc-download-note {
  margin-top: 1rem;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.fc-download-buttons {
  margin-top: 1.25rem;
}

.fc-download-buttons .button {
  gap: 0.5rem;
}

.fc-download-icon {
  flex: none;
}


@media (max-width: 40rem) {
  .fc-download-buttons .button {
    width: 100%;
  }
}

.fc-verdict {
  font-weight: 700;
}

.fc-manual {
  margin-top: 2.5rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg-alt);
}

.fc-manual h3,
.fc-cta h3 {
  margin-top: 0;
}

.fc-manual > p {
  margin-bottom: 0.75rem;
}

.fc-manual ul {
  margin: 0;
  padding-left: 1.25rem;
}

.fc-manual-list li + li {
  margin-top: 0.375rem;
}

.fc-cta {
  margin-top: 2.5rem;
  padding: 1.5rem;
  border-left: 4px solid var(--color-primary-dark);
  border-radius: var(--radius-sm);
  background: var(--color-primary-light);
  color: var(--color-text);
}

@media (forced-colors: active) {
  .fc-summary,
  .fc-progress,
  .fc-cta,
  .upload-drop.is-dragover,
  .upload-drop.has-file,
  .upload-drop.has-error,
  .fc-selected::before {
    border-color: CanvasText;
  }

  .fc-icon {
    color: CanvasText;
  }

  .fc-spinner {
    border-color: CanvasText;
    border-top-color: Highlight;
  }
}

/* The result follows the upload section directly: no double gap. */
.fc-result {
  padding-top: 0;
}
