/* ============================================================
   Auth Pages — Zhi xing
   Premium dark aesthetic with teal brand accent
   Unified styles for login, register & forgot-password
   ============================================================ */

/* --- CSS Variables --- */
:root {
  --auth-bg: #05080f;
  --auth-surface: #0a0f1a;
  --auth-card-bg: rgba(10, 15, 26, 0.78);
  --auth-card-border: rgba(255, 255, 255, 0.07);
  --auth-accent: #1fa7c6;
  --auth-accent-strong: #1893af;
  --auth-accent-glow: rgba(31, 167, 198, 0.2);
  --auth-accent-soft: rgba(31, 167, 198, 0.08);
  --auth-input-bg: rgba(255, 255, 255, 0.04);
  --auth-input-border: rgba(255, 255, 255, 0.08);
  --auth-input-focus: rgba(31, 167, 198, 0.4);
  --auth-text: #eef3fa;
  --auth-text-soft: #91a0b3;
  --auth-text-muted: #4e5a6b;
  --auth-error: #f87171;
  --auth-success: #4ade80;
  --auth-radius: 16px;
  --auth-radius-sm: 10px;
  --auth-transition: 0.22s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* --- Page Container --- */
.auth-page {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 72px);
  overflow: hidden;
  background: var(--auth-bg);
  isolation: isolate;
}

/* --- Atmospheric Background --- */
.auth-atmos {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.auth-atmos-spot {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.28;
}

.auth-atmos-spot--1 {
  width: 720px;
  height: 720px;
  top: -220px;
  left: -120px;
  background: radial-gradient(circle, rgba(31, 167, 198, 0.16), transparent 70%);
  animation: auth-spot-1 14s ease-in-out infinite;
}

.auth-atmos-spot--2 {
  width: 560px;
  height: 560px;
  bottom: -180px;
  right: -100px;
  background: radial-gradient(circle, rgba(23, 56, 93, 0.18), transparent 70%);
  animation: auth-spot-2 16s ease-in-out infinite;
}

.auth-atmos-spot--3 {
  width: 400px;
  height: 400px;
  top: 40%;
  left: 55%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(31, 167, 198, 0.08), transparent 70%);
  animation: auth-spot-3 12s ease-in-out infinite;
}

@keyframes auth-spot-1 {
  0%, 100% { opacity: 0.22; transform: scale(1) rotate(0deg); }
  33%  { opacity: 0.35; transform: scale(1.08) rotate(1deg); }
  66%  { opacity: 0.25; transform: scale(0.96) rotate(-0.5deg); }
}

@keyframes auth-spot-2 {
  0%, 100% { opacity: 0.14; transform: scale(1.02); }
  50%  { opacity: 0.24; transform: scale(1.1); }
}

@keyframes auth-spot-3 {
  0%, 100% { opacity: 0.05; transform: translate(-50%, -50%) scale(1); }
  50%  { opacity: 0.12; transform: translate(-50%, -50%) scale(1.12); }
}

/* Dot grid overlay */
.auth-atmos-grid {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.025) 0.5px, transparent 0.5px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 25%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 25%, transparent 70%);
}

/* --- Two-Column Split Layout --- */
.auth-split {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 48px;
  gap: 0;
}

/* --- Brand Side (Left) --- */
.auth-brand {
  flex: 0 0 44%;
  padding-right: 64px;
  animation: auth-brand-in 0.8s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes auth-brand-in {
  from { opacity: 0; transform: translateX(-24px); }
  to   { opacity: 1; transform: translateX(0); }
}

.auth-brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 52px;
  padding: 10px 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.auth-brand-logo img {
  height: 32px;
  width: auto;
}

.auth-brand-logo span {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: var(--auth-text);
  letter-spacing: 0.04em;
}

.auth-brand-headline {
  font-family: var(--font-display);
  font-size: clamp(36px, 4.5vw, 54px);
  font-weight: 800;
  color: #ffffff;
  line-height: 1.08;
  margin: 0 0 20px;
  letter-spacing: -0.025em;
  max-width: 440px;
}

.auth-brand-headline mark {
  background: none;
  color: var(--auth-accent);
}

.auth-brand-desc {
  font-size: 16px;
  color: var(--auth-text-soft);
  line-height: 1.6;
  margin: 0 0 48px;
  max-width: 380px;
}

.auth-brand-features {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-brand-feature {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--auth-text-soft);
  letter-spacing: 0.02em;
}

.auth-brand-feature-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(31, 167, 198, 0.1);
  color: var(--auth-accent);
  flex-shrink: 0;
}

/* --- Card Side (Right) --- */
.auth-card-wrap {
  flex: 0 0 50%;
  display: flex;
  justify-content: center;
  animation: auth-card-in 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) 0.1s both;
}

@keyframes auth-card-in {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-card {
  width: 100%;
  max-width: 436px;
  padding: 40px 38px;
  border: 1px solid var(--auth-card-border);
  border-radius: 24px;
  background: var(--auth-card-bg);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.04) inset,
    0 16px 48px rgba(0, 0, 0, 0.45),
    0 4px 12px rgba(0, 0, 0, 0.25);
}

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

.auth-card-header h2 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.auth-card-header p {
  font-size: 14px;
  color: var(--auth-text-soft);
  margin: 0;
}

/* --- Role Tabs (Login) --- */
.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  padding: 5px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.auth-tab {
  flex: 1;
  padding: 11px 16px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--auth-text-soft);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--auth-transition);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.auth-tab:hover {
  color: var(--auth-text);
  background: rgba(255, 255, 255, 0.03);
}

.auth-tab.active {
  background: var(--auth-accent-soft);
  color: var(--auth-accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* --- Role Cards (Register) --- */
.auth-role-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 28px;
}

.auth-role-card {
  position: relative;
  padding: 20px 16px;
  border: 1.5px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: all var(--auth-transition);
  text-align: center;
  overflow: hidden;
}

.auth-role-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: radial-gradient(ellipse at center, rgba(31, 167, 198, 0.06), transparent 70%);
  opacity: 0;
  transition: opacity var(--auth-transition);
}

.auth-role-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
}

.auth-role-card:hover::before {
  opacity: 1;
}

.auth-role-card.active {
  border-color: rgba(31, 167, 198, 0.45);
  background: rgba(31, 167, 198, 0.08);
  box-shadow: 0 0 24px rgba(31, 167, 198, 0.1);
}

.auth-role-card.active::before {
  opacity: 1;
}

.auth-role-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  margin: 0 auto 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--auth-text-soft);
  transition: all var(--auth-transition);
}

.auth-role-card.active .auth-role-card-icon {
  background: var(--auth-accent-soft);
  color: var(--auth-accent);
}

.auth-role-card-label {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  color: var(--auth-text);
  margin: 0 0 4px;
}

.auth-role-card-desc {
  font-size: 12px;
  color: var(--auth-text-muted);
  margin: 0;
  line-height: 1.4;
}

.auth-role-card-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.6);
  transition: all var(--auth-transition);
}

.auth-role-card.active .auth-role-card-check {
  opacity: 1;
  transform: scale(1);
  border-color: var(--auth-accent);
  background: var(--auth-accent);
}

.auth-role-card-check svg {
  width: 11px;
  height: 11px;
  color: #fff;
}

/* --- Form Fields --- */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.auth-field-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--auth-text-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-wrap .auth-input-icon {
  position: absolute;
  left: 14px;
  display: flex;
  align-items: center;
  color: var(--auth-text-muted);
  pointer-events: none;
  transition: color var(--auth-transition);
  z-index: 1;
}

.auth-input-wrap input {
  width: 100%;
  padding: 13px 44px 13px 42px;
  border: 1px solid var(--auth-input-border);
  border-radius: var(--auth-radius-sm);
  background: var(--auth-input-bg);
  color: var(--auth-text);
  font-family: var(--font-body);
  font-size: 15px;
  outline: none;
  transition: all var(--auth-transition);
}

.auth-input-wrap input::placeholder {
  color: var(--auth-text-muted);
}

.auth-input-wrap input:focus {
  border-color: var(--auth-input-focus);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px var(--auth-accent-glow);
}

.auth-input-wrap input:focus ~ .auth-input-icon {
  color: var(--auth-accent);
}

/* Field with error */
.auth-field.has-error .auth-input-wrap input {
  border-color: var(--auth-error);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15);
}

.auth-field-error {
  font-size: 12px;
  color: var(--auth-error);
  margin-top: 6px;
  padding-left: 2px;
  animation: auth-error-in 0.2s ease;
}

@keyframes auth-error-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Password toggle */
.auth-password-toggle {
  position: absolute;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--auth-text-muted);
  cursor: pointer;
  transition: all var(--auth-transition);
}

.auth-password-toggle:hover {
  color: var(--auth-text-soft);
  background: rgba(255, 255, 255, 0.05);
}

/* --- Row: remember + forgot --- */
.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.auth-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--auth-text-soft);
  user-select: none;
}

.auth-remember input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  position: relative;
  transition: all var(--auth-transition);
  flex-shrink: 0;
}

.auth-remember input[type="checkbox"]:checked {
  background: var(--auth-accent);
  border-color: var(--auth-accent);
}

.auth-remember input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.auth-forgot {
  font-size: 13px;
  font-weight: 600;
  color: var(--auth-text-soft);
  text-decoration: none;
  transition: color var(--auth-transition);
}

.auth-forgot:hover {
  color: var(--auth-accent);
}

/* --- File Upload Zone --- */
.auth-file-upload {
  position: relative;
  padding: 28px 20px;
  border: 2px dashed rgba(255, 255, 255, 0.08);
  border-radius: var(--auth-radius-sm);
  background: rgba(255, 255, 255, 0.02);
  text-align: center;
  cursor: pointer;
  transition: all var(--auth-transition);
}

.auth-file-upload:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
}

.auth-file-upload.has-file {
  border-color: var(--auth-success);
  border-style: solid;
  background: rgba(74, 222, 128, 0.05);
}

.auth-file-upload-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  margin: 0 auto 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--auth-text-soft);
}

.auth-file-upload p {
  font-size: 13px;
  color: var(--auth-text-soft);
  margin: 0 0 4px;
  font-weight: 600;
}

.auth-file-upload span {
  font-size: 11px;
  color: var(--auth-text-muted);
}

/* --- Submit Button --- */
.auth-submit {
  position: relative;
  width: 100%;
  padding: 15px 24px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--auth-accent), var(--auth-accent-strong));
  color: #fff;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all var(--auth-transition);
  overflow: hidden;
}

.auth-submit::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.12), transparent);
  border-radius: 14px;
  transition: opacity var(--auth-transition);
}

.auth-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(31, 167, 198, 0.35);
}

.auth-submit:active {
  transform: translateY(0) scale(0.985);
}

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

.auth-submit-text,
.auth-submit-spinner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.spinner-icon {
  animation: auth-spin 0.8s linear infinite;
}

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

/* --- Captcha Row --- */
.auth-captcha-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.auth-captcha-row .auth-input-wrap {
  flex: 1;
}

.auth-captcha-btn {
  flex-shrink: 0;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--auth-radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: var(--auth-accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--auth-transition);
  white-space: nowrap;
}

.auth-captcha-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(31, 167, 198, 0.3);
}

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

/* --- Global Error --- */
.auth-global-error {
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.2);
  color: var(--auth-error);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  animation: auth-error-in 0.2s ease;
}

/* --- Card Footer --- */
.auth-card-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.auth-card-footer p {
  font-size: 14px;
  color: var(--auth-text-soft);
  margin: 0;
}

.auth-card-footer a {
  color: var(--auth-accent);
  font-weight: 700;
  text-decoration: none;
  transition: opacity 0.2s;
}

.auth-card-footer a:hover {
  opacity: 0.8;
}

.auth-card-footer p + p {
  margin-top: 8px;
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .auth-split {
    flex-direction: column;
    padding: 32px 20px;
    gap: 32px;
  }

  .auth-brand {
    flex: 0 0 auto;
    padding-right: 0;
    text-align: center;
  }

  .auth-brand-headline {
    max-width: 100%;
    font-size: 32px;
  }

  .auth-brand-desc {
    max-width: 100%;
  }

  .auth-brand-features {
    display: none;
  }

  .auth-brand-logo {
    margin-bottom: 32px;
  }

  .auth-card-wrap {
    flex: 0 0 auto;
    width: 100%;
  }

  .auth-card {
    max-width: 100%;
    padding: 32px 24px;
  }

  .auth-role-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .auth-split {
    padding: 20px 12px;
  }

  .auth-card {
    padding: 24px 18px;
    border-radius: 20px;
  }

  .auth-brand-headline {
    font-size: 26px;
  }

  .auth-brand-logo {
    margin-bottom: 24px;
  }

  .auth-tabs {
    gap: 4px;
  }

  .auth-tab {
    padding: 10px 12px;
    font-size: 13px;
  }

  .auth-input-wrap input {
    padding: 12px 40px 12px 38px;
    font-size: 14px;
  }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  .auth-brand,
  .auth-card-wrap {
    animation: none;
  }

  .auth-atmos-spot {
    animation: none;
  }
}
