body {
  font-family: sans-serif;
  padding: 10px;
  max-width: 800px;
  margin: auto;
  background: #f5f7fa;
  color: #333;
  font-size: 16px;
}

form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: white;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgb(0 0 0 / 0.1);
}

.step {
  display: none;
}

.step.active {
  display: block;
}

label {
  display: block;
  margin-top: 12px;
  font-weight: 600;
  font-size: 1rem;
}

/* Pflichtfeld-Markierung */
.required-field::after {
  content: " *";
  color: #dc3545;
  font-weight: bold;
}

input, select, textarea {
  width: 100%;
  padding: 12px;
  margin-top: 8px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
  transition: border-color 0.3s;
}

input:focus, select:focus, textarea:focus {
  border-color: #ff9900;
  outline: none;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.row > * {
  flex: 1 1 45%;
  min-width: 200px;
}

input[type="time"], input[type="date"], input[type="number"] {
  max-width: 160px;
}

.flex-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 30px;
  gap: 10px;
}

button {
  padding: 14px 24px;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  background-color: #ff9900;
  color: #fff;
  border-radius: 6px;
  transition: background-color 0.3s;
}

button:hover:not(:disabled) {
  background-color: #cc7a00;
}

button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.techniker-block, .ersatzteil-block, .artikel-block, .nachlieferung-block {
  border: 1px solid #ddd;
  background: #fafafa;
  padding: 15px 20px;
  border-radius: 8px;
  position: relative;
  margin-bottom: 15px;
}

.remove-button {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background-color: #dc3545;
  border: none;
  color: white;
  padding: 8px 14px;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s;
  width: auto;
}

.remove-button:hover {
  background-color: #a71d2a;
}

.time-group {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.time-group > * {
  flex: 1 1 140px;
  min-width: 140px;
}

/* Kundenspezifische Felder */
.kunde-fields {
  margin-top: 15px;
}

.itab-einsatz-fields {
  background: #fafafa;
  padding: 15px;
  border-radius: 8px;
  margin-top: 15px;
  border: 1px solid #ddd;
}

/* Checkbox und Radio Gruppen */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin: 15px 0;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.checkbox-label span {
  font-weight: 500;
}

.radio-group {
  display: flex;
  gap: 20px;
  margin: 10px 0;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.radio-label input[type="radio"] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.radio-label span {
  font-weight: 500;
}

.nachlieferung-optionen {
  margin-top: 30px;
  padding: 20px;
  background: #fafafa;
  border-radius: 8px;
  border: 1px solid #ddd;
}

.option-group {
  margin-bottom: 20px;
}

.option-group:last-child {
  margin-bottom: 0;
}

.option-group > label {
  font-weight: 600;
  margin-bottom: 10px;
  display: block;
}

.wartezeit-group {
  background: #fafafa;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #ddd;
}

.wartezeit-group .checkbox-label {
  margin-bottom: 10px;
}

/* Fahrer Checkbox Styling */
.fahrer-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 15px;
  max-width: 160px;
}

.fahrer-checkbox input[type="checkbox"] {
  width: auto;
  margin: 0;
  transform: scale(1.2);
}

.fahrer-checkbox label {
  margin: 0;
  font-weight: 500;
  color: #333;
}

/* Custom Dropdown für durchsuchbare Artikel */
.custom-dropdown {
  position: absolute;
  background: white;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  width: 100%;
  left: 0;
  top: calc(100% + 2px);
}

.dropdown-option {
  padding: 12px 15px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s;
}

.dropdown-option:last-child {
  border-bottom: none;
}

.dropdown-option:hover {
  background-color: #f5f7fa;
}

.dropdown-option.no-results {
  color: #999;
  cursor: default;
  text-align: center;
  font-style: italic;
}

.dropdown-option.no-results:hover {
  background-color: white;
}

.dropdown-option strong {
  display: block;
  color: #333;
  margin-bottom: 4px;
}

.dropdown-option small {
  color: #666;
  font-size: 0.85rem;
}

/* Signature Block */
.signature-block {
  display: flex;
  flex-direction: column;
  gap: 40px;
  margin-top: 20px;
}

.signature-block > div {
  width: 100%;
}

.signature-container {
  position: relative;
  width: 100%;
  height: 150px;
  border: 1px solid #333;
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.signature-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  touch-action: none;
}

.signature-block button {
  margin-top: 12px;
  width: auto;
  background-color: #dc3545;
  padding: 10px 16px;
  font-size: 1rem;
}

.signature-block button:hover {
  background-color: #a71d2a;
}

/* Bildvorschau */
#image-preview, #image-preview-itab {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.preview-container {
  position: relative;
  width: 120px;
  height: 120px;
}

.preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 1px solid #ddd;
  border-radius: 6px;
}

.remove-image {
  position: absolute;
  top: -10px;
  right: -10px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.remove-image:hover {
  background: #a71d2a;
}

/* Datalist Styling - Bessere Browser-Kompatibilität */
input[list] {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 20px;
  padding-right: 40px;
}

/* Validierungs-Feedback */
.validation-error {
  color: #dc3545;
  font-size: 0.9rem;
  margin-top: 5px;
  padding: 5px 10px;
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
}

.validation-success {
  color: #155724;
  font-size: 0.9rem;
  margin-top: 5px;
  padding: 5px 10px;
  background: #d4edda;
  border: 1px solid #c3e6cb;
  border-radius: 4px;
}

@media (max-width: 768px) {
  body {
    padding: 5px;
    font-size: 15px;
  }

  form {
    padding: 10px;
    gap: 15px;
  }

  .row {
    flex-direction: column;
    gap: 10px;
  }

  .row > * {
    flex: 1 1 100%;
    min-width: auto;
  }

  .time-group {
    flex-direction: column;
  }

  .time-group > * {
    flex: 1 1 100%;
    min-width: auto;
  }

  input[type="time"],
  input[type="date"],
  input[type="number"] {
    max-width: 100%;
  }

  .signature-block {
    gap: 30px;
  }

  .signature-container {
    height: 120px;
  }

  .flex-buttons {
    flex-direction: column;
    gap: 10px;
  }

  .flex-buttons button {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
  }

  .techniker-block,
  .ersatzteil-block,
  .artikel-block,
  .nachlieferung-block {
    padding: 15px;
  }

  .remove-button {
    position: relative;
    margin-top: 15px;
    width: 100%;
    bottom: auto;
    right: auto;
    padding: 10px;
  }

  .fahrer-checkbox {
    font-size: 0.95rem;
  }

  .itab-einsatz-fields {
    padding: 10px;
  }

  .preview-container {
    width: 100px;
    height: 100px;
  }

  .custom-dropdown {
    max-height: 200px;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 14px;
  }

  input, select, textarea {
    padding: 10px;
    font-size: 0.95rem;
  }

  .signature-container {
    height: 100px;
  }

  .signature-block button {
    padding: 12px;
    font-size: 0.95rem;
  }

  .preview-container {
    width: 90px;
    height: 90px;
  }

  .fahrer-checkbox {
    font-size: 0.9rem;
  }

  .fahrer-checkbox input[type="checkbox"] {
    transform: scale(1);
  }

  .custom-dropdown {
    max-height: 150px;
  }

  .dropdown-option {
    padding: 10px 12px;
  }
}
