/* ProDigit auth pages (login, signup, forgot password) */

html[data-auth-ui] {
  color-scheme: dark;
}

html[data-auth-ui],
html[data-auth-ui] body.auth-body {
  overflow-x: hidden;
}

html[data-auth-ui],
html[data-auth-ui] body.auth-body {
  --auth-page-bg: #05070b;
  --auth-card-bg: #111827;
  --auth-card-border: rgba(255, 255, 255, 0.14);
  --auth-text: #f8fafc;
  --auth-text-body: #cbd5e1;
  --auth-text-muted: #94a3b8;
  --auth-input-bg: #05070b;
  --auth-input-text: #f8fafc;
  --auth-placeholder: #64748b;
  --auth-accent: #22d3ee;
  --auth-accent-hover: #67e8f9;
  --auth-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

html[data-auth-ui] body.auth-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans, Inter, system-ui, sans-serif);
  color: var(--auth-text-body);
  background: var(--auth-page-bg);
}

.auth-loading {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--auth-page-bg, #05070b);
  color: var(--auth-text-muted, #94a3b8);
  font-size: var(--text-sm, 0.875rem);
}

.auth-loading[hidden] {
  display: none !important;
}

.auth-loading__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3, 0.75rem);
  max-width: 22rem;
  padding: 0 var(--space-4, 1rem);
  text-align: center;
}

.auth-loading .app-still-loading__actions {
  justify-content: center;
}

.auth-loading__spinner {
  width: 2rem;
  height: 2rem;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--auth-accent, #22d3ee);
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}

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

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6, 1.5rem) var(--space-4, 1rem);
  background: var(--auth-page-bg, #05070b);
}

.auth-page[hidden],
#auth-loading[hidden] {
  display: none !important;
}

.auth-signed-in-root:not([hidden]) {
  position: relative;
  z-index: 10;
}

.auth-signed-in-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3, 0.75rem);
  margin: var(--space-5, 1.25rem) 0;
  position: relative;
  z-index: 5;
  pointer-events: auto;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(24rem, 100%);
  padding: var(--space-8, 2rem);
  background: var(--auth-card-bg, #111827);
  border: 1px solid var(--auth-card-border, rgba(255, 255, 255, 0.14));
  border-radius: var(--radius-lg, 16px);
  box-shadow: var(--auth-shadow);
  color: var(--auth-text-body, #cbd5e1);
}

.auth-card .app-shell__brand,
.auth-card a.app-shell__brand {
  color: var(--auth-text, #f8fafc) !important;
  font-weight: 700;
  text-decoration: none;
}

.auth-card h1 {
  margin: 0 0 var(--space-2, 0.5rem);
  font-size: var(--text-2xl, 1.5rem);
  font-weight: 700;
  color: var(--auth-text, #f8fafc);
  letter-spacing: -0.02em;
}

.auth-card__lead {
  margin: 0 0 var(--space-6, 1.5rem);
  font-size: var(--text-sm, 0.875rem);
  line-height: 1.55;
  color: var(--auth-text-muted, #94a3b8);
}

.auth-demo-hint {
  margin-bottom: var(--space-4, 1rem);
  padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
  font-size: var(--text-xs, 0.75rem);
  line-height: 1.5;
  color: var(--auth-text-body, #cbd5e1);
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.22);
  border-radius: var(--radius-md, 12px);
}

.auth-demo-hint strong {
  color: var(--auth-text, #f8fafc);
}

.auth-demo-hint code {
  font-size: 0.85em;
  color: var(--auth-accent, #22d3ee);
}

.auth-demo-hint a {
  color: var(--auth-accent, #22d3ee);
  font-weight: 600;
}

.auth-field {
  display: block;
  margin-bottom: var(--space-4, 1rem);
}

.auth-field span {
  display: block;
  margin-bottom: var(--space-2, 0.5rem);
  font-size: var(--text-sm, 0.875rem);
  font-weight: 500;
  color: var(--auth-text-muted, #94a3b8);
}

.auth-field input {
  width: 100%;
  padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
  font-family: inherit;
  font-size: var(--text-base, 1rem);
  color: var(--auth-input-text, #f8fafc);
  background: var(--auth-input-bg, #05070b);
  border: 1px solid var(--auth-card-border, rgba(255, 255, 255, 0.14));
  border-radius: var(--radius-md, 12px);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-field input::placeholder {
  color: var(--auth-placeholder, #64748b);
}

.auth-field input:focus {
  outline: none;
  border-color: var(--auth-accent, #22d3ee);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.2);
}

.auth-field input:-webkit-autofill,
.auth-field input:-webkit-autofill:hover,
.auth-field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--auth-input-text, #f8fafc);
  -webkit-box-shadow: 0 0 0 1000px var(--auth-input-bg, #05070b) inset;
  box-shadow: 0 0 0 1000px var(--auth-input-bg, #05070b) inset;
  border: 1px solid var(--auth-card-border, rgba(255, 255, 255, 0.14));
  transition: background-color 99999s ease-out 0s;
}

.auth-links {
  margin-top: var(--space-4, 1rem);
  font-size: var(--text-sm, 0.875rem);
  text-align: center;
  color: var(--auth-text-muted, #94a3b8);
}

.auth-links a {
  color: var(--auth-accent, #22d3ee);
  font-weight: 500;
  text-decoration: none;
}

.auth-links a:hover {
  color: var(--auth-accent-hover, #67e8f9);
  text-decoration: underline;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3, 0.75rem);
  margin: var(--space-4, 1rem) 0;
  font-size: var(--text-xs, 0.75rem);
  color: var(--auth-text-muted, #94a3b8);
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--auth-card-border, rgba(255, 255, 255, 0.14));
}

.auth-google-btn {
  width: 100%;
  margin-bottom: 0;
  color: var(--auth-text, #f8fafc) !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid var(--auth-card-border, rgba(255, 255, 255, 0.14)) !important;
}

.auth-google-btn:hover:not(:disabled) {
  border-color: var(--auth-accent, #22d3ee) !important;
  color: var(--auth-accent, #22d3ee) !important;
}

.auth-google-btn:disabled {
  opacity: 0.55;
  color: var(--auth-text-muted, #94a3b8) !important;
}

html[data-auth-ui] .auth-card .btn--primary {
  width: 100%;
  color: #0a0a0b;
  background: var(--auth-accent, #22d3ee);
  border-color: var(--auth-accent, #22d3ee);
  font-weight: 600;
}

html[data-auth-ui] .auth-card .btn--primary:hover {
  background: var(--auth-accent-hover, #67e8f9);
  border-color: var(--auth-accent-hover, #67e8f9);
}

html[data-auth-ui] .auth-card .btn--ghost {
  color: var(--auth-text, #f8fafc);
  border-color: var(--auth-card-border, rgba(255, 255, 255, 0.14));
  background: transparent;
}

.auth-submit {
  width: 100%;
  margin-top: var(--space-2, 0.5rem);
}

.auth-message {
  margin: var(--space-4, 1rem) 0 0;
  padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
  font-size: var(--text-sm, 0.875rem);
  line-height: 1.45;
  border-radius: var(--radius-md, 12px);
}

.auth-message--error {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.auth-message--success {
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.auth-message--info {
  color: #bae6fd;
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.28);
}

.auth-card--polished {
  width: min(27rem, 100%);
  padding: var(--space-8, 2rem) var(--space-8, 2rem) var(--space-6, 1.5rem);
  background: linear-gradient(165deg, #141a24 0%, #111827 55%, #0f172a 100%);
  border: 1px solid var(--auth-card-border);
  box-shadow: var(--auth-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.auth-card--polished h1 {
  margin-top: 0;
}

.auth-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3, 0.75rem);
  margin-bottom: var(--space-5, 1.25rem);
}

.auth-card__brand {
  font-size: var(--text-lg, 1.125rem);
  font-weight: 700;
  color: var(--auth-text, #f8fafc);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.auth-notice__badge,
[data-auth-testing-badge] {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #67e8f9;
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.35);
  border-radius: 999px;
}

.auth-notice {
  margin-bottom: var(--space-5, 1.25rem);
  padding: var(--space-4, 1rem);
  font-size: var(--text-sm, 0.875rem);
  line-height: 1.55;
  border-radius: var(--radius-md, 12px);
}

.auth-notice--info {
  color: var(--auth-text-body, #cbd5e1);
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-left: 3px solid rgba(34, 211, 238, 0.55);
}

.auth-notice--info p {
  margin: 0;
}

.auth-divider span {
  padding: 0 var(--space-2, 0.5rem);
  white-space: nowrap;
}

.auth-links__sep {
  margin: 0 var(--space-2, 0.5rem);
  color: var(--auth-text-muted, #94a3b8);
}

.auth-card__footer {
  margin-top: var(--space-6, 1.5rem);
  padding-top: var(--space-4, 1rem);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-card__footer p {
  margin: 0;
  font-size: var(--text-xs, 0.75rem);
  line-height: 1.5;
  color: var(--auth-text-muted, #94a3b8);
}

html[data-auth-ui] .auth-card .btn--primary:focus-visible,
html[data-auth-ui] .auth-card .btn--ghost:focus-visible,
.auth-field input:focus-visible {
  outline: 2px solid var(--auth-accent, #22d3ee);
  outline-offset: 2px;
}

.auth-card--polished .auth-field:last-of-type {
  margin-bottom: var(--space-5, 1.25rem);
}

.auth-card--polished .auth-divider {
  margin: var(--space-5, 1.25rem) 0;
}

.auth-card--polished .auth-google-btn {
  min-height: 2.75rem;
}

@media (max-width: 430px) {
  .auth-page {
    padding: var(--space-4, 1rem);
    align-items: flex-start;
    padding-top: var(--space-6, 1.5rem);
  }

  .auth-card,
  .auth-card--polished {
    padding: var(--space-6, 1.5rem);
  }

  .auth-card__header {
    flex-wrap: wrap;
  }

  .auth-card__footer {
    margin-top: var(--space-5, 1.25rem);
  }
}

.auth-card--wide {
  max-width: 28rem;
}

.auth-tabs {
  display: flex;
  gap: 0.25rem;
  margin: var(--space-4, 1rem) 0 var(--space-5, 1.25rem);
  padding: 0.25rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-tabs__btn {
  flex: 1;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.625rem 0.5rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.auth-tabs__btn.is-active {
  background: rgba(34, 211, 238, 0.12);
  color: #e2e8f0;
}

.auth-tabs__btn:hover {
  color: #f8fafc;
}

.auth-link-btn {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: #22d3ee;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 430px) {
  .auth-tabs__btn {
    font-size: 0.75rem;
    padding: 0.5rem 0.25rem;
  }
}

.auth-notice__badge--beta {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  border-color: rgba(139, 92, 246, 0.35);
}

.auth-notice--beta {
  margin-bottom: var(--space-4, 1rem);
}

.auth-notice--beta .auth-notice__title {
  font-weight: 600;
  margin: 0 0 0.35rem;
  color: #e2e8f0;
}

.auth-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
  position: relative;
  z-index: 5;
  pointer-events: auto;
  font-family: inherit;
  font-size: var(--text-base, 1rem);
  font-weight: 600;
  padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
  border-radius: var(--radius-md, 12px);
  border: 1px solid transparent;
  cursor: pointer;
}

.auth-button--primary {
  color: #05070b;
  background: var(--auth-accent, #22d3ee);
  border-color: var(--auth-accent, #22d3ee);
}

.auth-button--primary:hover {
  background: var(--auth-accent-hover, #67e8f9);
  border-color: var(--auth-accent-hover, #67e8f9);
  color: #05070b;
  text-decoration: none;
}

.auth-button--ghost {
  color: var(--auth-text-body, #cbd5e1);
  background: transparent;
  border-color: var(--auth-card-border, rgba(255, 255, 255, 0.14));
}

.auth-button--ghost:hover {
  border-color: var(--auth-accent, #22d3ee);
  color: var(--auth-accent, #22d3ee);
}

.auth-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-inline-notice {
  margin: 0 0 var(--space-4, 1rem);
  font-size: var(--text-xs, 0.75rem);
  color: var(--auth-text-muted, #94a3b8);
}

.auth-field-hint {
  display: block;
  margin-top: var(--space-2, 0.5rem);
  font-size: var(--text-xs, 0.75rem);
  line-height: 1.4;
}

.auth-field-hint--warn {
  color: #fbbf24;
}

.auth-password-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.auth-password-wrap input {
  width: 100%;
  padding-right: 2.75rem;
  min-height: 2.75rem;
}

.auth-field--password {
  margin-bottom: var(--space-4, 1rem);
}

@media (max-width: 430px) {
  .auth-password-wrap input {
    font-size: 1rem;
    min-height: 3rem;
    padding-right: 3rem;
  }

  .auth-password-toggle {
    right: 0.35rem;
    width: 2.5rem;
    height: 2.5rem;
  }

  .auth-field--password {
    margin-bottom: var(--space-3, 0.75rem);
  }
}

.auth-password-toggle {
  position: absolute;
  right: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--auth-text-muted, #94a3b8);
  cursor: pointer;
  border-radius: var(--radius-sm, 8px);
}

.auth-password-toggle:hover,
.auth-password-toggle:focus-visible {
  color: var(--auth-accent, #22d3ee);
  outline: none;
}

.auth-password-toggle:focus-visible {
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.35);
}

.auth-password-toggle__icon {
  display: block;
  pointer-events: none;
}

.auth-password-toggle__icon[hidden] {
  display: none !important;
}

.auth-field input.auth-input--weak {
  border-color: rgba(248, 113, 113, 0.65);
}

.auth-field input.auth-input--partial {
  border-color: rgba(251, 191, 36, 0.55);
}

.auth-field input.auth-input--secure {
  border-color: rgba(52, 211, 153, 0.65);
}

.auth-password-checklist {
  list-style: none;
  margin: 0 0 var(--space-4, 1rem);
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.75rem;
  font-size: var(--text-xs, 0.75rem);
  color: var(--auth-text-muted, #94a3b8);
}

.auth-password-checklist li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.auth-password-checklist .auth-check-icon::before {
  content: "";
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.45);
}

.auth-password-checklist li.is-pass {
  color: #6ee7b7;
}

.auth-password-checklist li.is-pass .auth-check-icon::before {
  background: #34d399;
}

.auth-password-checklist li.is-fail {
  color: #fca5a5;
}

.auth-password-checklist li.is-fail .auth-check-icon::before {
  background: #f87171;
}

#auth-signup-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.auth-message--success {
  color: #6ee7b7;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: var(--radius-md, 12px);
  padding: 0.65rem 0.85rem;
  font-size: var(--text-sm, 0.875rem);
}

.auth-google-btn--primary,
.auth-google-btn.btn--primary {
  color: #0a0a0b !important;
  background: var(--auth-accent, #22d3ee) !important;
  border-color: var(--auth-accent, #22d3ee) !important;
  font-weight: 600;
}

.auth-google-btn--primary:hover:not(:disabled),
.auth-google-btn.btn--primary:hover:not(:disabled) {
  color: #0a0a0b !important;
  background: var(--auth-accent-hover, #67e8f9) !important;
  border-color: var(--auth-accent-hover, #67e8f9) !important;
}

.auth-inline-notice--beta {
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--auth-text-muted, #94a3b8);
  background: rgba(34, 211, 238, 0.06);
  border: 1px solid rgba(34, 211, 238, 0.18);
  border-radius: 0.65rem;
}

.auth-email-fallback {
  margin-top: 1rem;
}

.auth-email-fallback summary {
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--auth-text-muted, #94a3b8);
  list-style: none;
}

.auth-email-fallback summary::-webkit-details-marker {
  display: none;
}

.auth-email-fallback[open] summary {
  margin-bottom: 0.75rem;
  color: var(--auth-text, #f8fafc);
}
