/* Dimensional Auth Overlay */
.auth-portal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
  overscroll-behavior: contain;
  background: transparent;
  perspective: 1000px;
}

.auth-portal.active {
  display: flex;
}

.auth-portal.closing {
  display: flex;
}

/* Auth Sync Loading States */
.btn-auth-sync {
  position: relative;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 140px;
  height: 44px;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.05);
  border-top: 2px solid #8b5cf6;
  border-right: 2px solid #d946ef;
  border-radius: 50%;
  animation: btn-spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  display: block;
  filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.6));
}

.btn-label {
  opacity: 1;
  transition:
    opacity 0.4s ease,
    transform 0.4s ease;
}

.btn-auth-sync:not(.synced) .btn-label {
  display: none;
  opacity: 0;
  transform: scale(0.9);
}

.btn-auth-sync.synced .btn-spinner {
  display: none;
}

.btn-icon {
  display: none;
}

@keyframes btn-spin {
  0% {
    transform: rotate(0deg);
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.6));
  }

  50% {
    filter: drop-shadow(0 0 12px rgba(217, 70, 239, 0.6));
  }

  100% {
    transform: rotate(360deg);
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.6));
  }
}

@media (max-width: 640px) {
  .btn-auth-sync.synced .btn-label {
    display: block !important;
    white-space: nowrap;
  }

  .btn-auth-sync.synced .btn-icon {
    display: none !important;
  }

  .nav-btn-main.btn-auth-sync {
    min-width: 138px;
    width: 138px;
    max-width: 138px;
    height: 40px;
    padding: 0 0.75rem;
    border-radius: 12px;
    gap: 8px;
  }

  .nav-btn-main.btn-auth-sync .btn-label {
    font-size: 0.82rem;
    white-space: nowrap;
  }

  .mobile-link.btn-auth-sync {
    justify-content: flex-start;
    gap: 15px;
  }

  .mobile-link.btn-auth-sync .btn-label {
    display: block !important;
    /* Keep text in the drawer menu */
  }
}

.auth-open body {
  overflow: hidden !important;
}

html.auth-open {
  overflow: hidden !important;
}

html.auth-open body {
  overflow: hidden !important;
}

body.auth-open {
  overflow: hidden !important;
}

.portal-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(91, 33, 182, 0.4) 0%,
    rgba(3, 3, 3, 0.95) 70%
  );
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 1;
}

.auth-portal.active .portal-backdrop {
  opacity: 1;
}

.auth-card {
  position: relative;
  width: min(440px, 100%);
  max-height: calc(100dvh - 32px);
  padding: clamp(1.25rem, 4vw, 3.5rem);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 40px;
  box-shadow:
    0 40px 100px -20px rgba(0, 0, 0, 0.5),
    inset 0 1px 1px rgba(255, 255, 255, 0.1);
  transform: none;
  opacity: 1;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 1024px) {
  .auth-card {
    width: 480px;
  }
}

.auth-portal.active .auth-card {
  transform: none;
  opacity: 1;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    transparent,
    rgba(255, 255, 255, 0.05),
    transparent
  );
  pointer-events: none;
}

.auth-card-inner {
  position: relative;
  z-index: 2;
  width: 100%;
}

.auth-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.auth-header h2 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

.auth-header p {
  color: var(--text-alt);
  font-size: 0.95rem;
}

.auth-options {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 2rem;
}

/* Prismatic Google Button */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 1.1rem;
  background: #fff;
  color: #000;
  border-radius: 16px;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.95rem;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  border: none;
  cursor: pointer;
}

.btn-google:hover {
  transform: translateY(-4px);
}

.btn-passkey {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 1.1rem;
  background: rgba(255, 255, 255, 0.03);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  font-weight: 800;
  font-size: 0.95rem;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.btn-passkey:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(196, 181, 253, 0.5);
}

.btn-google:disabled,
.btn-passkey:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-separator {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0;
  color: var(--text-alt);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.auth-separator::before,
.auth-separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.auth-form {
  overflow: hidden;
}

.auth-form-slider {
  display: flex;
  width: 100%;
  transition: transform 0.35s ease;
}

.auth-form-slider.step-1 {
  transform: translateX(0);
}

.auth-form-slider.step-2 {
  transform: translateX(-100%);
}

.auth-form-slider.step-3 {
  transform: translateX(-200%);
}

.auth-form-page {
  width: 100%;
  min-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.auth-step-nav {
  display: flex;
  justify-content: flex-start;
}

.auth-inline-feedback {
  margin: 0;
  text-align: left;
  font-size: 0.84rem;
  color: #c4b5fd;
}

.input-group {
  position: relative;
}

.input-group input {
  width: 100%;
  padding: 1.2rem 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  color: #fff;
  font-size: 1rem;
  transition: all 0.3s;
  outline: none;
}

.input-group input:focus {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--primary-bright);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}

.input-group.has-password-toggle input {
  padding-right: 3.1rem;
}

.auth-password-toggle {
  position: absolute;
  right: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.7rem;
  height: 1.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.68);
  cursor: pointer;
  transition:
    color 0.2s ease,
    background 0.2s ease;
}

.auth-password-toggle:hover {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.08);
}

.auth-password-toggle svg {
  width: 1rem;
  height: 1rem;
}

.auth-password-toggle .icon-eye-off {
  display: none;
}

.auth-password-toggle.is-visible .icon-eye {
  display: none;
}

.auth-password-toggle.is-visible .icon-eye-off {
  display: block;
}

.input-group label {
  position: absolute;
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-alt);
  pointer-events: none;
  transition: all 0.3s;
  font-weight: 600;
  opacity: 1;
}

.input-group input:focus ~ label,
.input-group input:not(:placeholder-shown) ~ label {
  opacity: 0;
  transform: translateY(-140%);
}

.otp-group {
  padding-top: 1.2rem;
}

.otp-fields {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.55rem;
}

.otp-digit {
  width: 100%;
  height: 44px;
  padding: 0 !important;
  border: none;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 0;
  background: transparent;
  color: #fff;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 44px;
  outline: none;
  transition:
    border-color 0.25s ease,
    color 0.25s ease;
  overflow: visible;
}

.otp-digit:focus {
  border-bottom-color: rgba(139, 92, 246, 0.75);
}

.otp-digit.is-filled {
  border-bottom-color: rgba(139, 92, 246, 0.65);
}

.otp-digit.is-error {
  border-bottom-color: #ef4444;
  color: #ef4444;
}

.auth-reset-cancel {
  margin-top: 0.35rem;
  align-self: center;
}

.btn-auth-submit {
  width: 100%;
  padding: 1.2rem;
  margin-top: 1rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 16px;
  font-weight: 900;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-auth-submit:hover {
  transform: translateY(-2px);
  background: var(--primary-bright);
}

.btn-auth-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(1);
  transform: none !important;
  box-shadow: none !important;
}

.auth-helper-text {
  margin-top: 15px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-alt);
}

.btn-text-link {
  background: none;
  border: none;
  color: var(--primary-bright);
  font-weight: 700;
  cursor: pointer;
  font-size: inherit;
  padding: 0;
  margin-left: 5px;
  text-decoration: none;
  transition: color 0.3s;
}

.btn-text-link:hover {
  color: #fff;
  text-shadow: 0 0 10px var(--primary-bright);
}

.auth-forgot-wrap {
  display: flex;
  justify-content: flex-end;
  margin-top: -0.4rem;
}

.cap-container {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0;
  min-height: 65px;
  width: 100%;
  overflow: hidden;
}

#cap-widget {
  width: 100%;
  display: flex;
  justify-content: center;
}

#cap-widget {
  --cap-widget-width: 100%;
  --cap-widget-height: 44px;
  --cap-border-radius: 12px;
}

.auth-close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  z-index: 10;
}

.auth-close:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: rotate(90deg);
}

/* Floating Particles for Auth */
.auth-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.auth-particle {
  position: absolute;
  background: var(--primary-bright);
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.3;
  animation: float-auth infinite linear;
}

@keyframes float-auth {
  from {
    transform: translate(0, 0);
  }

  to {
    transform: translate(var(--tx), var(--ty));
  }
}

@media (max-width: 640px) {
  .auth-portal {
    align-items: center;
    padding: 12px;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }

  .auth-card {
    border-radius: 24px;
    max-height: calc(100dvh - 24px);
    touch-action: pan-y;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .auth-card::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }

  .auth-header {
    display: none !important;
  }
  .auth-card.is-scrollable .auth-header {
    display: none !important;
  }

  .auth-separator {
    margin: 0.7rem 0;
  }
  .auth-card.is-scrollable .auth-separator {
    margin: 0.5rem 0;
  }

  .auth-options {
    margin-top: 1.25rem;
  }

  .auth-close {
    top: 1rem;
    right: 1rem;
  }

  body.auth-open iframe[src*="tawk.to"],
  body.auth-open #tawkchat-container,
  body.auth-open .tawk-min-container,
  body.auth-open .tawk-min-container iframe {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  body.auth-open.auth-mobile-tawk-hidden [id*="tawk"],
  body.auth-open.auth-mobile-tawk-hidden [class*="tawk"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}
