/**
 * Auth – Split layout: form left, animated lines background right.
 * Uses 100% Mantine design tokens (spacing, radius, input height, colors).
 */
body.auth-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: #0f0f0f;
  color: #fff;
  line-height: 1.6;
  font-family: "Noto Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.auth-wrapper {
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-wrap: wrap;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
    #171717;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  position: relative;
}

.auth-lines {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
  width: 90vw;
  pointer-events: none;
}

.auth-line {
  position: absolute;
  width: 1px;
  height: 100%;
  top: 0;
  left: 50%;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.auth-line::after {
  content: '';
  display: block;
  position: absolute;
  height: 15vh;
  width: 100%;
  top: -50%;
  left: 0;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, #ffffff 75%, #ffffff 100%);
  animation: auth-line-drop 7s 0s infinite;
  animation-fill-mode: forwards;
  animation-timing-function: cubic-bezier(0.4, 0.26, 0, 0.97);
}

.auth-line:nth-child(1) {
  margin-left: -25%;
}

.auth-line:nth-child(1)::after {
  animation-delay: 2s;
}

.auth-line:nth-child(2)::after {
  animation-delay: 0s;
}

.auth-line:nth-child(3) {
  margin-left: 25%;
}

.auth-line:nth-child(3)::after {
  animation-delay: 2.5s;
}

@keyframes auth-line-drop {
  0% { top: -50%; }
  100% { top: 110%; }
}

.auth-form {
  box-sizing: border-box;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  min-height: 100vh;
  width: 100%;
  max-width: 420px;
  min-width: 0;
  padding: 2rem 2rem 2.5rem;
  padding-top: 3.5rem;
  border-radius: 0;
  background: linear-gradient(180deg, rgba(26, 26, 28, 0.97) 0%, rgba(18, 18, 20, 0.98) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 4px 0 32px rgba(0, 0, 0, 0.5), inset 1px 0 0 rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
  z-index: 1;
  animation: auth-form-enter 0.5s ease-out;
}

@keyframes auth-form-enter {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

.auth-form::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #2563eb 0%, #3b82f6 25%, #60a5fa 50%, #3b82f6 75%, #2563eb 100%);
  background-size: 200% 100%;
  animation: auth-accent-shimmer 6s ease-in-out infinite;
  opacity: 1;
}

@keyframes auth-accent-shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.auth-theme-toggle {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.auth-page-register .auth-brand {
  margin-top: -2px;
}

.auth-brand-logo {
  height: 44px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  object-position: left center;
}

.auth-brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: contain;
  flex-shrink: 0;
}

.auth-brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.03em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

[data-mantine-color-scheme=light] .auth-brand-name {
  color: #0f172a;
}

@media (max-width: 768px) {
  .auth-form { max-width: 100%; border-right: none; padding: var(--mantine-spacing-lg); }
  .auth-lines { opacity: 0.5; }
}

.auth-title {
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: 1.875rem;
  letter-spacing: -0.03em;
  text-align: center;
  margin: 0 0 0.25rem;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.auth-subtitle {
  font-size: 0.9375rem;
  color: #94a3b8;
  text-align: center;
  margin: 0 0 1.75rem;
  line-height: 1.5;
  letter-spacing: 0.01em;
}

.auth-form form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.auth-input-wrap {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.auth-input-wrap label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #94a3b8;
  margin-bottom: 0.375rem;
}

.auth-input {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 2.875rem;
  height: 2.875rem;
  padding: 0 1rem;
  font-size: 0.9375rem;
  font-family: inherit;
  line-height: 1.55;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(30, 30, 34, 0.9);
  color: #fff;
  outline: none;
  transition: border-color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

.auth-input::placeholder {
  color: #64748b;
}

.auth-input:hover {
  background: rgba(38, 38, 42, 0.95);
  border-color: rgba(255, 255, 255, 0.12);
}

.auth-input:focus {
  border-color: #3b82f6;
  background: rgba(30, 30, 34, 0.98);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.28);
}

/* Autofill: override Chrome’s yellow – box-shadow trick per https://stackoverflow.com/q/6282325 */
.auth-form input:-webkit-autofill,
.auth-form input:-webkit-autofill:hover,
.auth-form input:-webkit-autofill:focus,
.auth-form input:-webkit-autofill:active,
.auth-form input:autofill,
.auth-form input:autofill:hover,
.auth-form input:autofill:focus,
.auth-form input:autofill:active,
.auth-input:-webkit-autofill,
.auth-input:-webkit-autofill:hover,
.auth-input:-webkit-autofill:focus,
.auth-input:-webkit-autofill:active,
.auth-input:autofill,
.auth-input:autofill:hover,
.auth-input:autofill:focus,
.auth-input:autofill:active {
  -webkit-text-fill-color: #fff !important;
  -webkit-box-shadow: 0 0 0px 1000px #1e1e22 inset !important;
  box-shadow: 0 0 0px 1000px #1e1e22 inset !important;
  /* Long delay prevents Chrome from applying its autofill background */
  caret-color: #fff !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  transition: background-color 0s 600000s, color 0s 600000s !important;
}

.auth-checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.875rem;
  color: #94a3b8;
}

.auth-checkbox-wrap input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: #3b82f6;
  border-radius: 4px;
}

/* Turnstile: override flex stretch so we can center. Form uses flex column + stretch. */
.auth-turnstile-wrap {
  align-self: center;
  width: 300px;
  max-width: 100%;
  margin: 0.25rem 0;
  min-height: 65px;
  box-sizing: border-box;
}

.auth-turnstile-card {
  display: block;
}

.auth-turnstile-card iframe {
  width: 100% !important;
  height: 65px !important;
  display: block !important;
}

.auth-btn {
  width: 100%;
  min-height: 3rem;
  padding: 0 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
  background-size: 200% 100%;
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-position 0.4s ease;
  margin-top: var(--mantine-spacing-xs);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
  position: relative;
  overflow: hidden;
}

.auth-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left 0.5s ease;
}

.auth-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
  background-position: 100% 0;
}

.auth-btn:hover:not(:disabled)::after {
  left: 100%;
}

.auth-btn:active:not(:disabled) {
  transform: translateY(0);
}

.auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-forgot {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 1rem 0 0;
  padding: 0.875rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.auth-forgot a {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 0.4rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #93c5fd;
  text-decoration: none;
  background: rgba(96, 165, 250, 0.08);
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: 8px;
  transition: all 0.2s ease;
}
.auth-forgot a:hover {
  color: #fff;
  background: rgba(96, 165, 250, 0.18);
  border-color: rgba(96, 165, 250, 0.4);
  transform: translateY(-1px);
}
.auth-forgot a:active {
  transform: translateY(0);
}
[data-mantine-color-scheme="light"] .auth-forgot {
  border-top-color: rgba(0, 0, 0, 0.06);
}
[data-mantine-color-scheme="light"] .auth-forgot a {
  color: #2563eb;
  background: rgba(37, 99, 235, 0.06);
  border-color: rgba(37, 99, 235, 0.2);
}
[data-mantine-color-scheme="light"] .auth-forgot a:hover {
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.35);
}

.auth-switch {
  text-align: center;
  margin-top: var(--mantine-spacing-xl);
  font-size: 0.9375rem;
  color: #94a3b8;
}

.auth-switch a {
  color: #60a5fa;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.auth-switch a:hover {
  color: #93c5fd;
}

.auth-error {
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 12px;
  color: #fca5a5;
  font-size: 0.875rem;
  line-height: 1.5;
}

.auth-success {
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 12px;
  color: #86efac;
  font-size: 0.875rem;
  line-height: 1.5;
}

.auth-hint {
  margin: 0 0 var(--mantine-spacing-md);
  font-size: var(--mantine-font-size-xs);
  opacity: 0.85;
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0 1rem;
  gap: 1rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  min-width: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.auth-divider span {
  padding: 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.auth-social-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 0.25rem;
}

.auth-social-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  min-height: 2.875rem;
  padding: 0 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(38, 38, 42, 0.85);
  color: #e2e8f0;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.auth-social-btn:hover:not(:disabled) {
  background: rgba(51, 51, 56, 0.95);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.auth-social-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-social-btn svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.auth-social-btn img {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

/* Light theme – matches navbar.css Mantine scheme */
[data-mantine-color-scheme=light] body.auth-page {
  background-color: #f1f5f9;
}

[data-mantine-color-scheme=light] .auth-wrapper {
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
    #f1f5f9;
}
[data-mantine-color-scheme=light] .auth-line {
  background: rgba(0, 0, 0, 0.08);
}
[data-mantine-color-scheme=light] .auth-line::after {
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.4) 75%, rgba(0, 0, 0, 0.5) 100%);
}
[data-mantine-color-scheme=light] .auth-form {
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.98) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right-color: #e2e8f0;
  box-shadow: 4px 0 32px rgba(0, 0, 0, 0.08), inset 1px 0 0 rgba(255, 255, 255, 0.8);
}

[data-mantine-color-scheme=light] .auth-form::before {
  background: linear-gradient(90deg, #1d4ed8 0%, #2563eb 25%, #3b82f6 50%, #2563eb 75%, #1d4ed8 100%);
  background-size: 200% 100%;
  animation: auth-accent-shimmer 6s ease-in-out infinite;
}

[data-mantine-color-scheme=light] .auth-title {
  color: #0f172a;
}

[data-mantine-color-scheme=light] .auth-subtitle {
  color: #64748b;
}

[data-mantine-color-scheme=light] .auth-input-wrap label {
  color: #64748b;
}

[data-mantine-color-scheme=light] .auth-input {
  background: #fff;
  border-color: #e2e8f0;
  color: #0f172a;
  border-radius: 12px;
}

[data-mantine-color-scheme=light] .auth-input::placeholder {
  color: #94a3b8;
}

[data-mantine-color-scheme=light] .auth-input:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

[data-mantine-color-scheme=light] .auth-input:focus {
  background: #fff;
  border-color: #3b82f6;
}

[data-mantine-color-scheme=light] .auth-form input:-webkit-autofill,
[data-mantine-color-scheme=light] .auth-form input:-webkit-autofill:hover,
[data-mantine-color-scheme=light] .auth-form input:-webkit-autofill:focus,
[data-mantine-color-scheme=light] .auth-form input:-webkit-autofill:active,
[data-mantine-color-scheme=light] .auth-form input:autofill,
[data-mantine-color-scheme=light] .auth-form input:autofill:hover,
[data-mantine-color-scheme=light] .auth-form input:autofill:focus,
[data-mantine-color-scheme=light] .auth-form input:autofill:active,
[data-mantine-color-scheme=light] .auth-input:-webkit-autofill,
[data-mantine-color-scheme=light] .auth-input:-webkit-autofill:hover,
[data-mantine-color-scheme=light] .auth-input:-webkit-autofill:focus,
[data-mantine-color-scheme=light] .auth-input:-webkit-autofill:active,
[data-mantine-color-scheme=light] .auth-input:autofill,
[data-mantine-color-scheme=light] .auth-input:autofill:hover,
[data-mantine-color-scheme=light] .auth-input:autofill:focus,
[data-mantine-color-scheme=light] .auth-input:autofill:active {
  -webkit-text-fill-color: #0f172a !important;
  -webkit-box-shadow: 0 0 0px 1000px #fff inset !important;
  box-shadow: 0 0 0px 1000px #fff inset !important;
  caret-color: #0f172a !important;
  border-color: #e2e8f0 !important;
  transition: background-color 0s 600000s, color 0s 600000s !important;
}

[data-mantine-color-scheme=light] .auth-checkbox-wrap {
  color: #64748b;
}

[data-mantine-color-scheme=light] .auth-switch {
  color: #64748b;
}

[data-mantine-color-scheme=light] .auth-switch a {
  color: #2563eb;
}

[data-mantine-color-scheme=light] .auth-switch a:hover {
  color: #3b82f6;
}

[data-mantine-color-scheme=light] .auth-btn {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

[data-mantine-color-scheme=light] .auth-btn:hover:not(:disabled) {
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

[data-mantine-color-scheme=light] .auth-divider::before,
[data-mantine-color-scheme=light] .auth-divider::after {
  background: #e2e8f0;
}

[data-mantine-color-scheme=light] .auth-divider span {
  color: #64748b;
}

[data-mantine-color-scheme=light] .auth-social-btn {
  background: #fff;
  border-color: #e2e8f0;
  color: #334155;
}

[data-mantine-color-scheme=light] .auth-social-btn:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
