/* ============================================
   USDTraDex — Auth Pages (Login / Register)
   Premium fintech, matches main website theme
   ============================================ */

/* ---------- Auth nav (matches main site nav) ---------- */
.auth-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0.875rem 1.25rem;
  background: rgba(10, 10, 12, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: authNavIn 0.5s ease-out;
}

@keyframes authNavIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-nav .auth-nav-logo {
  display: inline-flex;
  align-items: center;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: #f8fafc;
  text-decoration: none;
  transition: color 0.25s ease;
}

.auth-nav .auth-nav-logo:hover {
  color: #f59e0b;
}

.auth-nav .auth-nav-logo img {
  display: block;
  height: 34px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  mix-blend-mode: lighten;
}

.auth-nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.auth-nav-links a {
  color: rgba(248, 250, 252, 0.9);
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 0.25s ease;
}

.auth-nav-links a:hover {
  color: #f59e0b;
}

.auth-nav-links .auth-nav-cta {
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #0a0a0c;
  border-radius: 10px;
  font-weight: 600;
}

.auth-nav-links .auth-nav-cta:hover {
  color: #0a0a0c;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
}

/* ---------- Page background ---------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 1rem 3rem;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  background: #0a0a0c;
}

.auth-page::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 100% 0%, rgba(245, 158, 11, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse 60% 60% at 0% 100%, rgba(220, 38, 38, 0.06) 0%, transparent 50%);
  z-index: 0;
}

.auth-page::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 120' opacity='0.05'%3E%3Cpath d='M0 0h24v24H0z' fill='none' stroke='%23f59e0b' stroke-width='0.5'/%3E%3Cpath d='M48 0h24v24H48z' fill='none' stroke='%23f59e0b' stroke-width='0.5'/%3E%3Cpath d='M96 0h24v24H96z' fill='none' stroke='%23f59e0b' stroke-width='0.5'/%3E%3Cpath d='M24 24h24v24H24z' fill='none' stroke='%23f59e0b' stroke-width='0.5'/%3E%3Cpath d='M72 24h24v24H72z' fill='none' stroke='%23f59e0b' stroke-width='0.5'/%3E%3Cpath d='M0 48h24v24H0z' fill='none' stroke='%23f59e0b' stroke-width='0.5'/%3E%3Cpath d='M48 48h24v24H48z' fill='none' stroke='%23f59e0b' stroke-width='0.5'/%3E%3C/svg%3E");
  background-size: 140px 140px;
  background-position: 100% 0;
  z-index: 0;
}

.auth-bg-line {
  position: fixed;
  bottom: 18%;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.12), transparent);
  pointer-events: none;
  z-index: 0;
  animation: authLine 8s ease-in-out infinite;
}

@keyframes authLine {
  0%, 100% { opacity: 0.4; transform: scaleX(0.85); }
  50% { opacity: 0.8; transform: scaleX(1); }
}

/* ---------- Content wrap & card ---------- */
.auth-wrap {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 440px;
  animation: authCardIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

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

.auth-modal {
  position: relative;
  padding: 2.5rem 2rem;
  background: rgba(18, 18, 22, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 20px;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 60px rgba(245, 158, 11, 0.06);
  color: #e2e8f0;
  overflow: hidden;
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
}

.auth-modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #f59e0b, #fbbf24, transparent);
  opacity: 0.8;
}

.auth-modal:hover {
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 0 80px rgba(245, 158, 11, 0.1);
}

.auth-logo {
  display: block;
  text-align: center;
  margin-bottom: 1.5rem;
  text-decoration: none;
  transition: opacity 0.3s ease;
}

.auth-logo img {
  display: block;
  margin: 0 auto;
  max-height: 44px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  mix-blend-mode: lighten;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3));
}

.auth-logo:hover {
  opacity: 0.9;
}

.auth-modal h2 {
  color: #f8fafc;
  margin-bottom: 0.25rem;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.65rem;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  color: #94a3b8;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  line-height: 1.45;
}

/* ---------- Form ---------- */
.auth-modal .form-group {
  margin-bottom: 1.2rem;
  animation: authFieldIn 0.5s ease backwards;
}

.auth-modal .form-group:nth-child(1) { animation-delay: 0.08s; }
.auth-modal .form-group:nth-child(2) { animation-delay: 0.12s; }
.auth-modal .form-group:nth-child(3) { animation-delay: 0.16s; }
.auth-modal .form-group:nth-child(4) { animation-delay: 0.2s; }
.auth-modal .form-group:nth-child(5) { animation-delay: 0.24s; }
.auth-modal .form-group:nth-child(6) { animation-delay: 0.28s; }
.auth-modal .form-group:nth-child(7) { animation-delay: 0.32s; }
.auth-modal .form-group:nth-child(8) { animation-delay: 0.36s; }
.auth-modal .form-group:nth-child(9) { animation-delay: 0.4s; }
.auth-modal .form-group:nth-child(10) { animation-delay: 0.44s; }

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

.auth-modal label {
  display: block;
  color: #cbd5e1;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  transition: color 0.25s ease;
}

.auth-password-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.auth-password-row label {
  margin-bottom: 0;
}

.auth-forgot-link {
  font-size: 0.85rem;
  color: #f59e0b;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.auth-forgot-link:hover {
  color: #fbbf24;
}

.auth-modal input[type="email"],
.auth-modal input[type="password"],
.auth-modal input[type="text"],
.auth-modal input[type="number"] {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(10, 10, 14, 0.7);
  color: #f8fafc;
  font-size: 1rem;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
  box-sizing: border-box;
}

.auth-modal input:hover {
  border-color: rgba(245, 158, 11, 0.25);
  background: rgba(10, 10, 14, 0.85);
}

.auth-modal input::placeholder {
  color: #64748b;
}

.auth-modal input:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
  background: rgba(10, 10, 14, 0.9);
}

.auth-modal input[type="checkbox"] {
  width: auto;
  margin-right: 0.5rem;
  accent-color: #f59e0b;
  cursor: pointer;
}

.auth-modal .checkbox-label {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  color: #94a3b8;
  font-size: 0.9rem;
  line-height: 1.5;
}

.auth-modal button[type="submit"] {
  width: 100%;
  padding: 0.95rem 1.5rem;
  margin-top: 0.25rem;
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  color: #0a0a0c;
  border: none;
  border-radius: 12px;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
  animation: authFieldIn 0.5s ease 0.35s backwards;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
}

.auth-modal button[type="submit"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.4);
}

.auth-modal button[type="submit"]:active {
  transform: translateY(0);
}

.auth-modal button[type="submit"]:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* ---------- Messages ---------- */
#authMessage {
  animation: authMsgIn 0.4s ease;
}

.auth-msg {
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  border-radius: 12px;
  font-size: 0.9rem;
  animation: authMsgIn 0.35s ease;
}

@keyframes authMsgIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-msg.error {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.auth-msg.success {
  background: rgba(22, 163, 74, 0.12);
  color: #86efac;
  border: 1px solid rgba(22, 163, 74, 0.25);
}

.auth-msg.success a {
  color: #f59e0b;
  text-decoration: underline;
  font-weight: 500;
}

.auth-msg.success a:hover {
  color: #fbbf24;
}

/* ---------- Toggle links ---------- */
.auth-toggle {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  animation: authFieldIn 0.5s ease 0.45s backwards;
}

.auth-toggle a {
  color: #f59e0b;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.25s ease, text-shadow 0.25s ease;
}

.auth-toggle a:hover {
  color: #fbbf24;
  text-shadow: 0 0 20px rgba(245, 158, 11, 0.35);
}

.auth-toggle .sep {
  color: #475569;
  margin: 0 0.5rem;
  font-size: 0.85rem;
}

.auth-reset-link-wrap {
  margin-top: 0.75rem;
  margin-bottom: 0;
}

.auth-reset-link {
  display: inline-block;
  color: #f59e0b;
  font-weight: 600;
  text-decoration: none;
  padding: 0.5rem 0;
  transition: color 0.2s ease;
}

.auth-reset-link:hover {
  color: #fbbf24;
}

#otpStep {
  display: none;
  animation: authCardIn 0.4s ease;
}

#otpStep .form-group {
  animation: none;
}

/* ========== REGISTER PAGE ========== */
.reg-page .auth-wrap {
  max-width: 520px;
}

.reg-page .auth-modal {
  padding: 2.25rem 2rem;
}

.reg-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.reg-header h2 {
  margin-bottom: 0.35rem;
  font-size: 1.6rem;
}

.reg-header .auth-subtitle {
  margin-bottom: 0;
  font-size: 0.875rem;
}

.reg-steps {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.reg-step {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  transition: all 0.3s ease;
}

.reg-step.active {
  width: 24px;
  border-radius: 4px;
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.reg-step.done {
  background: #16a34a;
}

.reg-section {
  margin-bottom: 1.5rem;
}

.reg-section-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 0.75rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(245, 158, 11, 0.2);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.reg-section-title::before {
  content: '';
  width: 3px;
  height: 14px;
  background: linear-gradient(180deg, #f59e0b, #fbbf24);
  border-radius: 2px;
}

.reg-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 520px) {
  .reg-row {
    grid-template-columns: 1fr;
  }
}

.reg-terms {
  font-size: 0.875rem;
  color: #94a3b8;
  line-height: 1.55;
}

.reg-terms a {
  color: #f59e0b;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.reg-terms a:hover {
  color: #fbbf24;
  text-decoration: underline;
}

.reg-terms-wrap {
  margin-bottom: 1rem;
}

.reg-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
  color: #64748b;
}

.reg-trust span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.reg-otp-wrap {
  text-align: center;
  padding: 0.5rem 0 1rem;
}

.reg-otp-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  background: rgba(245, 158, 11, 0.12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.reg-otp-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  color: #f8fafc;
  margin-bottom: 0.25rem;
}

.reg-otp-hint {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-bottom: 1rem;
}

#otpInput {
  text-align: center;
  font-size: 1.4rem;
  letter-spacing: 0.35em;
  font-weight: 600;
}

.auth-toggle .reg-login {
  color: #f8fafc;
  font-weight: 600;
}

.auth-toggle .reg-login:hover {
  color: #fbbf24;
}

.reg-hint {
  display: block;
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.35rem;
}

/* ---------- Responsive: small screens ---------- */
@media (max-width: 768px) {
  .auth-nav {
    padding: 0.65rem 1rem;
  }

  .auth-nav .auth-nav-logo img {
    height: 28px;
    max-width: 120px;
  }

  .auth-nav-links {
    gap: 0.75rem;
  }

  .auth-nav-links a {
    font-size: 0.85rem;
  }

  .auth-nav-links .auth-nav-cta {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
  }

  .auth-page {
    padding: 4.5rem 1rem 2rem;
    min-height: 100vh;
  }

  .auth-wrap {
    max-width: 100%;
    padding: 0 0.5rem;
  }

  .auth-modal {
    padding: 2rem 1.5rem;
  }

  .auth-modal h2 {
    font-size: 1.45rem;
  }

  .auth-subtitle {
    font-size: 0.85rem;
  }

  .auth-password-row {
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .auth-forgot-link {
    font-size: 0.8rem;
  }

  .auth-toggle {
    margin-top: 1.25rem;
    padding-top: 1rem;
    font-size: 0.9rem;
  }

  .auth-toggle .sep {
    margin: 0 0.35rem;
  }

  .reg-page .auth-wrap {
    max-width: 100%;
  }

  .reg-page .auth-modal {
    padding: 2rem 1.5rem;
  }

  .reg-header h2 {
    font-size: 1.4rem;
  }

  .reg-header .auth-subtitle {
    font-size: 0.8rem;
  }

  .reg-section {
    margin-bottom: 1.25rem;
  }

  .auth-msg {
    font-size: 0.85rem;
    padding: 0.65rem 0.9rem;
    word-break: break-word;
  }
}

@media (max-width: 520px) {
  .auth-page {
    padding: 4rem 0.75rem 1.5rem;
  }

  .auth-wrap {
    padding: 0 0.25rem;
  }

  .auth-modal {
    padding: 1.5rem 1.25rem;
    border-radius: 16px;
  }

  .auth-logo img {
    max-height: 38px;
  }

  .auth-modal h2 {
    font-size: 1.3rem;
  }

  .auth-subtitle {
    font-size: 0.8rem;
    margin-bottom: 1.25rem;
  }

  .auth-modal .form-group {
    margin-bottom: 1rem;
  }

  .auth-modal input[type="email"],
  .auth-modal input[type="password"],
  .auth-modal input[type="text"],
  .auth-modal input[type="number"] {
    padding: 0.8rem 0.9rem;
    font-size: 0.95rem;
  }

  .auth-modal button[type="submit"] {
    padding: 0.85rem 1.25rem;
    font-size: 0.95rem;
  }

  .auth-toggle {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 1rem;
    padding-top: 1rem;
  }

  .auth-toggle .sep {
    display: none;
  }

  .auth-toggle a {
    display: inline-block;
  }

  .reg-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .reg-page .auth-modal {
    padding: 1.5rem 1.25rem;
  }

  .reg-header h2 {
    font-size: 1.25rem;
  }

  .reg-section-title {
    font-size: 0.7rem;
  }

  .reg-terms {
    font-size: 0.8rem;
  }

  .reg-trust {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    font-size: 0.7rem;
  }

  .auth-msg.success {
    line-height: 1.5;
  }
}

@media (max-width: 360px) {
  .auth-nav {
    padding: 0.5rem 0.75rem;
  }

  .auth-nav-links {
    gap: 0.5rem;
  }

  .auth-nav-links a {
    font-size: 0.8rem;
  }

  .auth-page {
    padding: 3.5rem 0.5rem 1rem;
  }

  .auth-modal {
    padding: 1.25rem 1rem;
  }

  .auth-modal h2 {
    font-size: 1.2rem;
  }

  .reg-header h2 {
    font-size: 1.15rem;
  }
}
