/* forms.css — colours come from theme.css tokens.
   Submit buttons and the file-selector button are styled by the shared
   .btn rule set in application.css. */

/* ================================
   Form Containers
=================================== */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  color: var(--text);
  width: 100%;
  max-width: 900px;
  margin: 1rem auto;
}

/* button_to renders a bare <form> wrapping a single button — it must not
   inherit the padded, centred form container above. */
form.button_to {
  display: inline;
  padding: 0;
  margin: 0;
  width: auto;
  max-width: none;
}

/* ================================
   Headings & Errors
=================================== */
form h2 {
  font-family: 'Delius-Regular';
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

form ul {
  list-style: disc;
  margin-left: 1.5rem;
  color: var(--danger);
}

form ul li {
  font-size: 0.9rem;
  margin: 0.2rem 0;
}

/* ================================
   Labels
=================================== */
form label {
  font-weight: 600;
  color: var(--green);
  margin-bottom: 0.3rem;
  display: block;
  letter-spacing: 0.3px;
}

form small {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ================================
   Input & Textarea Fields
=================================== */
form input[type="text"],
form input[type="number"],
form input[type="email"],
form input[type="password"],
form input[type="date"],
form input[type="tel"],
form input[type="url"],
form input[type="search"],
form textarea,
form select {
  width: 100%;
  padding: 0.7rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--field-text);
  font-size: 1rem;
  font-weight: 500;
  transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
  font-family: 'Inter-Variable';
  box-shadow: var(--shadow);
}

form input::placeholder,
form textarea::placeholder {
  color: var(--field-placeholder);
}

form input:focus,
form textarea:focus,
form select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 12px rgba(63, 217, 158, 0.4);
}

/* Native dropdown lists follow the OS palette unless told otherwise */
form select option {
  background: var(--surface);
  color: var(--text);
}

/* ================================
   Textarea
=================================== */
form textarea {
  resize: vertical;
  min-height: 4rem;
}

/* ================================
   File Input
=================================== */
form input[type="file"] {
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
}

/* Submit button keeps the shared .btn look but stretches to its own row */
form input[type="submit"],
form button[type="submit"] {
  padding: 0.8rem 1rem;
  border-radius: 0.5rem;
  font-weight: bold;
  width: fit-content;
  align-self: flex-start;
}

/* ================================
   Field Grouping
=================================== */
form > div {
  display: flex;
  flex-direction: column;
}

/* ================================
   Responsive Grid Layout
=================================== */
@media (min-width: 720px) {
  form.two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }

  form.two-column textarea,
  form.two-column input[type="file"],
  form.two-column input[type="submit"],
  form.two-column button[type="submit"] {
    grid-column: 1 / span 2;
  }

  form.two-column > div {
    display: flex;
    flex-direction: column;
  }
}
