/*
 * Telas de conta (login, cadastro, senha, e-mail) no visual do app Next.
 *
 * Tokens copiados do shadcn/ui do app (preset radix-nova, base neutral,
 * fonte Geist, raio 0.625rem) em registro-rural-site/frontend/app/globals.css.
 * Mudou lá, atualize aqui. Sem Bootstrap: só estas classes.
 */

:root {
  color-scheme: light;
  --background: oklch(1 0 0);
  --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.145 0 0);
  --primary: oklch(0.205 0 0);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.97 0 0);
  --secondary-foreground: oklch(0.205 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --accent: oklch(0.97 0 0);
  --accent-foreground: oklch(0.205 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --success: oklch(0.527 0.154 150.069);
  --border: oklch(0.922 0 0);
  --input: oklch(0.922 0 0);
  --ring: oklch(0.708 0 0);
  --radius: 0.625rem;
  --font-sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --page: oklch(0.985 0 0);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --background: oklch(0.145 0 0);
    --foreground: oklch(0.985 0 0);
    --card: oklch(0.205 0 0);
    --card-foreground: oklch(0.985 0 0);
    --primary: oklch(0.922 0 0);
    --primary-foreground: oklch(0.205 0 0);
    --secondary: oklch(0.269 0 0);
    --secondary-foreground: oklch(0.985 0 0);
    --muted: oklch(0.269 0 0);
    --muted-foreground: oklch(0.708 0 0);
    --accent: oklch(0.269 0 0);
    --accent-foreground: oklch(0.985 0 0);
    --destructive: oklch(0.704 0.191 22.216);
    --success: oklch(0.723 0.192 149.579);
    --border: oklch(1 0 0 / 10%);
    --input: oklch(1 0 0 / 15%);
    --ring: oklch(0.556 0 0);
    --page: oklch(0.145 0 0);
  }
}

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

body.auth {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  background: var(--page);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.auth h1,
.auth h2,
.auth p,
.auth ul {
  margin: 0;
}

.auth h2 {
  font-size: 1rem;
  line-height: 1.4;
}

.auth a {
  color: inherit;
}

.auth .text-muted,
.auth a.text-muted {
  color: var(--muted-foreground);
}

.auth a.text-muted:hover {
  color: var(--foreground);
}

.auth-wrap {
  width: 100%;
  max-width: 24rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.auth-wrap--wide {
  max-width: 32rem;
}

/* Marca: ícone + nome, como no header do site. */
.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  align-self: center;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.auth-brand svg {
  width: 1.75rem;
  height: 1.6rem;
}

/* Card */
.card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem 0;
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.4);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.card-header {
  display: grid;
  gap: 0.375rem;
  padding: 0 1.5rem;
  text-align: center;
}

.card-header--start {
  text-align: left;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.card-description {
  color: var(--muted-foreground);
  text-wrap: pretty;
}

.card-content {
  display: grid;
  gap: 1.25rem;
  padding: 0 1.5rem;
}

.card-footer {
  padding: 0 1.5rem;
  text-align: center;
  color: var(--muted-foreground);
}

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: 0.25rem;
  border-radius: 999px;
  background: var(--muted);
  color: var(--foreground);
}

.card-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.card-icon--success {
  color: var(--success);
}

.card-icon--destructive {
  color: var(--destructive);
}

/* Formulários */
.stack {
  display: grid;
  gap: 1rem;
}

.stack-sm {
  display: grid;
  gap: 0.5rem;
}

.field {
  display: grid;
  gap: 0.5rem;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.label,
.auth label {
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
}

.auth input[type='text'],
.auth input[type='email'],
.auth input[type='password'],
.auth input[type='number'],
.auth input[type='tel'],
.auth input[type='url'],
.auth textarea,
.auth select,
.input {
  display: flex;
  width: 100%;
  min-width: 0;
  height: 2.25rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) * 0.8);
  background: transparent;
  color: var(--foreground);
  font: inherit;
  font-size: 0.875rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

@media (prefers-color-scheme: dark) {
  .auth input[type='text'],
  .auth input[type='email'],
  .auth input[type='password'],
  .auth input[type='number'],
  .auth input[type='tel'],
  .auth input[type='url'],
  .auth textarea,
  .auth select,
  .input {
    background: color-mix(in oklab, var(--input) 30%, transparent);
  }
}

.auth textarea {
  height: auto;
  min-height: 4rem;
}

.auth input::placeholder,
.auth textarea::placeholder {
  color: var(--muted-foreground);
}

.auth input:focus-visible,
.auth textarea:focus-visible,
.auth select:focus-visible {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
}

.field.has-error input,
.auth input[aria-invalid='true'] {
  border-color: var(--destructive);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--destructive) 20%, transparent);
}

.auth input[type='checkbox'],
.auth input[type='radio'] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.field-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.field-check label {
  font-weight: 400;
}

.field-help {
  color: var(--muted-foreground);
  font-size: 0.8125rem;
}

.field-help ul {
  display: grid;
  gap: 0.125rem;
  padding-left: 1rem;
  margin: 0;
}

.field-error {
  color: var(--destructive);
  font-size: 0.8125rem;
}

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.25rem;
  padding: 0 1rem;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) * 0.8);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s, opacity 0.15s;
  outline: none;
}

.btn:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
  border-color: var(--ring);
}

.btn:disabled,
.btn[aria-disabled='true'] {
  opacity: 0.5;
  pointer-events: none;
}

.btn svg,
.btn img {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.auth .btn-primary,
.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.btn-primary:hover {
  background: color-mix(in oklab, var(--primary) 90%, transparent);
}

.auth .btn-outline,
.btn-outline {
  background: var(--background);
  border-color: var(--border);
  color: var(--foreground);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

@media (prefers-color-scheme: dark) {
  .btn-outline {
    background: color-mix(in oklab, var(--input) 30%, transparent);
    border-color: var(--input);
  }
}

.btn-outline:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.auth .btn-secondary,
.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
}

.btn-secondary:hover {
  background: color-mix(in oklab, var(--secondary) 80%, transparent);
}

.auth .btn-ghost,
.btn-ghost {
  background: transparent;
  color: var(--foreground);
}

.btn-ghost:hover {
  background: var(--accent);
}

.auth .btn-destructive,
.btn-destructive {
  background: var(--destructive);
  color: oklch(0.985 0 0);
}

.btn-destructive:hover {
  background: color-mix(in oklab, var(--destructive) 90%, transparent);
}

.btn-block {
  width: 100%;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Separador "ou" */
.separator {
  position: relative;
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.separator::after {
  content: '';
  position: absolute;
  inset: 50% 0 auto;
  border-top: 1px solid var(--border);
  z-index: 0;
}

.separator span {
  position: relative;
  z-index: 1;
  padding: 0 0.5rem;
  background: var(--card);
}

.auth hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* Alertas */
.alert {
  display: grid;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 0.875rem;
  text-align: left;
}

.alert-destructive {
  color: var(--destructive);
  border-color: color-mix(in oklab, var(--destructive) 35%, transparent);
  background: color-mix(in oklab, var(--destructive) 6%, var(--card));
}

.alert-success {
  color: var(--success);
  border-color: color-mix(in oklab, var(--success) 35%, transparent);
  background: color-mix(in oklab, var(--success) 6%, var(--card));
}

.alert-muted {
  color: var(--muted-foreground);
  background: var(--muted);
  border-color: transparent;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 0.6);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.25rem;
  white-space: nowrap;
}

.badge-secondary {
  background: var(--secondary);
  border-color: transparent;
}

/* Listas (e-mails, contas conectadas) */
.list {
  display: grid;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  padding: 0;
  list-style: none;
}

.list > * + * {
  border-top: 1px solid var(--border);
}

.list-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  flex-wrap: wrap;
}

.list-item label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  word-break: break-all;
}

.list-item .badges {
  display: flex;
  gap: 0.375rem;
  margin-left: auto;
}

/* Texto */
.text-sm {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.75rem;
}

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

.font-medium {
  font-weight: 500;
}

.link {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.link:hover {
  color: var(--foreground);
}

.link-subtle {
  font-size: 0.875rem;
  text-decoration: none;
  text-underline-offset: 4px;
}

.link-subtle:hover {
  text-decoration: underline;
}

/* Rodapé legal, abaixo do card */
.auth-legal {
  color: var(--muted-foreground);
  font-size: 0.75rem;
  text-align: center;
  text-wrap: balance;
}

.auth-legal a {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.auth-legal a:hover {
  color: var(--foreground);
}

.auth-legal .dot {
  padding: 0 0.375rem;
}

@media (max-width: 400px) {
  .card {
    padding: 1.25rem 0;
  }
  .card-header,
  .card-content,
  .card-footer {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
}
