/* ===== Auth Pages — Premium Dark UI ===== */

/* Reset & Base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body.auth-page {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #0a0a1a;
  overflow-x: hidden;
}

/* Animated gradient background */
body.auth-page::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse 80% 50% at 20% 80%, rgba(99, 66, 235, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 60% at 80% 15%, rgba(139, 92, 246, 0.12) 0%, transparent 55%),
    radial-gradient(ellipse 50% 80% at 50% 100%, rgba(67, 56, 202, 0.1) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* Floating orbs */
body.auth-page::after {
  content: '';
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.08) 0%, transparent 70%);
  top: -150px;
  right: -100px;
  animation: orbFloat 12s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-40px, 30px) scale(1.05); }
  66% { transform: translate(20px, -20px) scale(0.95); }
}

/* Container */
.auth-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 20px;
  animation: authSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-container.auth-register {
  max-width: 520px;
}

@keyframes authSlideUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Card */
.auth-card {
  background: rgba(15, 15, 35, 0.85);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 24px;
  padding: 44px 38px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 120px rgba(124, 58, 237, 0.06);
  position: relative;
  overflow: hidden;
}

/* Subtle top glow line */
.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(167, 139, 250, 0.5), transparent);
}

/* Brand / Header */
.auth-brand {
  text-align: center;
  margin-bottom: 6px;
}

.auth-brand-name {
  font-size: 2.1rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, #a78bfa 60%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
  margin: 0;
}

.auth-subtitle {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.9rem;
  margin-top: 6px;
  margin-bottom: 32px;
  text-align: center;
  font-weight: 400;
}

/* Flash Alerts */
.auth-alert {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.85rem;
  margin-bottom: 20px;
  text-align: center;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  animation: alertSlideIn 0.35s ease-out;
}
@keyframes alertSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.auth-alert i {
  font-size: 1rem;
  flex-shrink: 0;
}
.auth-alert-danger, .auth-alert-error {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.auth-alert-success {
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.2);
}
.auth-alert-warning, .auth-alert-message {
  background: rgba(234, 179, 8, 0.1);
  color: #fde047;
  border: 1px solid rgba(234, 179, 8, 0.2);
}
.auth-alert-info {
  background: rgba(59, 130, 246, 0.1);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Form Groups */
.auth-field {
  position: relative;
  margin-bottom: 20px;
}

.auth-field label {
  display: block;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.auth-field .auth-input {
  width: 100%;
  padding: 13px 16px 13px 44px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  color: #fff;
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.3s ease;
  outline: none;
}

.auth-field .auth-input::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

.auth-field .auth-input:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
}

.auth-field .auth-input:focus {
  border-color: rgba(139, 92, 246, 0.6);
  background: rgba(139, 92, 246, 0.06);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1), 0 0 20px rgba(139, 92, 246, 0.05);
}

.auth-field .field-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.95rem;
  pointer-events: none;
  transition: color 0.3s ease;
  z-index: 2;
}

/* Override browser autofill yellow background */
.auth-field .auth-input:-webkit-autofill,
.auth-field .auth-input:-webkit-autofill:hover,
.auth-field .auth-input:-webkit-autofill:focus,
.auth-field .auth-input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px rgba(30, 30, 45, 1) inset !important;
  -webkit-text-fill-color: #fff !important;
  caret-color: #fff;
  transition: background-color 5000s ease-in-out 0s;
}

.auth-field:has(label) .field-icon {
  top: calc(50% + 12px);
}

.auth-field .auth-input:focus ~ .field-icon,
.auth-field:focus-within .field-icon {
  color: #a78bfa;
}

/* Password toggle */
.auth-field .toggle-password {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  padding: 4px;
  font-size: 0.9rem;
  transition: color 0.3s ease;
}

.auth-field:has(label) .toggle-password {
  top: calc(50% + 12px);
}

.auth-field .toggle-password:hover {
  color: rgba(255, 255, 255, 0.6);
}

/* Select2 overrides for country */
.auth-field .select2-container--default .select2-selection--single {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 14px !important;
  height: 48px !important;
  padding: 7px 16px 7px 44px !important;
  color: #fff !important;
  transition: all 0.3s ease;
}

.auth-field .select2-container--default .select2-selection--single:hover {
  border-color: rgba(255, 255, 255, 0.12) !important;
  background: rgba(255, 255, 255, 0.06) !important;
}

.auth-field .select2-container--default.select2-container--focus .select2-selection--single,
.auth-field .select2-container--default.select2-container--open .select2-selection--single {
  border-color: rgba(139, 92, 246, 0.6) !important;
  background: rgba(139, 92, 246, 0.06) !important;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1) !important;
}

.auth-field .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: #fff !important;
  line-height: 32px !important;
  padding-left: 0 !important;
}

.auth-field .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 46px !important;
  right: 8px !important;
}

.auth-field .select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: rgba(255, 255, 255, 0.3) transparent transparent transparent !important;
}

.select2-dropdown {
  background: #141428 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 14px !important;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4) !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 10px !important;
  color: #fff !important;
  padding: 10px 14px !important;
}

.select2-container--default .select2-results__option {
  color: rgba(255, 255, 255, 0.7) !important;
  padding: 10px 14px !important;
  transition: all 0.15s ease;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background: rgba(139, 92, 246, 0.25) !important;
  color: #fff !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
  background: rgba(139, 92, 246, 0.12) !important;
}

/* Remember me / checkbox */
.auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.auth-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.auth-checkbox input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: #8b5cf6;
  cursor: pointer;
  border-radius: 4px;
}

.auth-checkbox label,
.auth-checkbox span {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
}

.auth-options a {
  color: #a78bfa;
  font-size: 0.85rem;
  text-decoration: none;
  transition: color 0.2s;
  font-weight: 500;
}

.auth-options a:hover {
  color: #c4b5fd;
}

/* Submit Button */
.auth-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 50%, #a78bfa 100%);
  background-size: 200% 200%;
  border: none;
  border-radius: 14px;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.3px;
}

.auth-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s ease;
}

.auth-btn:hover {
  background-position: 100% 0;
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(124, 58, 237, 0.35), 0 2px 8px rgba(124, 58, 237, 0.2);
}

.auth-btn:hover::before {
  left: 100%;
}

.auth-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.25);
}

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

/* Loading spinner on button */
.auth-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.auth-btn.loading::after {
  content: '';
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-left: 10px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: authSpin 0.6s linear infinite;
  vertical-align: middle;
}

@keyframes authSpin {
  to { transform: rotate(360deg); }
}

/* reCAPTCHA container */
.auth-recaptcha {
  margin-bottom: 22px;
  display: flex;
  justify-content: center;
}

.auth-recaptcha > div {
  transform-origin: center;
}

/* Footer links */
.auth-footer {
  text-align: center;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.auth-footer p {
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.88rem;
  margin: 0;
}

.auth-footer a {
  color: #a78bfa;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s;
}

.auth-footer a:hover {
  color: #c4b5fd;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 22px 0;
  gap: 14px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
}

.auth-divider span {
  color: rgba(255, 255, 255, 0.25);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Terms checkbox for register */
.auth-terms {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 22px;
}

.auth-terms input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: #8b5cf6;
  cursor: pointer;
  margin-top: 2px;
  flex-shrink: 0;
}

.auth-terms label {
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.84rem;
  cursor: pointer;
  line-height: 1.5;
}

.auth-terms a {
  color: #a78bfa;
  text-decoration: none;
  transition: color 0.2s;
}

.auth-terms a:hover {
  color: #c4b5fd;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Two-column fields */
.auth-row {
  display: flex;
  gap: 14px;
}

.auth-row .auth-field {
  flex: 1;
}

/* Info message */
.auth-info {
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.auth-info i {
  color: #a78bfa;
  margin-top: 2px;
  flex-shrink: 0;
}

.auth-info p {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.85rem;
  margin: 0;
  line-height: 1.5;
}

/* Toastr overrides for dark theme */
body.auth-page #toast-container > .toast {
  border-radius: 14px;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background-image: none !important;
  background-repeat: no-repeat !important;
  color: #fff;
}

body.auth-page #toast-container > .toast-success {
  background-color: rgba(16, 185, 129, 0.92) !important;
}

body.auth-page #toast-container > .toast-error {
  background-color: rgba(239, 68, 68, 0.92) !important;
}

body.auth-page #toast-container > .toast-warning {
  background-color: rgba(245, 158, 11, 0.92) !important;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .auth-container {
    padding: 16px;
  }

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

  .auth-brand-name {
    font-size: 1.7rem;
  }

  .auth-row {
    flex-direction: column;
    gap: 0;
  }

  .auth-recaptcha > div {
    transform: scale(0.85);
    transform-origin: center;
  }
}

@media (max-width: 360px) {
  .auth-recaptcha > div {
    transform: scale(0.75);
  }

  .auth-card {
    padding: 26px 20px;
  }
}

/* RTL support */
[dir="rtl"] .auth-field .auth-input {
  padding: 13px 44px 13px 16px;
}

[dir="rtl"] .auth-field .field-icon {
  left: auto;
  right: 15px;
}

[dir="rtl"] .auth-field .toggle-password {
  right: auto;
  left: 14px;
}

[dir="rtl"] .auth-field .select2-container--default .select2-selection--single {
  padding: 7px 44px 7px 16px !important;
}

[dir="rtl"] .auth-btn.loading::after {
  margin-left: 0;
  margin-right: 10px;
}
