/* ==========================================================================
   IT-Sicherheits-Check – Stylesheet
   Heller Apple-Stil, keine externen Ressourcen. Enthält am Ende ein
   eigenes Druck-Layout für "Als PDF speichern".
   ========================================================================== */

:root {
  --bg: #ffffff;
  --surface: #f5f5f7;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.08);
  --line: #d2d2d7;
  --track: #e8e8ed;

  /* Status-Farben (sparsam einsetzen) */
  --red: #d7373f;
  --red-soft: rgba(215, 55, 63, 0.1);
  --orange: #e68a00;
  --orange-soft: rgba(230, 138, 0, 0.12);
  --green: #1a7f37;
  --green-soft: rgba(26, 127, 55, 0.1);

  --radius-card: 22px;
  --radius-option: 14px;
  --radius-pill: 980px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ---------- Layout ---------- */

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 64px 16px 56px;
}

.intro {
  text-align: center;
  margin-bottom: 40px;
}

/* Während Fragebogen und Bericht: Kopf kompakter, ohne Einleitungstext */
body:not([data-view="start"]) .intro {
  margin-bottom: 28px;
}

body:not([data-view="start"]) .intro .lead {
  display: none;
}

body:not([data-view="start"]) .intro h1 {
  font-size: clamp(26px, 5vw, 32px);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

h1 {
  font-size: clamp(32px, 7vw, 48px);
}

h2 {
  font-size: clamp(24px, 5vw, 30px);
  line-height: 1.15;
}

h3,
h4 {
  font-size: 19px;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

h2:focus {
  outline: none;
}

.lead {
  margin: 16px auto 0;
  max-width: 580px;
  font-size: clamp(17px, 2.6vw, 21px);
  color: var(--text-2);
}

.muted {
  color: var(--text-2);
}

/* ---------- Karten ---------- */

.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 40px 32px;
}

.card + .card {
  margin-top: 16px;
}

.section-title {
  margin-bottom: 6px;
}

.section-sub {
  margin: 0 0 24px;
  font-size: 15px;
  color: var(--text-2);
}

/* Übergang zwischen den Ansichten */
.stage-enter {
  animation: stageIn 0.4s var(--ease) both;
}

.stage-leave {
  animation: stageOut 0.18s var(--ease) both;
}

@keyframes stageIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

@keyframes stageOut {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateY(-8px); }
}

/* ---------- Startansicht ---------- */

.start {
  text-align: center;
}

.areas-overview {
  /* Flex statt Grid, damit eine unvollständige letzte Zeile zentriert steht */
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 0 0 32px;
  padding: 0;
  list-style: none;
  text-align: left;
}

.areas-overview li {
  flex: 0 0 calc((100% - 20px) / 3);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: var(--radius-option);
  font-size: 15px;
  font-weight: 600;
}

.area-num {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  line-height: 26px;
  text-align: center;
}

.start-hint {
  margin: 14px 0 0;
  font-size: 14px;
  color: var(--text-3);
}

/* ---------- Fortschritt ---------- */

.progress {
  margin-bottom: 16px;
}

.progress.is-hidden {
  display: none;
}

.progress-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 16px;
  margin-bottom: 8px;
  font-size: 14px;
}

.progress-label {
  font-weight: 600;
  color: var(--text);
}

.progress-area {
  color: var(--text-2);
}

.progress-track {
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--line);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.45s var(--ease);
}

/* ---------- Frage ---------- */

.question-area {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-3);
}

.question-title {
  font-size: clamp(21px, 4.4vw, 28px);
  line-height: 1.2;
}

.question-hint {
  margin: 12px 0 0;
  font-size: 15px;
  color: var(--text-2);
}

/* ---------- Antwortoptionen ---------- */

.options {
  margin: 28px 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  padding: 16px 18px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-option);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.option:first-child {
  margin-top: 0;
}

.option:hover {
  border-color: var(--text-3);
}

/* Native Radio-Buttons visuell ersetzen, aber zugänglich lassen */
.option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.option-dot {
  flex: none;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: var(--bg);
  transition: border-color 0.2s var(--ease), border-width 0.2s var(--ease);
}

.option-title {
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.option.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.option.is-selected .option-dot {
  border-color: var(--accent);
  border-width: 6px;
}

.option input:focus-visible ~ .option-dot {
  outline: 3px solid rgba(0, 113, 227, 0.35);
  outline-offset: 2px;
}

/* ---------- Buttons ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 11px 24px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--accent);
  font: inherit;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), opacity 0.2s var(--ease), border-color 0.2s var(--ease);
}

.btn:focus-visible {
  outline: 3px solid rgba(0, 113, 227, 0.35);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
}

.btn-secondary:hover {
  background: var(--accent-soft);
}

/* "Zurück" / "Check wiederholen" als ruhiger Textlink */
.btn-link {
  border-color: transparent;
  background: transparent;
  color: var(--accent);
  padding-left: 4px;
  padding-right: 4px;
}

.btn-link:hover {
  text-decoration: underline;
}

.actions .btn-primary {
  margin-left: auto;
}

.btn-large {
  min-height: 50px;
  padding: 14px 32px;
}

/* ---------- Bericht: Gesamtergebnis ---------- */

.report-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  margin: 0 0 12px;
  padding: 0 4px;
  font-size: 14px;
  color: var(--text-2);
}

.summary {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: center;
  gap: 32px;
}

.ring {
  position: relative;
  width: 180px;
  height: 180px;
}

.ring svg {
  display: block;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: var(--track);
  stroke-width: 10;
}

.ring-value {
  fill: none;
  stroke: var(--tone, var(--accent));
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s var(--ease);
}

.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-number {
  font-size: 60px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.score-unit {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-2);
}

.badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.summary-title {
  margin-top: 12px;
  font-size: clamp(24px, 4.6vw, 30px);
}

.summary-text {
  margin: 12px 0 0;
  color: var(--text);
}

.summary-points {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--text-2);
}

/* Bewertungsstufen: setzen --tone für Ring, Badge und Titel */
.level--critical { --tone: var(--red); }
.level--basic    { --tone: var(--orange); }
.level--solid    { --tone: var(--green); }
.level--mature   { --tone: var(--green); }

.level--critical .badge { background: var(--red-soft); color: var(--red); }
.level--basic .badge    { background: var(--orange-soft); color: #a86400; }
.level--solid .badge    { background: var(--green-soft); color: var(--green); }
.level--mature .badge   { background: var(--green); color: #ffffff; }

.level--critical .summary-title { color: var(--red); }
.level--basic .summary-title    { color: #a86400; }
.level--solid .summary-title    { color: var(--text); }
.level--mature .summary-title   { color: var(--green); }

/* "Solide" bewusst dezenter als "Ausgereift" */
.level--solid .ring-value { opacity: 0.7; }

/* ---------- Bericht: Bereiche ---------- */

.area-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.area-row + .area-row {
  margin-top: 20px;
}

.area-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.area-name {
  font-weight: 600;
  min-width: 0;
  overflow-wrap: anywhere;
}

.area-value {
  flex: none;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--tone);
}

.area-points {
  font-weight: 400;
  font-size: 14px;
  color: var(--text-3);
}

.bar-track {
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--track);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  min-width: 0;
  border-radius: inherit;
  background: var(--tone);
  transition: width 0.9s var(--ease);
}

.tone--red    { --tone: var(--red); }
.tone--orange { --tone: var(--orange); }
.tone--green  { --tone: var(--green); }

.tone--orange .area-value { color: #a86400; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 24px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
  font-size: 13px;
  color: var(--text-2);
}

.legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--tone);
}

/* ---------- Bericht: Maßnahmen ---------- */

.measures {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: measure;
}

.measures li {
  position: relative;
  counter-increment: measure;
  padding: 18px 20px 18px 62px;
  background: var(--bg);
  border-radius: var(--radius-option);
}

.measures li + li {
  margin-top: 10px;
}

.measures li::before {
  content: counter(measure);
  position: absolute;
  left: 20px;
  top: 18px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  line-height: 28px;
  text-align: center;
}

.measure-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.measure-title {
  font-size: 17px;
}

.status {
  display: inline-block;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status--0 { background: var(--red-soft); color: var(--red); }
.status--1 { background: var(--orange-soft); color: #a86400; }
.status--2 { background: var(--green-soft); color: var(--green); }

.measure-area {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-3);
}

.measure-text {
  margin: 8px 0 0;
  font-size: 15px;
}

.all-done {
  margin: 0;
  padding: 18px 20px;
  background: var(--bg);
  border-radius: var(--radius-option);
  font-size: 15px;
}

/* ---------- Bericht: Antwortübersicht ---------- */

.answers-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.answers-details summary::-webkit-details-marker {
  display: none;
}

.answers-details summary::after {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  margin-right: 4px;
  border-right: 2px solid var(--text-3);
  border-bottom: 2px solid var(--text-3);
  transform: rotate(45deg);
  transition: transform 0.2s var(--ease);
}

.answers-details[open] summary::after {
  transform: rotate(-135deg);
}

.answers-details summary:focus-visible {
  outline: 3px solid rgba(0, 113, 227, 0.35);
  outline-offset: 4px;
  border-radius: 6px;
}

.answers-table {
  width: 100%;
  margin-top: 20px;
  border-collapse: collapse;
  font-size: 14px;
}

.answers-table th,
.answers-table td {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.answers-table th {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-3);
}

.answers-table .group-row th {
  padding-top: 18px;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
}

.answers-table td.num {
  width: 28px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.answers-table td.ans {
  width: 1%;
  padding-left: 16px;
  text-align: right;
}

/* ---------- Bericht: Abschluss ---------- */

.company-field {
  display: block;
  margin: 0 auto 20px;
  max-width: 380px;
  text-align: left;
}

.company-field span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-2);
}

.company-field input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

.company-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.2);
}

.card--next {
  text-align: center;
}

.actions-result {
  flex-direction: column;
  justify-content: center;
  margin-top: 0;
}

.next-divider {
  margin: 28px auto 24px;
  max-width: 380px;
  border-top: 1px solid var(--line);
}

.actions-result .btn {
  margin: 0;
  width: 100%;
  max-width: 380px;
}

.disclaimer {
  margin: 16px 0 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--text-3);
  border-radius: var(--radius-option);
  background: var(--bg);
  font-size: 15px;
}

.disclaimer strong {
  font-weight: 600;
}

/* ---------- Vertrauenshinweis ---------- */

.trust {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  margin: 24px auto 0;
  max-width: 520px;
  font-size: 13px;
  color: var(--text-3);
  text-align: left;
}

.trust-icon {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  fill: var(--text-3);
}

/* Druckkopf nur im Ausdruck */
.print-header {
  display: none;
}

/* ---------- Bewegung reduzieren ---------- */

@media (prefers-reduced-motion: reduce) {
  .stage-enter,
  .stage-leave {
    animation: none;
  }
  .progress-bar,
  .ring-value,
  .bar-fill {
    transition: none;
  }
}

/* ---------- Kleine Bildschirme ---------- */

@media (max-width: 600px) {
  .page {
    padding-top: 40px;
  }

  .intro {
    margin-bottom: 28px;
  }

  .card {
    padding: 28px 20px;
  }

  .areas-overview li {
    flex-basis: calc((100% - 10px) / 2);
  }

  .option {
    padding: 14px;
    gap: 12px;
  }

  .summary {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 20px;
    text-align: center;
  }

  .ring {
    width: 160px;
    height: 160px;
  }

  .score-number {
    font-size: 52px;
  }

  .measures li {
    padding: 16px 16px 16px 54px;
  }

  .measures li::before {
    left: 16px;
    top: 16px;
  }
}

@media (max-width: 400px) {
  /* Fragebogen: "Weiter" oben, "Zurück" darunter */
  .actions:not(.actions-result) {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .actions .btn-primary {
    margin-left: 0;
  }

  .areas-overview li {
    flex-basis: 100%;
  }
}

/* ==========================================================================
   Druck-Layout ("Als PDF speichern")
   Kompakter Audit-Bericht auf A4, Bedienelemente ausgeblendet.
   ========================================================================== */

@page {
  size: A4;
  margin: 16mm 15mm 18mm;
}

@media print {
  :root {
    --surface: #ffffff;
  }

  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body {
    font-size: 11pt;
    line-height: 1.35;
  }

  .page {
    max-width: none;
    padding: 0;
  }

  /* Bedienelemente und Bildschirm-Kopf ausblenden */
  .intro,
  .progress,
  .no-print,
  .actions {
    display: none !important;
  }

  .stage-enter,
  .stage-leave {
    animation: none !important;
  }

  .ring-value,
  .bar-fill {
    transition: none !important;
  }

  /* Briefkopf mit Logo-Platzhalter */
  .print-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--text);
  }

  .print-logo {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40mm;
    height: 12mm;
    border: 1px dashed var(--text-3);
    border-radius: 8px;
    font-size: 9pt;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
  }

  .print-meta {
    flex: 1;
    text-align: right;
  }

  .print-company {
    font-size: 13pt;
    font-weight: 700;
    letter-spacing: -0.02em;
  }

  .print-title {
    margin-top: 2px;
    font-size: 10pt;
    color: var(--text-2);
  }

  .print-date {
    font-size: 10pt;
    color: var(--text-2);
  }

  .report-meta {
    display: none;
  }

  /* Karten: weiß mit feiner Linie statt grauer Fläche (tonersparend) */
  .card {
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .card + .card {
    margin-top: 8px;
  }

  /* Lange Abschnitte dürfen umbrechen, einzelne Einträge nicht */
  .card--measures,
  .card--answers {
    break-inside: auto;
    page-break-inside: auto;
  }

  h2 {
    font-size: 16pt;
  }

  .section-title {
    font-size: 12.5pt;
    break-after: avoid;
    page-break-after: avoid;
  }

  .section-sub {
    margin: 2px 0 8px;
    font-size: 9pt;
  }

  .summary {
    grid-template-columns: 32mm 1fr;
    gap: 16px;
  }

  .ring {
    width: 32mm;
    height: 32mm;
  }

  .score-number {
    font-size: 27pt;
  }

  .score-unit {
    font-size: 8pt;
  }

  .summary-title {
    margin-top: 6px;
    font-size: 15pt;
  }

  .summary-text,
  .summary-points {
    margin-top: 4px;
    font-size: 9.5pt;
  }

  .area-row + .area-row {
    margin-top: 6px;
  }

  .area-head {
    margin-bottom: 3px;
    font-size: 10pt;
  }

  .bar-track {
    height: 7px;
    border: 0.5pt solid var(--line);
  }

  .legend {
    margin-top: 6px;
    padding-top: 6px;
    font-size: 8.5pt;
  }

  .measures li {
    padding: 8px 12px 8px 44px;
    border: 1px solid var(--line);
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .measures li + li {
    margin-top: 6px;
  }

  .measures li::before {
    left: 12px;
    top: 8px;
    width: 22px;
    height: 22px;
    font-size: 10pt;
    line-height: 22px;
  }

  .measure-title {
    font-size: 11pt;
  }

  .measure-text {
    margin-top: 4px;
    font-size: 9.5pt;
  }

  /* Antwortübersicht im Druck immer vollständig */
  .answers-details summary::after {
    display: none;
  }

  .answers-table {
    margin-top: 8px;
    font-size: 9pt;
  }

  .answers-table th,
  .answers-table td {
    padding: 5px 0;
  }

  .answers-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .answers-table .group-row th {
    padding-top: 10px;
    font-size: 9.5pt;
  }

  .disclaimer {
    margin-top: 10px;
    padding: 10px 12px;
    font-size: 9.5pt;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .trust {
    margin-top: 10px;
    max-width: none;
    justify-content: flex-start;
    font-size: 8.5pt;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}
