/* Base checkbox styling */
.form-group input[type="checkbox"] {
  width: auto !important;
  min-width: 18px;
  min-height: 18px;
  margin-right: 10px;
  margin-bottom: 8px;
  display: inline-block;
  vertical-align: top;
  flex-shrink: 0;
}

/* Checkbox label styling */
.form-group input[type="checkbox"] + label {
  display: inline-block;
  margin-right: 15px;
  margin-bottom: 10px;
  font-weight: normal;
  color: black;
  line-height: 1.4;
  vertical-align: top;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Checkbox container */
.checkbox-container {
  display: flex;
  flex-direction: column;
  margin-top: 10px;
}

/* Individual checkbox item wrapper */
.checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.checkbox-item input[type="checkbox"] {
  margin: 2px 0 0 0;
  min-width: 18px;
  min-height: 18px;
}

.checkbox-item label {
  margin: 0;
  flex: 1;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
}

/* Accessibility - Focus states */
.checkbox-item input[type="checkbox"]:focus {
  outline: 2px solid #4299e1;
  outline-offset: 2px;
}

.checkbox-item input[type="checkbox"]:focus + label {
  color: #2d3748;
  font-weight: 500;
}

/* Specific infection_comments styling */
.form-group input[name="infection_comments[]"] {
  width: auto !important;
  min-width: 18px;
  min-height: 18px;
  margin-right: 10px;
  margin-bottom: 0;
  display: inline-block;
  vertical-align: top;
}

.form-group input[name="infection_comments[]"] + label {
  display: inline-block;
  margin-right: 0;
  margin-bottom: 0;
  font-weight: normal;
  color: black;
  line-height: 1.4;
  vertical-align: top;
  word-wrap: break-word;
  max-width: calc(100% - 30px);
}

/* Mobile styles (tablets and below) */
@media (max-width: 768px) {
  /* Touch-friendly checkboxes */
  .form-group input[type="checkbox"] {
    min-width: 20px;
    min-height: 20px;
    margin-right: 12px;
    transform: scale(1.2);
  }

  /* Improved label readability */
  .form-group input[type="checkbox"] + label {
    font-size: 14px;
    line-height: 1.5;
    margin-right: 0;
    margin-bottom: 0;
    display: block;
    width: 100%;
    padding-left: 5px;
  }

  /* Enhanced checkbox item styling */
  .checkbox-item {
    padding: 12px;
    margin-bottom: 0;
    border-radius: 8px;
  }

  .checkbox-item input[type="checkbox"] {
    min-width: 22px;
    min-height: 22px;
    transform: scale(1);
  }

  .checkbox-item label {
    font-size: 15px;
    line-height: 1.6;
    padding-left: 8px;
  }

  /* Prevent overflow */
  .checkbox-container {
    width: 100%;
    overflow-x: hidden;
  }

  /* infection_comments mobile fixes */
  .form-group input[name="infection_comments[]"] {
    margin-right: 8px;
    vertical-align: baseline;
  }

  .form-group input[name="infection_comments[]"] + label {
    display: block;
    width: 100%;
    margin-left: 0;
    margin-bottom: 0;
  }
}

/* Extra small screens (phones) */
@media (max-width: 480px) {
  .checkbox-item {
    padding: 10px;
    margin-bottom: 0;
  }

  .checkbox-item label {
    font-size: 14px;
    line-height: 1.5;
  }

  .form-group input[type="checkbox"] {
    min-width: 18px;
    min-height: 18px;
  }
}
