/* ========================================
   AUTH PAGE – Premium Light Login/Register
   ======================================== */

@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap");

/* ---------- Page wrapper ---------- */
.auth-page {
  min-height: calc(100vh - 12rem); /* Account for header and footer */
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f8f9fb 0%, #eef1f5 100%);
  padding: 2rem 1rem;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Card ---------- */
.auth-card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: 1.25rem;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.06);
  overflow: hidden;
  position: relative;
  margin: 0; /* Prevent margin:auto from overriding align-items: flex-start */
}

/* Decorative gradient glow behind the card */
.auth-card::before {
  content: "";
  position: absolute;
  top: -80px;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(
    180deg,
    rgba(56, 131, 246, 0.12) 0%,
    rgba(56, 131, 246, 0.04) 50%,
    transparent 100%
  );
  filter: blur(40px);
  pointer-events: none;
  z-index: 0;
}

.auth-card-body {
  padding: 2.5rem 2rem 2rem;
  position: relative;
  z-index: 1;
}

/* ---------- Logo / Branding ---------- */
.auth-logo-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2rem;
}

.auth-logo-box {
  background: #fff;
  padding: 1rem;
  border-radius: 1rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-logo-box img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.auth-title {
  font-size: 1.625rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
  text-align: center;
}

.auth-subtitle {
  color: #6b7280;
  font-size: 0.9rem;
  margin-top: 0.35rem;
  text-align: center;
}

/* ---------- Tabs ---------- */
.auth-tabs {
  display: flex;
  background: #f3f4f6;
  border-radius: 0.625rem;
  padding: 4px;
  margin-bottom: 1.75rem;
  gap: 4px;
}

.auth-tab {
  flex: 1;
  padding: 0.6rem 0;
  border: none;
  background: transparent;
  color: #6b7280;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
  text-align: center;
}

.auth-tab:hover {
  color: #374151;
}

.auth-tab.active {
  background: #fff;
  color: #111827;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ---------- Form sections ---------- */
.auth-form-login,
.auth-form-register {
  display: none;
}

.auth-form-login.active,
.auth-form-register.active {
  display: block;
  animation: authFadeIn 0.3s ease;
}

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

/* ---------- Input groups ---------- */
.auth-field {
  margin-bottom: 1.25rem;
}

.auth-field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.4rem;
}

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

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

.auth-field .label-row a {
  font-size: 0.75rem;
  color: #3b82f6;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.auth-field .label-row a:hover {
  text-decoration: underline;
  color: #2563eb;
}

.auth-input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #e5e7eb;
  border-radius: 0.625rem;
  background: #f9fafb;
  color: #111827;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.auth-input::placeholder {
  color: #9ca3af;
}

.auth-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
  background: #fff;
}

/* Password wrapper */
.auth-password-wrap {
  position: relative;
}

.auth-password-wrap .auth-input {
  padding-right: 70px;
}

.auth-password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 0.375rem;
  transition: color 0.2s, background 0.2s;
  font-family: inherit;
}

.auth-password-toggle:hover {
  color: #3b82f6;
  background: #f3f4f6;
}

/* Identifier field with inline verify button */
.auth-identifier-wrap {
  position: relative;
}

.auth-identifier-wrap .auth-input {
  padding-right: 80px;
}

.auth-verify-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #3b82f6;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 0.375rem;
  transition: color 0.2s, background 0.2s;
  font-family: inherit;
  display: none;
  text-decoration: underline;
}

.auth-verify-btn:hover {
  color: #2563eb;
  background: #eff6ff;
}

/* ---------- OTP section ---------- */
.auth-otp-section {
  display: none;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: #f0f7ff;
  border-radius: 0.625rem;
  border: 1px solid #dbeafe;
  animation: authFadeIn 0.3s ease;
}

.auth-otp-section.visible {
  display: block;
}

.auth-otp-input-wrap {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
}

.auth-otp-section .auth-input {
  flex: 1 1 auto;
  margin-bottom: 0.5rem;
  background: #fff;
}

.auth-otp-msg {
  font-size: 0.8rem;
  margin: 0 0 0.5rem;
  color: #ef4444;
}

.auth-otp-msg.success {
  color: #10b981;
}

.auth-otp-error {
  color: #ef4444;
  font-size: 0.75rem;
}

.auth-otp-confirm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 0.5rem;
  background: #111827;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.auth-otp-confirm-btn:hover {
  background: #1f2937;
}

.auth-otp-confirm-btn:active {
  transform: scale(0.97);
}

.auth-otp-confirm-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Submit buttons ---------- */
.auth-submit-btn {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 0.625rem;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  cursor: pointer;
  transition: all 0.25s ease;
  background: linear-gradient(to top, #1d4ed8, #3b82f6, #60a5fa);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.auth-submit-btn:hover {
  background: linear-gradient(to top, #1e40af, #2563eb, #3b82f6);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35);
}

.auth-submit-btn:active {
  transform: scale(0.98);
}

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

/* ---------- Footer links ---------- */
.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid #f3f4f6;
}

.auth-footer p {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0;
}

.auth-footer a,
.auth-switch-link {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
}

.auth-footer a:hover,
.auth-switch-link:hover {
  text-decoration: underline;
  color: #2563eb;
}

/* ---------- Alert overrides ---------- */
.auth-alert {
  border-radius: 0.625rem;
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  border: none;
}

.auth-alert-error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.auth-alert-success {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.auth-alert .btn-close {
  filter: none;
  opacity: 0.6;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .auth-page {
    padding: 1rem 0.75rem;
    align-items: flex-start;
    padding-top: 5rem;
  }

  .auth-card-body {
    padding: 2rem 1.5rem 1.5rem;
  }

  .auth-logo-box img {
    width: 42px;
    height: 42px;
  }

  .auth-title {
    font-size: 1.375rem;
  }

  .auth-otp-input-wrap {
    flex-direction: column;
  }

  .auth-otp-confirm-btn {
    width: 100%;
  }
}
