/* Reset and base */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f0f2f5;
  color: #1a1a1a;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* Centered card layout */
.container {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
}

.container h1 {
  font-size: 1.375rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 1.5rem;
  color: #111;
}

/* Form groups */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
  color: #333;
}

.form-group input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  font-size: 0.9375rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-group input:focus {
  border-color: #0073bb;
  box-shadow: 0 0 0 2px rgba(0, 115, 187, 0.2);
}

/* Buttons — shared */
button {
  display: block;
  width: 100%;
  padding: 0.625rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

/* Primary submit buttons */
#login-submit,
#new-password-submit {
  background: #0073bb;
  color: #fff;
  margin-top: 0.5rem;
}

#login-submit:hover:not(:disabled),
#new-password-submit:hover:not(:disabled) {
  background: #005d99;
}

/* Disabled submit button — visually distinct */
#login-submit:disabled,
#new-password-submit:disabled {
  background: #a0c4de;
  color: #e8f0f6;
  cursor: not-allowed;
  opacity: 0.7;
}

/* Try Again button */
#try-again-btn {
  background: #0073bb;
  color: #fff;
  margin-top: 1rem;
}

#try-again-btn:hover {
  background: #005d99;
}

/* Sections — hidden by default via HTML hidden attribute */
section[hidden] {
  display: none !important;
}

section {
  text-align: left;
}

/* NEW_PASSWORD state info text */
#new-password-section p {
  font-size: 0.875rem;
  color: #555;
  margin-bottom: 1rem;
  text-align: center;
}

/* LOADING state */
#loading-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 0;
}

#loading-section p {
  margin-top: 1rem;
  font-size: 0.9375rem;
  color: #555;
}

/* CSS-only spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e0e0e0;
  border-top-color: #0073bb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ERROR state */
#error-section {
  text-align: center;
}

/* Default error style (applied when no category class is set) */
#error-message {
  padding: 0.875rem 1rem;
  border-radius: 4px;
  font-size: 0.9375rem;
  line-height: 1.4;
  text-align: left;
  background: #fef2f2;
  border: 1px solid #f87171;
  color: #991b1b;
}

/* Error category visual cues — override defaults */
#error-section.error-authentication #error-message {
  background: #fef2f2;
  border: 1px solid #f87171;
  color: #991b1b;
}

#error-section.error-authorization #error-message {
  background: #fff7ed;
  border: 1px solid #fb923c;
  color: #9a3412;
}

#error-section.error-connectivity #error-message {
  background: #fefce8;
  border: 1px solid #facc15;
  color: #854d0e;
}
