@use '../variables' as v;
@use '../mixins' as m;

// ─────────────────────────────────────────────
// Auth pages (Login, Register, etc.)
// ─────────────────────────────────────────────

.auth-page {
  font-family: v.$font-family;
  min-height: 100vh;
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  position: relative;
  overflow: hidden;

  // Colorful animated background blobs
  &::before,
  &::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(85px);
    opacity: 0.12;
    z-index: 1;
    pointer-events: none;
    transition: opacity v.$transition-slow;
  }

  &::before {
    width: 450px;
    height: 450px;
    background: linear-gradient(135deg, #4285F4 0%, #34A853 100%);
    top: -150px;
    left: -150px;
    animation: auth-blob-one 25s infinite alternate ease-in-out;
  }

  &::after {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, #EA4335 0%, #FBBC05 100%);
    bottom: -200px;
    right: -200px;
    animation: auth-blob-two 30s infinite alternate ease-in-out;
  }
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: v.$radius-xl;
  box-shadow: v.$shadow-md;
  padding: 40px 36px;
  position: relative;
  z-index: 2;
  animation: auth-card-entrance 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

// ── Logo ─────────────────────────────────────
.auth-logo {
  @include m.flex-center;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;


  &-name {
    font-size: v.$font-size-xl;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
  }
}

// ── Heading ──────────────────────────────────
.auth-title {
  font-size: v.$font-size-2xl;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 6px;

}

.auth-sub {
  font-size: v.$font-size-sm;
  color: var(--text-secondary);
  margin-bottom: 12px;
 
}

// ── Error banner ─────────────────────────────
.auth-error {
  background: var(--danger-light);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  border-radius: v.$radius;
  padding: 10px 14px;
  font-size: v.$font-size-sm;
  margin-bottom: 20px;
}

// ── Form ─────────────────────────────────────
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: v.$font-size-sm;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-forgot {
  font-size: v.$font-size-xs;
  color: v.$primary;
  text-decoration: none;
  font-weight: 500;

  &:hover { text-decoration: underline; }
}

.form-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: v.$font-size-xs;
  font-weight: 500;
  color: v.$primary;
  padding: 0;
  font-family: v.$font-family;
}

// ── Password strength checklist ──────────────
.auth-checklist {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
  margin-top: 2px;
}

.auth-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: v.$font-size-xs;
  color: var(--text-muted);

  &-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-color);
    flex-shrink: 0;
  }

  &.is-met {
    color: var(--success);

    .auth-check-dot { background: var(--success); }
  }
}

// ── Password input wrapper (for eye toggle) ──
.form-input-wrap {
  position: relative;
  display: flex;
  align-items: center;

  .form-input {
    padding-right: 40px; // room for eye btn
  }
}

.form-eye-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color v.$transition-base;
  border-radius: v.$radius-sm;

  &:hover {
    color: var(--text-secondary);
  }

  &:focus-visible {
    outline: 2px solid v.$primary;
    outline-offset: 1px;
  }
}

.form-input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-color);
  border-radius: v.$radius;
  font-size: v.$font-size-base;
  font-family: v.$font-family;
  color: var(--text-secondary);
  background: var(--bg-surface);
  transition: border-color v.$transition-base, box-shadow v.$transition-base;
  outline: none;
}

.form-checkbox {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  font-size: v.$font-size-sm;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;

  input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: v.$primary;
    cursor: pointer;
    flex-shrink: 0;
  }
}

// ── Submit button ─────────────────────────────
.auth-btn {
  width: 100%;
  height: 42px;
  background: v.$primary;
  color: v.$white;
  border: none;
  border-radius: v.$radius;
  font-size: v.$font-size-base;
  font-weight: 600;
  font-family: v.$font-family;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background v.$transition-base, box-shadow v.$transition-base;
  margin-top: 4px;

  &:hover:not(:disabled) {
    background: v.$primary-hover;
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.35);
  }

  &:disabled {
    opacity: 0.65;
    cursor: not-allowed;
  }
}

.auth-btn-secondary {
  background: transparent;
  color: v.$primary;
  border: 1px solid v.$primary;

  &:hover:not(:disabled) {
    background: rgba(66, 133, 244, 0.08);
    box-shadow: none;
  }
}

.auth-btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: v.$white;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

// ── Footer ───────────────────────────────────
.auth-footer {
  margin-top: 24px;
  font-size: v.$font-size-xs;
  color: var(--text-muted);
  text-align: center;
  position: relative;
  z-index: 2;
}

// ── Responsive ───────────────────────────────
@include m.max-sm {
  .auth-card {
    padding: 28px 20px;
    border-radius: v.$radius-lg;
  }
}

// ── Animations ────────────────────────────────
@keyframes auth-card-entrance {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes auth-blob-one {
  0% {
    transform: translate(0, 0) scale(1) rotate(0deg);
  }
  50% {
    transform: translate(120px, 80px) scale(1.15) rotate(180deg);
  }
  100% {
    transform: translate(-40px, 160px) scale(0.9) rotate(360deg);
  }
}

@keyframes auth-blob-two {
  0% {
    transform: translate(0, 0) scale(1.1) rotate(0deg);
  }
  50% {
    transform: translate(-140px, -90px) scale(0.85) rotate(-180deg);
  }
  100% {
    transform: translate(60px, -200px) scale(1.25) rotate(-360deg);
  }
}
