/**
 * MinhaDoula — telas de autenticação (cadastro, login, verificação)
 * Mobile first · tokens.css + auth.css · ver .ai/frontend.md
 */

.auth-shell,
.auth-shell *,
.auth-shell *::before,
.auth-shell *::after {
  box-sizing: border-box;
}

.auth-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  background:
    radial-gradient(ellipse 80% 50% at 80% -10%, rgba(217, 144, 168, 0.18), transparent 55%),
    radial-gradient(ellipse 70% 45% at 0% 110%, rgba(155, 138, 203, 0.16), transparent 50%),
    var(--md-surface);
  color: var(--md-ink);
  font-family: var(--md-font-ui), sans-serif;
}

.auth-top {
  padding: 16px 16px 0;
  display: flex;
  justify-content: center;
}

.auth-logo {
  display: block;
  line-height: 0;
}

.auth-logo img {
  width: min(148px, 46vw);
  height: auto;
}

.auth-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  padding: 20px 16px 28px;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  min-width: 0;
  overflow: hidden;
  padding: 22px 18px 24px;
  border: 1px solid var(--md-line);
  border-radius: var(--md-radius-lg);
  background: var(--md-white);
  box-shadow: var(--md-shadow);
}

.auth-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--md-accent), var(--md-primary));
}

.auth-card--wide {
  max-width: 520px;
}

.auth-head {
  text-align: center;
  margin-bottom: 20px;
}

.auth-eyebrow {
  margin: 0 0 8px;
  color: var(--md-primary);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.auth-title {
  margin: 0 0 8px;
  font-family: var(--md-font-display);
  font-size: clamp(1.28rem, 5.4vw, 1.7rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.18;
  color: var(--md-ink);
  text-wrap: balance;
}

.auth-copy {
  margin: 0;
  color: var(--md-muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.auth-copy--tight {
  margin-bottom: 16px;
}

.auth-notice {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--md-radius-sm);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
}

.auth-notice--ok {
  background: #eceaf7;
  color: var(--md-primary);
  border: 1px solid rgba(57, 58, 143, 0.18);
}

.auth-notice--error {
  background: var(--md-rose-bg);
  color: var(--md-rose);
  border: 1px solid rgba(156, 88, 114, 0.22);
}

.auth-form,
.auth-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  width: 100%;
  min-width: 0;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.auth-field span {
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--md-muted);
}

.auth-field span em {
  color: var(--md-rose);
  font-style: normal;
}

.auth-input,
.auth-select {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid rgba(57, 58, 143, 0.14);
  border-radius: 14px;
  background: var(--md-surface);
  color: var(--md-ink);
  font: inherit;
  font-weight: 600;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.auth-input::placeholder,
.auth-select:invalid {
  color: #9a9bb3;
  font-weight: 500;
}

.auth-input:hover,
.auth-select:hover {
  border-color: rgba(57, 58, 143, 0.28);
}

.auth-input:focus,
.auth-select:focus {
  outline: 2px solid var(--md-accent);
  outline-offset: 2px;
  border-color: rgba(57, 58, 143, 0.28);
  background: var(--md-white);
}

.auth-input.is-invalid,
.auth-select.is-invalid {
  border-color: var(--md-rose);
}

.auth-input[type="date"] {
  color-scheme: light;
  min-height: 52px;
}

.auth-select {
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2366677D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px;
  cursor: pointer;
}

.auth-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-input-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
}

.auth-input-wrap .auth-input {
  padding-right: 48px;
}

.auth-toggle-pass {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--md-muted);
  cursor: pointer;
}

.auth-toggle-pass:hover,
.auth-toggle-pass:focus-visible {
  color: var(--md-primary);
  background: rgba(57, 58, 143, 0.06);
}

.auth-field-hint {
  margin: 0;
  font-size: 0.74rem;
  color: var(--md-muted);
}

.auth-field-error {
  margin: 0;
  font-size: 0.74rem;
  color: var(--md-rose);
}

.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.auth-btn--primary {
  background: var(--md-primary);
  color: var(--md-white);
  box-shadow: 0 12px 28px rgba(57, 58, 143, 0.22);
}

.auth-btn--ghost {
  background: var(--md-white);
  color: var(--md-primary);
  border-color: var(--md-line);
}

.auth-btn--block {
  width: 100%;
}

.auth-actions {
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  margin-top: 20px;
}

.auth-alt {
  margin-top: 22px;
  width: 100%;
  min-width: 0;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  color: var(--md-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--md-line);
}

.auth-google {
  position: relative;
  width: 100%;
  min-width: 0;
  height: 52px;
  border: 1px solid rgba(57, 58, 143, 0.14);
  border-radius: 14px;
  background: var(--md-white);
  overflow: hidden;
}

.auth-google-face {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 100%;
  padding: 0 16px;
  color: var(--md-ink);
  font-size: 0.92rem;
  font-weight: 700;
  pointer-events: none;
  user-select: none;
}

.auth-google-logo {
  flex-shrink: 0;
}

.auth-google-gsi {
  position: absolute;
  inset: 0;
  opacity: 0.02;
  overflow: hidden;
  border-radius: 14px;
}

.auth-google-gsi > div,
.auth-google-gsi iframe {
  max-width: none !important;
}

.auth-links {
  margin-top: 20px;
}

.auth-link-row {
  margin: 0;
  text-align: center;
  color: var(--md-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.auth-link-row + .auth-link-row {
  margin-top: 8px;
}

.auth-link-row--legal {
  font-size: 0.76rem;
}

.auth-link-row a {
  color: var(--md-primary);
  font-weight: 800;
  text-decoration: none;
}

.auth-link-row--legal a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}

.auth-step {
  position: relative;
  text-align: center;
  color: var(--md-muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.auth-step__dot {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  margin: 0 auto 6px;
  border-radius: 50%;
  border: 2px solid rgba(57, 58, 143, 0.16);
  background: var(--md-white);
  color: var(--md-muted);
  font-weight: 800;
  font-size: 0.78rem;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.auth-step.is-active .auth-step__dot,
.auth-step.is-done .auth-step__dot {
  border-color: var(--md-primary);
  background: var(--md-primary);
  color: var(--md-white);
}

.auth-step.is-active {
  color: var(--md-primary);
}

.auth-step.is-done {
  color: var(--md-ink);
}

.auth-type-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.auth-type-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 88px;
  min-width: 0;
  padding: 16px;
  border: 2px solid var(--md-line);
  border-radius: var(--md-radius-md);
  background: var(--md-white);
  color: var(--md-ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.auth-type-btn svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--md-accent);
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-type-btn .auth-type-icon--gestante {
  width: 26px;
  height: 26px;
  fill: currentColor;
  stroke: none;
  stroke-width: 0;
}

.auth-type-btn strong {
  font-size: 0.98rem;
  font-weight: 800;
}

.auth-type-btn small {
  color: var(--md-muted);
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.35;
}

.auth-type-btn.is-selected {
  border-color: var(--md-primary);
  background: linear-gradient(145deg, rgba(57, 58, 143, 0.06), rgba(217, 144, 168, 0.08));
  color: var(--md-primary);
  box-shadow: 0 10px 24px rgba(57, 58, 143, 0.1);
}

.auth-type-btn.is-selected svg {
  color: var(--md-primary);
}

.auth-token-grid {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 8px;
}

.auth-token-input {
  width: 42px;
  height: 50px;
  flex: 0 0 42px;
  padding: 0;
  border: 1px solid rgba(57, 58, 143, 0.14);
  border-radius: 12px;
  background: var(--md-surface);
  color: var(--md-primary);
  font-size: 1.1rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-token-input:focus {
  outline: 2px solid var(--md-accent);
  outline-offset: 2px;
  background: var(--md-white);
}

.auth-plans {
  display: grid;
  gap: 12px;
}

.auth-plan {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 20px 16px;
  border: 1px solid var(--md-line);
  border-radius: var(--md-radius-md);
  background: var(--md-white);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.auth-plan.is-featured {
  border: 2px solid var(--md-primary);
  box-shadow: 0 16px 40px rgba(57, 58, 143, 0.14);
}

.auth-plan h3 {
  margin: 0 0 6px;
  font-family: var(--md-font-display);
  font-size: 1.05rem;
}

.auth-plan .price {
  margin: 0 0 14px;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--md-primary);
}

.auth-plan ul {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  color: var(--md-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.auth-plan li::before {
  content: "✓ ";
  color: var(--md-primary);
  font-weight: 900;
}

.auth-plan .auth-btn {
  width: 100%;
  margin-top: auto;
}

.auth-foot {
  padding: 8px 16px 24px;
  text-align: center;
  color: var(--md-muted);
  font-size: 0.78rem;
}

.auth-foot a {
  color: var(--md-primary);
  font-weight: 700;
}

.auth-foot-legal {
  margin: 6px 0 0;
}

.auth-step-panel[hidden] {
  display: none !important;
}

.auth-reveal {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.auth-reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (hover: hover) {
  .auth-google:hover {
    border-color: rgba(57, 58, 143, 0.28);
  }

  .auth-btn:hover:not(:disabled) {
    transform: translateY(-2px);
  }

  .auth-btn--primary:hover:not(:disabled) {
    background: var(--md-primary-hover);
  }

  .auth-type-btn:hover:not(.is-selected) {
    transform: translateY(-2px);
    border-color: rgba(57, 58, 143, 0.28);
  }

  .auth-plan:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 46px rgba(32, 33, 61, 0.1);
  }

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

@media (min-width: 720px) {
  .auth-top {
    padding: 24px 24px 0;
  }

  .auth-main {
    align-items: center;
    padding: 28px 24px 40px;
  }

  .auth-card {
    padding: 32px 28px 28px;
  }

  .auth-card--wide {
    max-width: 640px;
  }

  .auth-form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .auth-field--full {
    grid-column: 1 / -1;
  }

  .auth-type-grid {
    grid-template-columns: 1fr 1fr;
  }

  .auth-actions {
    flex-direction: row;
    justify-content: space-between;
  }

  .auth-actions .auth-btn {
    width: auto;
    min-width: 148px;
  }

  .auth-plans {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .auth-step {
    font-size: 0.72rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card,
  .auth-type-btn,
  .auth-plan,
  .auth-btn,
  .auth-reveal {
    transition: none !important;
    transform: none !important;
  }
}
