/* ---------------------------------------------------------------
   Circula Livro — telas de autenticação (login / cadastro).
   Adaptado dos mockups aprovados em docs/design/auth. Mobile-first,
   sem moldura de celular: a página real ocupa a tela toda e centraliza
   o cartão em telas maiores. Áreas de toque >= 44px.
   Paleta da identidade visual (CLAUDE.md):
     #EE57CF (magenta)  #CFEE57 (lima)  #57CFEE (azul)  grafite p/ texto
--------------------------------------------------------------- */
:root {
  --pink: #EE57CF;
  --pink-600: #d63bb6;
  --lime: #CFEE57;
  --sky: #57CFEE;
  --ink: #23262F;      /* grafite — texto principal */
  --ink-soft: #5A6072; /* texto secundário */
  --line: #E7E8EE;
  --bg: #F6F7FB;
  --white: #FFFFFF;
  --danger: #E5484D;
  --danger-bg: #FDECEC;
  --ok: #2FA36B;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(35, 38, 47, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Mobile-first: o cartão ocupa a largura toda com respiro lateral.
   A partir de tablet (>=560px) ele vira um cartão centralizado. */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 24px 22px 32px;
}
@media (min-width: 560px) {
  .auth-wrap { align-items: center; padding: 32px 16px; }
  .auth-card {
    background: var(--white);
    border-radius: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
    padding: 32px 30px 36px;
  }
}

/* Cabeçalho de app com botão voltar */
.appbar {
  display: flex; align-items: center; gap: 10px;
  min-height: 44px; margin: 0 0 8px;
}
.appbar .back {
  width: 44px; height: 44px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--ink); cursor: pointer; text-decoration: none;
}
.appbar h2 { font-size: 17px; margin: 0; font-weight: 700; }

/* Marca */
.brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 8px 0 6px; }
.brand__mark {
  width: 56px; height: 56px; border-radius: 18px;
  background: linear-gradient(135deg, var(--pink), var(--sky));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 26px; box-shadow: 0 8px 18px rgba(238,87,207,.35);
}
.brand__name { font-weight: 800; font-size: 20px; letter-spacing: -.3px; }
.brand__name span { color: var(--pink); }

.title { font-size: 22px; font-weight: 800; margin: 14px 0 4px; letter-spacing: -.4px; text-align: center; }
.subtitle { font-size: 14px; color: var(--ink-soft); margin: 0 0 18px; line-height: 1.4; text-align: center; }

/* Formulário */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.control {
  position: relative; display: flex; align-items: center;
  height: 50px; border: 1.5px solid var(--line); border-radius: 14px;
  background: var(--white); padding: 0 14px; gap: 10px;
}
.control input {
  border: 0; outline: 0; flex: 1; font-size: 16px; color: var(--ink); background: transparent;
  min-width: 0;
}
.control input::placeholder { color: #A9AEBE; }
.control .lead { color: #9AA0B2; font-size: 16px; display: inline-flex; }
.control .toggle {
  color: var(--ink-soft); font-size: 12px; font-weight: 600; cursor: pointer;
  background: none; border: 0; padding: 6px; min-height: 44px;
}
.control:focus-within { border-color: var(--sky); }
.control.is-error { border-color: var(--danger); background: var(--danger-bg); }
.hint { font-size: 12px; color: var(--ink-soft); margin-top: 6px; }
.hint.error { color: var(--danger); display: flex; align-items: center; gap: 6px; }
.hint.error[hidden] { display: none !important; }

/* Alerta de topo (banner do template — nunca alert() nativo) */
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--danger-bg); border: 1px solid #F6C6C7; color: #8A2A2D;
  border-radius: 14px; padding: 12px 14px; font-size: 13px; margin-bottom: 16px; line-height: 1.35;
}
.alert .ic { font-size: 16px; line-height: 1; }
.alert strong { color: #7a2124; }
.alert--ok { background: #EAF7F0; border-color: #BFE6D0; color: #1F6B47; }
.alert--ok strong { color: #1F6B47; }
.alert[hidden] { display: none !important; }

/* Botão primário */
.btn-primary {
  height: 52px; width: 100%; border: 0; border-radius: 14px; cursor: pointer;
  background: var(--pink); color: #fff; font-size: 16px; font-weight: 700;
  box-shadow: 0 10px 20px rgba(238,87,207,.30); margin-top: 4px;
}
.btn-primary:disabled { opacity: .5; box-shadow: none; }

/* Select dentro da moldura (.control) — seta customizada */
.control:has(select) {
  padding-right: 40px;
}

.control:has(select)::after {
  content: '';
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--ink-soft);
  border-bottom: 2px solid var(--ink-soft);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.control select {
  border: 0;
  outline: 0;
  flex: 1;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  min-width: 0;
  width: 100%;
  height: 100%;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.control select:invalid,
.control select option[value=""][disabled] {
  color: #A9AEBE;
}

.control select option {
  color: var(--ink);
  background: var(--white);
  font-weight: 600;
  padding: 10px 14px;
}

/* Foto de perfil (AEC-19) — preview + botão de troca */
.avatar-field {
  display: flex; align-items: center; gap: 16px; margin-bottom: 20px;
}
.avatar-preview {
  width: 84px; height: 84px; flex: 0 0 84px; border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), var(--sky));
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 32px; font-weight: 800;
  border: 2px solid var(--white); box-shadow: var(--shadow);
}
.avatar-actions { flex: 1; min-width: 0; }
.avatar-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 16px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--white);
  color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer;
}
.avatar-actions .hint { margin-top: 8px; }

.foot { text-align: center; font-size: 14px; color: var(--ink-soft); margin-top: 18px; }
.foot a { color: var(--pink); font-weight: 700; text-decoration: none; }
.link-inline { color: var(--pink); font-weight: 600; text-decoration: none; }
.field-foot { text-align: right; margin-top: 8px; }
.field-foot a { font-size: 13px; }

/* Login social — Google e Apple (AEC-18).
   Botões de largura total, área de toque >= 44px, mobile-first. */
.social-group { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }
.btn-social {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  height: 52px; width: 100%; border-radius: 14px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--white); color: var(--ink);
  font-size: 15px; font-weight: 700; text-decoration: none;
}
.btn-social:hover { border-color: #d4d6df; }
.btn-social .ic { width: 20px; height: 20px; display: inline-flex; }
.btn-social--apple { background: #000; border-color: #000; color: #fff; }

/* Separador "ou" entre login social e login por e-mail */
.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--ink-soft); font-size: 12px; margin: 18px 0;
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}
