/* Devise page styles — targets default Devise-generated markup */

/* Center the form on the page */
body .container:has(> h2:first-child) {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  width: 100%;
}

/* Scope all Devise form styling via a wrapper approach:
   Devise views render an h2 + form + shared links directly inside yield.
   We target forms with action containing "users" (Devise default routes). */

form[action*="/users"] {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Page headings */
h2:has(+ form[action*="/users"]),
form[action*="/users"] ~ h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 1.5rem;
  text-align: center;
}

/* Form field groups */
form[action*="/users"] .field {
  margin-bottom: 1rem;
}

/* Labels */
form[action*="/users"] label {
  display: block;
  font-weight: 500;
  font-size: 0.875rem;
  color: #374151;
  margin-bottom: 0.375rem;
}

/* Remove the <br> after labels */
form[action*="/users"] .field br {
  display: none;
}

/* Text and password inputs */
form[action*="/users"] input[type="email"],
form[action*="/users"] input[type="password"],
form[action*="/users"] input[type="text"] {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #111827;
  background-color: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  box-sizing: border-box;
}

form[action*="/users"] input[type="email"]:focus,
form[action*="/users"] input[type="password"]:focus,
form[action*="/users"] input[type="text"]:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Checkbox row (Remember me) */
form[action*="/users"] .field:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

form[action*="/users"] .field:has(input[type="checkbox"]) label {
  margin-bottom: 0;
  font-weight: 400;
  font-size: 0.875rem;
  color: #6b7280;
}

/* Submit buttons */
form[action*="/users"] .actions input[type="submit"] {
  display: block;
  width: 100%;
  padding: 0.625rem 1rem;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #fff;
  background-color: #2563eb;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease-in-out;
}

form[action*="/users"] .actions input[type="submit"]:hover {
  background-color: #1d4ed8;
}

/* Shared links (forgot password, sign up, etc.) */
form[action*="/users"] ~ a,
form[action*="/users"] ~ br + a {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  color: #6b7280;
  text-decoration: none;
  text-align: center;
}

form[action*="/users"] ~ a:hover {
  color: #3b82f6;
  text-decoration: underline;
}

/* Hide the <br> tags between shared links */
form[action*="/users"] ~ br {
  display: none;
}

/* Error messages block */
#error_explanation {
  max-width: 400px;
  margin: 0 auto 1rem;
  padding: 1rem;
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
}

#error_explanation h2 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #991b1b;
  margin-bottom: 0.5rem;
}

#error_explanation ul {
  list-style: disc;
  padding-left: 1.25rem;
  margin: 0;
}

#error_explanation li {
  font-size: 0.8125rem;
  color: #b91c1c;
  margin-bottom: 0.25rem;
}

/* Flash messages */
.flash {
  max-width: 480px;
  margin: 1rem auto;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  text-align: center;
}

.flash.notice {
  background-color: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.flash.alert {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

/* Minimum password length hint */
form[action*="/users"] em {
  display: block;
  font-size: 0.75rem;
  color: #9ca3af;
  font-style: normal;
  margin-bottom: 0.25rem;
}
