/* ============================================
   KI-Readiness Fragebogen — transformwerk.digital
   Farbschema: handwerksberater-kolb.de
   Dunkelblau + Orange, Font: Inter
   ============================================ */

:root {
  --blue-900: #0a1628;
  --blue-800: #111d35;
  --blue-700: #1a2a4a;
  --blue-600: #243a63;
  --blue-500: #2e4a7d;
  --blue-400: #4a6fa5;
  --blue-300: #7a9cc7;
  --blue-100: #dce6f2;
  --orange-500: #e8720c;
  --orange-400: #f28a2e;
  --orange-300: #f5a623;
  --orange-600: #c45d00;
  --white: #ffffff;
  --gray-50: #f8f9fa;
  --gray-100: #eef1f5;
  --gray-200: #d8dee6;
  --gray-300: #b0bac8;
  --gray-600: #5a6577;
  --gray-800: #2d3748;
  --color-error: #d32f2f;
  --color-success: #2e7d32;
  --shadow-sm: 0 1px 3px rgba(10, 22, 40, 0.08);
  --shadow-md: 0 4px 12px rgba(10, 22, 40, 0.12);
  --shadow-lg: 0 8px 30px rgba(10, 22, 40, 0.16);
  --radius: 8px;
  --radius-lg: 16px;
  --radius-pill: 50px;
  --transition: 0.25s ease;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--gray-800);
  background: var(--gray-50);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-weight: 700; line-height: 1.25; color: var(--blue-900); }
h1 { font-size: clamp(1.5rem, 4vw, 2rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.6rem); margin-bottom: 0.5rem; }
h3 { font-size: 1.1rem; margin-bottom: 0.4rem; }
a { color: var(--orange-500); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--orange-600); }

/* ---- Header ---- */
.header {
  background: var(--blue-900);
  color: var(--white);
  padding: 1.25rem 1.5rem;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.header__title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.header__subtitle {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--blue-300);
  margin-top: 0.15rem;
}

/* ---- Progress Bar ---- */
.progress-bar {
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 1.5rem 1rem 1rem;
  max-width: 600px;
  margin: 0 auto;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
  cursor: pointer;
}

.progress-step__circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--gray-200);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--gray-600);
  transition: all var(--transition);
  position: relative;
  z-index: 2;
}

.progress-step__label {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--gray-600);
  margin-top: 0.3rem;
  text-align: center;
  max-width: 80px;
  line-height: 1.2;
  transition: all var(--transition);
}

.progress-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 18px;
  left: calc(50% + 18px);
  right: calc(-50% + 18px);
  height: 2px;
  background: var(--gray-200);
  z-index: 1;
  transition: background var(--transition);
}

.progress-step.active .progress-step__circle {
  border-color: var(--orange-500);
  background: var(--orange-500);
  color: var(--white);
}

.progress-step.active .progress-step__label {
  color: var(--orange-500);
  font-weight: 600;
}

.progress-step.completed .progress-step__circle {
  border-color: var(--color-success);
  background: var(--color-success);
  color: var(--white);
}

.progress-step.completed .progress-step__label { color: var(--color-success); }
.progress-step.completed::after { background: var(--color-success); }

/* ---- Main Container ---- */
.main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

/* ---- Form Step ---- */
.form-step {
  display: none;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  margin-bottom: 1.5rem;
  animation: fadeIn 0.3s ease;
}

.form-step.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-step__title {
  font-size: 1.35rem;
  margin-bottom: 0.5rem;
  color: var(--blue-900);
}

.form-step__description {
  font-size: 0.92rem;
  color: var(--gray-600);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

/* ---- Section ---- */
.section { margin-bottom: 1.5rem; }

.section__title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--blue-700);
  padding-left: 0.75rem;
  border-left: 3px solid var(--orange-500);
  margin-bottom: 1rem;
}

/* ---- Form Fields ---- */
.field-group { margin-bottom: 1rem; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-800);
  margin-bottom: 0.3rem;
}

.field-label--required::after {
  content: ' *';
  color: var(--orange-500);
}

.field-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--white);
  transition: all var(--transition);
  color: var(--gray-800);
}

.field-input::placeholder {
  color: var(--gray-300);
  font-weight: 400;
}

.field-input:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(46, 74, 125, 0.12);
}

.field-input.error {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1);
}

.field-error {
  font-size: 0.78rem;
  color: var(--color-error);
  margin-top: 0.2rem;
  display: none;
}

.field-error.visible { display: block; }

textarea.field-input {
  resize: vertical;
  min-height: 80px;
}

select.field-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235a6577' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  padding-right: 2.2rem;
}

/* ---- Dynamic Task Rows ---- */
.task-list { margin-bottom: 1rem; }

.task-row {
  display: grid;
  grid-template-columns: 1fr 120px 36px;
  gap: 0.5rem;
  align-items: start;
  margin-bottom: 0.5rem;
  animation: fadeIn 0.2s ease;
}

.task-row .field-input { margin-bottom: 0; }

.btn-remove-task {
  width: 36px;
  height: 36px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--gray-600);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition);
  margin-top: 0;
}

.btn-remove-task:hover {
  border-color: var(--color-error);
  color: var(--color-error);
  background: rgba(211, 47, 47, 0.05);
}

.task-header {
  display: grid;
  grid-template-columns: 1fr 120px 36px;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.task-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--blue-100);
  border-radius: var(--radius);
  margin-top: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--blue-700);
}

.btn-add-task {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--orange-500);
  background: transparent;
  border: 1px dashed var(--orange-400);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-add-task:hover {
  background: rgba(232, 114, 12, 0.05);
  border-color: var(--orange-500);
}

/* ---- Checkbox Cards ---- */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.checkbox-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  background: var(--white);
}

.checkbox-card:hover {
  border-color: var(--blue-400);
  background: rgba(46, 74, 125, 0.02);
}

.checkbox-card.selected {
  border-color: var(--blue-500);
  background: rgba(46, 74, 125, 0.05);
}

.checkbox-card input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--blue-500);
}

.checkbox-card__label {
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--gray-800);
}

/* ---- Radio Cards (KI-Wichtigkeit) ---- */
.radio-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
  background: var(--white);
}

.radio-card:hover {
  border-color: var(--blue-400);
}

.radio-card.selected {
  border-color: var(--orange-500);
  background: rgba(232, 114, 12, 0.04);
}

.radio-card input[type="radio"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--orange-500);
}

.radio-card__content { flex: 1; }

.radio-card__label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--blue-900);
  display: block;
}

.radio-card__description {
  font-size: 0.82rem;
  color: var(--gray-600);
  margin-top: 0.2rem;
  line-height: 1.4;
}

/* ---- Mitarbeiter Radio Group ---- */
.radio-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.radio-option:hover { border-color: var(--blue-400); }

.radio-option.selected {
  border-color: var(--blue-500);
  background: rgba(46, 74, 125, 0.05);
}

.radio-option input[type="radio"] {
  accent-color: var(--blue-500);
}

.radio-option__label {
  font-size: 0.88rem;
  color: var(--gray-800);
}

/* ---- Navigation Buttons ---- */
.step-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-100);
}

.btn {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.7rem 2rem;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn:focus-visible {
  outline: 3px solid var(--blue-400);
  outline-offset: 2px;
}

.btn--primary {
  background: var(--orange-500);
  color: var(--white);
}

.btn--primary:hover {
  background: var(--orange-600);
  box-shadow: 0 4px 12px rgba(232, 114, 12, 0.3);
}

.btn--secondary {
  background: var(--white);
  color: var(--blue-700);
  border: 2px solid var(--blue-500);
}

.btn--secondary:hover {
  background: var(--blue-500);
  color: var(--white);
}

.btn--outline {
  background: transparent;
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
}

.btn--outline:hover {
  border-color: var(--gray-600);
  color: var(--gray-800);
}

.btn--lg {
  padding: 0.85rem 2.5rem;
  font-size: 1.05rem;
}

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

/* ---- Summary ---- */
.summary-section {
  margin-bottom: 1rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}

.summary-section__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 1rem;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.summary-section__title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--blue-700);
}

.summary-section__edit {
  font-size: 0.78rem;
  color: var(--orange-500);
  cursor: pointer;
}

.summary-section__edit:hover { text-decoration: underline; }

.summary-table { width: 100%; border-collapse: collapse; }

.summary-table td {
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--gray-50);
  vertical-align: top;
}

.summary-table td:first-child {
  color: var(--gray-600);
  width: 40%;
}

.summary-chip {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  background: var(--blue-100);
  color: var(--blue-700);
  border-radius: var(--radius-pill);
  margin: 0.1rem 0.15rem;
}

/* ---- Privacy ---- */
.privacy-check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 1.5rem 0;
  padding: 1rem;
  background: var(--gray-50);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}

.privacy-check input { margin-top: 3px; accent-color: var(--blue-500); }
.privacy-check label { font-size: 0.85rem; line-height: 1.4; color: var(--gray-800); }

/* ---- Submit Area ---- */
.submit-area {
  text-align: center;
  margin-top: 1.5rem;
}

.webhook-status {
  text-align: center;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  display: none;
}

.webhook-status.success { color: var(--color-success); display: block; }
.webhook-status.error { color: var(--color-error); display: block; }

/* ---- Confirmation Screen ---- */
.confirmation {
  display: none;
  text-align: center;
  padding: 3rem 2rem;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  max-width: 620px;
  margin: 2rem auto;
  animation: fadeIn 0.4s ease;
}

.confirmation.active { display: block; }

.confirmation__icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  background: linear-gradient(135deg, var(--color-success), #43a047);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--white);
}

.confirmation__title {
  font-size: 1.5rem;
  color: var(--blue-900);
  margin-bottom: 1rem;
}

.confirmation__text {
  font-size: 0.95rem;
  color: var(--gray-600);
  line-height: 1.7;
  max-width: 480px;
  margin: 0 auto 1.5rem;
}

.confirmation__next-steps {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  text-align: left;
  margin-bottom: 1.5rem;
}

.confirmation__next-steps h3 {
  color: var(--blue-700);
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.confirmation__next-steps p {
  font-size: 0.9rem;
  color: var(--gray-600);
  line-height: 1.6;
  margin-bottom: 0;
}

.confirmation__contact {
  font-size: 0.85rem;
  color: var(--gray-600);
  margin-bottom: 1.5rem;
}

.confirmation__signature {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--blue-700);
}

/* ---- Footer ---- */
.footer {
  background: var(--blue-900);
  color: rgba(255,255,255,0.6);
  text-align: center;
  padding: 1.5rem;
  font-size: 0.78rem;
}

.footer a { color: rgba(255,255,255,0.8); }
.footer a:hover { color: var(--white); }

/* ---- Autosave Indicator ---- */
.autosave-indicator {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  font-size: 0.75rem;
  color: var(--color-success);
  background: var(--white);
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 50;
}

.autosave-indicator.visible { opacity: 1; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .form-step { padding: 1.25rem; }
  .field-row { grid-template-columns: 1fr; }
  .radio-group { grid-template-columns: 1fr; }
  .task-row { grid-template-columns: 1fr 90px 36px; }
  .task-header { grid-template-columns: 1fr 90px 36px; }
  .progress-step__label { font-size: 0.55rem; max-width: 55px; }
  .progress-step__circle { width: 30px; height: 30px; font-size: 0.75rem; }
  .progress-step:not(:last-child)::after { top: 15px; left: calc(50% + 15px); right: calc(-50% + 15px); }
  .btn { padding: 0.6rem 1.2rem; font-size: 0.85rem; }
  .header__title { font-size: 0.95rem; }
  .confirmation { padding: 2rem 1.25rem; margin: 1rem; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .form-step { padding: 1.75rem; }
}

/* ---- Print ---- */
@media print {
  .header, .progress-bar, .step-nav, .footer, .autosave-indicator { display: none; }
  .form-step { display: block !important; box-shadow: none; break-inside: avoid; }
}
