/* Egion Auth Suite — Dark theme. Purple-to-blue gradient palette. */

/* Palette: purplish-blue #6F42C1 / #5B3AA8 → vibrant blue #3B82F6 / #4287F5 */

/* ─── Auth page background (same as landing: dots + dark base) ────────────── */
body.auth-page {
  background-color: #040810;
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: 0 0;
  background-attachment: fixed;
  position: relative;
}

/* Soft glow behind the card area */
body.auth-page .container {
  position: relative;
}

body.auth-page .container::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120%;
  max-width: 600px;
  height: 80vh;
  max-height: 700px;
  background: radial-gradient(ellipse at center, rgba(111, 66, 193, 0.07) 0%, rgba(59, 130, 246, 0.04) 40%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ─── Auth page layout (vertically centered) ───────────────────────────── */
body.auth-page .navbar,
body.auth-page .strategy-bar {
  display: none !important;
}

body.auth-page .container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100vh - 0px);
  padding: 32px 24px 48px;
  max-width: 100%;
  box-sizing: border-box;
}

body.auth-page .container .flash:first-child {
  margin-top: 0;
}

body.auth-page .auth-card {
  position: relative;
  z-index: 1;
}

body.auth-page .container .flash {
  position: relative;
  z-index: 1;
}

/* ─── Auth card ────────────────────────────────────────────────────────── */
.auth-card {
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
  background: linear-gradient(180deg, #17171a 0%, #131314 50%, #0f0f11 100%);
  border: 1px solid rgba(42, 42, 44, 0.9);
  border-radius: 20px;
  padding: 40px 36px;
  position: relative;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 4px 24px rgba(0, 0, 0, 0.4),
    0 24px 48px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  box-sizing: border-box;
  transition: box-shadow 0.2s ease;
}

/* Top accent line — purple to blue */
.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, #6F42C1 15%, #5B3AA8 35%, #3B82F6 70%, transparent 100%);
  border-radius: 20px 20px 0 0;
}

/* Soft corner glow */
.auth-card::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -20%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(111, 66, 193, 0.06) 0%, rgba(59, 130, 246, 0.03) 40%, transparent 60%);
  pointer-events: none;
}

.auth-card > * {
  position: relative;
  z-index: 1;
}

/* Title row: logo left, heading centered in the card */
.auth-title-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  margin-bottom: 20px;
  position: relative;
  min-height: 52px;
}

.auth-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
  border-radius: 4px;
}

.auth-title-row .auth-logo {
  filter: drop-shadow(0 2px 8px rgba(111, 66, 193, 0.2));
}

/* Base heading: normal flow and spacing (Forgot password, etc.) */
.auth-card h1 {
  text-align: center;
  margin: 0 0 12px 0;
  font-size: 26px;
  font-weight: 700;
  color: #e8edf5;
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  letter-spacing: -0.02em;
  position: relative;
  white-space: nowrap;
}

/* Title centered in the middle of the card only when inside title row (Login/Register) */
.auth-title-row h1 {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  width: auto;
}

/* Accent line centered under the logo + title block */
.auth-title-row::after {
  content: '';
  display: block;
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, #6F42C1, #3B82F6);
  border-radius: 2px;
}

.auth-card .subtitle {
  text-align: center;
  color: #7b8ba5;
  font-size: 13px;
  margin: 0 0 24px 0;
  line-height: 1.5;
  padding-top: 2px;
}

/* "Don't have an account? Register here" — clean, centered */
.auth-register-prompt {
  text-align: center;
  font-size: 14px;
  color: #7b8ba5;
  margin: 18px 0 4px 0;
  line-height: 1.5;
}

.auth-register-prompt a {
  color: #A78BFA;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s;
}

.auth-register-prompt a:hover {
  color: #C4B5FD;
  text-decoration: underline;
}

.auth-card .field {
  margin-bottom: 18px;
  position: relative;
}

.auth-card label {
  display: block;
  color: #9ca3af;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
}

/* ─── Inputs (dark, rounded, focus glow) ────────────────────────────────── */
.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  background: #1c1c1e;
  border: 1px solid #2a2a2c;
  border-radius: 12px;
  color: #e8edf5;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.auth-card input[type="email"]:hover,
.auth-card input[type="password"]:hover,
.auth-card input[type="text"]:hover {
  border-color: rgba(255, 255, 255, 0.08);
}

.auth-card input::placeholder {
  color: #6b7280;
}

.auth-card input:focus {
  outline: none;
  border-color: #3B82F6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.auth-card input:focus-visible {
  outline: none;
  border-color: #3B82F6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.auth-card input:-webkit-autofill,
.auth-card input:-webkit-autofill:hover,
.auth-card input:-webkit-autofill:focus {
  -webkit-text-fill-color: #e8edf5;
  -webkit-box-shadow: 0 0 0 1000px #1c1c1e inset;
  caret-color: #e8edf5;
}

/* Password field wrapper for show/hide toggle */
.auth-card .password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-card .password-wrapper input {
  padding-right: 44px;
}

.auth-card .password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent !important;
  border: none !important;
  padding: 6px;
  cursor: pointer;
  color: #7b8ba5;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: none !important;
  min-width: auto;
  min-height: auto;
}

.auth-card .password-toggle:hover {
  color: #e8edf5;
  background: transparent !important;
  box-shadow: none !important;
}

.auth-card .password-toggle:focus,
.auth-card .password-toggle:active {
  outline: none;
  background: transparent !important;
  box-shadow: none !important;
}

.auth-card .password-toggle svg {
  width: 20px;
  height: 20px;
  pointer-events: none;
}

/* Code inputs (2FA / email verify) — centered digits */
.auth-card .code-input {
  width: 100%;
  padding: 16px;
  font-size: 28px;
  text-align: center;
  letter-spacing: 12px;
  font-weight: 700;
  font-family: ui-monospace, monospace;
  background: #1c1c1e;
  border: 1px solid #2a2a2c;
  border-radius: 12px;
  color: #e8edf5;
}

.auth-card .code-input:focus {
  border-color: #3B82F6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

/* Security / email badge (2FA pages) */
.auth-card .security-badge,
.auth-card .email-display {
  text-align: center;
  background: linear-gradient(135deg, rgba(111, 66, 193, 0.12) 0%, rgba(59, 130, 246, 0.06) 100%);
  border: 1px solid rgba(111, 66, 193, 0.35);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 22px;
  font-size: 13px;
  color: #7b8ba5;
  box-shadow: 0 0 20px rgba(111, 66, 193, 0.08);
}

.auth-card .security-badge b,
.auth-card .email-display {
  color: #e8edf5;
}

.auth-card .security-badge span:first-child,
.auth-card .email-display {
  color: #A78BFA;
  font-weight: 600;
  font-size: 14px;
}

/* Primary submit button — purple-to-blue gradient (pill style) */
.auth-card button[type="submit"] {
  width: 100%;
  margin-top: 10px;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 600;
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  background: linear-gradient(90deg, #6F42C1 0%, #5B3AA8 35%, #4287F5 70%, #3B82F6 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 2px 16px rgba(111, 66, 193, 0.35);
  position: relative;
}

.auth-card button[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(111, 66, 193, 0.4), 0 4px 16px rgba(59, 130, 246, 0.3);
}

.auth-card button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ─── Google Sign-In button (dark themed) ──────────────────────────────── */
.auth-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 20px;
  background: #131314 !important;
  color: #e8edf5 !important;
  border: 1px solid #3a3a3d !important;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  box-shadow: none !important;
}

.auth-google-btn:hover {
  background: #1c1c1e !important;
  border-color: #4a4a4d !important;
  color: #fff !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3) !important;
}

.auth-google-btn svg {
  flex-shrink: 0;
}

/* Official Google "G" icon (multi-color) */
.auth-google-btn .g-icon {
  width: 20px;
  height: 20px;
}

/* Divider "or" */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0 16px;
}

.auth-divider hr {
  flex: 1;
  border: none;
  height: 1px;
  margin: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(111, 66, 193, 0.25) 20%, rgba(59, 130, 246, 0.2) 80%, transparent 100%);
}

.auth-divider span {
  color: #6b7280;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Secondary link button (e.g. Login with email code) */
.auth-secondary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 20px;
  background: rgba(111, 66, 193, 0.08);
  color: #A78BFA;
  border: 1px solid rgba(111, 66, 193, 0.4);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
}

.auth-secondary-btn:hover {
  background: rgba(111, 66, 193, 0.15);
  border-color: #6F42C1;
  color: #C4B5FD;
}

/* Auth links row (Forgot password, Home) */
.auth-links {
  text-align: center;
  margin-top: 24px;
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 12px;
}

.auth-links-sep {
  color: var(--muted, #7b8ba5);
  opacity: 0.6;
  pointer-events: none;
  user-select: none;
}

.auth-links a {
  color: #7b8ba5;
  text-decoration: none;
  transition: color 0.2s;
  padding: 4px 0;
  position: relative;
}

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

.auth-links a:hover::after {
  width: 100%;
}

.auth-links a::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 0;
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, #6F42C1, #3B82F6);
  transition: width 0.2s ease;
}

/* Terms & Privacy (register page) */
.auth-legal {
  margin-top: 16px;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.5;
}

.auth-legal a {
  color: #A78BFA;
  text-decoration: none;
}

.auth-legal a:hover {
  text-decoration: underline;
}

.auth-legal .checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.auth-legal .checkbox-row input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: #6F42C1;
}

.auth-legal .checkbox-row label {
  margin: 0;
  font-size: 12px;
  color: #9ca3af;
  cursor: pointer;
}

/* Password strength indicator (register) */
.password-strength {
  margin-top: 6px;
  font-size: 12px;
  color: #6b7280;
}

.password-strength .strength-bar {
  height: 4px;
  border-radius: 2px;
  background: #2a2a2c;
  margin-top: 6px;
  overflow: hidden;
}

.password-strength .strength-fill {
  height: 100%;
  border-radius: 2px;
  width: 0%;
  transition: width 0.2s, background 0.2s;
}

.password-strength.weak .strength-fill { width: 25%; background: #F6465D; }
.password-strength.fair .strength-fill { width: 50%; background: #FFD166; }
.password-strength.good .strength-fill { width: 75%; background: #3B82F6; }
.password-strength.strong .strength-fill { width: 100%; background: #2EBD85; }

.password-strength .criteria {
  margin-top: 8px;
  list-style: none;
  padding: 0;
}

.password-strength .criteria li {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 12px;
}

.password-strength .criteria li.met {
  color: #2EBD85;
}

.password-strength .criteria li.unmet {
  color: #6b7280;
}

/* Trust device checkbox (2FA) */
.auth-card .field.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.auth-card .field.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #6F42C1;
  flex-shrink: 0;
}

.auth-card .field.checkbox-row label {
  margin: 0;
  font-weight: 400;
  font-size: 13px;
  cursor: pointer;
}

/* Responsive ───────────────────────────────────────────────────────────── */
/* Form stays same size; only outer container/background adapts. */

@media (max-width: 768px) {
  body.auth-page .container {
    padding: 24px 16px 40px;
    min-height: 100vh;
    min-height: 100dvh;
  }
}

@media (max-width: 480px) {
  body.auth-page .container {
    padding: 20px 12px 36px;
  }
}

@media (max-width: 360px) {
  body.auth-page .container {
    padding: 16px 10px 32px;
  }
}

/* Safe area support for notched devices — only affects outer spacing */
@supports (padding: max(0px)) {
  body.auth-page .container {
    padding-left: max(24px, env(safe-area-inset-left) + 12px);
    padding-right: max(24px, env(safe-area-inset-right) + 12px);
    padding-bottom: max(48px, env(safe-area-inset-bottom) + 16px);
  }

  @media (max-width: 480px) {
    body.auth-page .container {
      padding-left: max(12px, env(safe-area-inset-left) + 8px);
      padding-right: max(12px, env(safe-area-inset-right) + 8px);
    }
  }
}
