* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --cream: #fefaf1;
  --red: #d31900;
  --navy: #00002d;
  --beige: #bfb1a2;
  --white: #ffffff;
  --light-beige: #f0eae0;
  --card-shadow: 0 12px 40px rgba(0, 0, 45, 0.25);
}

body {
  font-family: "Open Sans", sans-serif;
  background: var(--navy);
  color: var(--navy);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow-x: hidden;
}

/* Fundo full-bleed */
.auth-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
  display: block;
}

.auth-bg-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(0, 0, 45, 0.18) 0%,
    rgba(0, 0, 45, 0.08) 50%,
    rgba(0, 0, 45, 0.22) 100%
  );
  z-index: 1;
}

/* Card central */
.auth-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 400px;
  background: var(--cream);
  border-radius: 14px;
  padding: 32px 32px 26px;
  box-shadow: 0 20px 50px rgba(0, 0, 45, 0.35);
}

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

.brand-name {
  font-family: "Poppins", sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.5px;
  line-height: 1.1;
}

.brand-tagline {
  font-size: 12px;
  color: var(--beige);
  margin-top: 4px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 600;
}

.auth-title {
  font-family: "Poppins", sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.15;
  margin-bottom: 6px;
}

.auth-sub {
  font-size: 13px;
  color: rgba(0, 0, 45, 0.7);
  line-height: 1.5;
  margin-bottom: 18px;
}

/* Form */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Quando o título vem direto antes do formulário (sem subtítulo) */
.auth-title + .auth-form {
  margin-top: 12px;
}

.field {
  display: flex;
  flex-direction: column;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

.field-input {
  font-family: "Open Sans", sans-serif;
  font-size: 15px;
  color: var(--navy);
  background: var(--white);
  border: 1.5px solid var(--beige);
  border-radius: 8px;
  padding: 12px 14px;
  width: 100%;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.field-input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(211, 25, 0, 0.12);
}

.field-input::placeholder {
  color: rgba(0, 0, 45, 0.35);
}

/* Senha com toggle de mostrar/ocultar */
.password-wrap {
  position: relative;
}

.password-wrap .field-input {
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 10px;
  font-size: 16px;
  color: var(--navy);
  opacity: 0.55;
  transition: opacity 0.15s;
  border-radius: 6px;
}

.password-toggle:hover {
  opacity: 1;
  background: rgba(0, 0, 45, 0.06);
}

.field-hint {
  font-size: 12px;
  color: rgba(0, 0, 45, 0.55);
  margin-top: 6px;
  line-height: 1.4;
}

.field-error {
  font-size: 12px;
  color: var(--red);
  margin-top: 6px;
  font-weight: 600;
  display: none;
}

.field.is-error .field-input {
  border-color: var(--red);
}

.field.is-error .field-error {
  display: block;
}

/* Botão primário */
.btn-primary {
  font-family: "Poppins", sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  background: var(--red);
  border: none;
  border-radius: 8px;
  padding: 14px 20px;
  cursor: pointer;
  margin-top: 10px;
  letter-spacing: 0.3px;
  transition:
    background 0.15s,
    transform 0.05s;
}

.btn-primary:hover {
  background: #b01500;
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary:disabled {
  background: var(--beige);
  cursor: not-allowed;
}

/* Links auxiliares */
.auth-link {
  display: block;
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--navy);
  text-decoration: none;
  font-weight: 600;
}

.auth-link:hover {
  text-decoration: underline;
  color: var(--red);
}

.auth-link-back {
  color: rgba(0, 0, 45, 0.65);
}

/* Rodapé do card */
.auth-footer {
  text-align: center;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid rgba(191, 177, 162, 0.4);
}

.auth-footer a {
  font-size: 12px;
  color: rgba(0, 0, 45, 0.55);
  text-decoration: none;
}

.auth-footer a:hover {
  color: var(--red);
}

/* Mensagem de sucesso pós-envio */
.auth-success {
  background: rgba(211, 25, 0, 0.08);
  border: 1px solid rgba(211, 25, 0, 0.25);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--navy);
  line-height: 1.5;
  margin-bottom: 20px;
  display: none;
}

.auth-success.is-visible {
  display: block;
}

.auth-success strong {
  display: block;
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  color: var(--red);
  margin-bottom: 4px;
}

/* ===== MOBILE ===== */
@media (max-width: 520px) {
  body {
    padding: 20px 16px;
    align-items: center;
  }

  .auth-card {
    border-radius: 14px;
    max-width: 100%;
    padding: 28px 22px 22px;
  }

  .auth-brand {
    margin-bottom: 18px;
  }

  .auth-title {
    font-size: 20px;
  }

  .auth-sub {
    font-size: 13px;
  }

  .field-input {
    font-size: 16px; /* evita zoom do iOS no foco */
  }
}

/* ============================================================
 * Guard de auth pra páginas privadas
 * Esconde conteúdo até page-protected.js confirmar autenticação.
 * Aplicar com <body class="protected-page"> + carregar page-protected.js.
 * ============================================================ */
.protected-page {
  visibility: hidden;
}
html.auth-ok .protected-page {
  visibility: visible;
}
