/* ─── Saúde AP / Auth — login design tokens ─── */

@font-face { font-family:'Human Sans'; font-weight:300; font-display:swap; src:url('../fonts/HumanSans-Light.woff2') format('woff2'); }
@font-face { font-family:'Human Sans'; font-weight:400; font-display:swap; src:url('../fonts/HumanSans-Regular.woff2') format('woff2'); }
@font-face { font-family:'Human Sans'; font-weight:500; font-display:swap; src:url('../fonts/HumanSans-Medium.woff2') format('woff2'); }
@font-face { font-family:'Human Sans'; font-weight:600; font-display:swap; src:url('../fonts/HumanSans-Bold.woff2') format('woff2'); }
@font-face { font-family:'Human Sans'; font-weight:700; font-display:swap; src:url('../fonts/HumanSans-Bold.woff2') format('woff2'); }
@font-face { font-family:'Human Sans'; font-weight:800; font-display:swap; src:url('../fonts/HumanSans-Black.woff2') format('woff2'); }

@font-face {
  font-family: 'Human Sans Fallback';
  font-style: normal;
  font-weight: 100 900;
  src: local('Segoe UI'), local('Roboto'), local('Helvetica Neue'), local('Arial');
  size-adjust: 100%;
  ascent-override: 95%;
  descent-override: 22%;
  line-gap-override: 0%;
}

:root {
  --brand-blue-dark:#373f91;
  --brand-blue:#0080fa;
  --brand-cyan:#2fbbe0;
  --brand-orange:#ff6900;

  --background:#f7f8fb;
  --foreground:#1d2347;
  --card:#ffffff;
  --card-foreground:#1d2347;

  --primary:#373f91;
  --primary-hover:#2c3279;
  --primary-foreground:#ffffff;
  --primary-70: rgba(55, 63, 145, 0.70);
  --primary-95: rgba(55, 63, 145, 0.95);

  --muted:#e3e6f1;
  --muted-foreground:#5a6080;
  --secondary:#ebedf6;
  --secondary-foreground:#2f3677;

  --accent:#ff6900;
  --destructive:#ca348a;

  --border:#d8dbe8;
  --input:#d8dbe8;
  --ring:#373f91;

  --radius:0.75rem;
  --shadow-strong:0 12px 40px -12px rgba(55, 63, 145, 0.25);
}

/* ─── Page reset / body ─── */
html.auth-page, body.auth-page { margin:0; padding:0; overflow-x:hidden; min-height:100vh; }
body.auth-page {
  font-family: 'Human Sans', 'Human Sans Fallback', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background: var(--background) !important;
  color: var(--foreground);
}
body.auth-page h1,
body.auth-page h2,
body.auth-page h3,
body.auth-page h4 {
  font-family: 'Human Sans', 'Human Sans Fallback', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0;
}
body.auth-page h1 { font-size: clamp(2rem, 4vw + 1rem, 3rem); font-weight: 800; }
body.auth-page h2 { font-size: 1.5rem; }
body.auth-page button,
body.auth-page input,
body.auth-page label { font-family: inherit; }

/* ─── Animações ─── */
@keyframes auth-fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes auth-scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes auth-float   { 0%, 100% { translate: 0 0; } 50% { translate: 0 -14px; } }

.animate-fade-in-bg { animation: auth-fadeIn 1.2s ease-out forwards; }
.animate-scale-in   { animation: auth-scaleIn 0.4s ease-out forwards; }
.animate-float      { animation: auth-float ease-in-out infinite; will-change: transform; }
@media (prefers-reduced-motion: reduce) { .animate-float { animation: none; } }

/* ─── Floating icons ─── */
.floating-icons {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; overflow: hidden;
}
.floating-icons img {
  position: absolute; user-select: none;
  filter: drop-shadow(0 4px 8px rgba(29, 35, 71, 0.08));
  will-change: transform;
}

/* ─── Shell layout ─── */
.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 10;
}

/* ─── App banner (topo) ─── */
.app-banner {
  background: var(--primary-95);
  color: var(--primary-foreground);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  position: relative; z-index: 51;
}
.app-banner__mobile { padding: 0.5rem 0.75rem; font-size: 11px; }
.app-banner__row {
  display: flex; align-items: center; justify-content: center;
  gap: 0.5rem; flex-wrap: wrap;
}
.app-banner__row--bordered {
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 0.375rem; margin-top: 0.375rem;
}
.app-banner__link {
  display: inline-flex; align-items: center; gap: 0.375rem;
  font-weight: 600; color: inherit; text-decoration: none;
  white-space: nowrap; transition: color .15s;
}
.app-banner__link:hover { color: #fff; }
.app-banner__link--disabled { opacity: 0.7; cursor: not-allowed; }
.app-banner__divider { opacity: 0.3; }
.app-banner__pill {
  margin-left: 0.25rem;
  padding: 0.125rem 0.375rem;
  border-radius: 9999px;
  background: rgba(255,255,255,0.20);
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.app-banner__desktop { display: none; }
@media (min-width: 640px) {
  .app-banner__mobile  { display: none; }
  .app-banner__desktop {
    display: flex; align-items: center; justify-content: space-between;
    height: 36px; padding: 0 1rem; font-size: 12px;
    max-width: 1280px; margin: 0 auto;
  }
  .app-banner__group { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
  .app-banner__group--right {
    border-left: 1px solid rgba(255,255,255,0.20);
    padding-left: 1rem;
  }
  .app-banner__hint { opacity: 0.7; font-weight: 500; }
}

/* ─── Main + painéis ─── */
.auth-main { flex: 1; display: flex; position: relative; }

.auth-brand {
  display: none; position: relative; overflow: hidden;
  align-items: center; justify-content: center; padding: 3rem;
}
@media (min-width: 1024px) { .auth-brand { display: flex; width: 50%; } }
@media (min-width: 1280px) { .auth-brand { width: 40%; } }

.auth-bg-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.auth-bg-img--mobile { display: block; }
@media (min-width: 1024px) { .auth-bg-img--mobile { display: none; } }
.auth-bg-overlay { position: absolute; inset: 0; background: var(--primary-70); }
.auth-bg-overlay--mobile { display: block; }
@media (min-width: 1024px) { .auth-bg-overlay--mobile { display: none; } }

.deco-circle {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,0.05);
}
.deco-circle--tl { top: -6rem; left: -6rem; width: 18rem; height: 18rem; }
.deco-circle--br { bottom: -8rem; right: -4rem; width: 24rem; height: 24rem; }

.auth-brand__content {
  position: relative; z-index: 10;
  max-width: 24rem; text-align: center;
  color: var(--primary-foreground);
  display: flex; flex-direction: column;
  gap: 2rem; align-items: center;
}
.logo-card {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 1rem;
  background: var(--card);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  border-radius: 1rem;
  box-shadow: 0 12px 40px -12px rgba(0,0,0,0.25);
}
.logo-card img { height: 4rem; width: auto; object-fit: contain; }

.auth-brand h1 { color: #fff; margin-bottom: .75rem; }
.auth-brand__lead {
  color: rgba(255,255,255,0.85);
  font-size: 1rem; line-height: 1.6;
  margin: 0;
}

.auth-features {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column;
  gap: 1rem; text-align: left; width: 100%;
}
.auth-features li { display: flex; align-items: center; gap: 0.75rem; }
.auth-features__icon {
  padding: .5rem; border-radius: .5rem;
  background: rgba(255,255,255,0.10);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.auth-features__icon svg { width: 20px; height: 20px; stroke: #fff; }
.auth-features__title {
  font-weight: 500; font-size: 0.875rem;
  color: rgba(255,255,255,0.95);
  margin: 0;
}
.auth-features__desc {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.70);
  margin: 0;
}

/* ─── Painel direito (form) ─── */
.auth-form-panel {
  flex: 1; display: flex;
  align-items: center; justify-content: center;
  padding: 1rem; position: relative; overflow-y: auto;
}
@media (min-width: 640px) { .auth-form-panel { padding: 2rem; } }

.auth-cracha-bg {
  display: none;
  position: absolute; inset: 0;
  pointer-events: none;
  background: url('../auth-cracha-bg.webp') no-repeat top right / contain;
  opacity: 0.55;
}
@media (min-width: 1024px) { .auth-cracha-bg { display: block; } }

.auth-form-wrapper {
  width: 100%;
  max-width: 28rem;
  position: relative;
  z-index: 10;
}

/* ─── Mobile header (logo + título por cima do bg) ─── */
.auth-mobile-header {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: 1.5rem;
  color: var(--primary-foreground);
  position: relative; z-index: 10;
  text-align: center;
}
@media (min-width: 1024px) { .auth-mobile-header { display: none; } }
.auth-mobile-header .logo-card { padding: .75rem; margin-bottom: .75rem; }
.auth-mobile-header .logo-card img { height: 2.5rem; }
.auth-mobile-header h1 { font-size: 1.5rem; color: #fff; }
.auth-mobile-header p { font-size: .875rem; color: rgba(255,255,255,.85); margin: .25rem 0 0; }

/* ─── Card central ─── */
.auth-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-strong);
  padding: 1.5rem;
  width: 100%;
  position: relative; z-index: 10;
}
@media (min-width: 1024px) { .auth-card { padding: 2rem; } }

.auth-card__title { font-size: 1.5rem; }
.auth-card__desc {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  margin: .25rem 0 1.5rem;
}

/* ─── Form ─── */
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-field { display: flex; flex-direction: column; gap: 0.5rem; }
.auth-field > label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--foreground);
}
.auth-input-wrap { position: relative; }
.auth-input-wrap > svg.auth-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--muted-foreground);
  pointer-events: none;
  z-index: 2;
}

/* PrimeFaces input override (saga-blue) — alinhamento com tokens auth */
.auth-input-wrap .auth-input,
.auth-input-wrap input.auth-input,
.auth-input-wrap .ui-inputtext.auth-input,
.auth-input-wrap .ui-password input {
  height: 2.5rem !important;
  width: 100% !important;
  padding: 0 0.75rem 0 2.5rem !important;
  border: 1px solid var(--input) !important;
  border-radius: 0.5rem !important;
  background: var(--card) !important;
  color: var(--foreground) !important;
  font-size: 0.875rem !important;
  font-family: inherit !important;
  box-shadow: none !important;
  transition: border-color .15s, box-shadow .15s;
}
.auth-input-wrap .ui-password { width: 100%; }
.auth-input-wrap .ui-password input { width: 100% !important; }
.auth-input-wrap .auth-input:focus,
.auth-input-wrap input.auth-input:focus,
.auth-input-wrap .ui-inputtext.auth-input:focus,
.auth-input-wrap .ui-password input:focus {
  outline: none !important;
  border-color: var(--ring) !important;
  box-shadow: 0 0 0 3px rgba(55, 63, 145, 0.15) !important;
}

/* ─── Mensagens / erros ─── */
.auth-error {
  display: block;
  margin-bottom: 1rem;
  padding: 0.625rem 0.875rem;
  background: rgba(202, 52, 138, 0.08);
  border: 1px solid rgba(202, 52, 138, 0.25);
  color: var(--destructive);
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 0.5rem;
}
.auth-card .ui-messages { margin-bottom: 1rem; }

/* ─── Botões ─── */
.auth-card .auth-btn,
.auth-card .auth-btn.ui-button {
  height: 2.5rem !important;
  width: 100% !important;
  background: var(--primary) !important;
  color: var(--primary-foreground) !important;
  border: 0 !important;
  border-radius: 0.5rem !important;
  font-weight: 600 !important;
  font-size: 0.875rem !important;
  cursor: pointer;
  box-shadow: none !important;
  transition: background .15s, transform .05s;
}
.auth-card .auth-btn .ui-button-text,
.auth-card .auth-btn.ui-button .ui-button-text {
  font-weight: 600;
}
.auth-card .auth-btn:hover,
.auth-card .auth-btn.ui-button:hover {
  background: var(--primary-hover) !important;
}
.auth-card .auth-btn:active { transform: translateY(1px); }
.auth-card .auth-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-card .auth-btn-secondary,
.auth-card .auth-btn-secondary.ui-button {
  height: 2.5rem !important;
  width: 100% !important;
  background: transparent !important;
  color: var(--primary) !important;
  border: 1px solid var(--input) !important;
  border-radius: 0.5rem !important;
  font-weight: 600 !important;
  font-size: 0.8125rem !important;
  margin-top: 0.5rem;
  box-shadow: none !important;
  transition: background .15s, border-color .15s;
}
.auth-card .auth-btn-secondary:hover,
.auth-card .auth-btn-secondary.ui-button:hover {
  background: var(--secondary) !important;
  border-color: var(--primary) !important;
}

.auth-secondary-links {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.auth-card .auth-link,
.auth-card .auth-link.ui-button {
  flex: 1 1 0;
  min-width: 8rem;
  height: 2rem !important;
  background: transparent !important;
  color: var(--muted-foreground) !important;
  border: 1px solid var(--border) !important;
  border-radius: 0.375rem !important;
  font-size: 0.7rem !important;
  font-weight: 600 !important;
  box-shadow: none !important;
  text-decoration: none !important;
}
.auth-card .auth-link:hover,
.auth-card .auth-link.ui-button:hover {
  background: var(--muted) !important;
  color: var(--foreground) !important;
  border-color: var(--input) !important;
}

/* ─── Meta (browser hint + versão) ─── */
.auth-meta {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.auth-meta a { color: var(--primary); text-decoration: none; font-weight: 600; }
.auth-meta a:hover { text-decoration: underline; }

/* ─── Footer credits ─── */
.site-footer-credits {
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 10;
  background: var(--background);
}
.site-footer-credits__inner {
  max-width: 1280px; margin: 0 auto;
  padding: 1rem;
  display: flex; flex-direction: column;
  align-items: center; justify-content: space-between;
  gap: 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted-foreground);
}
@media (min-width: 1024px) { .site-footer-credits__inner { flex-direction: row; } }
.site-footer-credits__copy { order: 3; text-align: center; }
@media (min-width: 1024px) { .site-footer-credits__copy { order: 1; text-align: left; } }
.site-footer-credits__partners {
  order: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: 0.75rem; width: 100%;
}
@media (min-width: 640px)  {
  .site-footer-credits__partners {
    flex-direction: row; gap: 1.25rem; justify-content: center;
  }
}
@media (min-width: 1024px) {
  .site-footer-credits__partners { order: 2; width: auto; }
}
.site-footer-credits__partner {
  display: flex; align-items: center; gap: 0.5rem;
}
.site-footer-credits__logo {
  height: 2rem; width: auto; flex-shrink: 0;
  background: var(--background);
  border-radius: 4px;
  padding: 2px 6px;
  object-fit: contain;
}

/* ─── Growl/messages container fora do card ─── */
.auth-growl-host { position: fixed; top: 4rem; right: 1rem; z-index: 9999; }
