/* ==========================================================================
   Auth Pages — Signup, Login, Password Reset
   realestatephotographyhub.com
   Uses brand variables from global.css (--primary, --error, --success, etc.)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Centered Auth Layout
   -------------------------------------------------------------------------- */

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
  background-color: var(--theme-bg);
  font-family: 'Inter', sans-serif;
}

/* --------------------------------------------------------------------------
   2. Auth Card
   -------------------------------------------------------------------------- */

.auth-card {
  width: 100%;
  max-width: 440px;
  background-color: var(--theme-card-bg);
  border-radius: var(--radius-lg, 12px);
  border: 1px solid var(--theme-border);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  padding: 40px;
}

/* --------------------------------------------------------------------------
   3. Auth Header (logo + title + subtitle)
   -------------------------------------------------------------------------- */

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-header .auth-logo {
  display: block;
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  object-fit: contain;
}

.auth-header .auth-title {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--theme-text);
}

.auth-header .auth-subtitle {
  margin: 0;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--theme-text-muted);
}

/* --------------------------------------------------------------------------
   4. Auth Form Fields
   -------------------------------------------------------------------------- */

.auth-form {
  display: flex;
  flex-direction: column;
}

.auth-field {
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
}

.auth-field label {
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--theme-text-secondary);
}

/* --------------------------------------------------------------------------
   5. Auth Input Styling
   -------------------------------------------------------------------------- */

.auth-field input[type="text"],
.auth-field input[type="email"],
.auth-field input[type="password"],
.auth-field input[type="tel"],
.auth-field select,
.auth-input {
  width: 100%;
  padding: 16px;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--theme-text-body);
  background-color: var(--theme-input-bg);
  border: 1px solid var(--theme-border-input);
  border-radius: var(--radius-md, 8px);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.auth-field input::placeholder,
.auth-input::placeholder {
  color: var(--theme-text-dim);
}

.auth-field input:hover,
.auth-input:hover {
  border-color: rgba(255,255,255,0.2);
}

.auth-field input:focus,
.auth-input:focus {
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.auth-field input.is-invalid,
.auth-input.is-invalid {
  border-color: var(--error, #dc2626);
}

.auth-field input.is-invalid:focus,
.auth-input.is-invalid:focus {
  border-color: var(--error, #dc2626);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

/* --------------------------------------------------------------------------
   6. Password Input with Show/Hide Toggle
   -------------------------------------------------------------------------- */

.auth-password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-password-wrapper input {
  padding-right: 52px; /* space for the toggle button */
}

.auth-password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: none;
  border: none;
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  color: var(--theme-text-muted);
  transition: color 0.15s ease, background-color 0.15s ease;
}

.auth-password-toggle:hover {
  color: var(--theme-text-secondary);
  background-color: var(--theme-border);
}

.auth-password-toggle:focus-visible {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: -2px;
}

.auth-password-toggle svg,
.auth-password-toggle .icon {
  width: 20px;
  height: 20px;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   7. Auth Submit Button
   -------------------------------------------------------------------------- */

.auth-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 16px 24px;
  margin-top: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--theme-text);
  background-color: var(--primary, #2563eb);
  border: none;
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.auth-submit:hover {
  background-color: var(--primary-hover, #1d4ed8);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.auth-submit:focus-visible {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: 2px;
}

.auth-submit:active {
  background-color: var(--primary-active, #1e40af);
  box-shadow: none;
}

.auth-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

/* --------------------------------------------------------------------------
   8. Auth Links (forgot password, sign up instead, etc.)
   -------------------------------------------------------------------------- */

.auth-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  text-align: center;
}

.auth-links a,
.auth-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--primary, #2563eb);
  text-decoration: none;
  transition: color 0.15s ease;
}

.auth-links a:hover,
.auth-link:hover {
  color: var(--primary-hover, #1d4ed8);
  text-decoration: underline;
}

.auth-links a:focus-visible,
.auth-link:focus-visible {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: 2px;
  border-radius: 2px;
}

.auth-links p {
  margin: 0;
  font-size: 14px;
  color: var(--theme-text-muted);
}

.auth-links p a {
  font-weight: 600;
}

/* Inline "forgot password" link aligned right inside the form */
.auth-field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.auth-field-row label {
  margin-bottom: 0;
}

.auth-field-row .auth-link {
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   9. Auth Divider ("or" separator)
   -------------------------------------------------------------------------- */

.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--theme-border-input);
}

.auth-divider span {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--theme-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* --------------------------------------------------------------------------
   10. Error Message
   -------------------------------------------------------------------------- */

.auth-error {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md, 8px);
  font-size: 14px;
  line-height: 1.5;
  color: #ef4444;
}

.auth-error .auth-error-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  color: var(--error, #dc2626);
}

.auth-error p {
  margin: 0;
}

/* Inline field-level error */
.auth-field-error {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--error, #dc2626);
}

/* --------------------------------------------------------------------------
   11. Success Message
   -------------------------------------------------------------------------- */

.auth-success {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-md, 8px);
  font-size: 14px;
  line-height: 1.5;
  color: #10b981;
}

.auth-success .auth-success-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  color: var(--success, #16a34a);
}

.auth-success p {
  margin: 0;
}

/* --------------------------------------------------------------------------
   12. Password Strength Indicator
   -------------------------------------------------------------------------- */

.password-strength {
  display: flex;
  gap: 4px;
  margin-top: 10px;
}

.password-strength-segment {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background-color: var(--theme-border-input);
  transition: background-color 0.25s ease;
}

/* Strength levels — apply to container, segments light up via nth-child */
.password-strength[data-strength="1"] .password-strength-segment:nth-child(-n+1) {
  background-color: var(--error, #dc2626);
}

.password-strength[data-strength="2"] .password-strength-segment:nth-child(-n+2) {
  background-color: var(--warning, #f59e0b);
}

.password-strength[data-strength="3"] .password-strength-segment:nth-child(-n+3) {
  background-color: var(--info, #3b82f6);
}

.password-strength[data-strength="4"] .password-strength-segment:nth-child(-n+4) {
  background-color: var(--success, #16a34a);
}

.password-strength-label {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary, #6b7280);
}

.password-strength[data-strength="1"] ~ .password-strength-label {
  color: var(--error, #dc2626);
}

.password-strength[data-strength="2"] ~ .password-strength-label {
  color: var(--warning, #f59e0b);
}

.password-strength[data-strength="3"] ~ .password-strength-label {
  color: var(--info, #3b82f6);
}

.password-strength[data-strength="4"] ~ .password-strength-label {
  color: var(--success, #16a34a);
}

/* --------------------------------------------------------------------------
   13. Auth Footer (privacy policy, terms links)
   -------------------------------------------------------------------------- */

.auth-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--theme-border);
  text-align: center;
}

.auth-footer span {
  font-size: 13px;
  color: var(--theme-text-dim);
}

.auth-footer a {
  font-size: 13px;
  font-weight: 500;
  color: var(--theme-text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.auth-footer a:hover {
  color: var(--primary, #2563eb);
  text-decoration: underline;
}

.auth-footer a:focus-visible {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: 2px;
  border-radius: 2px;
}

.auth-footer .auth-footer-separator {
  color: var(--text-tertiary, #9ca3af);
  user-select: none;
}

/* --------------------------------------------------------------------------
   14. Loading State on Submit Button
   -------------------------------------------------------------------------- */

.auth-submit.is-loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.auth-submit.is-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  margin-top: -11px;
  margin-left: -11px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: auth-spinner 0.6s linear infinite;
}

@keyframes auth-spinner {
  to {
    transform: rotate(360deg);
  }
}

/* --------------------------------------------------------------------------
   15. Responsive — Full Width on Mobile
   -------------------------------------------------------------------------- */

@media (max-width: 480px) {
  .auth-page {
    padding: 16px 0;
    align-items: flex-start;
    background-color: var(--theme-bg);
  }

  .auth-card {
    max-width: 100%;
    padding: 28px 20px;
    box-shadow: none;
    border-radius: 0;
  }

  .auth-header {
    margin-bottom: 24px;
  }

  .auth-header .auth-title {
    font-size: 22px;
  }

  .auth-field input[type="text"],
  .auth-field input[type="email"],
  .auth-field input[type="password"],
  .auth-field input[type="tel"],
  .auth-field select,
  .auth-input {
    padding: 14px;
  }

  .auth-submit {
    padding: 14px 20px;
  }

  .auth-footer {
    margin-top: 24px;
    padding-top: 20px;
  }
}

/* Tablet and small desktop — minor padding tweak */
@media (min-width: 481px) and (max-width: 768px) {
  .auth-card {
    padding: 36px 32px;
  }
}

/* --------------------------------------------------------------------------
   Social / OAuth Buttons (bonus utility for auth pages)
   -------------------------------------------------------------------------- */

.auth-social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 24px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--theme-text-body);
  background-color: var(--theme-input-bg);
  border: 1px solid var(--theme-border-input);
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.auth-social-btn + .auth-social-btn {
  margin-top: 10px;
}

.auth-social-btn:hover {
  background-color: var(--theme-card-bg);
  border-color: rgba(255,255,255,0.2);
}

.auth-social-btn:focus-visible {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: 2px;
}

.auth-social-btn .auth-social-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

/* --------------------------------------------------------------------------
   Checkbox (Remember me, agree to terms)
   -------------------------------------------------------------------------- */

.auth-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
}

.auth-checkbox input[type="checkbox"] {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--primary, #2563eb);
  border-radius: var(--radius-sm, 4px);
  cursor: pointer;
}

.auth-checkbox label {
  font-size: 14px;
  line-height: 1.5;
  color: var(--theme-text-muted);
  cursor: pointer;
}

.auth-checkbox label a {
  color: var(--primary, #2563eb);
  text-decoration: none;
  font-weight: 500;
}

.auth-checkbox label a:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Transitions for visibility toggling (JS hooks)
   -------------------------------------------------------------------------- */

.auth-fade-enter {
  opacity: 0;
  transform: translateY(-6px);
}

.auth-fade-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* --------------------------------------------------------------------------
   Google OAuth Button
   -------------------------------------------------------------------------- */
.auth-google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 24px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--theme-text-body);
  background-color: var(--theme-input-bg);
  border: 1px solid var(--theme-border-input);
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.auth-google-btn:hover {
  background-color: var(--theme-card-bg);
  border-color: rgba(255,255,255,0.2);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.auth-google-btn:focus-visible {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: 2px;
}

.auth-google-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-google-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

/* Auth card heading + subtext (used on signup) */
.auth-card__heading {
  font-family: 'Oswald', 'Inter', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--theme-text);
  margin: 0 0 0.5rem;
  text-align: center;
}

.auth-card__subtext {
  font-size: 0.9375rem;
  color: var(--theme-text-muted);
  text-align: center;
  margin: 0 0 1.5rem;
  line-height: 1.5;
}

/* Auth message styles */
.auth-msg {
  padding: 12px 16px;
  border-radius: var(--radius-md, 8px);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.auth-msg--error {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.auth-msg--success {
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #10b981;
}

/* Auth button */
.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 24px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--theme-text);
  background-color: var(--primary, #2563eb);
  border: none;
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
  margin-top: 8px;
}

.auth-btn:hover {
  background-color: #1d4ed8;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.auth-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.auth-btn__loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Ensure hidden attribute works even when CSS sets display */
.auth-btn__loading[hidden],
.auth-btn__text[hidden],
[hidden] {
  display: none !important;
}

.auth-spinner {
  width: 20px;
  height: 20px;
  animation: auth-spinner 0.6s linear infinite;
}

/* Auth label and input utility */
.auth-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--theme-text-secondary);
  margin-bottom: 6px;
}

/* Auth field actions row (forgot password) */
.auth-field--actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 4px;
}

.auth-link--forgot {
  font-size: 13px;
  font-weight: 500;
  color: var(--primary, #2563eb);
  text-decoration: none;
}

.auth-link--forgot:hover {
  text-decoration: underline;
}

/* Auth trust badges */
.auth-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  font-size: 0.8125rem;
  color: var(--theme-text-dim);
}

.auth-trust__badge {
  font-weight: 500;
}

.auth-trust__sep {
  color: var(--theme-border-input);
}

/* Auth alternate link */
.auth-alt {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--theme-text-muted);
}

.auth-alt a {
  color: var(--primary, #2563eb);
  font-weight: 600;
  text-decoration: none;
}

.auth-alt a:hover {
  text-decoration: underline;
}

/* Auth nav bar */
.auth-nav {
  padding: 16px 24px;
  border-bottom: 1px solid var(--theme-border);
}

.auth-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
}

.auth-nav__logo {
  font-family: 'Oswald', sans-serif;
  font-weight: 800;
  font-size: 1.125rem;
  color: var(--theme-text);
  text-decoration: none;
}

.auth-nav__link {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary, #2563eb);
  text-decoration: none;
}

.auth-nav__link:hover {
  text-decoration: underline;
}

/* Auth main container */
.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
  padding: 40px 16px;
}

/* Auth footer */
.auth-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px;
  border-top: 1px solid var(--theme-border);
}

.auth-footer__copy {
  font-size: 13px;
  color: var(--theme-text-dim);
  margin: 0;
}

.auth-footer__links {
  display: flex;
  gap: 16px;
}

.auth-footer__links a {
  font-size: 13px;
  color: var(--theme-text-muted);
  text-decoration: none;
}

.auth-footer__links a:hover {
  color: var(--primary, #2563eb);
}

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--theme-border-input);
}

.auth-divider span {
  font-size: 13px;
  font-weight: 500;
  color: var(--theme-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Password strength bar inline */
.password-strength__bar {
  height: 4px;
  background: var(--theme-border-input);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}

.password-strength__fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.25s ease, background 0.25s ease;
  width: 0%;
}

.password-strength__label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin-top: 4px;
}
