form {
  max-width: 400px;
  margin: 1em 0;
  display: flex;
  flex-direction: column;
  gap: 0.75em;
  flex-wrap: wrap;
  align-items: center;
}

label {
  font-weight: 600;
  flex: 0 0 120px;
  /* fixed label width */
  margin-right: 0.5rem;
  text-align: right;
}

.form-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: nowrap;
}

.form-group input,
.form-group textarea {
  padding: 0.5em;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: inherit;
  font-size: 1em;
  resize: vertical;
  flex: 1 1 auto;
  min-width: 200px;
}

.form-group.message-group textarea {
  flex: 1 1 auto;
  min-width: 250px;
  min-height: 120px;
  resize: vertical;
}

.form-group.message-group {
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
}

.form-group.message-group label {
  margin-right: 0;
  margin-bottom: 0.25rem;
  margin-top: 0.5em;
  text-align: right;
  align-self: flex-start;
  width: auto;
  flex: 0 0 120px;
}

button {
  padding: 0.6em 1.2em;
  background-color: #007acc;
  color: white;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  background-color: #005fa3;
}

label.required::after {
  content: " *";
  color: #d33;
  font-weight: normal;
  margin-left: 0.2em;
  font-size: 1.1em;
  vertical-align: super;
  font-family: sans-serif;
}

.required-note {
  color: #d33;
  font-size: 0.9rem;
  margin-top: 0.5rem;
  font-family: sans-serif;
}

@media (max-width: 600px) {

  form,
  .form-group {
    flex-direction: column;
    align-items: stretch;
  }

  label {
    flex: none;
    margin-right: 0;
    text-align: left;
  }

  input,
  textarea {
    width: 100%;
  }
}

.h-captcha {
  margin: 1rem 0;
  display: flex;
  justify-content: center;
}

input.honeypot {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.char-counter {
  text-align: right;
  font-size: 0.9em;
  color: #666;
  margin-top: 5px;
  margin-right: 0.5rem;
}

.security-notice {
  margin-top: 20px;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 5px;
  border-left: 4px solid #007bff;
}

.security-notice details {
  cursor: pointer;
}

.security-notice summary {
  font-weight: bold;
  color: #007bff;
  outline: none;
}

.security-content {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #dee2e6;
}

.security-content ul {
  margin: 10px 0;
  padding-left: 20px;
}

.security-content li {
  margin: 5px 0;
}

#submitBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-group.message-group {
  position: relative;
}

.form-group input:invalid,
.form-group textarea:invalid {
  border-color: #dc3545;
}

.form-group input:valid,
.form-group textarea:valid {
  border-color: #28a745;
}
