/* Form-specific styles - scoped to form elements */

/* Form element - base styles */
.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Form groups */
.form .form__group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form .form__label {
  font-weight: 500;
  color: var(--font-1);
  font-size: 0.9rem;
}

.form .form__input,
.form .form__select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-1);
  border-radius: 4px;
  font-size: 0.9rem;
  background-color: var(--bg-1);
  color: var(--font-1);
  transition: border-color 0.2s ease;
}

.form .form__input:focus,
.form .form__select:focus {
  outline: none;
  border-color: var(--link);
  box-shadow: 0 0 0 2px oklch(from var(--link) / 0.25);
}

.form .form__input:-webkit-autofill,
.form .form__select:-webkit-autofill,
.form .form__input:autofill,
.form .form__select:autofill,
.form .form__input[data-com-onepassword-filled="light"],
.form .form__select[data-com-onepassword-filled="light"] {
  background-color: var(--bg-4) !important;
  color: var(--font-1) !important;
  box-shadow: 0 0 0 1000px var(--bg-4) inset !important;
  -webkit-text-fill-color: var(--font-1) !important;
  filter: none; /* For Firefox compatibility */
}

/* Form actions */
.form .form__actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* Error messages within forms */
.form .form__errors {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.form .form__errors h4 {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

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

.form .form__errors li {
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
}

/* Readonly field styles */
.form .form__readonly {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-1);
  border-radius: 4px;
  font-size: 0.9rem;
  background-color: var(--bg-2);
  color: var(--font-2);
  line-height: 1.4;
}

/* Legacy form styles (from original form.css) - consider migrating these */
.form-container {
  padding: 2rem;
}

.form-group {
  margin-bottom: 1rem;
}

/* Legacy input styles - should be updated to use form__input */
input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-1);
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
  background-color: var(--bg-1);
  color: var(--font-1);
}

input[type="email"]:focus,
input[type="password"]:focus,
input[type="text"]:focus {
  outline: none;
  border-color: var(--link);
  box-shadow: 0 0 0 2px oklch(from var(--link) / 0.25);
}

input[type="email"]:-webkit-autofill,
input[type="password"]:-webkit-autofill,
input[type="text"]:-webkit-autofill,
input[type="email"]:autofill,
input[type="password"]:autofill,
input[type="text"]:autofill,
input[data-com-onepassword-filled="light"] {
  background-color: var(--bg-4) !important;
  color: var(--font-1) !important;
  box-shadow: 0 0 0 1000px var(--bg-4) inset !important;
  -webkit-text-fill-color: var(--font-1) !important;
  filter: none; /* For Firefox compatibility */
}

/* Legacy submit button - should be updated to use btn classes */
input[type="submit"] {
  width: 100%;
  padding: 0.75rem;
  background-color: var(--link);
  color: var(--bg-1);
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

input[type="submit"]:hover {
  background-color: oklch(from var(--link) l c h / 0.8);
}

/* Form links */
.form-link {
  text-align: center;
  margin-top: 1rem;
}

.form-link a {
  color: var(--link);
  text-decoration: underline;
  font-weight: 600;
}

.form-link a:hover {
  text-decoration: none;
}

/* Flash messages - could be moved to a separate messages.css file */
.flash-message {
  padding: 0.75rem;
  margin-bottom: 1rem;
  border-radius: 4px;
  text-align: center;
}

.flash-alert {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.flash-notice {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}