/* auth/styles/auth-global.css
   Global auth page styles — mobile-first.
   Motion standard: docs/ux-motion-spec.md
   ─────────────────────────────────────── */

@import url('/assets/css/base.css');
@import url('/assets/css/motion.css');

/* ── Auth container — full-viewport centred ───────────────────────────────── */
.auth-container {
  position: relative;
  z-index: 1;
  isolation: isolate;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: 0.75rem;
  /* Forward navigation: slide in from right per motion standard */
  animation: np-enter-from-right var(--np-duration-default) var(--np-ease-decelerate) both;
}

/* ── Auth card ────────────────────────────────────────────────────────────── */
.auth-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 480px;
  background: white;
  border-radius: var(--radius-xl);
  padding: 0.75rem 1.25rem 2rem;
}

/* ── Back arrow ──────────────────────────────────────────────────────────────
   Rules (from ux-motion-spec.md):
   • Always inline with the page <h1>, same row, same baseline
   • 24×24px icon, 44×44px touch target
   • No background on plain/card backgrounds
   • Colour inherits var(--color-text) — dark mode safe
   ─────────────────────────────────────────────────────────────────────────── */
.auth-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* 44×44 minimum touch target — WCAG 2.5.5 / Apple HIG */
  min-width: 44px;
  min-height: 44px;
  color: var(--color-text);
  background: none;
  border: none;
  text-decoration: none;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  /* Active nudge: leftward 3px — reinforces the back direction */
  transition: background-color 0.15s ease, transform 0.15s ease;
  padding: 0;
  cursor: pointer;
}

.auth-back svg {
  width: 24px;
  height: 24px;
  pointer-events: none;
}

/* Hover: subtle background tint only — no colour change */
@media (hover: hover) {
  .auth-back:hover {
    background-color: var(--color-background, #f8f9fa);
  }
}

.auth-back:active {
  transform: translateX(-3px);
}

/* On full-bleed image backgrounds only — add .auth-back--on-image */
.auth-back--on-image {
  background-color: rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-full);
  color: #ffffff;
}

.auth-back--on-image:hover {
  background-color: rgba(0, 0, 0, 0.5);
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.auth-header {
  margin-bottom: 1.5rem;
}

@media screen and (min-width: 600px) {
  .auth-header {
    margin-bottom: 2rem;
  }
}

/* Top row: [back arrow] [h1 centered] [spacer]
   The spacer mirrors the arrow width so h1 stays truly centred
   regardless of title length. Both must always be present together. */
.auth-header__top {
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: 0.4rem;
}

/* Spacer — mirrors the 44px arrow container width */
.auth-header__spacer {
  width: 44px;
  min-width: 44px;
  flex-shrink: 0;
}

.auth-header h1 {
  flex: 1;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--color-text);
  margin: 0;
}

@media screen and (min-width: 600px) {
  .auth-header h1 {
    font-size: 2rem;
  }
}

.auth-header p {
  text-align: center;
  font-size: 0.95rem;
  color: var(--color-text-light);
  margin: 0;
}

/* Centred header variant — no back arrow, h1 fills full width */
.auth-header--centered .auth-header__top {
  justify-content: center;
}

/* ── Logo ─────────────────────────────────────────────────────────────────── */
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
}

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

/* ── Social login buttons ─────────────────────────────────────────────────── */
.social-logins {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: white;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
}

.social-btn:hover {
  background: var(--color-background);
  border-color: var(--color-text-light);
  text-decoration: none;
  color: var(--color-text);
}

.social-btn--disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.social-btn span {
  white-space: nowrap;
}

.social-btn__coming-soon {
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--color-text-light);
  letter-spacing: 0.01em;
}

/* ── OR divider ───────────────────────────────────────────────────────────── */
.auth-divider {
  text-align: center;
  position: relative;
  margin: 1.5rem 0;
}

.auth-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--color-border);
}

.auth-divider span {
  position: relative;
  background: white;
  padding: 0 1rem;
  color: var(--color-text-light);
  font-size: 0.875rem;
}

/* ── Form groups ──────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

/* ── Input with left icon ─────────────────────────────────────────────────── */
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 1rem;
  color: var(--color-text-light);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.auth-input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 3rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: white;
}

.auth-input:focus {
  outline: none;
  border-color: var(--color-blue);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.auth-input::placeholder {
  color: var(--color-text-light);
  opacity: 0.6;
}

/* ── Password visibility toggle ───────────────────────────────────────────── */
.password-toggle {
  position: absolute;
  right: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--color-text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.password-toggle:hover {
  color: var(--color-text);
}

.password-toggle .eye-open,
.password-toggle .eye-closed {
  width: 20px;
  height: 20px;
}

.password-toggle .eye-closed { display: none; }
.password-toggle.showing .eye-open  { display: none; }
.password-toggle.showing .eye-closed { display: block; }

/* ── Inline error messages ────────────────────────────────────────────────── */
.error-message {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: #E74C3C;
}

/* ── Submit button ────────────────────────────────────────────────────────── */
.auth-submit-btn {
  width: 100%;
  padding: 1rem;
  background: var(--color-blue);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.auth-submit-btn:hover {
  background: #357ABD;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.auth-submit-btn:active {
  transform: translateY(0);
}

.auth-submit-btn:disabled {
  background: var(--color-border);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Inline button spinner ────────────────────────────────────────────────── */
@keyframes np-spin {
  to { transform: rotate(360deg); }
}

.np-spinner-inline {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: np-spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* ── Consent checkboxes ───────────────────────────────────────────────────── */
.auth-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--color-text);
  cursor: pointer;
  line-height: 1.4;
}

.auth-checkbox-label input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 0.1rem;
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  accent-color: var(--color-blue);
}

.auth-checkbox-label a {
  color: var(--color-blue);
  text-decoration: none;
}

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

/* ── Terms line ───────────────────────────────────────────────────────────── */
.auth-terms {
  text-align: center;
  font-size: 0.78rem;
  color: var(--color-text-light);
  line-height: 1.5;
  margin-top: 0.5rem;
}

.auth-terms a {
  color: var(--color-blue);
  text-decoration: none;
}

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

/* ── Footer link line ─────────────────────────────────────────────────────── */
.auth-footer {
  text-align: center;
  font-size: 0.9rem;
  color: var(--color-text-light);
  margin-top: 1.5rem;
}

.auth-footer a {
  color: var(--color-blue);
  font-weight: 600;
  text-decoration: none;
}

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

/* ── Remember me / extras row ─────────────────────────────────────────────── */
.auth-extras {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.auth-link {
  color: var(--color-blue);
  text-decoration: none;
  transition: color 0.2s;
}

.auth-link:hover {
  color: #357ABD;
  text-decoration: underline;
}

/* ── Desktop card padding ─────────────────────────────────────────────────── */
@media screen and (min-width: 640px) {
  .auth-card {
    padding: 3rem 2.5rem;
  }
}

/* ── Reduced motion ───────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .auth-container {
    animation: none;
  }
}
