/* Admin watch reference create/edit form (FEAT-46 / UC-163).
   The .form-sections tabs/panels are styled globally in watches.css; this file
   covers the form fields, the autocomplete (#) / required (*) markers, and the
   legend. Index styling reuses the shared admin-* classes in application.css. */

.wr-form {
  max-width: 56rem;
}

.wr-form__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.wr-form__flag,
.wr-form__required {
  font-weight: 600;
}

.wr-form__flag {
  color: var(--color-accent);
}

.wr-form__required {
  color: var(--color-error);
}

.wr-form__section {
  border: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
}

/* Tabs can group several fieldsets in one panel (e.g. Case = case + dial +
   bracelet); space them apart. */
.form-sections__panel > .wr-form__section + .wr-form__section {
  margin-top: 1.75rem;
}

.wr-form__section > legend {
  grid-column: 1 / -1;
  padding: 0;
  margin-bottom: 0.25rem;
  font-family: var(--font-display, var(--font));
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

.wr-form__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.wr-form__field label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text);
}

.wr-form__field input,
.wr-form__field select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm, 6px);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
}

.wr-form__field select[multiple] {
  min-height: 9rem;
}

.wr-form__field input:focus,
.wr-form__field select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-glow, transparent);
}

.wr-form__field small {
  font-size: 0.75rem;
  color: var(--color-muted);
}

.wr-form__field--check {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.25rem 0.5rem;
}

.wr-form__field--check input {
  width: auto;
}

.wr-form__field--check small {
  grid-column: 1 / -1;
}

.wr-form__suggestable-note {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.8rem;
  color: var(--color-muted);
}

.wr-form__checks-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text);
}

.wr-form__checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.4rem 1rem;
}

.wr-form__check-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--color-text);
}

.wr-form__check-item input {
  width: auto;
}

.wr-form__errors {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-error);
  border-radius: var(--radius-sm, 6px);
  background: color-mix(in srgb, var(--color-error) 8%, transparent);
  color: var(--color-error);
}

.wr-form__errors ul {
  margin: 0;
  padding-left: 1.25rem;
}

.wr-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.5rem;
}

@media (max-width: 480px) {
  .wr-form__section {
    grid-template-columns: 1fr;
  }
}
