/* ============================================
   NeoTrace.in &mdash; Auth Pages Stylesheet
   ============================================ */

/* --- Background & Layout --- */
.auth-body,
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.25rem;
  margin: 0;
  position: relative;
  overflow-x: hidden;
  background-color: #050811;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #F8FAFC;
  box-sizing: border-box;
}

/* Ambient glow orbs */
.auth-body::before,
.auth-page::before,
.auth-body::after,
.auth-page::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}

.auth-body::before,
.auth-page::before {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(255, 87, 34, 0.16) 0%, transparent 70%);
  top: -150px;
  right: -100px;
}

.auth-body::after,
.auth-page::after {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.12) 0%, transparent 70%);
  bottom: -150px;
  left: -100px;
}

/* Wrapper to guarantee center alignment */
.auth-wrapper {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

/* --- Auth Card --- */
.auth-card {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: rgba(13, 19, 34, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 2.5rem 2.2rem;
  position: relative;
  z-index: 1;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 25px 80px rgba(0, 0, 0, 0.7),
    0 0 40px rgba(255, 87, 34, 0.08);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-sizing: border-box;
}

.auth-card--wide {
  max-width: 580px;
}

/* --- Brand Header --- */
.auth-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-brand__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-orange, #FF5722), #ff7849);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 0.75rem;
  box-shadow: 0 4px 20px rgba(255, 87, 34, 0.3);
}

.auth-brand__logo img, .auth-logo-img {
  width: 36px !important;
  height: 36px !important;
  max-width: 36px !important;
  max-height: 36px !important;
  object-fit: contain !important;
  border-radius: 8px;
  display: inline-block;
}

.auth-brand__name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary, #F8FAFC);
  letter-spacing: -0.3px;
}

.auth-brand__name span {
  color: var(--accent-orange, #FF5722);
}

/* --- Headings --- */
.auth-heading {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary, #F8FAFC);
  text-align: center;
  margin-bottom: 0.375rem;
  letter-spacing: -0.3px;
}

.auth-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary, #94A3B8);
  text-align: center;
  margin-bottom: 2rem;
  line-height: 1.5;
}

/* --- Form Groups --- */
.form-group {
  margin-bottom: 1.25rem;
  position: relative;
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary, #94A3B8);
  margin-bottom: 0.5rem;
  letter-spacing: 0.01em;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-row .form-group {
  flex: 1;
  min-width: 0;
}

/* --- Input Wrapper (with icon) --- */
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted, #64748B);
  pointer-events: none;
  transition: color 0.2s;
  z-index: 1;
}

.input-wrapper input:focus ~ .input-icon,
.input-wrapper input:focus + .input-icon {
  color: var(--accent-blue, #38BDF8);
}

.input-wrapper input {
  padding-left: 44px;
}

.input-wrapper .toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted, #64748B);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: color 0.2s;
}

.toggle-password:hover {
  color: var(--text-secondary, #94A3B8);
}

.toggle-password svg {
  width: 18px;
  height: 18px;
}

/* --- Input Fields --- */
.auth-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  background: var(--bg-primary, #0A0E17);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 10px;
  color: var(--text-primary, #F8FAFC);
  font-size: 0.9375rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-input::placeholder {
  color: var(--text-muted, #475569);
}

.auth-input:focus {
  border-color: var(--accent-blue, #38BDF8);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.auth-input.input-error {
  border-color: #EF4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.auth-input.input-success {
  border-color: var(--accent-green, #10B981);
}

/* --- Error Messages --- */
.field-error {
  display: none;
  font-size: 0.75rem;
  color: #EF4444;
  margin-top: 0.375rem;
  padding-left: 2px;
  align-items: center;
  gap: 4px;
}

.field-error.visible {
  display: flex;
}

.field-error svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* --- Password Strength Indicator --- */
.password-strength {
  margin-top: 0.5rem;
}

.strength-bars {
  display: flex;
  gap: 4px;
  margin-bottom: 0.375rem;
}

.strength-bar {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--border-color, rgba(255, 255, 255, 0.08));
  transition: background-color 0.3s;
}

.strength-bar.active {
  background: var(--text-muted, #64748B);
}

/* Strength levels */
.password-strength[data-strength="1"] .strength-bar.active {
  background: #EF4444;
}

.password-strength[data-strength="2"] .strength-bar.active {
  background: #F59E0B;
}

.password-strength[data-strength="3"] .strength-bar.active {
  background: #38BDF8;
}

.password-strength[data-strength="4"] .strength-bar.active {
  background: #10B981;
}

.strength-text {
  font-size: 0.7rem;
  color: var(--text-muted, #64748B);
  letter-spacing: 0.02em;
}

.password-strength[data-strength="1"] .strength-text { color: #EF4444; }
.password-strength[data-strength="2"] .strength-text { color: #F59E0B; }
.password-strength[data-strength="3"] .strength-text { color: #38BDF8; }
.password-strength[data-strength="4"] .strength-text { color: #10B981; }

/* --- Checkbox --- */
.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
  border-radius: 5px;
  background: var(--bg-primary, #0A0E17);
  cursor: pointer;
  position: relative;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.form-check input[type="checkbox"]:checked {
  background: var(--accent-orange, #FF5722);
  border-color: var(--accent-orange, #FF5722);
}

.form-check input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 6px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.form-check label {
  font-size: 0.8125rem;
  color: var(--text-secondary, #94A3B8);
  cursor: pointer;
  margin-bottom: 0;
}

/* --- Buttons --- */
.btn-auth {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 10px;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.btn-auth:active {
  transform: scale(0.98);
}

.btn-auth--primary {
  background: linear-gradient(135deg, var(--accent-orange, #FF5722), #e64a19);
  color: #fff;
  box-shadow: 0 4px 16px rgba(255, 87, 34, 0.3);
}

.btn-auth--primary:hover {
  background: linear-gradient(135deg, #ff6e40, var(--accent-orange, #FF5722));
  box-shadow: 0 6px 24px rgba(255, 87, 34, 0.4);
}

.btn-auth--secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary, #F8FAFC);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
}

.btn-auth--secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn-auth:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Loading spinner */
.btn-auth .spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.btn-auth.loading .spinner {
  display: block;
}

.btn-auth.loading .btn-text {
  display: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Form Actions Row --- */
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.forgot-link {
  font-size: 0.8125rem;
  color: var(--accent-blue, #38BDF8);
  text-decoration: none;
  transition: color 0.2s;
}

.forgot-link:hover {
  color: #7dd3fc;
  text-decoration: underline;
}

/* --- Divider --- */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color, rgba(255, 255, 255, 0.06));
}

.auth-divider span {
  font-size: 0.8125rem;
  color: var(--text-muted, #64748B);
  text-transform: lowercase;
}

/* --- PIN Login Form --- */
.pin-form-toggle {
  text-align: center;
}

.pin-form-toggle a {
  font-size: 0.875rem;
  color: var(--text-secondary, #94A3B8);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  transition: color 0.2s;
}

.pin-form-toggle a:hover {
  color: var(--text-primary, #F8FAFC);
}

.pin-form-toggle a svg {
  width: 16px;
  height: 16px;
}

.login-form-container {
  position: relative;
}

.login-form,
.pin-login-form {
  transition: opacity 0.3s, transform 0.3s;
}

.pin-login-form {
  display: none;
}

.pin-login-form.active {
  display: block;
  animation: fadeSlideUp 0.3s ease;
}

.login-form.hidden {
  display: none;
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- PIN Input --- */
.pin-input-group {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 1rem 0;
}

.pin-digit {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  letter-spacing: 0;
  background: var(--bg-primary, #0A0E17);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 10px;
  color: var(--text-primary, #F8FAFC);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.pin-digit:focus {
  border-color: var(--accent-blue, #38BDF8);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

/* --- Footer Links --- */
.auth-footer {
  text-align: center;
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.06));
}

.auth-footer p {
  font-size: 0.875rem;
  color: var(--text-secondary, #94A3B8);
}

.auth-footer a {
  color: var(--accent-orange, #FF5722);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.auth-footer a:hover {
  color: #ff7849;
  text-decoration: underline;
}

/* --- Terms Text --- */
.terms-text {
  font-size: 0.75rem;
  color: var(--text-muted, #64748B);
  text-align: center;
  margin-top: 1rem;
  line-height: 1.5;
}

.terms-text a {
  color: var(--accent-blue, #38BDF8);
  text-decoration: none;
}

.terms-text a:hover {
  text-decoration: underline;
}

/* --- Success Message --- */
.auth-success {
  display: none;
  text-align: center;
  padding: 1rem 0;
  animation: fadeSlideUp 0.4s ease;
}

.auth-success.visible {
  display: block;
}

.auth-success__icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.1);
  border: 2px solid var(--accent-green, #10B981);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  color: var(--accent-green, #10B981);
}

.auth-success__icon svg {
  width: 32px;
  height: 32px;
}

.auth-success h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary, #F8FAFC);
  margin-bottom: 0.5rem;
}

.auth-success p {
  font-size: 0.875rem;
  color: var(--text-secondary, #94A3B8);
  line-height: 1.5;
}

/* --- General Auth Alert --- */
.auth-alert {
  display: none;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.auth-alert.visible {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  animation: fadeSlideUp 0.3s ease;
}

.auth-alert svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.auth-alert--error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #FCA5A5;
}

.auth-alert--success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #6EE7B7;
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .auth-body,
  .auth-page {
    padding: 1.5rem 0.85rem;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    box-sizing: border-box;
  }

  .auth-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .auth-card {
    width: 100%;
    max-width: 100%;
    padding: 2rem 1.25rem;
    border-radius: 16px;
    margin: 0 auto;
    box-sizing: border-box;
  }

  .auth-card--wide {
    max-width: 100%;
  }

  .auth-heading {
    font-size: 1.3rem;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .pin-digit {
    width: 42px;
    height: 50px;
    font-size: 1.3rem;
  }

  .auth-page::before {
    width: 300px;
    height: 300px;
    top: -100px;
    right: -80px;
  }

  .auth-page::after {
    width: 250px;
    height: 250px;
    bottom: -80px;
    left: -60px;
  }
}

@media (max-width: 380px) {
  .auth-card {
    padding: 1.5rem 1.25rem;
  }

  .pin-digit {
    width: 38px;
    height: 46px;
    font-size: 1.2rem;
  }

  .pin-input-group {
    gap: 6px;
  }
}
