/* ══════════════════════════════════════════════════════════════════
   login.css  —  Atlas · Light Glassmorphism Login Page
   ══════════════════════════════════════════════════════════════════ */

/* ── Fonts & Reset ─────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --clr-bg-from:    #e0e7ff;
  --clr-bg-to:      #f5f3ff;
  --clr-blob-1:     #c7d2fe;
  --clr-blob-2:     #ddd6fe;
  --clr-blob-3:     #e9d5ff;

  --clr-primary:    #6366f1;
  --clr-primary-dk: #4f46e5;
  --clr-accent:     #8b5cf6;

  --clr-card-bg:    rgba(255, 255, 255, 0.65);
  --clr-card-border:rgba(255, 255, 255, 0.85);
  --clr-input-bg:   rgba(255, 255, 255, 0.7);
  --clr-input-brd:  rgba(99, 102, 241, 0.2);
  --clr-input-focus:rgba(99, 102, 241, 0.5);

  --clr-text:       #1e1b4b;
  --clr-text-muted: #6b7280;
  --clr-label:      #4b5563;

  --clr-error-bg:   rgba(239, 68, 68, 0.08);
  --clr-error-brd:  rgba(239, 68, 68, 0.25);
  --clr-error-text: #dc2626;

  --radius-card:    24px;
  --radius-input:   12px;
  --radius-btn:     12px;

  --shadow-card:
    0 8px 32px rgba(99, 102, 241, 0.12),
    0 2px 8px  rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255,255,255,0.9);

  --shadow-input-focus:
    0 0 0 3px rgba(99, 102, 241, 0.15);

  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background: linear-gradient(135deg, var(--clr-bg-from) 0%, var(--clr-bg-to) 100%);
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Animated Background Blobs ─────────────────────────────────── */
.bg-blobs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  animation: blobFloat 12s ease-in-out infinite alternate;
}

.blob-1 {
  width: 520px;
  height: 520px;
  background: var(--clr-blob-1);
  top: -120px;
  left: -100px;
  animation-duration: 14s;
}

.blob-2 {
  width: 420px;
  height: 420px;
  background: var(--clr-blob-2);
  bottom: -80px;
  right: -80px;
  animation-duration: 11s;
  animation-delay: -4s;
}

.blob-3 {
  width: 300px;
  height: 300px;
  background: var(--clr-blob-3);
  top: 50%;
  left: 55%;
  transform: translate(-50%, -50%);
  animation-duration: 18s;
  animation-delay: -7s;
}

@keyframes blobFloat {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(30px, -20px) scale(1.05); }
  66%  { transform: translate(-20px, 25px) scale(0.96); }
  100% { transform: translate(15px, 10px) scale(1.02); }
}

/* ── Particles canvas ───────────────────────────────────────────── */
#particles-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* ── Page layout ────────────────────────────────────────────────── */
.page {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100dvh;
  padding: 24px 16px;
}

/* ── Card ───────────────────────────────────────────────────────── */
.card {
  width: 100%;
  max-width: 420px;
  background: var(--clr-card-bg);
  border: 1.5px solid var(--clr-card-border);
  border-radius: var(--radius-card);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: var(--shadow-card);
  padding: 36px 36px 28px;
  animation: cardIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(28px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ── Logo ────────────────────────────────────────────────── */
.logo-wrap {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
}

.atlas-login-logo {
  height: 52px;
  width: auto;
  display: block;
}

.logo-sub {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--clr-text-muted);
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

/* ── Divider ────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99,102,241,0.2), transparent);
  margin-bottom: 24px;
}

/* ── Heading ────────────────────────────────────────────────────── */
.card-heading {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--clr-text);
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 6px;
}

.card-sub {
  font-size: 0.875rem;
  color: var(--clr-text-muted);
  margin-bottom: 28px;
  font-weight: 400;
}

/* ── Form fields ────────────────────────────────────────────────── */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-wrap {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--clr-label);
  letter-spacing: 0.01em;
  padding-left: 2px;
  transition: color var(--transition);
}

.field-wrap:focus-within .field-label {
  color: var(--clr-primary);
}

.input-box {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--clr-text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
  transition: color var(--transition);
}

.input-box:focus-within .input-icon {
  color: var(--clr-primary);
}

.input-box input {
  width: 100%;
  background: var(--clr-input-bg);
  border: 1.5px solid var(--clr-input-brd);
  border-radius: var(--radius-input);
  padding: 13px 14px 13px 44px;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 400;
  color: var(--clr-text);
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
  -webkit-appearance: none;
}

.input-box input::placeholder {
  color: #9ca3af;
  font-weight: 400;
}

.input-box input:focus {
  border-color: var(--clr-primary);
  box-shadow: var(--shadow-input-focus);
  background: rgba(255,255,255,0.9);
}

/* Password eye toggle */
.eye-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--clr-text-muted);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 6px;
  transition: color var(--transition), background var(--transition);
}

.eye-btn:hover {
  color: var(--clr-primary);
  background: rgba(99,102,241,0.08);
}

/* Shake animation on error */
.card.shake {
  animation: shake 0.38s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15%       { transform: translateX(-7px); }
  30%       { transform: translateX(7px); }
  45%       { transform: translateX(-4px); }
  60%       { transform: translateX(4px); }
  75%       { transform: translateX(-2px); }
}

/* ── Error banner ───────────────────────────────────────────────── */
.error-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--clr-error-bg);
  border: 1px solid var(--clr-error-brd);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--clr-error-text);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition:
    opacity var(--transition),
    transform var(--transition);
}

.error-banner.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* ── Submit button ──────────────────────────────────────────────── */
.btn-submit {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--clr-primary) 0%, var(--clr-accent) 100%);
  border: none;
  border-radius: var(--radius-btn);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  letter-spacing: 0.01em;
  overflow: hidden;
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    opacity var(--transition);
  box-shadow: 0 4px 18px rgba(99,102,241,0.35);
}

.btn-submit::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--transition);
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(99,102,241,0.45);
}

.btn-submit:hover::before {
  background: rgba(255,255,255,0.08);
}

.btn-submit:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(99,102,241,0.25);
}

.btn-submit:disabled,
.btn-submit.loading {
  opacity: 0.75;
  pointer-events: none;
  cursor: not-allowed;
}

/* Loader spinner */
.btn-loader {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-submit.loading .btn-loader {
  display: block;
}

.btn-submit.loading .btn-arrow {
  display: none;
}

.btn-submit.loading .btn-text {
  opacity: 0.8;
}

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

/* ── Card footer ────────────────────────────────────────────────── */
.card-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  margin-top: 20px;
  font-size: 0.75rem;
  color: var(--clr-text-muted);
  font-weight: 400;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
  flex-shrink: 0;
  animation: pulse-dot 2.2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(34,197,94,0.6); }
  50%       { opacity: 0.6; box-shadow: 0 0 12px rgba(34,197,94,0.9); }
}

.footer-sep {
  opacity: 0.4;
}

/* ── Field error highlight ──────────────────────────────────────── */
.field-wrap.has-error .input-box input {
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .card {
    padding: 28px 22px 22px;
    border-radius: 18px;
  }

  .card-heading {
    font-size: 1.25rem;
  }
}

/* ── 2FA step ───────────────────────────────────────────────────── */
.twofa-step {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.twofa-icon-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
}

.twofa-error {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: none !important;
}

.btn-2fa-back {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--clr-primary);
  cursor: pointer;
  text-align: center;
  padding: 4px 0;
  opacity: 0.75;
  transition: opacity 0.2s;
}
.btn-2fa-back:hover { opacity: 1; }
