/* RootZone Auth UI — login, forgot password, reset password */
:root {
  --rz-red: #e63946;
  --rz-red-dark: #c62828;
  --rz-red-glow: rgba(230, 57, 70, 0.35);
  --rz-bg: #0a0a0a;
  --rz-card: linear-gradient(145deg, #12121a 0%, #1a1a2e 100%);
  --rz-border: rgba(230, 57, 70, 0.28);
  --rz-text: #eee;
  --rz-muted: #888;
  --rz-input-bg: #0d0d14;
  --rz-success: #4caf50;
  --rz-radius: 14px;
}

@media (prefers-reduced-motion: reduce) {
  .rz-auth-overlay,
  .rz-auth-card,
  .rz-auth-btn,
  .rz-auth-forgot-link,
  .rz-auth-close,
  .rz-auth-alert,
  .rz-strength-fill {
    animation: none !important;
    transition: none !important;
  }
}

.rz-auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: radial-gradient(ellipse 120% 80% at 50% -20%, #1a1a2e 0%, var(--rz-bg) 55%);
  font-family: 'Cairo', sans-serif;
  color: var(--rz-text);
}

.rz-auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 8500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.rz-auth-overlay.is-open,
.rz-auth-overlay.active {
  display: flex;
}

.rz-auth-card {
  width: 100%;
  max-width: 440px;
  max-height: min(92dvh, 720px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: var(--rz-card);
  border: 1px solid var(--rz-border);
  border-radius: 18px;
  padding: 28px 24px 24px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(230, 57, 70, 0.06),
    0 0 48px var(--rz-red-glow);
  position: relative;
  animation: rzAuthIn 0.35s ease;
}

.login-page .login-container.rz-auth-card,
.signup-page .signup-container.rz-auth-card {
  max-height: min(92dvh, 720px);
  overflow-y: auto;
}

@keyframes rzAuthIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.rz-auth-close {
  position: absolute;
  top: 14px;
  left: 16px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--rz-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s, transform 0.2s;
}

.rz-auth-close:hover,
.rz-auth-close:focus-visible {
  color: var(--rz-red);
  background: rgba(230, 57, 70, 0.12);
  outline: none;
}

.rz-auth-brand {
  text-align: center;
  margin-bottom: 20px;
  padding-top: 4px;
}

.rz-auth-brand-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(230, 57, 70, 0.12);
  border: 1px solid rgba(230, 57, 70, 0.25);
  color: var(--rz-red);
  font-size: 22px;
  box-shadow: 0 0 24px rgba(230, 57, 70, 0.15);
}

.rz-auth-brand h1,
.rz-auth-brand h2 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--rz-red);
  margin: 0 0 6px;
  letter-spacing: 0.02em;
}

.rz-auth-brand p {
  margin: 0;
  font-size: 13px;
  color: var(--rz-muted);
  line-height: 1.5;
}

.rz-auth-notice {
  background: rgba(230, 57, 70, 0.08);
  border: 1px solid rgba(230, 57, 70, 0.22);
  border-radius: var(--rz-radius);
  padding: 11px 14px;
  font-size: 13px;
  color: #ccc;
  text-align: center;
  margin-bottom: 18px;
  line-height: 1.65;
}

.rz-auth-field {
  margin-bottom: 14px;
  text-align: right;
}

.rz-auth-field label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--rz-muted);
  margin-bottom: 7px;
  font-weight: 600;
}

.rz-auth-field label i {
  color: var(--rz-red);
  font-size: 12px;
  opacity: 0.85;
}

.rz-auth-input-wrap {
  position: relative;
}

.rz-auth-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--rz-input-bg);
  border: 1px solid #2a2a3a;
  border-radius: var(--rz-radius);
  color: var(--rz-text);
  font-family: inherit;
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.rz-auth-input-wrap .rz-auth-input {
  padding-left: 44px;
}

.rz-auth-input:focus {
  outline: none;
  border-color: var(--rz-red);
  box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.18);
}

.rz-auth-input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.rz-auth-toggle-pw {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--rz-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1;
}

.rz-auth-toggle-pw:hover,
.rz-auth-toggle-pw:focus-visible {
  color: var(--rz-red);
  outline: none;
}

.rz-auth-alert {
  display: none;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border-radius: var(--rz-radius);
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 14px;
  text-align: right;
}

.rz-auth-alert.is-visible {
  display: flex;
}

.rz-auth-alert--error {
  background: rgba(230, 57, 70, 0.1);
  border: 1px solid rgba(230, 57, 70, 0.35);
  color: #ffb4b4;
}

.rz-auth-alert--success {
  background: rgba(76, 175, 80, 0.1);
  border: 1px solid rgba(76, 175, 80, 0.35);
  color: #a5d6a7;
}

.rz-auth-alert i {
  margin-top: 2px;
  flex-shrink: 0;
}

.rz-auth-btn {
  width: 100%;
  padding: 13px 16px;
  border: none;
  border-radius: var(--rz-radius);
  background: linear-gradient(135deg, var(--rz-red), var(--rz-red-dark));
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 8px 24px rgba(230, 57, 70, 0.25);
}

.rz-auth-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(230, 57, 70, 0.32);
}

.rz-auth-btn:focus-visible {
  outline: 2px solid var(--rz-red);
  outline-offset: 2px;
}

.rz-auth-btn:disabled {
  opacity: 0.62;
  cursor: not-allowed;
  transform: none;
}

.rz-auth-btn--ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: none;
  color: #ccc;
  margin-top: 10px;
}

.rz-auth-btn--ghost:hover:not(:disabled) {
  border-color: rgba(230, 57, 70, 0.4);
  color: var(--rz-red);
  box-shadow: none;
}

.rz-auth-forgot-link {
  display: inline-block;
  margin-top: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--rz-red);
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  padding: 4px 8px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

.rz-auth-forgot-link:hover,
.rz-auth-forgot-link:focus-visible {
  color: #ff6b6b;
  background: rgba(230, 57, 70, 0.08);
  outline: none;
}

.rz-auth-footer-link {
  display: block;
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--rz-muted);
  text-decoration: none;
}

.rz-auth-footer-link:hover {
  color: var(--rz-red);
}

.rz-auth-lockout {
  display: none;
  background: rgba(230, 57, 70, 0.1);
  border: 1px solid rgba(230, 57, 70, 0.28);
  border-radius: var(--rz-radius);
  padding: 12px;
  margin: 12px 0;
  text-align: center;
  font-size: 13px;
  color: #ccc;
}

.rz-auth-lockout.is-visible {
  display: block;
}

.rz-auth-turnstile {
  display: none;
  justify-content: center;
  margin: 12px 0 4px;
  min-height: 0;
}

.rz-auth-turnstile.is-active {
  display: flex;
  min-height: 65px;
}

/* Password strength */
.rz-strength {
  margin: 10px 0 14px;
}

.rz-strength-bar {
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-bottom: 8px;
}

.rz-strength-fill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  transition: width 0.25s ease, background 0.25s ease;
  background: var(--rz-muted);
}

.rz-strength-fill--1 { width: 25%; background: #ef5350; }
.rz-strength-fill--2 { width: 50%; background: #ff9800; }
.rz-strength-fill--3 { width: 75%; background: #ffc107; }
.rz-strength-fill--4 { width: 100%; background: var(--rz-success); }

.rz-req-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.rz-req-list li {
  font-size: 12px;
  color: var(--rz-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.rz-req-list li i {
  width: 14px;
  text-align: center;
  font-size: 11px;
}

.rz-req-list li.is-met {
  color: var(--rz-success);
}

.rz-auth-loading {
  text-align: center;
  padding: 32px 12px;
  color: var(--rz-muted);
  font-size: 14px;
}

.rz-auth-loading i {
  color: var(--rz-red);
  margin-left: 8px;
}

.rz-forgot-overlay {
  z-index: 9000;
}

.rz-forgot-overlay.is-open {
  animation: rzForgotFadeIn 0.28s ease;
}

.rz-forgot-card {
  animation: rzAuthIn 0.32s ease;
}

@keyframes rzForgotFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.rz-forgot-success-panel {
  text-align: center;
  padding: 12px 4px 4px;
}

.rz-forgot-success-icon {
  width: 72px;
  height: 72px;
  margin: 8px auto 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(76, 175, 80, 0.12);
  border: 1px solid rgba(76, 175, 80, 0.35);
  color: var(--rz-success);
  font-size: 36px;
  box-shadow: 0 0 32px rgba(76, 175, 80, 0.2);
}

.rz-forgot-success h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--rz-success);
  margin: 0 0 12px;
}

.rz-forgot-success p {
  font-size: 14px;
  line-height: 1.7;
  color: #ccc;
  margin: 0 0 22px;
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}

.login-container .rz-auth-forgot-link,
.rz-auth-page > .rz-auth-card > .rz-auth-forgot-link {
  display: block;
  width: 100%;
  text-align: center;
}

@media (max-width: 480px) {
  .rz-auth-card {
    padding: 22px 18px 18px;
    border-radius: 16px;
  }

  .rz-auth-brand h1,
  .rz-auth-brand h2 {
    font-size: 1.25rem;
  }

  .rz-auth-input {
    font-size: 16px;
  }
}
