/* Auth pages (allauth template overrides): centered card on cream canvas.
   Layout + copy follow design_import/ReziDay v1.0/App.dc.html (Login screen).
   First screens a new user sees, and rare ones (a login is a few a month): they may be a
   little more expressive than the app, on the house presets — `gentle` for the arrival,
   `expressive` for the tick — and never a loop that outlives the moment. */

/* ---- Page layout ---- */
.auth-page {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px max(24px, env(safe-area-inset-right)) max(48px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  background: var(--canvas);
  overflow: hidden;
}

.auth-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.auth-wrap {
  position: relative;
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  /* Arrives once: a short rise, on `gentle`. Transform only, on purpose: an opacity fade
     from 0 holds the page's LCP (the title) back until it has finished (+700 ms measured). */
  animation: auth-in var(--rz-gentle-dur) var(--rz-gentle) backwards;
}
@keyframes auth-in {
  from { transform: translateY(calc(14px * var(--motion-distance))); }
}

/* ---- Brand + titles above the card ---- */
.auth-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/* The lockup is components.css's; the auth pages show it at hero size (a 48px mark),
   centred over the form. */
.auth-brand { --brand-word-size: 33px; align-self: center; }

.auth-titles { text-align: center; }

.auth-title {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: var(--t-title-2-track);
  color: var(--ink);
  margin: 0;
}

.auth-sub {
  margin: 6px 0 0;
  font-size: 15px;
  color: var(--text-2);
}
.auth-sub:empty { display: none; }

/* ---- Card ---- */
.auth-card {
  background: var(--card);
  /* The app's card frame + warm offset shadow (Planul de azi, Restanțe, the stats strip). */
  border: 1.5px solid var(--frame);
  border-radius: var(--r-card);
  padding: 32px 32px 30px;
  box-shadow: -3px 3px 0 var(--peach);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---- Social buttons ---- */
.auth-social {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* The full-width button of the auth cards. A .btn, so it has the one press recipe. */
.btn--auth {
  width: 100%;
  height: max(50px, var(--hit-min));
  border-radius: var(--r-control);
  font-size: 15px;
}
.btn--auth svg { flex: none; }

/* A provider that is not wired yet (Apple): it wears the disabled colours (no opacity) and a
   badge that says why. */
.auth-soon {
  padding: 2px 9px;
  border-radius: var(--r-pill); corner-shape: round;
  background: rgba(15, 34, 48, .06);
  border: 1px solid var(--disabled-lip);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
}

/* ---- "sau" divider ---- */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.auth-divider span {
  font-size: var(--t-eyebrow-size);
  font-weight: var(--t-eyebrow-weight);
  letter-spacing: var(--t-eyebrow-track);
  text-transform: uppercase;
  color: var(--text-3);
}

/* ---- Form ---- */
.auth-form {
  --auth-field-edge: #9B9486;       /* 3:1 on the card: the field's edge is a non-text element */
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Inputs (SINTEZA §5.9): 42px under a mouse, 48px on touch (16px type there, below that iOS
   zooms the page on focus); focus = a teal edge + a soft halo, the outline is the halo's job;
   invalid = a red edge, the message below says why. */
.auth-form .input {
  height: 42px;
  font-size: 15px;
  border-radius: var(--r-row);
  border: 1px solid var(--auth-field-edge);
  transition:
    border-color var(--rz-instant-dur) var(--rz-instant),
    box-shadow var(--rz-instant-dur) var(--rz-instant);
}
@media (pointer: coarse) {
  .auth-form .input { height: 48px; font-size: 16px; }
}
.auth-form .input::placeholder { color: var(--text-4); }
.auth-form .input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14, 124, 123, .12);
}
.auth-form .input[aria-invalid="true"] { border-color: var(--error); }
.auth-form .input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(163, 75, 62, .14); }
.auth-form .field-label { font-size: 13.5px; }

/* Password: the reset link sits in the label row, but follows the input in the DOM
   so Tab goes email → password, not email → «Ai uitat parola?». */
.field--pw {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
}
.field--pw > .field-label { grid-row: 1; grid-column: 1; }
.field--pw > .field-link  { grid-row: 1; grid-column: 2; }
.field--pw > .input,
.field--pw > .field-errors { grid-column: 1 / -1; }
.field--pw > .field-errors { margin-top: 6px; }

.field-link {
  position: relative;
  font-size: 13px;
  font-weight: 500;
  color: var(--teal);
}
/* A target bigger than the words, reaching up and sideways (not down into the input). */
.field-link::after { content: ""; position: absolute; inset: -10px -8px -4px; }

.auth-submit { margin-top: 2px; }

/* ---- Errors: an ✕ and a sentence, under the field they are about ---- */
.auth-error,
.field-error {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  color: var(--error);
}
.auth-error::before,
.field-error::before {
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 2px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center / contain no-repeat;
}
.auth-error {
  background: var(--error-tint);
  border-radius: var(--r-row);
  padding: 10px 13px;
  font-size: 13px;
  line-height: 1.5;
}
.auth-error > div { flex: 1; min-width: 0; }
/* An error arrives with a short drop and fade on `snappy` (the line itself still takes its
   place at once: only transform and opacity move). Runs again whenever [hidden] is lifted. */
.auth-error,
.field-error { animation: auth-err-in var(--rz-snappy-dur) var(--rz-snappy) backwards; }
@keyframes auth-err-in { from { opacity: 0; transform: translateY(calc(-4px * var(--motion-distance))); } }
.auth-error[hidden],
.field-error[hidden],
.field-errors[hidden] { display: none; }
.field-errors { display: flex; flex-direction: column; gap: 4px; }
.field-error {
  font-size: 12.5px;
  line-height: 1.45;
  font-weight: 500;
}
.field-error a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ---- Info text (confirmation / done cards) ---- */
.auth-info {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--slate);
  text-align: center;
}
.auth-info strong { color: var(--ink); }

/* ---- "Check your email" + "email confirmed" (accounts/verification.py) ---- */
.auth-verify-wait,
.auth-verify-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.auth-verify-wait[hidden],
.auth-verify-done[hidden] { display: none; }

.auth-verify-icon {
  width: 60px;
  height: 60px;
  border-radius: var(--r-round); corner-shape: round;
  display: grid;
  place-items: center;
  background: var(--teal-tint);
  color: var(--teal);
}

.auth-wait {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--teal);
}
/* The page may sit open for ten minutes: a pulse that never stopped would be a timer running
   on someone who is reading their mail. Two beats, then the dot rests, solid — the words
   next to it say it is still waiting. */
.auth-wait-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-round); corner-shape: round;
  background: var(--teal);
  animation: auth-pulse calc(var(--rz-gentle-dur) * 1.6) var(--rz-gentle) 2;
}
@keyframes auth-pulse {
  0%, 100% { opacity: 1; transform: none; }
  50%      { opacity: .35; transform: scale(calc(1 - .2 * var(--motion-distance))); }
}

.auth-note {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--slate);
  text-align: center;
}
.auth-note--ok { color: var(--success-ink); }

.auth-resend {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-2);
  text-align: center;
}
.auth-resend-btn {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--teal);
  cursor: pointer;
  transition: color var(--rz-instant-dur) var(--rz-instant);
}
@media (hover: hover) and (pointer: fine) {
  .auth-resend-btn:hover { color: var(--teal-hover); }
}

.auth-done-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
}

/* The tick: it arrives with one `expressive` settle (no spin), the ring draws on `smooth`
   and the check on `snappy` once the ring is most of the way round. Under Reduce Motion the
   drawing is skipped and the finished tick fades in. */
.auth-check {
  width: 72px;
  height: 72px;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: auth-check-pop var(--rz-expressive-dur) var(--rz-expressive) both;
}
.auth-check-ring {
  stroke: var(--success);
  stroke-width: 3.5;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  fill: var(--success-tint);
  transform: rotate(-90deg);
  transform-origin: center;
  animation: auth-draw var(--rz-smooth-dur) var(--rz-smooth) forwards;
}
.auth-check-tick {
  stroke: var(--success-ink);
  stroke-width: 4.5;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: auth-draw var(--rz-snappy-dur) var(--rz-snappy) calc(var(--rz-smooth-dur) * .7) forwards;
}
@keyframes auth-draw { to { stroke-dashoffset: 0; } }
@keyframes auth-check-pop {
  from { opacity: 0; transform: scale(calc(1 - .22 * var(--motion-distance))); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-check { animation: auth-fade var(--rz-fade-dur) var(--rz-fade) both; }
  .auth-check-ring,
  .auth-check-tick { animation: none; stroke-dashoffset: 0; }
}
@keyframes auth-fade { from { opacity: 0; } }

/* ---- Below the card ---- */
.auth-below {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--text-2);
}
.auth-switch a { font-weight: 600; color: var(--teal); }

.auth-terms {
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-3);
}

.auth-back { text-align: center; }
.auth-back a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--teal);
}
@media (hover: hover) and (pointer: fine) {
  .auth-back a:hover { text-decoration: underline; text-underline-offset: 3px; }
}

.auth-footer-links {
  display: flex;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-3);
}
.auth-footer-links a { color: var(--text-3); }
@media (hover: hover) and (pointer: fine) {
  .auth-footer-links a:hover { color: var(--ink); }
}

/* The links under the card are small text: on touch the box around them is the target. */
@media (pointer: coarse) {
  .auth-switch a,
  .auth-back a,
  .auth-footer-links a,
  .auth-terms a {
    display: inline-block;
    padding: 12px 4px;
    margin: -12px -4px;
  }
  .auth-back a { display: inline-flex; }
}

/* ===== Dayly ===== */
/* The change-password page (registration/password_change_form.html) is the «Schimbă parola»
   card of ReziDay's «Contul tău» (account.css), which Dayly does not carry: these are that
   sheet's rules for the card, plus the invalid edge, scoped to the form. */
.acc-hint { font-size: 12.5px; color: var(--text-3); }
.acc-pw-form { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.acc-pw-current .input { max-width: 360px; }
.acc-pw-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.acc-pw-grid > .field { align-self: start; }
.acc-pw-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.acc-pw-form .input[aria-invalid="true"] { border-color: var(--error); }
.acc-pw-form .input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(163, 75, 62, .14); }
