/*
 * Authentication UI Styles
 * Extends warm minimalism theme from custom.css
 */

/* Auth Page Layout */
.auth-page {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem 0 6rem;
  animation: fadeIn 0.7s ease-out;
}

.auth-container {
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
}

.auth-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.auth-header h1 {
  font-size: 2rem;
  font-weight: 300;
  color: var(--warm-gray);
  margin: 0 0 0.75rem 0;
}

.auth-header p {
  font-size: 1rem;
  color: var(--warm-gray-60);
  font-weight: 300;
  margin: 0;
}

/* Form Styles */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.form-field label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--warm-gray);
}

.form-field input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--warm-gray);
  background: transparent;
  border: 1px solid var(--warm-gray-20);
  border-radius: 0.375rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.form-field input::placeholder {
  color: var(--warm-gray-30);
}

.form-field input:hover {
  border-color: var(--warm-gray-30);
}

.form-field input:focus {
  outline: none;
  border-color: var(--warm-gray-50);
  box-shadow: 0 0 0 3px rgba(58, 54, 50, 0.1);
}

/* Error State */
.form-field.has-error input {
  border-color: #c45c4d;
}

.form-field.has-error input:focus {
  box-shadow: 0 0 0 3px rgba(196, 92, 77, 0.15);
}

.form-error {
  font-size: 0.8125rem;
  color: #c45c4d;
  display: none;
}

.form-field.has-error .form-error {
  display: block;
}

/* Success State */
.form-field.has-success input {
  border-color: #5a8a5e;
}

/* Form Button */
.form-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.875rem 1.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--warm-beige);
  background: var(--warm-gray);
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.1s ease;
  margin-top: 0.5rem;
}

.form-button:hover {
  opacity: 0.9;
}

.form-button:active {
  transform: scale(0.98);
}

.form-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Loading Spinner */
.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: none;
}

.form-button.is-loading .spinner {
  display: block;
}

.form-button.is-loading .button-text {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Alert Messages */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 0.375rem;
  font-size: 0.9375rem;
  font-weight: 400;
  display: none;
  margin-bottom: 1.5rem;
}

.alert.is-visible {
  display: block;
}

.alert-success {
  background: rgba(90, 138, 94, 0.1);
  color: #4a7a4e;
  border: 1px solid rgba(90, 138, 94, 0.2);
}

.alert-error {
  background: rgba(196, 92, 77, 0.1);
  color: #b54a3d;
  border: 1px solid rgba(196, 92, 77, 0.2);
}

.alert-info {
  background: rgba(58, 54, 50, 0.05);
  color: var(--warm-gray);
  border: 1px solid var(--warm-gray-10);
}

/* Password Requirements */
.password-requirements {
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--warm-gray-05);
  border-radius: 0.375rem;
  font-size: 0.8125rem;
}

.password-requirements p {
  margin: 0 0 0.5rem 0;
  color: var(--warm-gray-60);
  font-weight: 500;
}

.password-requirements ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.password-requirements li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--warm-gray-50);
  transition: color 0.2s ease;
}

.password-requirements li.is-valid {
  color: #5a8a5e;
}

.password-requirements li .check-icon {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
}

.password-requirements li .check-icon svg {
  width: 100%;
  height: 100%;
}

/* Auth Links */
.auth-links {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--warm-gray-10);
}

.auth-links p {
  font-size: 0.9375rem;
  color: var(--warm-gray-60);
  margin: 0;
}

.auth-links a {
  color: var(--warm-gray);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid var(--warm-gray-20);
  padding-bottom: 1px;
  transition: border-color 0.2s ease;
}

.auth-links a:hover {
  border-color: var(--warm-gray);
}

/* Header Auth Links */
.nav-auth {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-auth .nav-link-login {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--warm-gray-60);
  text-decoration: none;
  transition: color 0.3s ease;
}

.nav-auth .nav-link-login:hover {
  color: var(--warm-gray);
}

.nav-auth .nav-link-logout {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--warm-gray-60);
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.3s ease;
}

.nav-auth .nav-link-logout:hover {
  color: var(--warm-gray);
}

/* Hidden by default, shown via JS based on auth state */
.auth-only {
  display: none;
}

.guest-only {
  display: flex;
}

body.is-authenticated .auth-only {
  display: flex;
}

body.is-authenticated .guest-only {
  display: none;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .auth-page {
    padding: 2rem 0 4rem;
  }

  .auth-header h1 {
    font-size: 1.75rem;
  }

  .form-field input {
    padding: 0.625rem 0.875rem;
  }

  .form-button {
    padding: 0.75rem 1.25rem;
  }
}
